Commit db19ef76 authored by Ismail Merzougui's avatar Ismail Merzougui

CREATE TYPE Etat as ENUm ('Abime','perdu','bon','neuf');

CREATE TYPE TypeDoc as ENUm ('Livre','Film','Musique');

CREATE TABLE Email
(
email VARCHAR(100),
prenom VARCHAR(100) NOT NULL,
nom VARCHAR(100) NOT NULL,
numeroTel VARCHAR(10) NOT NULL UNIQUE,
PRIMARY KEY (email)
);


CREATE TABLE Login
(
login VARCHAR(100) PRIMARY KEY,
email VARCHAR(100) NOT NULL UNIQUE,
motdepasse VARCHAR(100) NOT NULL,
Blackliste boolean NOT NULL,
FOREIGN KEY (email) REFERENCES Email
);


CREATE TABLE Adherent
(
IdCarte VARCHAR(100) PRIMARY KEY,
login VARCHAR(100) NOT NULL UNIQUE,
FOREIGN KEY (login) REFERENCES Login
);




 
CREATE TABLE Contributeur
(
nom VARCHAR(100) NOT NULL,
prenom VARCHAR(100) NOT NULL,
dateDeNaissance DATE NOT NULL,
nationalite VARCHAR(100) NOT NULL,
PRIMARY KEY (nom,prenom,dateDeNaissance)
);
 
 
 
 
 
 
 
CREATE TABLE EmailPersonnel
(
email VARCHAR(100) PRIMARY KEY,
nom VARCHAR(100) NOT NULL,
prenom VARCHAR(100) NOT NULL,
numeroTel VARCHAR(100) Not NULL
);
 
CREATE TABLE Personnel
(
login VARCHAR(100) NOT NULL ,
email VARCHAR(100) NOT NULL UNIQUE,
mdp VARCHAR(100) NOT NULL,
PRIMARY KEY (login),
FOREIGN KEY (email) REFERENCES EmailPersonnel
);
 
 
CREATE TABLE Document
(
code VARCHAR(100) NOT NULL,
titre VARCHAR(100) NOT NULL,
dateSortie VARCHAR(100) NOT NULL,
editeur VARCHAR(500),
langue VARCHAR(100) NOT NULL,
etatdudocumennt Etat NOT NULL,
synopsis VARCHAR(500),
ISBN VARCHAR(100)  UNIQUE,
resume VARCHAR(500),
duree TIME ,
typeD TypeDoc,
disponible boolean NOT NULL,
PRIMARY KEY (code)
);

CREATE TABLE GenreDocument (
code VARCHAR(100),
genre VARCHAR(100) NOT NULL,
PRIMARY KEY (code),
FOREIGN KEY (code) REFERENCES Document
);
 
 
 
CREATE TABLE EmpruntDocument
(
code VARCHAR(100) NOT NULL,
Idcarte VARCHAR(100) NOT NULL,
dateEmprunt DATE  NOT NULL,
dateRetour DATE ,
etatEmprunt ETAT NOT NULL,
etatRetour ETAT NOT NULL,
PRIMARY KEY (code, Idcarte, dateEmprunt),
FOREIGN KEY(code) REFERENCES Document,
FOREIGN KEY (Idcarte) REFERENCES Adherent,
CONSTRAINT DateUnique UNIQUE(dateEmprunt,code),
CONSTRAINT DateUnique2 UNIQUE(dateRetour,code)
);
 
 
 
CREATE TABLE Sanction
(
TypeSanction VARCHAR(100),
dateDebut DATE NOT NULL,
Duree TIME NOT NULL,
dateFin DATE NOT NULL,
IdCarte VARCHAR(100) NOT NULL,
PRIMARY KEY (TypeSanction, dateDebut),
FOREIGN KEY (IdCarte) REFERENCES Adherent
);
 
 
CREATE TABLE ContributionDocument
(
nom VARCHAR(100) NOT NULL,
prenom VARCHAR(100) NOT NULL,
DateDeNaissance DATE NOT NULL,
Code VARCHAR(100) NOT NULL,
typeC VARCHAR(100) NOT NULL,
PRIMARY KEY (nom, prenom, DateDeNaissance, code),
FOREIGN KEY (nom, prenom, DateDeNaissance) REFERENCES Contributeur,
FOREIGN KEY (code) REFERENCES Document
);
 
 
 
 
 INSERT INTO email(email, prenom, nom, numeroTel)
