Bageri AB fortsätning
This commit is contained in:
parent
9b06ea6c45
commit
c54ecdab71
1 changed files with 3 additions and 3 deletions
|
@ -16,13 +16,15 @@ CREATE TABLE IF NOT EXISTS Recipes (
|
||||||
ProductID int,
|
ProductID int,
|
||||||
PRIMARY KEY (RecipeName, RecipeYear)
|
PRIMARY KEY (RecipeName, RecipeYear)
|
||||||
FOREIGN KEY (ingrediences) REFERENCES ingredience(IngredienceID)
|
FOREIGN KEY (ingrediences) REFERENCES ingredience(IngredienceID)
|
||||||
|
FOREIGN KEY (ProductID) REFERENCES Products(ProductID)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS ingredience (
|
CREATE TABLE IF NOT EXISTS ingredience (
|
||||||
IngredienceID int PRIMARY KEY,
|
IngredienceID int PRIMARY KEY,
|
||||||
RawMaterialName varchar(100),
|
RawMaterialName varchar(100),
|
||||||
amount int,
|
amount int,
|
||||||
unit varchar(50)
|
unit varchar(50),
|
||||||
|
FOREIGN KEY (RawMaterialName) REFERENCES RawMaterials(RawMaterialName)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS RawMaterials (
|
CREATE TABLE IF NOT EXISTS RawMaterials (
|
||||||
|
@ -78,8 +80,6 @@ CREATE TABLE IF NOT EXISTS PalletTraceability (
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
-- ALTER TABLE Recipes ADD FOREIGN KEY (ProductID) REFERENCES Products (ProductID);
|
|
||||||
-- ALTER TABLE ingredience ADD FOREIGN KEY (RawMaterialName) REFERENCES RawMaterials (RawMaterialName);
|
|
||||||
-- ALTER TABLE PalletsProduced ADD FOREIGN KEY (ProductID) REFERENCES Products (ProductID);
|
-- ALTER TABLE PalletsProduced ADD FOREIGN KEY (ProductID) REFERENCES Products (ProductID);
|
||||||
-- ALTER TABLE PalletsDelivered ADD FOREIGN KEY (PalletID) REFERENCES PalletsProduced (PalletID);
|
-- ALTER TABLE PalletsDelivered ADD FOREIGN KEY (PalletID) REFERENCES PalletsProduced (PalletID);
|
||||||
-- ALTER TABLE PalletsDelivered ADD FOREIGN KEY (DeliveredID) REFERENCES Truck (Pallet);
|
-- ALTER TABLE PalletsDelivered ADD FOREIGN KEY (DeliveredID) REFERENCES Truck (Pallet);
|
||||||
|
|
Loading…
Reference in a new issue