Complete the code to select all columns from both tables using a FULL OUTER JOIN.
SELECT * FROM employees [1] departments ON employees.dept_id = departments.id;The FULL OUTER JOIN returns all rows when there is a match in one of the tables. It includes matched rows and unmatched rows from both tables.
Complete the code to find all employees and departments, including those without matches.
SELECT employees.name, departments.name FROM employees [1] departments ON employees.dept_id = departments.id;FULL OUTER JOIN returns all employees and all departments, including those without matching counterparts.
Fix the error in the join type to correctly perform a FULL OUTER JOIN.
SELECT * FROM sales [1] customers ON sales.customer_id = customers.id;To include all sales and customers, even if they don't match, use FULL OUTER JOIN.
Fill both blanks to select employee names and department names, including unmatched rows.
SELECT employees.name AS emp_name, departments.name AS dept_name FROM employees [1] departments ON employees.dept_id [2] departments.id;
The FULL OUTER JOIN includes all rows from both tables. The ON condition uses = to match department IDs.
Fill all three blanks to select all orders and customers, including unmatched rows, and order by customer name.
SELECT orders.id, customers.name, orders.amount FROM orders [1] customers ON orders.customer_id [2] customers.id ORDER BY customers.name [3];
Use FULL OUTER JOIN to include all orders and customers. The ON condition uses = to match IDs. Ordering by customer name ascending uses ASC.