Starter shop
Corner Market (fictional) · 3 tables · 46 rows · version 2
Three small tables you can read in full: customers, products and orders. Every order belongs to one customer and is for one product. Use it to learn SELECT, WHERE, ORDER BY and your first joins without being overwhelmed by data.
Relationships
Sample queries
SELECT customer_name, city
FROM customers
WHERE city = 'Riyadh';SELECT product_name, price
FROM products
ORDER BY price DESC;SELECT o.order_id, c.customer_name, o.order_date
FROM orders AS o
JOIN customers AS c ON c.customer_id = o.customer_id
ORDER BY o.order_date;Data dictionary
customers
12 rows · primary key (customer_id)People who have registered with the shop.
| Column | Type | Null? | Key | Description |
|---|---|---|---|---|
| customer_id | integer | no | PK | Unique number for each customer. |
| customer_name | text | no | Full name. | |
| city | text | yes | City of the delivery address. NULL when the customer has not told us. | |
| text | yes | Email address. NULL when not provided. | ||
| joined_on | date | no | Date the customer registered. |
products
10 rows · primary key (product_id)Items the shop sells.
| Column | Type | Null? | Key | Description |
|---|---|---|---|---|
| product_id | integer | no | PK | Unique number for each product. |
| product_name | text | no | Name shown in the shop. | |
| category | text | no | Product category. | |
| price | numeric(12,2) | no | Current price in SAR. | |
| stock | integer | no | Units in stock right now. |
orders
24 rows · primary key (order_id)One row per order. Each order is for a single product.
| Column | Type | Null? | Key | Description |
|---|---|---|---|---|
| order_id | integer | no | PK | Unique number for each order. |
| customer_id | integer | no | customers.customer_id | Who placed the order. |
| product_id | integer | no | products.product_id | What was ordered. |
| order_date | date | no | Date the order was placed. | |
| quantity | integer | no | Number of units ordered. | |
| status | text | no | processing, shipped, delivered or cancelled. |