tp_bdd2/personnel.sql

161 lines
3.6 KiB
MySQL
Raw Normal View History

2022-12-07 08:22:52 +01:00
-- Axel ou Yasmine
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-11-30 16:43:20 +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:22:52 +01:00
-- Axel ou Yasmine
2022-11-30 16:43:20 +01:00
CREATE TABLE Scientifique(
idScientique INT NOT NULL,
idPersonnel INT NOT NULL,
2022-12-07 08:24:08 +01:00
grade VARCHAR,
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:37:02 +01:00
-- Ronan
CREATE Partenaire(
idPartenaire INT NOT NULL,
nom VARCHAR,
pays VARCHAR,
PRIMARY KEY(idPartenaire)
);
2022-12-07 08:37:52 +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:32:23 +01:00
-- Nathan
CREATE Evenement(
idEvenement INT NOT NULL,
dateDebut DATE,
dateFin DATE,
PRIMARY KEY (idEvenement)
);
2022-12-07 08:37:02 +01:00
-- Ronan
CREATE Congres(
idCongres INT NOT NULL,
nb_inscriptions INT NOT NULL,
class VARCHAR,
FOREIGN KEY (idCongres) REFERENCES Evenement(idEvenement),
PRIMARY KEY (idCongres)
);
-- Ronan
CREATE Labo_externe(
idLabo INT NOT NULL,
nom VARCHAR,
pays VARCHAR,
PRIMARY KEY(idLabo)
);
2022-12-07 08:29:47 +01:00
-- Nathan
CREATE Journee_Porte_Ouvertes(
idPorteOuverte INT NOT NULL,
FOREIGN KEY (idPorteOuverte) REFERENCES Evenement(idEvenement),
PRIMARY KEY (idPorteOuverte)
);
2022-12-07 08:22:52 +01:00
-- Nathan
CREATE Auteur_Externe (
idAuteur INT NOT NULL,
nom VARCHAR,
prenom VARCHAR,
adresseMail VARCHAR,
idLabo INT NOT NULL,
FOREIGN KEY (idLabo) REFERENCES LaboExterne(idLabo),
PRIMARY KEY (idAuteur)
);
2022-11-30 16:48:39 +01:00
2022-12-07 08:22:52 +01:00
-- Nathan
CREATE Publication (
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-11-30 16:36:19 +01:00
CREATE Participe(
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-11-30 16:35:17 +01:00
CREATE Preside(
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-11-30 16:34:37 +01:00
CREATE Publie_Scientifique(
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-11-30 16:30:07 +01:00
CREATE Publie_Doctorant(
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,
FOREIGN 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-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,
idPersonnel INT NOT NULL,
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
);