Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. create table Buveur (
  2. numBuveur NUMBER(3),
  3. nom VARCHAR2(20) NOT NULL,
  4. prenom VARCHAR2(20),
  5. ville VARCHAR2(20),
  6. CONSTRAINT cleBuveur PRIMARY KEY (numBuveur));
  7.  
  8. create table viticulteur (
  9. NumViti NUMBER(3),
  10. nom VARCHAR2(20) NOT NULL,
  11. prenom VARCHAR2(20),
  12. ville varchar2(20),
  13. Constraint cleViti PRIMARY KEY (NumViti);
  14.  
  15. create table vin (
  16. numVin NUMBER(3),
  17. cru Varchar2(20),
  18. Millesime Number(4),
  19. region Varchar2(10),
  20. numViti number(3),
  21. Constraint cleVin PRIMARY KEY (numVin),
  22. constraint cirViti FOREIGN KEY (numViti) REFERENCES Viticulteur);
  23.  
  24. create table commande(
  25. numCommande NUMBER(4),
  26. numBuveur number(3),
  27. numVin number(3),
  28. dateCommande Date,
  29. Quantite Number (4) NOT NULL,
  30. Constraint cleCom PRIMARY KEY (numCommande),
  31. constraint cirBuveur FOREIGN KEY (numBuveur) REFERENCES buveur,
  32. constraint cirVin FOREIGN KEY (numVin) REFERENCES vin);
  33.  
  34. create table livraison (
  35. numCommande NUMBER(4),
  36. dateLiv Date,
  37. quantiteLiv NUMBER(3),
  38. Constraint cleLivraison PRIMARY KEY (numCommande, dateLiv),
  39. constraint cirCom FOREIGN KEY (numCommande) REFERENCES Commande,
  40. constraint verifQuant CHECK (quantiteLiv>0));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement