Complete the code to select all columns from two tables joined on the "id" column.
SELECT * FROM employees [1] departments ON employees.id = departments.id;The INNER JOIN returns rows when there is a match in both tables based on the join condition.
Complete the code to join "orders" and "customers" tables on the "customer_id" column.
SELECT orders.order_id, customers.name FROM orders [1] customers ON orders.customer_id = customers.customer_id;Using INNER JOIN ensures only orders with matching customers are selected.
Fix the error in the join condition to correctly join "products" and "categories" on "category_id".
SELECT * FROM products INNER JOIN categories ON products.[1] = categories.category_id;The join condition must use the correct column category_id from the products table to match categories.
Fill both blanks to create a join that selects employee names and their department names.
SELECT employees.name, departments.[1] FROM employees [2] departments ON employees.department_id = departments.id;
The query selects the department name and uses an INNER JOIN to get matching employees and departments.
Fill all three blanks to join "sales" and "stores" tables and select store name and total sales.
SELECT stores.[1], SUM(sales.amount) AS total_sales FROM sales [2] stores ON sales.[3] = stores.id GROUP BY stores.name;
The query selects the store name, joins with INNER JOIN on store_id to match sales to stores, and sums sales amounts.