Complete the code to select all customers and their orders, including customers without orders.
SELECT customers.name, orders.order_id FROM customers [1] orders ON customers.id = orders.customer_id;LEFT JOIN returns all rows from the left table (customers) and matching rows from the right table (orders). Customers without orders still appear.
Complete the code to select all orders and their customers, including orders without customers.
SELECT orders.order_id, customers.name FROM orders [1] customers ON orders.customer_id = customers.id;RIGHT JOIN returns all rows from the right table (customers) and matching rows from the left table (orders). Orders without customers still appear.
Fix the error in the join to include all employees and their departments, even if some employees have no department.
SELECT employees.name, departments.dept_name FROM employees [1] departments ON employees.dept_id = departments.id;LEFT JOIN keeps all employees (left table) even if they have no matching department.
Fill both blanks to select all products and their suppliers, including products without suppliers.
SELECT products.name, suppliers.name FROM products [1] suppliers ON products.supplier_id [2] suppliers.id;
LEFT JOIN keeps all products even if they have no supplier. The ON condition uses '=' to match supplier IDs.
Fill all three blanks to select all orders, their customers, and their shipping info, including orders without customers or shipping info.
SELECT orders.id, customers.name, shipping.address FROM orders [1] customers ON orders.customer_id [2] customers.id [3] JOIN shipping ON orders.shipping_id = shipping.id;
LEFT JOIN keeps all orders even if no matching customer. The ON condition uses '='. The shipping table is joined with LEFT JOIN to keep orders without shipping info.