Templates/Education

Certifications database schema

Certification programmes with exams, candidate attempts and issued certificates.

5 tables, 5 relationships

Opens as a new diagram you can change. Free.

Tables

programs

  • iduuid not null
  • nametext not null
  • validity_monthsinteger
  • created_attimestamptz not null

exams

  • iduuid not null
  • program_id> programsuuid not null
  • titletext not null
  • pass_markinteger not null
  • created_attimestamptz not null

candidates

  • iduuid not null
  • full_nametext not null
  • emailtext not null
  • created_attimestamptz not null

exam_attempts

  • iduuid not null
  • exam_id> examsuuid not null
  • candidate_id> candidatesuuid not null
  • scoreinteger not null
  • taken_attimestamptz not null
  • created_attimestamptz not null

certificates

  • iduuid not null
  • program_id> programsuuid not null
  • candidate_id> candidatesuuid not null
  • serialtext not null
  • issued_ondate not null
  • expires_ondate
  • 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 "candidates" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "full_name" TEXT NOT NULL,
  "email" TEXT NOT NULL UNIQUE,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "certificates" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "program_id" UUID NOT NULL,
  "candidate_id" UUID NOT NULL,
  "serial" TEXT NOT NULL UNIQUE,
  "issued_on" DATE NOT NULL,
  "expires_on" DATE,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "exam_attempts" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "exam_id" UUID NOT NULL,
  "candidate_id" UUID NOT NULL,
  "score" INTEGER NOT NULL,
  "taken_at" TIMESTAMPTZ NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "exams" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "program_id" UUID NOT NULL,
  "title" TEXT NOT NULL,
  "pass_mark" INTEGER NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "programs" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "name" TEXT NOT NULL,
  "validity_months" INTEGER,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

ALTER TABLE "exams" ADD CONSTRAINT "fk_exams_program_id" FOREIGN KEY ("program_id") REFERENCES "programs" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "exam_attempts" ADD CONSTRAINT "fk_exam_attempts_exam_id" FOREIGN KEY ("exam_id") REFERENCES "exams" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "exam_attempts" ADD CONSTRAINT "fk_exam_attempts_candidate_id" FOREIGN KEY ("candidate_id") REFERENCES "candidates" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "certificates" ADD CONSTRAINT "fk_certificates_program_id" FOREIGN KEY ("program_id") REFERENCES "programs" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "certificates" ADD CONSTRAINT "fk_certificates_candidate_id" FOREIGN KEY ("candidate_id") REFERENCES "candidates" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

More Education templates

Start with one diagram, free

One diagram with two branches, no card needed. Upgrade when your team needs more.