Exam 5: Joining Tables
Difficulty: Intermediate
Topics covered: INNER JOIN, LEFT JOIN, ON, multi-table joins
Each question shows the target output. Write a SQL query that produces exactly those columns and rows.
Question 1
Join orders with customers. Return order_id, order_date, and the customer's name aliased as customer_name.
Question 2
Join orders with products. Return order_id, the product name aliased as product_name, and total_amount. Only include completed orders.
Question 3
Use a LEFT JOIN to show all customers and any orders they have placed. Return the customer name aliased as customer_name, order_id, and order_date.
Question 4
For every order, show customer_name, product_name, quantity, total_amount, and status, one row per order.
Question 5
Find all customers who have never placed an order. Use a LEFT JOIN and filter on NULL. Return customer_id and name.