Complete the code to select all columns from the employees table.
SELECT [1] FROM employees;The asterisk (*) selects all columns from the table.
Complete the code to join employees with departments on department_id.
SELECT employees.name, departments.name FROM employees [1] JOIN departments ON employees.department_id = departments.id;INNER JOIN returns rows when there is a match in both tables.
Fix the error in the join condition to correctly join orders and customers.
SELECT orders.id, customers.name FROM orders INNER JOIN customers ON orders.customer_id [1] customers.id;In SQL, the single equals sign (=) is used for equality comparison in JOIN conditions.
Fill both blanks to select employee names and their manager names using a self join.
SELECT e.name AS employee, m.name AS manager FROM employees e [1] JOIN employees m ON e.[2] = m.id;
LEFT JOIN includes all employees even if they don't have a manager. The join condition uses 'manager_id' to link employees to their managers.
Fill all three blanks to select product names, order quantities, and customer names using multiple joins.
SELECT p.[1], o.[2], c.[3] FROM orders o INNER JOIN products p ON o.product_id = p.id INNER JOIN customers c ON o.customer_id = c.id;
We select product name (p.name), order quantity (o.quantity), and customer name (c.name) to get meaningful order details.