Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. "DROP TABLE IF EXISTS Command;"+
  2. "DROP TABLE IF EXISTS RecipeIngredient;"+
  3. "DROP TABLE IF EXISTS InventoryIngredient;"+
  4. "DROP TABLE IF EXISTS Ingredient;"+
  5. "DROP TABLE IF EXISTS Recipe;"+
  6. "DROP TABLE IF EXISTS Inventory;"+
  7.  
  8. "CREATE TABLE "+database+".Inventory("+
  9. "iid int,"+
  10. "weight double,"+
  11. "CONSTRAINT PK_Inventory PRIMARY KEY (iid));"+
  12.  
  13. "CREATE TABLE "+database+".Ingredient("+
  14. "ean varchar(13),"+
  15. "`name` tinytext,"+
  16. "CONSTRAINT PK_Ingredient PRIMARY KEY (ean));"+
  17.  
  18. "CREATE TABLE "+database+".InventoryIngredient("+
  19. "iid int,"+
  20. "ean varchar(13),"+
  21. "CONSTRAINT PK_InventoryIngredient PRIMARY KEY (iid),"+
  22. "CONSTRAINT FK_InventoryIngredient_Inventory FOREIGN KEY (iid) REFERENCES Inventory (iid),"+
  23. "CONSTRAINT FK_InventoryIngredient_Ingredient FOREIGN KEY (ean) REFERENCES Ingredient (ean));"+
  24.  
  25.  
  26. "CREATE TABLE "+database+".Recipe("+
  27. "rid int,"+
  28. "nom tinytext,"+
  29. "CONSTRAINT PK_Recipe PRIMARY KEY (rid));"+
  30.  
  31. "CREATE TABLE "+database+".RecipeIngredient("+
  32. "ean varchar(13),"+
  33. "rid int,"+
  34. "weight double,"+
  35. "CONSTRAINT PK_RecipeIngredient PRIMARY KEY (rid),"+
  36. "CONSTRAINT FK_RecipeIngredient_Ingredient FOREIGN KEY (ean) REFERENCES Ingredient (ean),"+
  37. "CONSTRAINT FK_RecipeIngredient_Recipe FOREIGN KEY (rid) REFERENCES Recipe (rid));"+
  38.  
  39. "CREATE TABLE "+database+".Command("+
  40. "cid int,"+
  41. "ean varchar(13),"+
  42. "CONSTRAINT PK_Command PRIMARY KEY (cid),"+
  43. "CONSTRAINT FK_Command_Ingredient FOREIGN KEY (ean) REFERENCES Ingredient (ean));";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement