Developpement/23BDD/BDD-23.sql

36 lines
823 B
MySQL
Raw Normal View History

2024-12-09 11:53:11 +01:00
CREATE TABLE Buveur (
NumBuveur NUMBER PRIMARY KEY,
Nom VARCHAR2(25) NOT NULL,
Prenom VARCHAR2(25),
Ville VARCHAR2(30) NOT NULL
);
CREATE TABLE Viticulteur (
NumVitic NUMBER PRIMARY KEY,
Nom VARCHAR2(25) NOT NULL,
Prenom VARCHAR2(25),
Ville VARCHAR2(30) NOT NULL
);
CREATE TABLE Vin (
NumVin NUMBER PRIMARY KEY,
cru VARCHAR2(15) NOT NULL,
Millesime INT NOT NULL,
Region VARCHAR2(15) NOT NULL,
NumVitic NUMBER REFERENCES Viticulteur
);
CREATE TABLE Commande (
NumCom NUMBER PRIMARY KEY,
NumBuveur NUMBER REFERENCES Buveur,
NumVin NUMBER REFERENCES Vin,
Qtte INT NOT NULL,
DateCom DATE NOT NULL
);
CREATE TABLE Livraison (
NumCom NUMBER REFERENCES Commande NOT NULL,
Qte NUMBER NOT NULL,
DateLiv DATE,
PRIMARY KEY(NumCom, DateLiv)
);