0
0
SQLquery~10 mins

FULL OUTER JOIN behavior in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select all columns from both tables using a FULL OUTER JOIN.

SQL
SELECT * FROM employees [1] departments ON employees.dept_id = departments.id;
Drag options to blanks, or click blank then click option'
AINNER JOIN
BLEFT JOIN
CRIGHT JOIN
DFULL OUTER JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN which only returns matched rows.
Using LEFT JOIN or RIGHT JOIN which return unmatched rows from only one table.
2fill in blank
medium

Complete the code to find all employees and departments, including those without matches.

SQL
SELECT employees.name, departments.name FROM employees [1] departments ON employees.dept_id = departments.id;
Drag options to blanks, or click blank then click option'
AFULL OUTER JOIN
BINNER JOIN
CCROSS JOIN
DSELF JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN which excludes unmatched rows.
Using CROSS JOIN which returns all combinations, not just matches.
3fill in blank
hard

Fix the error in the join type to correctly perform a FULL OUTER JOIN.

SQL
SELECT * FROM sales [1] customers ON sales.customer_id = customers.id;
Drag options to blanks, or click blank then click option'
AFULL OUTER JOIN
BLEFT JOIN
CRIGHT JOIN
DINNER JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using LEFT JOIN or RIGHT JOIN which exclude unmatched rows from one side.
Using INNER JOIN which excludes all unmatched rows.
4fill in blank
hard

Fill both blanks to select employee names and department names, including unmatched rows.

SQL
SELECT employees.name AS emp_name, departments.name AS dept_name FROM employees [1] departments ON employees.dept_id [2] departments.id;
Drag options to blanks, or click blank then click option'
AFULL OUTER JOIN
B=
C<>
DLEFT JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using LEFT JOIN instead of FULL OUTER JOIN.
Using <> instead of = in the ON condition.
5fill in blank
hard

Fill all three blanks to select all orders and customers, including unmatched rows, and order by customer name.

SQL
SELECT orders.id, customers.name, orders.amount FROM orders [1] customers ON orders.customer_id [2] customers.id ORDER BY customers.name [3];
Drag options to blanks, or click blank then click option'
AFULL OUTER JOIN
B=
CASC
DDESC
Attempts:
3 left
💡 Hint
Common Mistakes
Using LEFT JOIN or RIGHT JOIN instead of FULL OUTER JOIN.
Using <> in ON condition causing no matches.
Ordering DESC instead of ASC.