This document contains SQL statements to create a school database with tables for teachers, courses, students, course sessions, and student enrollments. It defines primary and foreign keys to link the tables together and indexes for performance. It also creates and then drops a table for remarks.
This document contains SQL statements to create a school database with tables for teachers, courses, students, course sessions, and student enrollments. It defines primary and foreign keys to link the tables together and indexes for performance. It also creates and then drops a table for remarks.
This document contains SQL statements to create a school database with tables for teachers, courses, students, course sessions, and student enrollments. It defines primary and foreign keys to link the tables together and indexes for performance. It also creates and then drops a table for remarks.
Create table ecole.ENSEIGNANT (Id_e varchar(45) PRIMARY KEY not null,nom
varchar(45), prenom varchar(45)); create table ecole.COURS(sigle VARCHAR(45)PRIMARY KEY not null ,libelle varchar(45),responsable VARCHAR(45) not null,nombreSeances INT); ALTER TABLE ecole.cours ADD INDEX responsable_idx (responsable ASC) VISIBLE; ALTER TABLE ecole.cours ADD CONSTRAINT responsable FOREIGN KEY (responsable) REFERENCES ecole.enseignant (Id_e) ON DELETE NO ACTION ON UPDATE NO ACTION; Create table ecole.ETUDIANT (NumApogee INT PRIMARY KEY not null , nom varchar(45), prenom varchar(45), age INT); Create table ecole.SEANCE (id_s varchar(45) PRIMARY KEY not null, cours varchar(45) not null , NumeroS INT, type varchar(45), date date, salle varchar(5) , heureDebut VARCHAR(20), heureFin VARCHAR(20), enseignant VARCHAR(45) not null); ALTER TABLE ecole.seance ADD INDEX cours_idx (cours ASC) VISIBLE,ADD INDEX enseignant_idx (enseignant ASC) VISIBLE; ALTER TABLE ecole.seance ADD CONSTRAINT cours FOREIGN KEY (cours) REFERENCES ecole.cours (sigle) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT enseignant FOREIGN KEY (enseignant) REFERENCES ecole.enseignant (Id_e) ON DELETE NO ACTION ON UPDATE NO ACTION; Create table ecole.inscription (NumApogee int not null,cours VARCHAR(45)not null); ALTER TABLE ecole.inscription ADD INDEX NumApogee_idx (NumApogee ASC) VISIBLE,ADD INDEX cours_idx (cours ASC) VISIBLE; ALTER TABLE ecole.inscription ADD CONSTRAINT NumApogee FOREIGN KEY (NumApogee) REFERENCES ecole.etudiant (NumApogee) ON DELETE NO ACTION ON UPDATE NO ACTION,ADD CONSTRAINT cours FOREIGN KEY (cours) REFERENCES ecole.cours (sigle) ON DELETE NO ACTION ON UPDATE NO ACTION; Create table ecole.remarques (id_r varchar(45) PRIMARY KEY not null,libelle VARCHAR(45)); Drop table ecole.remarques;