ER Diagram for a University Database
Learn how to design an ER diagram for a university database using the Vertabelo data modeler!
In this article, we’re going to demonstrate how to create an entity-relationship diagram (ERD or ER diagram) for a university database. We’ll design it from scratch using the Vertabelo web-based data modeler.
To make our university database ER diagram simpler to understand, we have divided the data model into three main areas:
- Career Planning, where we define each career with its required courses and the professors that teach those courses.
- Year Planning, where we define each course occurrence, including the schedule, rooms, and the professor in charge.
- Student & Enrollment, where we define students and their careers and courses. We’ll also define the evaluation and status of each enrollment.
Note: Not all universities are organized in the same way. This could be because of local legal requirements or because of the specific characteristics of the career training they offer. This data model represents a generic scenario; it may require adjustments based on your own requirements.
Career Planning Area
This area includes all information about university career training, the courses that belong to each career training path, and the professors that teach those courses.
The assumed requirements are:
- The university can have multiple careers (like “Mechanical Engineering” or “Psychology”). Careers can have different durations and levels (undergraduate, graduate, etc.).
- Each career belongs to one and only one department (like science, literature, etc.)
- Each career is composed of a number of courses, which may be mandatory or optative (elective).
- Each course belongs to a year and a semester.
- A course may require a previous course to be completed by a student before they can enroll in it.
- More than one professor can teach the same course.
- Each course approval criteria and evaluation instance are not included in the data model.

Now let’s review the tables in this section in detail.
CareerLevel
This table stores the different types of career training paths offered by the university. It is composed of the following columns:
CareerLevelis the surrogate primary k If you are new to database modeling, read the articles Always Define a Primary Key for Each Table and What Is a Primary Key? to learn about primary keys.CareerLevelNameis the name of the level (undergraduate, graduate, PhD, etc.)
Department
This table stores the different departments of the university. It is composed of the following columns:
DepartmentIDis the surrogate primary key.DepartmentNameis the name of the department.
Career
This table is composed of the following columns:
CareerIDis the surrogate primary key.CareerNameis the actual name of the career.DepartmentIDis a foreign key to theDepartmentYou can learn more about foreign keys in the article What Is a Foreign Key?.DurationYearsis the duration (expressed in years) of the career training.RequiredOptativeCoursesis the number of optative (elective) courses required to complete this career training (besides completing all mandatory courses).CareerLevelIDis a foreign key to theCareerLeveltable.
Course
Each course (or subject) record is composed of the following columns:
CourseIDis the surrogate primary key.CourseNameis the actual name of the course.CourseCodeis an abbreviated way to identify the course. It may include a shortened name and the year of the career, g. MAT-1 for first-year mathematics or CHM-3 for third-year chemistry.CareerIDis a foreign key to the Career It indicates which career the course belongs to.Yearrepresents the course year (1st, 3rd, etc.)Semesterrepresents the semester of that year (1st or 2nd).Optativetells if the course is mandatory (required) or optative (elective). Most careers require a minimum number of elective courses to be completed.
Assumptions:
- Each course belongs to one and only one c There may be cases where a course can belong to multiple careers; that would require a change in the model. We would need to introduce a new table to represent the many-to-many relationship between courses and careers.
CourseDependency
This table tells us which courses are mandatory to enroll in a given course. A common example is when the completion of “Math 1” is required to enroll in “Math 2”. The columns are:
CourseIDis a foreign key toCoursetable and part of the compound primary key. It represents the course that requires a prerequisite.RequiredCourseIDis a foreign key toCoursetable and part of the compound primary key. It represents the required prerequisite course for the aboveCourseID.
Professor
This table contains basic information for each professor. It includes the following columns:
ProfessorIDis the surrogate primary key.FirstNameandLastNamestore the name of the professorEmailstores each professor’s email.PhoneNumberstores each professor’s phone number.
ProfessorCourse
This table allows the system to define which courses each professor can teach.
ProfessorIDis a foreign key to the Professor table and part of the compound primary key.CourseIDis a foreign key toCoursetable and part of the compound primary key. It indicates the course that this professor can teach.
Year Planning Area
This area contains information related to how the career and each of its courses are organized each year.
The assumed requirements are:
- In a career with any given number of students, some courses may be held in a single group by a single professor, while other courses (g. a chemistry lab) will require more and smaller groups.
- Each group will have an assigned professor and may have additional assistant professors.
- Each group will have a schedule and an assigned room.