VALUES('ismail.sylla@etu.utc.fr','Ismail','Sylla',0654326698);
INSERT INTO email(email, prenom, nom, numeroTel)
VALUES('ismail.merzougui@etu.utc.fr','Ismail','Merzougui',0684532155);
INSERT INTO email(email, prenom, nom, numeroTel)
VALUES('sofiane.mahjoub@etu.utc.fr','Sofiane','Mahjoub',0789562345);
 


INSERT INTO Login(login, email, motdepasse, Blackliste)
VALUES('syllaism','ismail.sylla@etu.utc.fr','laloalo56', 't');

INSERT INTO Login(login, email, motdepasse, Blackliste)
VALUES('mahjoubsof','sofiane.mahjoub@etu.utc.fr','fu5uo75', 'f');
INSERT INTO Login(login, email, motdepasse, Blackliste)
VALUES('merzouguiism','ismail.merzougui@etu.utc.fr','lmmlmls45', 'f');


INSERT INTO Adherent(IdCarte,login)
VALUES(00776, 'syllaism');
INSERT INTO Adherent(IdCarte,login)
VALUES(00001, 'mahjoubsof');
INSERT INTO Adherent(IdCarte,login)
VALUES(000026,'merzouguiism');
 
 
 
INSERT INTO Contributeur(nom,prenom, DateDeNaissance,nationalite)
 VALUES('Tarentino','Quentin',TO_DATE('19560330','YYYYMMDD'),'Americain');
 
INSERT INTO Contributeur(nom,prenom, DateDeNaissance,nationalite)
 VALUES('Allers','Roger',TO_DATE('19490223','YYYYMMDD'),'Americain');
 
INSERT INTO Contributeur(nom,prenom, DateDeNaissance,nationalite)
 VALUES('Cameron','James',TO_DATE('19540416','YYYYMMDD'),'Canadien');
 
INSERT INTO Contributeur(nom,prenom, DateDeNaissance,nationalite)
 VALUES('De Palma','Brian',TO_DATE('19400911','YYYYMMDD'),'Americain');
 
 
 
INSERT INTO Contributeur(nom,prenom, DateDeNaissance,nationalite)
 VALUES('Hugo', 'Victor', TO_DATE('18020226','YYYYMMDD'),'Français' );
 
INSERT INTO Contributeur(nom,prenom, DateDeNaissance,nationalite)
 VALUES('Baudelaire', 'Charles',TO_DATE('18210409','YYYYMMDD'),'Français');
 
INSERT INTO Contributeur(nom,prenom, DateDeNaissance,nationalite)
 VALUES('Kipling', 'Rudyard', TO_DATE('18651218','YYYYMMDD'),'Anglais' );
 
INSERT INTO Contributeur(nom,prenom, DateDeNaissance,nationalite)
 VALUES('Poquelin', 'Jean-Baptiste', TO_DATE('16220115','YYYYMMDD'),'Français' );
 
INSERT INTO Contributeur(nom,prenom, DateDeNaissance,nationalite)
VALUES('Ludwig', 'Beethoven',TO_DATE('17701215','YYYYMMDD'),'Allemand');
 
INSERT INTO Contributeur(nom,prenom, DateDeNaissance,nationalite)
 VALUES('Andrieu', 'Tarik',TO_DATE('19860522','YYYYMMDD'), 'Française');
 
 
INSERT INTO Contributeur(nom,prenom, DateDeNaissance,nationalite)
 VALUES('Henley', 'Don',TO_DATE('19470622','YYYYMMDD'), 'Americain');
 
 


INSERT INTO EmailPersonnel(nom,prenom, email, numeroTel)
VALUES('Ribery','Frank','frank.ribery@insa.fr',0754326698);

INSERT INTO EmailPersonnel(nom,prenom, email, numeroTel)
VALUES('Kyle','Junior','junior.kyke@w9.fr',0783246985);

INSERT INTO EmailPersonnel(nom,prenom, email, numeroTel)
VALUES('Henni','Mohammed','bahouelogique@snapchat.fr',0654669877);
 
INSERT INTO Personnel(login, email,mdp)
VALUES('fribery','frank.ribery@insa.fr','jojoj45');
 
INSERT INTO Personnel(login,email,mdp)
VALUES('jkyle','junior.kyke@w9.fr','jofooj45');
 
INSERT INTO Personnel(login,email,mdp)
VALUES('MHenni','bahouelogique@snapchat.fr','jofooj45');
 
 
 
INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)
 
VALUES(52369841, 'Les miserables', TO_DATE('18620502','YYYYMMDD'), 'FOLIO','Français', 'Abime',NULL,978-3-16-148410-0,'pain',NULL,'Livre','t');
 
INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)

VALUES(52369842, 'Les fleurs du mal', TO_DATE('18570406','YYYYMMDD'), 'Gallimard', 'Français', 'neuf',NULL,978-3-16-148410-1, 'chocolat',NULL,'Livre','t');
 
INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)

VALUES(52369843, 'Le livre de la jungle',TO_DATE('18940215','YYYYMMDD'),'FOLIO', 'Anglais', 'perdu',NULL, 978-3-16-148410-2,'football',NULL,'Livre','f');
 
INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)

VALUES(52369844, 'Don Juan', TO_DATE('16760205','YYYYMMDD'),  'Hachette', 'Français', 'Abime',NULL, 978-3-16-148410-3, 'NF18',NULL,'Livre','f');
 
 
INSERT INTO ContributionDocument(nom, prenom, DateDeNaissance, code, typeC)
VALUES('Hugo', 'Victor', TO_DATE('18020226','YYYYMMDD'), 52369841, 'Ecrivain');
 
INSERT INTO ContributionDocument(nom, prenom, DateDeNaissance, code, typeC)
VALUES('Baudelaire', 'Charles', TO_DATE('18210409','YYYYMMDD'), 52369842, 'Ecrivain');
 
INSERT INTO ContributionDocument(nom, prenom, DateDeNaissance, code, typeC)
VALUES('Kipling', 'Rudyard', TO_DATE('18651218','YYYYMMDD'), 52369843, 'Ecrivain');
 
INSERT INTO ContributionDocument(nom, prenom, DateDeNaissance, code, typeC)
VALUES('Poquelin', 'Jean-Baptiste', TO_DATE('16220115','YYYYMMDD'), 52369844,'Ecrivain');
 
 
 
 
 
INSERT INTO EmpruntDocument(code,Idcarte,DateEmprunt,DateRetour,etatemprunt,etatretour)
VALUES(52369841,00776,TO_DATE('20190204','YYYYMMDD'),TO_DATE('20190205','YYYYMMDD'),'Abime','Abime');
 
INSERT INTO EmpruntDocument(code,Idcarte,DateEmprunt,DateRetour,etatemprunt,etatretour)
VALUES(52369842,00776,TO_DATE('20190102','YYYYMMDD'),TO_DATE('20190103','YYYYMMDD'),'neuf','Abime');
 
 INSERT INTO EmpruntDocument(code,Idcarte,DateEmprunt,DateRetour,etatemprunt,etatretour)
VALUES(52369843,00001,TO_DATE('20190304','YYYYMMDD'),TO_DATE('20190305','YYYYMMDD'),'perdu','perdu');
 
 INSERT INTO EmpruntDocument(code,Idcarte,DateEmprunt,DateRetour,etatemprunt,etatretour)
VALUES(52369844,00026,TO_DATE('20190304','YYYYMMDD'),TO_DATE('20190305','YYYYMMDD'),'Abime','perdu');
 
 
 
 
 
 
INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)
VALUES(64564564, 'django',TO_DATE('20130708','YYYYMMDD'),NULL,'anglais','neuf','choco',NULL,'football1','02:32:59','Film','t');
 
INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)
VALUES(64564563, 'Le roi lion', TO_DATE('19940408','YYYYMMDD'),NULL, 'anglais', 'neuf','choco2',NULL, 'football2','01:52:45','Film','t');
 
INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)
VALUES(64564565, 'Titanic',TO_DATE('19970403','YYYYMMDD'),NULL, 'anglais', 'Abime','choco3',NULL, 'football3','03:25:10','Film','t');
 
INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)
VALUES(64564566, 'Scarface', TO_DATE('19830506','YYYYMMDD'),NULL, 'Anglais et Italien', 'neuf','choco4',NULL,'football4','04:52:59', 'Film','t');
 
 
 
 
INSERT INTO ContributionDocument(nom,prenom, DateDeNaissance,Code,typeC)
VALUES('Tarentino','Quentin',TO_DATE('19560330','YYYYMMDD'),64564564,'Realisateur');
 
INSERT INTO ContributionDocument(nom,prenom, DateDeNaissance,Code,typeC)
VALUES('Allers','Roger',TO_DATE('19490223','YYYYMMDD'),64564563,'Realisateur');
 
INSERT INTO ContributionDocument(nom,prenom, DateDeNaissance,Code,typeC)
VALUES('Cameron','James',TO_DATE('19540416','YYYYMMDD'),64564565,'Realisateur');
 
