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.sqlThe script drops tables with the same names first, so point it at an empty or scratch database.
Tables and columns
| Table | Columns |
|---|---|
| company | id, name, industry, description, timezone, currency, phone, email, website, address_line1, address_city, address_region, address_postal_code, address_country, payment_terms_days |
| policies | id, company_id, title, rule |
| employees | id, name, email, phone, role, hired_on, active |
| customers | id, kind, name, address_line1, address_city, address_region, address_postal_code, address_country, created_at, source, status, owner_id, tags |
| contacts | id, customer_id, first_name, last_name, email, phone, title, created_at |
| leads | id, contact_id, source, created_at, request, status, first_response_at, owner_id, deal_id |
| deals | id, 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 |
| quotes | id, deal_id, customer_id, number, status, total_cents, created_at, sent_at, expires_on, follow_ups |
| quote_line_items | quote_id, position, sku, description, quantity, unit_price_cents, amount_cents |
| jobs | id, customer_id, quote_id, title, status, scheduled_start, scheduled_end, assignee_ids, completed_at, notes |
| invoices | id, customer_id, job_id, number, status, total_cents, issued_on, due_on, paid_cents |
| invoice_line_items | invoice_id, position, sku, description, quantity, unit_price_cents, amount_cents |
| payments | id, invoice_id, customer_id, amount_cents, method, received_at, reference |
| messages | id, channel, direction, thread_id, from, to, subject, body, sent_at, contact_id, employee_id, related_ids, read |
| calls | id, direction, from, to, started_at, duration_sec, outcome, contact_id, employee_id, summary |
| tasks | id, title, assignee_id, due_on, status, created_at, completed_at, related_ids |
| events | id, type, at, subject_id, actor_id, data |
| anomalies | id, 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
- HubSpot sample data (contacts, companies and deals CSV)
- QuickBooks sample data (customers and invoices CSV)
- Sample CRM data
- Sample invoice and payment data
- Sample customer emails, texts and calls
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.