Using INNER JOIN to Combine Customer and Order Data
📖 Scenario: You work at a small online store. You have two tables: one with customer details and another with their orders. You want to see which customers placed orders and details about those orders.
🎯 Goal: Create a query using INNER JOIN to combine the customers and orders tables, showing only customers who have placed orders along with their order details.
📋 What You'll Learn
Create a
customers table with columns customer_id (integer), name (text), and city (text).Create an
orders table with columns order_id (integer), customer_id (integer), and product (text).Insert the exact data provided into both tables.
Write an
INNER JOIN query to combine the tables on customer_id.Select
customers.name, customers.city, and orders.product in the result.💡 Why This Matters
🌍 Real World
Combining customer and order data is common in sales and e-commerce to analyze who bought what.
💼 Career
Understanding INNER JOIN is essential for database querying roles like data analyst, backend developer, and database administrator.
Progress0 / 4 steps