University registrar database schema
Departments, courses offered as sections each term, instructors and registrations.
7 tables, 7 relationships
Opens as a new diagram you can change. Free.
Tables
departments
- iduuid not null
- nametext not null
- codetext not null
- created_attimestamptz not null
courses
- iduuid not null
- department_id> departmentsuuid not null
- codetext not null
- titletext not null
- creditsinteger not null
- created_attimestamptz not null
terms
- iduuid not null
- nametext not null
- starts_ondate not null
- ends_ondate not null
- created_attimestamptz not null
instructors
- iduuid not null
- department_id> departmentsuuid not null
- full_nametext not null
- created_attimestamptz not null
sections
- iduuid not null
- course_id> coursesuuid not null
- term_id> termsuuid not null
- instructor_id> instructorsuuid not null
- capacityinteger not null
- created_attimestamptz not null
students
- iduuid not null
- student_numbertext not null
- full_nametext not null
- created_attimestamptz not null
registrations
- iduuid not null
- section_id> sectionsuuid not null
- student_id> studentsuuid not null
- final_gradetext
- created_attimestamptz not null
As PostgreSQL
The same diagram exports to MySQL, MariaDB, SQLite, SQL Server and Oracle, and to Prisma, Drizzle, SQLAlchemy and Convex models.
CREATE TABLE "courses" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"department_id" UUID NOT NULL,
"code" TEXT NOT NULL UNIQUE,
"title" TEXT NOT NULL,
"credits" INTEGER NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "departments" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"name" TEXT NOT NULL,
"code" TEXT NOT NULL UNIQUE,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "instructors" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"department_id" UUID NOT NULL,
"full_name" TEXT NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "registrations" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"section_id" UUID NOT NULL,
"student_id" UUID NOT NULL,
"final_grade" TEXT,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "sections" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"course_id" UUID NOT NULL,
"term_id" UUID NOT NULL,
"instructor_id" UUID NOT NULL,
"capacity" INTEGER NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "students" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"student_number" TEXT NOT NULL UNIQUE,
"full_name" TEXT NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "terms" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"name" TEXT NOT NULL,
"starts_on" DATE NOT NULL,
"ends_on" DATE NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
ALTER TABLE "courses" ADD CONSTRAINT "fk_courses_department_id" FOREIGN KEY ("department_id") REFERENCES "departments" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "instructors" ADD CONSTRAINT "fk_instructors_department_id" FOREIGN KEY ("department_id") REFERENCES "departments" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "sections" ADD CONSTRAINT "fk_sections_course_id" FOREIGN KEY ("course_id") REFERENCES "courses" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "sections" ADD CONSTRAINT "fk_sections_term_id" FOREIGN KEY ("term_id") REFERENCES "terms" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "sections" ADD CONSTRAINT "fk_sections_instructor_id" FOREIGN KEY ("instructor_id") REFERENCES "instructors" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "registrations" ADD CONSTRAINT "fk_registrations_section_id" FOREIGN KEY ("section_id") REFERENCES "sections" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "registrations" ADD CONSTRAINT "fk_registrations_student_id" FOREIGN KEY ("student_id") REFERENCES "students" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;More Education templates
- Online coursesCourses of modules and lessons, enrolments, lesson progress and quizzes.
- School managementStudents and guardians, classes taught by teachers, grades and attendance.
- Quizzes & assessmentsQuizzes of multiple-choice questions, attempts and recorded answers.
- LibraryBooks with authors, physical copies, members, loans and holds.
- Tutoring marketplaceTutors teaching subjects, bookable lessons with students, and reviews.
- CertificationsCertification programmes with exams, candidate attempts and issued certificates.
- Language learningCourses by language, units of lessons and exercises, learner attempts and streaks.
- FlashcardsDecks of cards with spaced-repetition review history per learner.
- Nursery / childcareChildren in rooms with key staff, guardians, daily attendance and incident reports.
Start with one diagram, free
One diagram with two branches, no card needed. Upgrade when your team needs more.