Skip to content
Due to increased demand, text TeamShift to hold the next available slot.(415) 718-2003Call instead
TeamShift

Free tool · runs in your browser

Sample SQL database: a small business in SQLite or Postgres

This page generates a free sample SQL database of one fictional small business: 18 related tables covering customers, sales, jobs, invoices, payments and messages, as a single script for SQLite or Postgres.

Generate the SQL script

Choose an industry and a size, then press "SQLite (.sql)" or "Postgres (.sql)". The script drops and creates each table, then inserts the rows in one transaction.

The interactive tool needs JavaScript. The same core runs locally: npx @teamshift/fake-business

Load it

sqlite3 business.db < home-services-seed-42-small-sqlite.sql

psql "$DATABASE_URL" -f home-services-seed-42-small-postgres.sql

The script drops tables with the same names first, so point it at an empty or scratch database.

Tables and columns

TableColumns
companyid, name, industry, description, timezone, currency, phone, email, website, address_line1, address_city, address_region, address_postal_code, address_country, payment_terms_days
policiesid, company_id, title, rule
employeesid, name, email, phone, role, hired_on, active
customersid, kind, name, address_line1, address_city, address_region, address_postal_code, address_country, created_at, source, status, owner_id, tags
contactsid, customer_id, first_name, last_name, email, phone, title, created_at
leadsid, contact_id, source, created_at, request, status, first_response_at, owner_id, deal_id
dealsid, customer_id, contact_id, title, stage, amount_cents, owner_id, created_at, updated_at, closed_at, lost_reason, next_action_summary, next_action_due_on
quotesid, deal_id, customer_id, number, status, total_cents, created_at, sent_at, expires_on, follow_ups
quote_line_itemsquote_id, position, sku, description, quantity, unit_price_cents, amount_cents
jobsid, customer_id, quote_id, title, status, scheduled_start, scheduled_end, assignee_ids, completed_at, notes
invoicesid, customer_id, job_id, number, status, total_cents, issued_on, due_on, paid_cents
invoice_line_itemsinvoice_id, position, sku, description, quantity, unit_price_cents, amount_cents
paymentsid, invoice_id, customer_id, amount_cents, method, received_at, reference
messagesid, channel, direction, thread_id, from, to, subject, body, sent_at, contact_id, employee_id, related_ids, read
callsid, direction, from, to, started_at, duration_sec, outcome, contact_id, employee_id, summary
tasksid, title, assignee_id, due_on, status, created_at, completed_at, related_ids
eventsid, type, at, subject_id, actor_id, data
anomaliesid, kind, record_ids, description, amount_at_risk_cents

Ids are text keys such as cus_… and inv_…; a column ending in _id points at the table it names. Money is whole cents. Nested values (an address, a list of ids) are JSON text in SQLite and jsonb in Postgres.

Queries to try

-- Unpaid invoices, oldest first
SELECT number, due_on, total_cents - paid_cents AS owed_cents
FROM invoices
WHERE status IN ('open', 'partially-paid')
ORDER BY due_on;

-- Revenue by customer
SELECT c.name, SUM(i.total_cents) / 100.0 AS invoiced
FROM invoices i JOIN customers c ON c.id = i.customer_id
WHERE i.status <> 'void'
GROUP BY c.name
ORDER BY invoiced DESC;

-- Open pipeline by stage
SELECT stage, COUNT(*) AS deals, SUM(amount_cents) / 100.0 AS amount
FROM deals
WHERE stage NOT IN ('won', 'lost')
GROUP BY stage;

For Copper Kettle Plumbing & Air (home services, seed 42, small) the first query returns the invoices behind the $298.00 still owed.

Good for

  • Practising joins and reporting queries on data that makes sense.
  • Seeding a development or demo database.
  • Testing a text-to-SQL feature or a reporting tool against known answers.
  • Teaching: the same seed gives every student the same database.

Other formats

Sample data by industry

FAQ

Where can I download a sample SQL database?

Generate one on this page. It is a single script that creates 18 related tables for a fictional small business and fills them, for SQLite or Postgres, free and without signing up.

Does it work with MySQL or SQL Server?

The scripts are written for SQLite and Postgres. For another database, download the CSV files instead and load them with that database's import tool.

Is any of this real customer data?

No. Every record is generated. Emails use the reserved .example domain, phone numbers sit in the fictional 555-0100 to 555-0199 range, and company, town and street names are invented. People's names come from a list of common US names, so a match to a real person is coincidence.

Will I get the same file next time?

Yes, for the same industry, seed, size and dates on a given generator release. The page address updates as you change settings, so a copied link reopens the same data.