tp_bdd2/personnel.sql

173 lines
4.1 KiB
MySQL
Raw Normal View History

2022-12-07 09:03:13 +01:00
-- Nathan
CREATE TYPE echelon AS ENUM (
'A*',
'A',
'B',
'C'
);
-- Nathan
CREATE TYPE grade AS ENUM (
'cr1',
'cr2',
'mcf',
'mcf hors classe'
);
2022-12-07 08:31:53 +01:00
-- Axel
2022-11-30 16:13:35 +01:00
CREATE TABLE Personnel
2022-11-30 16:27:25 +01:00
(
2022-11-30 16:43:20 +01:00
idPersonnel INT CONSTRAINT UnePersonne PRIMARY KEY,
2022-12-07 08:24:08 +01:00
nom VARCHAR,
prenom VARCHAR,
2022-11-30 16:43:20 +01:00
date_de_naissance DATE,
2022-12-07 08:24:08 +01:00
adress VARCHAR,
2022-12-07 09:03:13 +01:00
date_de_recrutement DATE
2022-11-30 16:27:25 +01:00
);
2022-11-30 16:22:37 +01:00
2022-12-07 08:31:53 +01:00
--Axel
2022-12-07 08:27:57 +01:00
CREATE TABLE Doctorant(
idDoctorant INT NOT NULL,
date_debut_these DATE,
2022-12-07 09:03:13 +01:00
date_soutenance DATE,
2022-12-07 08:52:20 +01:00
FOREIGN KEY (idDoctorant) REFERENCES Personnel(idPersonnel),
2022-12-07 08:27:57 +01:00
PRIMARY KEY(idPersonnel)
);
2022-12-07 08:31:53 +01:00
--Yasmine
2022-11-30 16:43:20 +01:00
CREATE TABLE Scientifique(
idScientique INT NOT NULL,
idPersonnel INT NOT NULL,
grade CHAR,
2022-12-07 08:27:57 +01:00
FOREIGN KEY (idPersonnel) REFERENCES Personnel(idPersonnel),
2022-11-30 16:43:20 +01:00
PRIMARY KEY(idPersonnel)
2022-11-30 16:27:25 +01:00
);
2022-11-30 16:22:37 +01:00
2022-12-07 08:50:45 +01:00
--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)
);
2022-12-07 08:40:12 +01:00
2022-12-07 08:37:52 +01:00
2022-12-07 08:32:23 +01:00
-- Nathan
2022-12-07 08:48:24 +01:00
CREATE TABLE Evenement(
2022-12-07 08:32:23 +01:00
idEvenement INT NOT NULL,
dateDebut DATE,
dateFin DATE,
PRIMARY KEY (idEvenement)
);
2022-12-07 08:24:38 +01:00
2022-12-07 08:37:02 +01:00
-- Ronan
2022-12-07 08:48:24 +01:00
CREATE TABLE Congres(
2022-12-07 08:37:02 +01:00
idCongres INT NOT NULL,
nb_inscriptions INT NOT NULL,
class VARCHAR,
FOREIGN KEY (idCongres) REFERENCES Evenement(idEvenement),
PRIMARY KEY (idCongres)
2022-12-07 08:24:38 +01:00
);
2022-12-07 08:37:02 +01:00
-- Ronan
2022-12-07 08:48:24 +01:00
CREATE TABLE Labo_externe(
2022-12-07 08:24:08 +01:00
idLabo INT NOT NULL,
nom VARCHAR,
pays VARCHAR,
PRIMARY KEY(idLabo)
2022-12-07 08:22:52 +01:00
);
2022-11-30 16:48:39 +01:00
2022-12-07 08:29:47 +01:00
-- Nathan
2022-12-07 08:48:24 +01:00
CREATE TABLE Journee_Porte_Ouvertes(
2022-12-07 08:29:47 +01:00
idPorteOuverte INT NOT NULL,
FOREIGN KEY (idPorteOuverte) REFERENCES Evenement(idEvenement),
PRIMARY KEY (idPorteOuverte)
);
2022-12-07 08:22:52 +01:00
-- Nathan
2022-12-07 08:48:24 +01:00
CREATE TABLE Auteur_Externe (
2022-12-07 08:22:52 +01:00
idAuteur INT NOT NULL,
nom VARCHAR,
prenom VARCHAR,
adresseMail VARCHAR,
idLabo INT NOT NULL,
2022-12-07 09:03:13 +01:00
FOREIGN KEY (idLabo) REFERENCES Labo_Externe(idLabo),
2022-12-07 08:22:52 +01:00
PRIMARY KEY (idAuteur)
2022-12-07 08:33:27 +01:00
);
2022-12-07 08:22:52 +01:00
-- Nathan
2022-12-07 08:48:24 +01:00
CREATE TABLE Publication (
2022-12-07 08:22:52 +01:00
idPublication INT NOT NULL,
titre VARCHAR,
annee DATE,
nomConf VARCHAR,
classeConf VARCHAR,
nbPages INT,
PRIMARY KEY (idPublication)
2022-11-30 16:48:39 +01:00
);
2022-12-07 08:22:52 +01:00
-- Ronan
2022-12-07 08:48:24 +01:00
CREATE TABLE Participe(
2022-11-30 16:36:19 +01:00
idProjet INT NOT NULL,
idScientifique INT NOT NULL,
FOREIGN KEY (idProjet) REFERENCES Projet(idProjet),
2022-11-30 16:48:39 +01:00
FOREIGN KEY (idScientifique) REFERENCES Scientifique(idScientifique),
PRIMARY KEY (idProjet, idScientifique)
2022-11-30 16:36:19 +01:00
);
2022-12-07 08:22:52 +01:00
-- Ronan
2022-12-07 08:48:24 +01:00
CREATE TABLE Preside(
2022-11-30 16:35:17 +01:00
idCongres INT NOT NULL,
idScientifique INT NOT NULL,
FOREIGN KEY (idCongres) REFERENCES Congres(idCongres),
2022-11-30 16:48:39 +01:00
FOREIGN KEY (idScientifique) REFERENCES Scientifique(idScientifique),
PRIMARY KEY (idCongres, idScientifique)
2022-11-30 16:35:17 +01:00
);
2022-11-30 16:34:37 +01:00
2022-12-07 08:22:52 +01:00
-- Ronan
2022-12-07 08:48:24 +01:00
CREATE TABLE Publie_Scientifique(
2022-11-30 16:34:37 +01:00
idPublication INT NOT NULL,
idScientifique INT NOT NULL,
FOREIGN KEY (idPublication) REFERENCES Publication(idPublication),
2022-11-30 16:48:39 +01:00
FOREIGN KEY (idScientifique) REFERENCES Scientifique(idScientifique),
PRIMARY KEY (idPublication, idScientifique)
2022-11-30 16:34:37 +01:00
);
2022-12-07 08:22:52 +01:00
-- Ronan
2022-12-07 08:48:24 +01:00
CREATE TABLE Publie_Doctorant(
2022-11-30 16:30:07 +01:00
idPublication INT NOT NULL,
idDoctorant INT NOT NULL,
FOREIGN KEY (idPublication) REFERENCES Publication(idPublication),
2022-11-30 16:48:39 +01:00
FOREIGN KEY (idDoctorant) REFERENCES Doctorant(idDoctorant),
PRIMARY KEY (idPublication, idDoctorant)
2022-11-30 16:30:07 +01:00
);
2022-12-07 08:22:52 +01:00
-- Ronan
2022-11-30 16:28:38 +01:00
CREATE TABLE Publie_Externe(
idPublication INT NOT NULL,
idAuteurExterne INT NOT NULL,
2022-12-07 08:31:53 +01:00
s dFOREIGN KEY (idPublication) REFERENCES Publication(idPublication),
2022-11-30 16:48:39 +01:00
FOREIGN KEY (idAuteurExterne) REFERENCES Auteur_Externe(idAuteur),
PRIMARY KEY (idPublication, idAuteurExterne)
2022-12-07 08:50:45 +01:00
CREATE TABLE Enseignant_Chercheur
2022-11-30 16:28:38 +01:00
);
2022-11-30 16:22:37 +01:00
2022-12-07 08:22:52 +01:00
-- Ronan
2022-11-30 16:25:03 +01:00
CREATE TABLE Participe_Externe(
idProjet INT NOT NULL,
idPartenaire INT NOT NULL,
FOREIGN KEY (idProjet) REFERENCES Projet(idProjet),
2022-11-30 16:48:39 +01:00
FOREIGN KEY (idPartenaire) REFERENCES Partenaire(idPartenaire),
PRIMARY KEY (idProjet, idPartenaire)
2022-11-30 16:25:03 +01:00
);
2022-11-30 16:22:37 +01:00
2022-12-07 08:22:52 +01:00
-- Ronan
2022-11-30 16:22:37 +01:00
CREATE TABLE Organise (
idPortesOuverte INT NOT NULL,
2022-12-07 09:03:13 +01:00
idPersonnel INT NOT NULL,
2022-11-30 16:22:37 +01:00
FOREIGN KEY (idPortesOuverte) REFERENCES Journee_Portes_Ouvertes(idPorte_Ouverte),
FOREIGN KEY (idPersonnel) REFERENCES Personnel(idPersonnel),
PRIMARY KEY(idPortesOuverte, idPersonnel)
2022-11-30 16:48:39 +01:00
);