Tables in this data model
- students — 4 columns
- guardians — 4 columns
- teachers — 3 columns
- courses — 3 columns
- sections — 5 columns
- enrollments — 3 columns
- assignments — 5 columns
- submissions — 5 columns
- attendance — 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 students (
student_id INTEGER NOT NULL PRIMARY KEY,
full_name VARCHAR(150) NOT NULL,
grade_level INTEGER,
enrolled_on DATE NOT NULL
);
CREATE TABLE guardians (
guardian_id INTEGER NOT NULL PRIMARY KEY,
student_id INTEGER NOT NULL REFERENCES students(student_id),
full_name VARCHAR(150) NOT NULL,
phone VARCHAR(30)
);
CREATE TABLE teachers (
teacher_id INTEGER NOT NULL PRIMARY KEY,
full_name VARCHAR(150) NOT NULL,
department VARCHAR(80)
);
CREATE TABLE courses (
course_id INTEGER NOT NULL PRIMARY KEY,
title VARCHAR(150) NOT NULL,
credits INTEGER NOT NULL
);
CREATE TABLE sections (
section_id INTEGER NOT NULL PRIMARY KEY,
course_id INTEGER NOT NULL REFERENCES courses(course_id),
teacher_id INTEGER NOT NULL REFERENCES teachers(teacher_id),
term VARCHAR(20) NOT NULL,
room VARCHAR(20)
);
CREATE TABLE enrollments (
enrollment_id INTEGER NOT NULL PRIMARY KEY,
student_id INTEGER NOT NULL REFERENCES students(student_id),
section_id INTEGER NOT NULL REFERENCES sections(section_id)
);
CREATE TABLE assignments (
assignment_id INTEGER NOT NULL PRIMARY KEY,
section_id INTEGER NOT NULL REFERENCES sections(section_id),
title VARCHAR(150) NOT NULL,
due_date DATE,
max_points INTEGER
);
CREATE TABLE submissions (
submission_id INTEGER NOT NULL PRIMARY KEY,
assignment_id INTEGER NOT NULL REFERENCES assignments(assignment_id),
student_id INTEGER NOT NULL REFERENCES students(student_id),
points DECIMAL(6,2),
submitted_at TIMESTAMP
);
CREATE TABLE attendance (
attendance_id INTEGER NOT NULL PRIMARY KEY,
enrollment_id INTEGER NOT NULL REFERENCES enrollments(enrollment_id),
class_date DATE NOT NULL,
status VARCHAR(10) NOT NULL
);
Related: ER diagram from SQL · All education & academia templates · All 521 templates