1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| CREATE TABLE AP_appli(
AP_ident INT AUTO_INCREMENT,
AP_nom VARCHAR(50) NOT NULL,
PRIMARY KEY(AP_ident),
UNIQUE(AP_nom)
);
CREATE TABLE PR_product(
PR_ident INT AUTO_INCREMENT,
PR_nom VARCHAR(50) NOT NULL,
PRIMARY KEY(PR_ident)
);
CREATE TABLE LI_license(
LI_ident INT AUTO_INCREMENT,
AP_ident INT NOT NULL,
PRIMARY KEY(LI_ident),
FOREIGN KEY(AP_ident) REFERENCES AP_appli(AP_ident)
);
CREATE TABLE TI_ticket(
TI_ident INT AUTO_INCREMENT,
TI_date DATE,
PR_ident INT NOT NULL,
LI_ident INT NOT NULL,
PRIMARY KEY(TI_ident),
FOREIGN KEY(PR_ident) REFERENCES PR_product(PR_ident),
FOREIGN KEY(LI_ident) REFERENCES LI_license(LI_ident)
);
CREATE TABLE AP_PR(
AP_ident INT,
PR_ident INT NOT NULL,
PRIMARY KEY(AP_ident),
UNIQUE(PR_ident),
FOREIGN KEY(AP_ident) REFERENCES AP_appli(AP_ident),
FOREIGN KEY(PR_ident) REFERENCES PR_product(PR_ident)
); |
Partager