LaDissertation.com - Dissertations, fiches de lectures, exemples du BAC
Recherche

Création BDD

TD : Création BDD. Recherche parmi 300 000+ dissertations

Par   •  18 Octobre 2022  •  TD  •  642 Mots (3 Pages)  •  302 Vues

Page 1 sur 3

#QUESTION 3 TP1 SLAM (B2)

// premier script

CREATE DATABASE IF NOT EXISTS entrepriseLegrand

CREATE TABLE `client`(`numCLient` INT(5) NOT NULL AUTO_INCREMENT,

`nomClient` TEXT(20) NOT NULL,

`villeClient` TEXT(30) NOT NULL,

`ContactClient` VARCHAR(30) NOT NULL,

`categorieCLient` VARCHAR(30),

PRIMARY KEY (numCLient)

);

CREATE TABLE `employe`(`numEmploye` INT(5) NOT NULL AUTO_INCREMENT,

`nomEmploye` TEXT(20) NOT NULL,

`prenomEmploye` TEXT(20) NOT NULL,

`roleEmploye` TEXT(30) NOT NULL,

`logEmploye` VARCHAR(30) NOT NULL,

`mdpEmploye` VARCHAR(30) NOT NULL,

PRIMARY KEY (numEmploye)

);

CREATE TABLE `appel`(`numAppel` INT(5) NOT NULL AUTO_INCREMENT,

`dateAppel` DATE NOT NULL,

`descriptionAppel` VARCHAR(50) NOT NULL,

`etatAppel` VARCHAR(30) NOT NULL,

`typeAppel` TEXT(20) NOT NULL,

`numCLient` INT(5),

`numEmploye` INT(5),

PRIMARY KEY (numAppel),

FOREIGN KEY (numClient) REFERENCES client(numClient),

FOREIGN KEY (numEmploye) REFERENCES employe(numEmploye)

);

CREATE TABLE `cahier`(`numCahier` INT(5) NOT NULL AUTO_INCREMENT,

`dateCahier` DATE NOT NULL,

`montantCahier` INT(3) NOT NULL,

`numCLient` INT(5) NOT NULL,

`numEmploye` INT(5) NOT NULL,

`numAppel` INT(5) NOT NULL,

PRIMARY KEY (numCahier),

FOREIGN KEY (numClient) REFERENCES client(numClient),

FOREIGN KEY (numEmploye) REFERENCES employe(numEmploye),

FOREIGN KEY (numAppel) REFERENCES appel(numAppel)

);

CREATE TABLE `ligne_cahier`(`numLigne` INT(5) NOT NULL AUTO_INCREMENT,

`descriptionArticleCahier` VARCHAR(50) NOT NULL,

`numCahier` INT(5) NOT NULL,

PRIMARY KEY (numligne),

FOREIGN KEY (numCahier) REFERENCES cahier(numCahier)

);

// Deuxième script (2ème façon de créer une base de données)

CREATE DATABASE IF NOT EXISTS

...

Télécharger au format  txt (3.9 Kb)   pdf (40.2 Kb)   docx (9 Kb)  
Voir 2 pages de plus »
Uniquement disponible sur LaDissertation.com