Tables in this data model
- staff — 4 columns
- dining_tables — 4 columns
- reservations — 7 columns
- menu_items — 5 columns
- checks — 7 columns
- check_items — 6 columns
- payments — 6 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 staff (
staff_id INTEGER NOT NULL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
role VARCHAR(30) NOT NULL,
pin_hash VARCHAR(100) NOT NULL
);
CREATE TABLE dining_tables (
table_id INTEGER NOT NULL PRIMARY KEY,
label VARCHAR(10) NOT NULL,
section VARCHAR(30) NOT NULL,
seats INTEGER NOT NULL
);
CREATE TABLE reservations (
reservation_id INTEGER NOT NULL PRIMARY KEY,
table_id INTEGER REFERENCES dining_tables(table_id),
guest_name VARCHAR(100) NOT NULL,
phone VARCHAR(20),
party_size INTEGER NOT NULL,
reserved_for TIMESTAMP NOT NULL,
status VARCHAR(20) NOT NULL
);
CREATE TABLE menu_items (
menu_item_id INTEGER NOT NULL PRIMARY KEY,
name VARCHAR(120) NOT NULL,
course VARCHAR(30) NOT NULL,
price DECIMAL(8,2) NOT NULL,
is_available BOOLEAN NOT NULL
);
CREATE TABLE checks (
check_id INTEGER NOT NULL PRIMARY KEY,
table_id INTEGER NOT NULL REFERENCES dining_tables(table_id),
server_id INTEGER NOT NULL REFERENCES staff(staff_id),
reservation_id INTEGER REFERENCES reservations(reservation_id),
opened_at TIMESTAMP NOT NULL,
closed_at TIMESTAMP,
total DECIMAL(10,2) NOT NULL
);
CREATE TABLE check_items (
check_item_id INTEGER NOT NULL PRIMARY KEY,
check_id INTEGER NOT NULL REFERENCES checks(check_id),
menu_item_id INTEGER NOT NULL REFERENCES menu_items(menu_item_id),
quantity INTEGER NOT NULL,
modifiers VARCHAR(200),
sent_to_kitchen_at TIMESTAMP
);
CREATE TABLE payments (
payment_id INTEGER NOT NULL PRIMARY KEY,
check_id INTEGER NOT NULL REFERENCES checks(check_id),
method VARCHAR(20) NOT NULL,
amount DECIMAL(10,2) NOT NULL,
tip DECIMAL(8,2) NOT NULL,
paid_at TIMESTAMP NOT NULL
);
Related: Database schema diagram tool · ER diagram from SQL · All database & er models templates · All 521 templates