This document contains SQL scripts that generate tables for an educational database including tables for students, classes, schools, teachers, subjects, evaluations and student results. Foreign key constraints are added between the tables.
This document contains SQL scripts that generate tables for an educational database including tables for students, classes, schools, teachers, subjects, evaluations and student results. Foreign key constraints are added between the tables.
This document contains SQL scripts that generate tables for an educational database including tables for students, classes, schools, teachers, subjects, evaluations and student results. Foreign key constraints are added between the tables.
This document contains SQL scripts that generate tables for an educational database including tables for students, classes, schools, teachers, subjects, evaluations and student results. Foreign key constraints are added between the tables.
-- This script was generated by a beta version of the ERD tool in pgAdmin 4.
-- Please log an issue at
https://redmine.postgresql.org/projects/pgadmin4/issues/new if you find any bugs, including reproduction steps. BEGIN;
CREATE TABLE IF NOT EXISTS public."Apprenant"
( id integer NOT NULL, nom character varying COLLATE pg_catalog."default" NOT NULL, prenom character varying COLLATE pg_catalog."default", sexe character varying COLLATE pg_catalog."default", CONSTRAINT "Apprenant_pkey" PRIMARY KEY (id) );
CREATE TABLE IF NOT EXISTS public."Classe"
( id integer NOT NULL, libelle character varying COLLATE pg_catalog."default" NOT NULL, CONSTRAINT "Classe_pkey" PRIMARY KEY (id) );
CREATE TABLE IF NOT EXISTS public."Ecole"
( id integer NOT NULL, nom character varying COLLATE pg_catalog."default" NOT NULL, ville character varying COLLATE pg_catalog."default", adresse character varying COLLATE pg_catalog."default", CONSTRAINT "Ecole_pkey" PRIMARY KEY (id) );
CREATE TABLE IF NOT EXISTS public."Enseignant"
( id integer NOT NULL, nom character varying COLLATE pg_catalog."default" NOT NULL, grade character varying COLLATE pg_catalog."default", sexe character varying COLLATE pg_catalog."default", CONSTRAINT "Enseignant_pkey" PRIMARY KEY (id) );
CREATE TABLE IF NOT EXISTS public."Evaluation"
( id integer NOT NULL, type character varying COLLATE pg_catalog."default" NOT NULL, CONSTRAINT "Evaluation_pkey" PRIMARY KEY (id) );
CREATE TABLE IF NOT EXISTS public."Matiere"
( id integer NOT NULL, libelle character varying COLLATE pg_catalog."default" NOT NULL, CONSTRAINT "Matiere_pkey" PRIMARY KEY (id) );
CREATE TABLE IF NOT EXISTS public."MatiereC"
( note double precision ); CREATE TABLE IF NOT EXISTS public."Resultat" ( "Apprenant_id" integer NOT NULL, "Evaluation_id" integer NOT NULL, "Moyenne" double precision );
CREATE TABLE IF NOT EXISTS public.apprenant
( id bigint NOT NULL DEFAULT nextval('apprenant_id_seq'::regclass), nom character varying(255) COLLATE pg_catalog."default", prenom character varying(75) COLLATE pg_catalog."default", sexe character varying(75) COLLATE pg_catalog."default", CONSTRAINT apprenant_pkey PRIMARY KEY (id) );
ALTER TABLE IF EXISTS public."Apprenant"
ADD CONSTRAINT "Apprenant_id_fkey" FOREIGN KEY (id) REFERENCES public."Classe" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; CREATE INDEX IF NOT EXISTS "Apprenant_pkey" ON public."Apprenant"(id);
ALTER TABLE IF EXISTS public."Apprenant"
ADD CONSTRAINT "Apprenant_id_fkey1" FOREIGN KEY (id) REFERENCES public."Classe" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; CREATE INDEX IF NOT EXISTS "Apprenant_pkey" ON public."Apprenant"(id);
ALTER TABLE IF EXISTS public."Classe"
ADD CONSTRAINT "Classe_id_fkey" FOREIGN KEY (id) REFERENCES public."Ecole" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; CREATE INDEX IF NOT EXISTS "Classe_pkey" ON public."Classe"(id);
ALTER TABLE IF EXISTS public."Enseignant"
ADD CONSTRAINT "Enseignant_id_fkey" FOREIGN KEY (id) REFERENCES public."Matiere" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; CREATE INDEX IF NOT EXISTS "Enseignant_pkey" ON public."Enseignant"(id);
ALTER TABLE IF EXISTS public."Resultat"
ADD CONSTRAINT "Resultat_Apprenant_id_fkey" FOREIGN KEY ("Apprenant_id") REFERENCES public."Apprenant" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE IF EXISTS public."Resultat" ADD CONSTRAINT "Resultat_Evaluation_id_fkey" FOREIGN KEY ("Evaluation_id") REFERENCES public."Evaluation" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION;