Design a College Management Database
Part of the SQL Roadmap
In short
This project pulls the whole phase together. You'll design the database a college could actually run on, covering departments, students, teachers, courses, enrolments and marks, and then query it like the admin office would.
A project designing tables for students, departments, courses, teachers, enrolments and marks, then writing queries against it.

Think of it like this
The architect's campus blueprint
Before a new engineering college in Bhubaneswar lays a single brick, the architect draws a blueprint: where each block stands, which corridors connect them, and which doors lead where. Your ER diagram and CREATE TABLE scripts are that blueprint. Build from a good one and the college runs smoothly for years.
Watch it happen
How the tables hang together
1/5Departments like Computer Science and Civil sit at the top. Everything else belongs to one.
The big ideas
What you need to know
Diagram first
Sketch entities and relationships on dbdiagram.io or paper before any SQL. Fixing a drawing is free.
Normalize to 3NF
Department names live once in departments. Students store only department_id.
Constraints everywhere
UNIQUE roll numbers, CHECK marks between 0 and 100, and foreign keys with sensible ON DELETE rules.
Prove it with queries
Insert realistic sample data and write at least ten queries, like toppers per department and course pass rates.
How it works
Building the college database
- 1
Draw the ER diagram
List entities, keys and whether each relationship is one-to-many or many-to-many.
- 2
Normalize
Check each table reaches 3NF so no fact is stored twice.
- 3
Write CREATE TABLE
Add types, primary keys, foreign keys and CHECK constraints.
- 4
Load sample data
Insert a few departments, 30 or more students and several courses with marks.
- 5
Query it
Answer real questions: toppers, pass rates and course loads per teacher.
See it in code
Walk through the code
1CREATE TABLE enrolments (2 enrolment_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,3 student_id INTEGER NOT NULL REFERENCES students (student_id),4 course_id INTEGER NOT NULL REFERENCES courses (course_id),5 semester SMALLINT NOT NULL CHECK (semester BETWEEN 1 AND 8),6 UNIQUE (student_id, course_id, semester)7);8 9CREATE TABLE marks (10 enrolment_id INTEGER NOT NULL11 REFERENCES enrolments (enrolment_id) ON DELETE CASCADE,12 exam VARCHAR(20) NOT NULL,13 score NUMERIC(5,2) NOT NULL CHECK (score BETWEEN 0 AND 100),14 PRIMARY KEY (enrolment_id, exam)15);16 17WITH totals AS (18 SELECT d.dept_name, s.full_name, SUM(m.score) AS total_score,19 DENSE_RANK() OVER (PARTITION BY d.dept_name20 ORDER BY SUM(m.score) DESC) AS rnk21 FROM departments d22 JOIN students s ON s.department_id = d.department_id23 JOIN enrolments e ON e.student_id = s.student_id24 JOIN marks m ON m.enrolment_id = e.enrolment_id25 GROUP BY d.dept_name, s.student_id, s.full_name26)27SELECT dept_name, full_name, total_score28FROM totals29WHERE rnk = 1;1/6The junction between students and courses. UNIQUE stops a double enrolment in the same semester.
Two key tables from the design, then the department toppers query. Assumes departments, students and courses tables already exist. Runs in PostgreSQL. In MySQL or SQL Server, swap the identity syntax for AUTO_INCREMENT or IDENTITY(1,1).
Save yourself the pain
Common mistakes
Oops
Putting dept_name directly on the students table.
Do this instead
Store department_id and keep the name only in departments. Renaming a department then takes one update.
Oops
Storing marks as columns like sem1_maths, sem1_physics.
Do this instead
Every new subject would need a new column. Store one row per enrolment and exam in a marks table.
Oops
Skipping sample data and queries.
Do this instead
A design isn't proven until it answers real questions. Write the queries and fix the tables if any feel awkward.
Your mission
Ship the college database
Quick check
Why is enrolments a separate table instead of a course_id column on students?
Go deeper
- 1Draw the ER diagram first and normalize it to 3NF.
- 2Write the CREATE TABLE scripts with keys and constraints, and insert sample data.
- 3Write 10 queries such as toppers per department and course pass rates.
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.