Advertisement
Spirit13300

Untitled

Oct 10th, 2019
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 5.41 KB | None | 0 0
  1. Base Restaurant
  2.  
  3. Commandes de création de la base et des TABLES
  4.  
  5. CREATE DATABASE restaurantxxxx
  6. GO
  7. USE restaurantxxxx
  8. CREATE TABLE tableduresto
  9. (NumTable INT,
  10.  ZoneGeo VARCHAR(1),
  11.  TypeFumeur VARCHAR(2),
  12.  CONSTRAINT PKTable PRIMARY KEY (NumTable))
  13.  
  14. CREATE TABLE serveur
  15.  (Numserveur INT ,
  16. NomServeur VARCHAR(20),
  17. PrenomServeur VARCHAR(15),
  18. CONSTRAINT PKserveur PRIMARY KEY (NumServeur))
  19.  
  20. CREATE TABLE Plat
  21. (NumPlat INT IDENTITY(1,1),
  22. NomPlat VARCHAR(20),
  23.  PrixVente smallmoney,
  24. CoutRevient smallmoney,
  25.  Categorie VARCHAR(1),
  26.  QteStock INT,
  27. CONSTRAINT PKplat PRIMARY KEY (NumPlat))
  28.  
  29.  
  30. CREATE TABLE Commande (NumCde INT IDENTITY(1,1), DateCde Datetime, MontantCde smallmoney, NumTable INT, NumServeur INT,
  31.  CONSTRAINT PKCommande PRIMARY KEY (Numcde),
  32. CONSTRAINT FKServeur FOREIGN KEY (NumServeur) REFERENCES Serveur(Numserveur),
  33. CONSTRAINT FKTable FOREIGN KEY (NumTable) REFERENCES TableDuresto(NumTable))
  34.  
  35. CREATE TABLE LigneCommande(NumCde INT, NumPlat INT, Quantite INT, CONSTRAINT PkLigneCom PRIMARY KEY (Numcde,NumPlat), CONSTRAINT FKCommande FOREIGN KEY (Numcde) REFERENCES Commande(NumCde), CONSTRAINT FKplat FOREIGN KEY (NumPlat) REFERENCES Plat(NumPlat))
  36. GO
  37.  
  38.  
  39.  
  40. INSERT INTO TableduResto
  41. VALUES (1,'A','N')
  42. GO
  43.  
  44. INSERT INTO TableduResto
  45.  VALUES (2,'B','O')
  46. GO
  47.  
  48. INSERT INTO TableduResto
  49. VALUES (3,'C','N')
  50. GO
  51.  
  52. INSERT INTO TableduResto
  53. VALUES (4,'B','O')
  54. GO
  55.  
  56. INSERT INTO TableduResto
  57. VALUES (5,'A','N')
  58. GO
  59.  
  60. INSERT INTO TableduResto
  61. VALUES (6,'B','O')
  62. GO
  63.  
  64. INSERT INTO TableduResto
  65. VALUES(7,'C','N')
  66. GO
  67.  
  68. INSERT INTO TableduResto
  69. VALUES (8,'B','O')
  70. GO
  71. INSERT INTO Serveur
  72. VALUES (1,'Aubert','Jean-Louis')
  73. GO
  74.  
  75. INSERT INTO Serveur
  76. VALUES(2,'Fabian','Lara')
  77. GO
  78.  
  79. INSERT INTO Serveur
  80. VALUES (3,'Thiersen','Yann')
  81. GO
  82.  
  83. INSERT INTO Serveur
  84. VALUES (4,'Lebreton','Arnaud')
  85. GO
  86.  
  87. INSERT INTO Serveur
  88. VALUES (5,'Segara','Hélène')
  89. GO
  90.  
  91.  
  92. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  93. VALUES('Salade de chèvre ','1','1','P','1000')
  94. GO
  95.  
  96. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  97. VALUES ('Salade du pêcheur','1','1','P','1000')
  98. GO
  99.  
  100. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  101. VALUES ('Huitres','1','1','P','1000')
  102. GO
  103.  
  104. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  105. VALUES ('Foie gras','1','1','P','1000')
  106. GO
  107.  
  108. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  109. VALUES ('Homard','1','1','P','1000')
  110. GO
  111.  
  112. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  113. VALUES ('Pizza reine','1','1','P','1000')
  114. GO
  115.  
  116. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  117. VALUES ('Pizza personalisée','1','1','P','1000')
  118. GO
  119.  
  120. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  121. VALUES('Calzone','1','1','P','1000')
  122. GO
  123.  
  124. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  125. VALUES ('Spaghetti bolognaise','1','1','P','1000')
  126. GO
  127.  
  128. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  129. VALUES('Tagliatèles à la carbo','1','1','P','1000')
  130. GO
  131.  
  132. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  133. VALUES ('Colonel','1','1','D','1000')
  134. GO
  135.  
  136. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient, Categorie,QteStock)
  137. VALUES('Crêpe au sucre','1','1','D','1000')
  138. GO
  139.  
  140. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient, Categorie,QteStock)
  141. VALUES ('Glace au fruit','1','1','D','1000')
  142. GO
  143.  
  144. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  145. VALUES ('Coupe de fruits ','1','1','D','1000')
  146. GO
  147.  
  148. INSERT INTO Plat (NomPlat,PrixVente,CoutRevient,Categorie,QteStock)
  149. VALUES ('Steak haché','1','1','P','1000')
  150. GO
  151.  
  152. INSERT INTO Commande (DateCde,MontantCde,NumTable,NumServeur)
  153. VALUES ('14/08/2013',0.0,2,1)
  154. INSERT INTO Commande (DateCde,MontantCde,NumTable,NumServeur)
  155. VALUES ('14/08/2013',0.0,5,1)
  156. INSERT INTO Commande (DateCde,MontantCde,NumTable,NumServeur)
  157. VALUES ('15/08/2013',0.0,1,2)
  158. INSERT INTO Commande (DateCde,MontantCde,NumTable,NumServeur)
  159. VALUES ('15/08/2013',0.0,3,3)
  160. INSERT INTO Commande (DateCde,MontantCde,NumTable,NumServeur)
  161. VALUES ('15/08/2013',0.0,5,2)
  162. INSERT INTO Commande (DateCde,MontantCde,NumTable,NumServeur)
  163. VALUES ('16/08/2013',0.0,1,1)
  164. INSERT INTO Commande (DateCde,MontantCde,NumTable,NumServeur)
  165. VALUES ('16/08/2013',0.0,2,1)
  166. INSERT INTO Commande (DateCde,MontantCde,NumTable,NumServeur)
  167. VALUES ('16/08/2013',0.0,3,4)
  168. INSERT INTO Commande (DateCde,MontantCde,NumTable,NumServeur)
  169. VALUES ('16/08/2013',0.0,4,4)
  170. INSERT INTO Commande (DateCde,MontantCde,NumTable,NumServeur)
  171. VALUES ('16/08/2013',0.0,5,4)
  172.  
  173.  
  174.  
  175. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  176. VALUES (1,2,2)
  177.  
  178. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  179. VALUES (1,5,1)
  180.  
  181. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  182. VALUES (1,8,2)
  183.  
  184. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  185. VALUES (2,4,2)
  186.  
  187. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  188. VALUES (2,6,3)
  189.  
  190. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  191. VALUES (2,11,3)
  192.  
  193. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  194. VALUES (2,15,2)
  195.  
  196. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  197. VALUES (3,9,1)
  198.  
  199. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  200. VALUES (3,14,4)
  201.  
  202. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  203. VALUES (3,15,2)
  204.  
  205. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  206. VALUES (3,1,2)
  207.  
  208. INSERT INTO LigneCommande (NumCde,NumPlat,Quantite)
  209. VALUES (3,5,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement