SchemaSeed Guides

Sample ecommerce database

A store schema needs three tables that fit together: a customer, a product, and an order that points at both. Random integers in user_id fail as soon as the database checks the foreign key. This sample generates the parents first and copies those ids into the order.

CREATE TABLE users (
  id INTEGER PRIMARY KEY,
  email VARCHAR(255) NOT NULL,
  full_name VARCHAR(120),
  city VARCHAR(80),
  created_at TIMESTAMP
);

CREATE TABLE products (
  id INTEGER PRIMARY KEY,
  title VARCHAR(160) NOT NULL,
  price DECIMAL(10, 2) NOT NULL,
  status VARCHAR(20) NOT NULL CHECK (status IN ('draft', 'active', 'archived'))
);

CREATE TABLE orders (
  id INTEGER PRIMARY KEY,
  user_id INTEGER NOT NULL REFERENCES users (id),
  product_id INTEGER REFERENCES products (id),
  total DECIMAL(10, 2),
  note TEXT,
  created_at TIMESTAMP
);

Names, emails, cities, and prices follow the column. status stays inside draft, active, and archived. Each order uses a customer id and a product id from the rows just generated. The SQL file inserts users and products before orders.

The schema stays in the browser. There is no account. You can download JSON, CSV, or SQL, up to 10,000 rows per table.

Open the shop sample

Other ready schemas

The same generator fills a blog and a company. Paste your own CREATE TABLE when the sample is only a starting point. To repeat the same rows later, set a seed.