ShareYourGroupShareYourGroupSQL

The practice database

Every example and exercise on this site uses one small database. It belongs to a made-up shop that sells groceries, stationery, electronics and things for the home. This page shows what is in it, so that you can check a table or column name while you write a query.

All the people, products, prices and orders are invented for teaching.

The five tables at a glance

TableOne row isRows
customersa person who buys from the shop12
productssomething the shop sells16
ordersone order placed by a customer20
order_itemsone line of an order: a product and a quantity38
employeesa member of staff8

How the tables are linked

The tables point to one another through id numbers. These links are what you write in the ON part of a join.

So the path from a customer to the products they bought runs through four tables: customers, then orders, then order_items, then products. The lesson on joining many tables follows that path.

Things planted in the data on purpose

Real data is untidy, and the lessons need examples of that. So the practice database has a few deliberate features.

Notes on the columns

How to see this from SQL

You do not need this page to find out what a database contains. In SQLite, which the practice box runs, this lists the tables:

SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name;

Result

name
customers
employees
order_items
orders
products

5 rows

And this describes the columns of one table:

PRAGMA table_info(customers);

Result

cidnametypenotnulldflt_valuepk
0idINTEGER0NULL1
1nameTEXT1NULL0
2cityTEXT1NULL0
3stateTEXT1NULL0
4joinedTEXT1NULL0
5emailTEXT0NULL0

6 rows

In MySQL the same jobs are done by SHOW TABLES and DESCRIBE customers. In PostgreSQL and SQL Server, the standard information_schema views hold the lists.

The statements that create and fill the database are in one plain file, which the practice box loads: seed.sql. You can read it to see CREATE TABLE and INSERT used for real, or run it in SQLite on your own computer to get the same database there.

The tables in full

customers (12 rows)

The people who buy from the shop. One row per customer.

Columns: id integer, name text, city text, state text, joined text, email text

idnamecitystatejoinedemail
1Asha VermaLudhianaPunjab2025-01-15asha@example.com
2Ravi KumarDelhiDelhi2025-02-03ravi@example.com
3Meena GillAmritsarPunjab2025-03-21NULL
4Kabir KhanMumbaiMaharashtra2025-04-10kabir@example.com
5Sunita RaoChennaiTamil Nadu2025-05-05sunita@example.com
6Arjun MehtaPuneMaharashtra2025-06-18NULL
7Priya NairKochiKerala2025-07-02priya@example.com
8Imran AliDelhiDelhi2025-08-14imran@example.com
9Neha JoshiJaipurRajasthan2025-09-09neha@example.com
10Tara SinghLudhianaPunjab2025-10-27NULL
11Vikram DasKolkataWest Bengal2025-11-30vikram@example.com
12Joy ThomasMumbaiMaharashtra2026-01-08joy@example.com

Open customers in the practice box

products (16 rows)

What the shop sells. One row per product, with its price in rupees and the number in stock.

Columns: id integer, name text, category text, price integer, stock integer

idnamecategorypricestock
1Basmati Rice 5 kgGrocery65040
2Toor Dal 1 kgGrocery16075
3Sunflower Oil 1 LGrocery14560
4Tea 500 gGrocery2800
5Notebook 200 pagesStationery60300
6Ball Pen pack of 10Stationery90150
7Geometry BoxStationery12045
8School BagStationery75020
9LED Bulb 9 WElectronics110200
10Extension BoardElectronics39935
11EarphonesElectronics4990
12Power BankElectronics129918

Showing the first 12 of 16 rows.

Open products in the practice box

orders (20 rows)

One row for each order placed. customer_id says who placed it.

Columns: id integer, customer_id integer, order_date text, status text

idcustomer_idorder_datestatus
112026-01-05delivered
222026-01-12delivered
342026-01-20cancelled
412026-02-02delivered
552026-02-14delivered
672026-02-28delivered
722026-03-03delivered
882026-03-15delivered
992026-03-22cancelled
1042026-04-01delivered
11112026-04-18delivered
1212026-05-06delivered

Showing the first 12 of 20 rows.

Open orders in the practice box

order_items (39 rows)

The lines of each order: which product and how many. An order has one or more lines.

Columns: order_id integer, product_id integer, quantity integer

order_idproduct_idquantity
112
121
154
294
2101
3121
432
441
5132
561
6141
7510

Showing the first 12 of 39 rows.

Open order_items in the practice box

employees (8 rows)

The staff of the shop. manager_id points to another row of the same table.

Columns: id integer, name text, department text, salary integer, manager_id integer, hired text

idnamedepartmentsalarymanager_idhired
1Anita KapoorManagement95000NULL2019-04-01
2Rohit BansalSales6000012020-06-15
3Deepa IyerSales4800022021-09-01
4Manoj YadavSales4800022022-01-10
5Farah SheikhWarehouse4200012020-11-20
6Gopal ReddyWarehouse3000052023-03-05
7Harpreet KaurSupport3600012021-02-14
8Nikhil JainSupport3300072024-07-22

Open employees in the practice box

Examples on this page were run with SQLite 3.50.4 on 12 November 2026. The results shown are the real results.

This is an independent learning site. It is not connected with the makers of any database product. MySQL, PostgreSQL, SQL Server, Oracle and SQLite are named only so that you know where a piece of SQL works. The shop, its customers and its staff in the practice database are made up.