172 lines
4.1 KiB
SQL
172 lines
4.1 KiB
SQL
-- Nathan
|
|
CREATE TYPE echelon AS ENUM (
|
|
'A*',
|
|
'A',
|
|
'B',
|
|
'C'
|
|
);
|
|
|
|
-- Nathan
|
|
CREATE TYPE grade AS ENUM (
|
|
'cr1',
|
|
'cr2',
|
|
'mcf',
|
|
'mcf hors classe'
|
|
);
|
|
|
|
-- Axel
|
|
CREATE TABLE Personnel
|
|
(
|
|
idPersonnel INT CONSTRAINT UnePersonne PRIMARY KEY,
|
|
nom VARCHAR,
|
|
prenom VARCHAR,
|
|
date_de_naissance DATE,
|
|
adress VARCHAR,
|
|
date_de_recrutement DATE
|
|
);
|
|
|
|
--Axel
|
|
CREATE TABLE Doctorant(
|
|
idDoctorant INT NOT NULL,
|
|
date_debut_these DATE,
|
|
date_soutenance DATE,
|
|
FOREIGN KEY (idDoctorant) REFERENCES Personnel(idPersonnel),
|
|
PRIMARY KEY(idPersonnel)
|
|
);
|
|
|
|
--Yasmine
|
|
CREATE TABLE Scientifique(
|
|
idScientique INT NOT NULL,
|
|
idPersonnel INT NOT NULL,
|
|
grade CHAR,
|
|
FOREIGN KEY (idPersonnel) REFERENCES Personnel(idPersonnel),
|
|
PRIMARY KEY(idPersonnel)
|
|
);
|
|
|
|
--Axel
|
|
CREATE TABLE Enseignant_Chercheur(
|
|
idEnseignant INT NOT NULL,
|
|
echelon ECHELON,
|
|
FOREIGN KEY (idEtablissement) REFERENCES Etablissement(idEtablissement),
|
|
FOREIN KEY (idEnseignant) REFERENCES Personnel(idPersonnel),
|
|
PRIMARY KEY (idEnseignant)
|
|
);
|
|
|
|
|
|
-- Nathan
|
|
CREATE TABLE Evenement(
|
|
idEvenement INT NOT NULL,
|
|
dateDebut DATE,
|
|
dateFin DATE,
|
|
PRIMARY KEY (idEvenement)
|
|
);
|
|
|
|
-- Ronan
|
|
CREATE TABLE Congres(
|
|
idCongres INT NOT NULL,
|
|
nb_inscriptions INT NOT NULL,
|
|
class VARCHAR,
|
|
FOREIGN KEY (idCongres) REFERENCES Evenement(idEvenement),
|
|
PRIMARY KEY (idCongres)
|
|
);
|
|
|
|
-- Ronan
|
|
CREATE TABLE Labo_externe(
|
|
idLabo INT NOT NULL,
|
|
nom VARCHAR,
|
|
pays VARCHAR,
|
|
PRIMARY KEY(idLabo)
|
|
);
|
|
|
|
-- Nathan
|
|
CREATE TABLE Journee_Porte_Ouvertes(
|
|
idPorteOuverte INT NOT NULL,
|
|
FOREIGN KEY (idPorteOuverte) REFERENCES Evenement(idEvenement),
|
|
PRIMARY KEY (idPorteOuverte)
|
|
);
|
|
|
|
-- Nathan
|
|
CREATE TABLE Auteur_Externe (
|
|
idAuteur INT NOT NULL,
|
|
nom VARCHAR,
|
|
prenom VARCHAR,
|
|
adresseMail VARCHAR,
|
|
idLabo INT NOT NULL,
|
|
FOREIGN KEY (idLabo) REFERENCES Labo_Externe(idLabo),
|
|
PRIMARY KEY (idAuteur)
|
|
);
|
|
|
|
-- Nathan
|
|
CREATE TABLE Publication (
|
|
idPublication INT NOT NULL,
|
|
titre VARCHAR,
|
|
annee DATE,
|
|
nomConf VARCHAR,
|
|
classeConf VARCHAR,
|
|
nbPages INT,
|
|
PRIMARY KEY (idPublication)
|
|
);
|
|
|
|
-- Ronan
|
|
CREATE TABLE Participe(
|
|
idProjet INT NOT NULL,
|
|
idScientifique INT NOT NULL,
|
|
FOREIGN KEY (idProjet) REFERENCES Projet(idProjet),
|
|
FOREIGN KEY (idScientifique) REFERENCES Scientifique(idScientifique),
|
|
PRIMARY KEY (idProjet, idScientifique)
|
|
);
|
|
|
|
-- Ronan
|
|
CREATE TABLE Preside(
|
|
idCongres INT NOT NULL,
|
|
idScientifique INT NOT NULL,
|
|
FOREIGN KEY (idCongres) REFERENCES Congres(idCongres),
|
|
FOREIGN KEY (idScientifique) REFERENCES Scientifique(idScientifique),
|
|
PRIMARY KEY (idCongres, idScientifique)
|
|
);
|
|
|
|
-- Ronan
|
|
CREATE TABLE Publie_Scientifique(
|
|
idPublication INT NOT NULL,
|
|
idScientifique INT NOT NULL,
|
|
FOREIGN KEY (idPublication) REFERENCES Publication(idPublication),
|
|
FOREIGN KEY (idScientifique) REFERENCES Scientifique(idScientifique),
|
|
PRIMARY KEY (idPublication, idScientifique)
|
|
);
|
|
|
|
-- Ronan
|
|
CREATE TABLE Publie_Doctorant(
|
|
idPublication INT NOT NULL,
|
|
idDoctorant INT NOT NULL,
|
|
FOREIGN KEY (idPublication) REFERENCES Publication(idPublication),
|
|
FOREIGN KEY (idDoctorant) REFERENCES Doctorant(idDoctorant),
|
|
PRIMARY KEY (idPublication, idDoctorant)
|
|
);
|
|
|
|
-- Ronan
|
|
CREATE TABLE Publie_Externe(
|
|
idPublication INT NOT NULL,
|
|
idAuteurExterne INT NOT NULL,
|
|
s dFOREIGN KEY (idPublication) REFERENCES Publication(idPublication),
|
|
FOREIGN KEY (idAuteurExterne) REFERENCES Auteur_Externe(idAuteur),
|
|
PRIMARY KEY (idPublication, idAuteurExterne)
|
|
CREATE TABLE Enseignant_Chercheur
|
|
);
|
|
|
|
-- Ronan
|
|
CREATE TABLE Participe_Externe(
|
|
idProjet INT NOT NULL,
|
|
idPartenaire INT NOT NULL,
|
|
FOREIGN KEY (idProjet) REFERENCES Projet(idProjet),
|
|
FOREIGN KEY (idPartenaire) REFERENCES Partenaire(idPartenaire),
|
|
PRIMARY KEY (idProjet, idPartenaire)
|
|
);
|
|
|
|
-- Ronan
|
|
CREATE TABLE Organise (
|
|
idPortesOuverte INT NOT NULL,
|
|
idPersonnel INT NOT NULL,
|
|
FOREIGN KEY (idPortesOuverte) REFERENCES Journee_Portes_Ouvertes(idPorte_Ouverte),
|
|
FOREIGN KEY (idPersonnel) REFERENCES Personnel(idPersonnel),
|
|
PRIMARY KEY(idPortesOuverte, idPersonnel)
|
|
);
|