Tables in this data model
- venues — 3 columns
- sections — 3 columns
- seats — 4 columns
- events — 4 columns
- ticket_types — 4 columns
- orders — 4 columns
- tickets — 5 columns
- checkins — 4 columns
How to use this ER diagram template
- Click Open in the editor. The ER diagram opens on a new page in FlowDiagram — nothing is uploaded and there is no sign-up.
- Rename, add or delete shapes and drag them where you want; connectors stay attached as things move.
- Drop in vendor logos from the library — 1,160 of them, including every AWS, Azure and Google Cloud service icon — or restyle it with the colour and theme controls.
- Prefer text? Edit the SQL DDL below and paste it in through ☰ → Import / export SQL; the finished model exports back to DDL.
- Export to PNG, SVG or PDF, or press Ctrl+L for a link that carries the whole diagram.
SQL DDL source
The whole template is the text below. Paste it into FlowDiagram, keep it in Git next to the code it describes, or hand it to an AI assistant to extend.
CREATE TABLE venues (
venue_id INTEGER NOT NULL PRIMARY KEY,
name VARCHAR(150) NOT NULL,
city VARCHAR(100) NOT NULL
);
CREATE TABLE sections (
section_id INTEGER NOT NULL PRIMARY KEY,
venue_id INTEGER NOT NULL REFERENCES venues(venue_id),
name VARCHAR(40) NOT NULL
);
CREATE TABLE seats (
seat_id INTEGER NOT NULL PRIMARY KEY,
section_id INTEGER NOT NULL REFERENCES sections(section_id),
row_label VARCHAR(5) NOT NULL,
seat_no INTEGER NOT NULL
);
CREATE TABLE events (
event_id INTEGER NOT NULL PRIMARY KEY,
venue_id INTEGER NOT NULL REFERENCES venues(venue_id),
title VARCHAR(200) NOT NULL,
starts_at TIMESTAMP NOT NULL
);
CREATE TABLE ticket_types (
ticket_type_id INTEGER NOT NULL PRIMARY KEY,
event_id INTEGER NOT NULL REFERENCES events(event_id),
name VARCHAR(40) NOT NULL,
price DECIMAL(10,2) NOT NULL
);
CREATE TABLE orders (
order_id INTEGER NOT NULL PRIMARY KEY,
buyer_email VARCHAR(255) NOT NULL,
total DECIMAL(10,2) NOT NULL,
status VARCHAR(20) NOT NULL
);
CREATE TABLE tickets (
ticket_id INTEGER NOT NULL PRIMARY KEY,
order_id INTEGER NOT NULL REFERENCES orders(order_id),
ticket_type_id INTEGER NOT NULL REFERENCES ticket_types(ticket_type_id),
seat_id INTEGER REFERENCES seats(seat_id),
barcode VARCHAR(40) NOT NULL UNIQUE
);
CREATE TABLE checkins (
checkin_id INTEGER NOT NULL PRIMARY KEY,
ticket_id INTEGER NOT NULL REFERENCES tickets(ticket_id),
scanned_at TIMESTAMP NOT NULL,
gate VARCHAR(10)
);
Related: Database schema diagram tool · ER diagram from SQL · All database & er models templates · All 521 templates