Let’s examine these tables:
Room
Each university classroom, auditorium, lab, or any other space where a class can be taught is stored in this table. It includes these columns:
RoomIDis the surrogate primary key.RoomCodeis an easy-to-remember code to identify the classroom.RoomNameis the actual room name.RoomCapacityspecifies the number of students that the room can host.Locationspecifies additional information (campus, building, etc.) to help the students identify the building.
CourseOccurrence
This table contains each occurrence of a course and the professor that is responsible for that occurrence. There should be one or more occurrences of each course in any given year. The columns in this table are:
CourseOccurrenceIDis the surrogate primary key.CourseIDis a foreign key toCourseOccurrenceYearis the calendar year of that course occurrence.CourseOccurrenceCodeis an easy-to-read identifier for each course occurrence. For an occurrence of MAT-1 in the year 2023, we can use a code MAT-1-23. For the 2023 CHM-3 course that requires three different groups, we can use the identifiers CHM-3-23-A, CHM-3-23-B, and CHM-3-23-C.ProfessorIDis a foreign key to the Professor table that identifies the professor assigned to the course occurrence.StartDateandEndDateare the planned start and end dates for the course occurrence.Capacityidentifies the number of students that can enroll in each course occurrence. If the university has two chemistry labs with 20 seats and one with 30 seats, then two of each CHM-3-23 course occurrence will have a capacity of 20; the other CHM-3-23 occurrence will have a capacity of 30.
AssistantProfessor
The columns in this table are:
CourseOccurrenceIDis a foreign key toCourseOccurrencetable and part of the compound primary key.ProfessorIDis a foreign key to the Professor table and part of the compound primary key.
Note: As an enhancement, a ProfessorRole table can be created and a foreign key referencing it can be established on the AssistantProfessor table to identify each professor’s role in each course occurrence.
Schedule
Each course occurrence has one or more weekly time slots and an assigned room (i.e. a classroom, lab, auditorium, etc.). The columns in this table are:
ScheduleIDis the surrogate primary key.CourseOccurrenceIDis a foreign key pointing to the CourseOccurrence table.DayOfWeekis a two-letter abbreviation of the day of the week.StartTimeandEndTimedefine the time each class starts and ends on the specified day of the week.RoomIDis a foreign key pointing to theRoomtable.
Student & Enrollment Area
The last of the areas includes the student information and the careers and courses in which they are enrolled. This area also stores the evaluations (exams, etc.) that each student has accomplished.
The assumed requirements are:
- Each course occurrence may have multiple evaluation instances per student.
- Decimal numbers are used to store evaluation scores. This allows values like 1 to 5, 1 to 10 (including decimals) or even 1 to 100 as a percentage. There are scoring systems that use letters (A to F) or even letters and modifiers (A+, B-, etc.). For these, a new table storing those values can be created; a column referencing that table should replace the Score column in
CourseEnrollmentEvaluation. - We are not keeping track of the history of status In most cases, there will be just an initial “Enrolled” status and a “Finalized” or “Drop Out” final status.

The tables in this area are:
Student
This table contains basic data on university students. It has the columns:
StudentIDis the surrogate primary key.LastNameandFirstNameare the student names.DateOfBirthis the student’s date of birth.EmailandPhoneNumberare additional contact information columns.
CareerStatus
This table contains the different statuses that a student can have for a specific career training path, like “Enrolled”, “Finalized”, “Drop Out”, etc. The columns are:
CareerStatusIDis the surrogate primary key.CareerStatusNameis the actual status.
CareerEnrollment
This table records each time a student starts a new career training path. The columns are:
CareerEnrollmentIDis the surrogate primary key.StudentIDis a foreign key to theStudenttable.CareerIDis a foreign key to theCareertable.EnrollmentDateis the date when the student enrolled.CareerStatusIDis a foreign key to theCareerStatustable; it represents this student’s current status in the career path.CareerStatusDateis the date when the status was last updated.
CourseEnrollment
At the beginning of each year or semester, each student must enroll in their courses. They may only enroll in courses if all previous required courses (as defined in the CourseDependency table) have been completed. This table includes the following columns:
CourseEnrollmentIDis the surrogate primary key.StudentIDis a foreign key to theStudenttable.CourseOccurrenceIDis a foreign key to theCourseOccurrenceThe student must pick a specific group (that defines a professor and schedule) for each course.FinalScorestores the final score of the course.
EvaluationType
This table includes all possible evaluation mechanisms (like written exam, group work, essay, etc.). The columns are:
EvaluationTypeIDis the surrogate primary key.EvaluationTypeNameis actually the name of the evaluation tIsGroupActivityindicates if the evaluation is for groups or individuals.
CourseEnrollmentEvaluation
This table records each time a student is evaluated for a particular course enrollment. The columns are:
CourseEnrollmentEvaluationIDis the surrogate primary key.CourseEnrollmentIDis a foreign key to theCourseEnrollmenttable.EvaluationTypeIDis a foreign key toEvaluationTypetable.EvaluationDateindicates the date the evaluation was performed.Scoreis the score the student achieved on the evaluation instance.
Final ER Diagram for a University Database
Now let’s take a look at our complete university database model in a Vertabelo physical diagram. To learn more about the different kinds of models used in database design, read What Are Conceptual, Logical, and Physical Data Models?.

Generating SQL Scripts from the database model
If you want to implement a model you have created in Vertabelo, you can generate a SQL script containing all the objects. It just takes a few clicks!
Start by clicking on the “Generate SQL Script” button on the diagram toolbar:

Then select the desired object types that you want to include in the script:

Once you click “Generate”, the script is prepared and you can either download to your computer or save it in the Vertabelo drive so it is accessible everywhere:

If you want to continue learning how to model for specific business requirements, do not miss our other Example ER Diagram articles in this blog!