Tables in this data model
- practitioners — 3 columns
- availability — 4 columns
- patients — 3 columns
- services — 4 columns
- appointments — 6 columns
- clinical_notes — 4 columns
- invoices — 4 columns
- insurance_claims — 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 practitioners (
practitioner_id INTEGER NOT NULL PRIMARY KEY,
full_name VARCHAR(150) NOT NULL,
specialty VARCHAR(80)
);
CREATE TABLE availability (
slot_id INTEGER NOT NULL PRIMARY KEY,
practitioner_id INTEGER NOT NULL REFERENCES practitioners(practitioner_id),
starts_at TIMESTAMP NOT NULL,
ends_at TIMESTAMP NOT NULL
);
CREATE TABLE patients (
patient_id INTEGER NOT NULL PRIMARY KEY,
full_name VARCHAR(150) NOT NULL,
phone VARCHAR(30)
);
CREATE TABLE services (
service_id INTEGER NOT NULL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
duration_min INTEGER NOT NULL,
fee DECIMAL(10,2) NOT NULL
);
CREATE TABLE appointments (
appointment_id INTEGER NOT NULL PRIMARY KEY,
patient_id INTEGER NOT NULL REFERENCES patients(patient_id),
practitioner_id INTEGER NOT NULL REFERENCES practitioners(practitioner_id),
service_id INTEGER NOT NULL REFERENCES services(service_id),
slot_id INTEGER REFERENCES availability(slot_id),
status VARCHAR(20) NOT NULL
);
CREATE TABLE clinical_notes (
note_id INTEGER NOT NULL PRIMARY KEY,
appointment_id INTEGER NOT NULL REFERENCES appointments(appointment_id),
body TEXT NOT NULL,
signed_at TIMESTAMP
);
CREATE TABLE invoices (
invoice_id INTEGER NOT NULL PRIMARY KEY,
appointment_id INTEGER NOT NULL REFERENCES appointments(appointment_id),
amount DECIMAL(10,2) NOT NULL,
status VARCHAR(20) NOT NULL
);
CREATE TABLE insurance_claims (
claim_id INTEGER NOT NULL PRIMARY KEY,
invoice_id INTEGER NOT NULL REFERENCES invoices(invoice_id),
payer VARCHAR(100) NOT NULL,
status VARCHAR(20) NOT NULL
);
Related: Database schema diagram tool · ER diagram from SQL · All database & er models templates · All 521 templates