INSERT INTO ContributionDocument(nom,prenom, DateDeNaissance,Code,typeC)
VALUES('De Palma','Brian',TO_DATE('19400911','YYYYMMDD'),64564566,'Realisateur');
 
 
INSERT INTO EmpruntDocument(code,Idcarte,DateEmprunt,DateRetour,etatemprunt,etatretour)
VALUES(64564564,00776,TO_DATE('20190402','YYYYMMDD'),TO_DATE('20190405','YYYYMMDD'),'neuf','Abime');
 
INSERT INTO EmpruntDocument(code,Idcarte,DateEmprunt,DateRetour,etatemprunt,etatretour)
VALUES(64564563,00776,TO_DATE('20190401','YYYYMMDD'),TO_DATE('20190405','YYYYMMDD'),'neuf','neuf');
 
INSERT INTO EmpruntDocument(code,Idcarte,DateEmprunt,DateRetour,etatemprunt,etatretour)
VALUES(64564565,00001,TO_DATE('20190331','YYYYMMDD'),TO_DATE('20190403','YYYYMMDD'),'Abime', 'Abime');
 
INSERT INTO EmpruntDocument(code,Idcarte,DateEmprunt,DateRetour,etatemprunt,etatretour)
VALUES(64564566,00026,TO_DATE('20190330','YYYYMMDD'),TO_DATE('20190401','YYYYMMDD'),'neuf','neuf');
 
 
 
 
 
INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)
 
VALUES(61449716, 'Lettre à Elise', TO_DATE('18100000','YYYYMMDD'), 'Bastberg',  'Français', 'neuf',NULL,NULL,NULL,'00:00:02','Musique','t');
 
INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)
VALUES(49751676, 'Hotel California', TO_DATE('19770000','YYYYMMDD'), 'Warner Chapell Music', 'Anglais', 'bon',NULL,NULL,NULL, '00:01:50','Musique','t');
 
INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)
VALUES(16479314, 'Au DD', TO_DATE('20190322','YYYYMMDD'), 'QLF Records', 'Francais', 'neuf',NULL,NULL,NULL, '00:02:00','Musique','t');

INSERT INTO Document (code, titre, dateSortie, editeur, langue, etatdudocumennt,synopsis,ISBN, resume, duree,typeD, disponible)
VALUES(46494874, 'Don Juan',  TO_DATE('16760000','YYYYMMDD'), 'Hachette', 'Français', 'Abime',NULL,NULL,NULL,'00:03:20','Musique','t');
 
 
 
 
 
INSERT INTO ContributionDocument(nom, prenom, DateDeNaissance, code, typeC)
VALUES('Ludwig', 'Beethoven',  TO_DATE('17701215','YYYYMMDD'), 61449716, 'Compositeur');
 
INSERT INTO ContributionDocument(nom, prenom, DateDeNaissance, code, typeC)
VALUES('Ludwig', 'Beethoven', TO_DATE('17701215','YYYYMMDD'), 46494874, 'Compositeur');
 
 
INSERT INTO ContributionDocument(nom, prenom, DateDeNaissance, code, typeC)
VALUES('Andrieu', 'Tarik', TO_DATE('19860522','YYYYMMDD'), 16479314, 'Chanteur');
 
INSERT INTO ContributionDocument(nom, prenom, DateDeNaissance, code, typeC)
VALUES('Henley', 'Don', TO_DATE('19470622','YYYYMMDD'), 49751676, 'Chanteur');
 
 



INSERT INTO GenreDocument (code, genre)
VALUES(52369841,'epique');


INSERT INTO GenreDocument (code, genre)
VALUES(52369842,'Poesie');


INSERT INTO GenreDocument (code, genre)
VALUES(52369843,'litterature enfance');


INSERT INTO GenreDocument (code, genre)
VALUES(52369844,'Piece de theatre');


INSERT INTO GenreDocument (code, genre)
VALUES(64564564,'Action');


INSERT INTO GenreDocument (code, genre)
VALUES(64564563,'Animation');


INSERT INTO GenreDocument (code, genre)
VALUES(64564565,'Drame et Romance');


INSERT INTO GenreDocument (code, genre)
VALUES(64564566,'Action et Drame');


INSERT INTO GenreDocument (code, genre)
VALUES(61449716,'Classique');


INSERT INTO GenreDocument (code, genre)
VALUES(49751676,'Rock');


INSERT INTO GenreDocument (code, genre)
VALUES(16479314,'Rap');


INSERT INTO GenreDocument (code, genre)
VALUES(46494874,'Piece de theatre');
parent 432cf5d9
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment