Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. -- rediction de l'execution en même temps
  2. -- sur un fichier text
  3. spool F:\plsql\G2\trace_creaschema_V2.txt
  4.  
  5. -- pour voir les commande à l'ecran avant execution
  6. set echo on;
  7.  
  8. -- nettoyage pour retester et recréer le schéma
  9. drop table ligne_commande;
  10. drop table commande;
  11. drop table produit;
  12. drop table client;
  13.  
  14. -- creation du schéma de la BD
  15. -- en crée les contraintes d'integrité refrentielle
  16. -- au même temps que les tables
  17.  
  18. -- creation de la table client
  19. create table client(
  20. NUMCLI NUMBER(7),
  21. NOM VARCHAR2(50),
  22. PRENOM VARCHAR2(25),
  23. TELEPHONE VARCHAR2(25),
  24. ADRESSE VARCHAR2(200) ,
  25. VILLE VARCHAR2(30),
  26. PAYS VARCHAR2(30),
  27. CONSTRAINT PK_CLIENT PRIMARY KEY (NUMCLI)
  28. );
  29.  
  30. -- verif
  31. desc client
  32.  
  33. -- la table produit
  34. create table produit(
  35. NUMPROD NUMBER(7),
  36. DESIGNATION VARCHAR2(50),
  37. DESCRIPTION VARCHAR2(200),
  38. PRIX NUMBER(11,2),
  39. QTESTOCK NUMBER (9),
  40. CONSTRAINT PK_PROD PRIMARY KEY (NUMPROD)
  41. );
  42. -- verif
  43. desc produit
  44.  
  45.  
  46. -- la table commande
  47. create table commande(
  48. NUMCOM NUMBER(7),
  49. NUMCLI NUMBER(7),
  50. DATECOM DATE,
  51. DATELIVRAI DATE,
  52. CONSTRAINT PK_COM PRIMARY KEY (NUMCOM),
  53. CONSTRAINT FK_COM_CLI FOREIGN KEY (NUMCLI) REFERENCES CLIENT(NUMCLI)
  54. );
  55.  
  56. -- verif
  57. desc commande
  58.  
  59. -- la table ligne_commande
  60. create table ligne_commande(
  61. NUMCOM NUMBER(7),
  62. NUMPROD NUMBER(7),
  63. PRIX NUMBER(11,2),
  64. QTECOM NUMBER(9),
  65. CONSTRAINT PK_LINCOM PRIMARY KEY (NUMCOM, NUMPROD),
  66. CONSTRAINT FK_LINCOM_COM FOREIGN KEY (NUMCOM) REFERENCES COMMANDE(NUMCOM),
  67. CONSTRAINT FK_LINCOM_PROD FOREIGN KEY (NUMPROD) REFERENCES PRODUIT(NUMPROD)
  68. );
  69.  
  70. -- veirf
  71. desc ligne_commande
  72.  
  73. -- verif sur le dico
  74. select table_name from user_tables;
  75.  
  76. -- les contraites
  77. select constraint_name from user_constraints;
  78.  
  79. -- fin de rediction
  80. spool off;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement