SQL - Sample Datasets
Overview
This page showcases the live sample datasets used across examples. Use it to understand table shapes and values at a glance.
Employees & Departments
departments
| id | name |
|---|
| 1 | Engineering |
| 2 | HR |
| 3 | Sales |
employees
| id | first_name | department_id | salary | hired_at | gender | city | title |
|---|
| 1 | Ada | 1 | 120000 | 2021-01-10 10:00:00 | Female | San Francisco | Engineer |
| 2 | Bob | 1 | 90000 | 2021-05-05 09:30:00 | Male | New York | Engineer |
| 3 | Chen | 2 | 80000 | | Male | Seattle | HR Specialist |
| 4 | Dee | 3 | 110000 | 2022-03-01 12:00:00 | Female | Austin | Sales Manager |
| 5 | Eli | 1 | 130000 | 2020-11-20 15:15:00 | Male | Boston | Principal Engineer |
Customers, Orders & Products
customers
| id | name | gender | city |
|---|
| 1 | Alice | Female | San Francisco |
| 2 | Ben | Male | New York |
| 3 | Cara | Female | Seattle |
| 4 | Dan | Male | Austin |
| 5 | Eva | Female | Boston |
products
| id | name | category | price |
|---|
| 1 | Laptop Pro | Electronics | 1999 |
| 2 | Wireless Mouse | Electronics | 49.99 |
| 3 | Office Chair | Furniture | 299 |
| 4 | Standing Desk | Furniture | 499 |
| 5 | Coffee Beans | Grocery | 14.99 |
orders
| id | customer_id | order_date | total |
|---|
| 1 | 1 | 2024-05-01 | 2048.99 |
| 2 | 2 | 2024-05-03 | 313.98 |
| 3 | 3 | 2024-05-05 | 513.99 |
order_items
| id | order_id | product_id | qty | price |
|---|
| 1 | 1 | 1 | 1 | 1999 |
| 2 | 1 | 2 | 1 | 49.99 |
| 3 | 2 | 3 | 1 | 299 |
| 4 | 2 | 5 | 1 | 14.99 |
| 5 | 3 | 4 | 1 | 499 |
| 6 | 3 | 2 | 1 | 14.99 |
Useful Views
Top customers by total
| name | total_spend |
|---|
| Alice | 2048.99 |
| Cara | 513.99 |
| Ben | 313.99 |
Top products by revenue
| name | revenue |
|---|
| Laptop Pro | 1999 |
| Standing Desk | 499 |
| Office Chair | 299 |
| Wireless Mouse | 64.98 |
| Coffee Beans | 14.99 |
Reset all sample data