NewThe ManyPI MCP Server is now live

Shop database as an SQL script

Four linked tables of a fictional office supplies shop as one SQL file: customers, products, orders and order items. Public domain, ready for any SQL course.

DatasetBachelor +2CC0 1.0

What you will learn

  • Load a small relational database
  • Practise joins across four tables

The script creates and fills four tables. It is the same data as the "Office supplies shop" in the SQL sandbox, so learners can work in the browser and you can load the file into your own database.

Table

Rows

Linked by

customers

8

id

products

6

id

orders

10

customer_id → customers.id

order_items

15

order_id → orders.id, product_id → products.id

One customer, Hannah Wolf, has never ordered: useful for showing what a LEFT JOIN keeps.

The first lines
CREATE TABLE customers (id INTEGER PRIMARY KEY, name TEXT NOT NULL, company TEXT, city TEXT, country TEXT);
CREATE TABLE products (id INTEGER PRIMARY KEY, name TEXT NOT NULL, category TEXT, price REAL);
CREATE TABLE orders (id INTEGER PRIMARY KEY, customer_id INTEGER REFERENCES customers(id), order_date TEXT, status TEXT);

The data is public domain under CC0 1.0.

Downloads

Reuse this material

CC0 1.0

It's in the public domain: use it however you like. A credit with a link is appreciated, not required.

"Shop database as an SQL script" by ManyPI (https://manypi.com/edu/shop-database-sql), licensed under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)