Merge branch 'main' of https://github.com/dDogge/ProjectDatabase2024
This commit is contained in:
commit
c5030f4cf0
2 changed files with 30 additions and 32 deletions
17
initialdata
17
initialdata
|
@ -16,7 +16,7 @@ INSERT INTO Cookie(name) VALUES
|
||||||
('Almond delight'),
|
('Almond delight'),
|
||||||
('Berliner');
|
('Berliner');
|
||||||
|
|
||||||
INSERT INTO Ingredient(name, stock, unit) VALUES
|
INSERT INTO Ingredient(ingredient_name, stock, unit) VALUES
|
||||||
('Bread crumbs', 500000, 'g'),
|
('Bread crumbs', 500000, 'g'),
|
||||||
('Butter', 500000, 'g'),
|
('Butter', 500000, 'g'),
|
||||||
('Chocolate', 500000, 'g'),
|
('Chocolate', 500000, 'g'),
|
||||||
|
@ -37,10 +37,11 @@ INSERT INTO Ingredient(name, stock, unit) VALUES
|
||||||
('Vanilla', 500000, 'g'),
|
('Vanilla', 500000, 'g'),
|
||||||
('Wheat flour', 500000, 'g');
|
('Wheat flour', 500000, 'g');
|
||||||
|
|
||||||
INSERT INTO Recipe (ingredient_id, cookie_id, amount) VALUES
|
INSERT INTO Recipe (ingredient_name, cookie_name, amount) VALUES
|
||||||
(2, 1, 450),(9, 1, 450),(11, 1, 190),(14, 1, 225),
|
('Butter', 'Nut ring', 450),('Flour', 'Nut ring', 450),('Icing sugar', 'Nut ring', 190),('Roasted, chopped nuts', 'Nut ring', 225),
|
||||||
(2, 2, 125),(3, 2, 50),(6, 2, 350),(8, 2, 750),(10, 2, 625),(16, 2, 375),
|
('Bread crumbs', 'Nut cookie', 125),('Chocolate', 'Nut cookie', 50),('Egg whites', 'Nut cookie', 350),('Fine-ground nuts', 'Nut cookie', 750),('Ground, roasted nuts', 'Nut cookie', 625),('Sugar', 'Nut cookie', 375),
|
||||||
(2, 3, 250),(7, 3, 250),(12, 3, 750),(13, 3, 25),(19, 3, 25),
|
('Butter', 'Amneris', 250),('Eggs', 'Amneris', 250),('Marzipan', 'Amneris', 750),('Potato starch', 'Amneris', 25),('Wheat flour', 'Amneris', 25),
|
||||||
(2, 4, 200),(9, 4, 300),(15, 4, 4),(16, 4, 250),(18, 4, 2),
|
('Butter', 'Tango', 200),('Flour', 'Tango', 300),('Sodium bicarbonate', 'Tango', 4),('Sugar', 'Tango', 250),('Vanilla', 'Tango', 2),
|
||||||
(2, 5, 400),(4, 5, 279),(5, 5, 10),(9, 5, 400),(16, 5, 270),
|
('Butter', 'Almond delight', 400),('Chopped almonds', 'Almond delight', 279),('Cinnamon', 'Almond delight', 10),('Flour', 'Almond delight', 400),('Sugar', 'Almond delight', 270),
|
||||||
(2, 6, 250),(3, 6, 50),(7, 6, 50),(9, 6, 350),(11, 6, 100),(17, 6, 5);
|
('Butter', 'Berliner', 250),('Chocolate', 'Berliner', 50),('Eggs', 'Berliner', 50),('Flour', 'Berliner', 350),('Icing sugar', 'Berliner', 100),('Vanilla sugar', 'Berliner', 5);
|
||||||
|
|
||||||
|
|
45
sqlCode
45
sqlCode
|
@ -1,53 +1,50 @@
|
||||||
DROP TABLE IF EXISTS OrderSpec;
|
DROP TABLE IF EXISTS OrderSpec;
|
||||||
DROP TABLE IF EXISTS Recipe;
|
DROP TABLE IF EXISTS Recipe;
|
||||||
DROP TABLE IF EXISTS Ingredient;
|
DROP TABLE IF EXISTS Ingredient;
|
||||||
DROP TABLE IF EXISTS Cookie;
|
|
||||||
DROP TABLE IF EXISTS Pallet;
|
DROP TABLE IF EXISTS Pallet;
|
||||||
|
DROP TABLE IF EXISTS Cookie;
|
||||||
DROP TABLE IF EXISTS Orders;
|
DROP TABLE IF EXISTS Orders;
|
||||||
DROP TABLE IF EXISTS Customer;
|
DROP TABLE IF EXISTS Customer;
|
||||||
|
|
||||||
CREATE TABLE Customer (
|
CREATE TABLE Customer (
|
||||||
customer_id INT AUTO_INCREMENT PRIMARY KEY,
|
name VARCHAR(255) PRIMARY KEY,
|
||||||
name VARCHAR(255),
|
|
||||||
address VARCHAR(255)
|
address VARCHAR(255)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE Orders (
|
CREATE TABLE Orders (
|
||||||
order_id INT AUTO_INCREMENT PRIMARY KEY,
|
order_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
customer_id INT,
|
customer_name VARCHAR(255),
|
||||||
delivery_date DATE,
|
delivery_date DATE,
|
||||||
order_date DATE,
|
order_date DATE,
|
||||||
FOREIGN KEY (customer_id) REFERENCES Customer(customer_id)
|
FOREIGN KEY (customer_name) REFERENCES Customer(name)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE Cookie (
|
||||||
|
name VARCHAR(255) PRIMARY KEY
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE Pallet (
|
CREATE TABLE Pallet (
|
||||||
pallet_id INT AUTO_INCREMENT PRIMARY KEY,
|
pallet_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
order_id INT,
|
order_id INT,
|
||||||
manufacture_date DATE,
|
manufacture_date DATETIME,
|
||||||
delivery_date DATE,
|
delivery_date DATE,
|
||||||
blocked BOOLEAN,
|
blocked VARCHAR(255) DEFAULT 'no',
|
||||||
|
cookie_name VARCHAR(255),
|
||||||
|
FOREIGN KEY(cookie_name) REFERENCES Cookie(name),
|
||||||
FOREIGN KEY (order_id) REFERENCES Orders(order_id)
|
FOREIGN KEY (order_id) REFERENCES Orders(order_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE Cookie (
|
|
||||||
cookie_id INT AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
pallet_id INT,
|
|
||||||
name VARCHAR(255),
|
|
||||||
FOREIGN KEY (pallet_id) REFERENCES Pallet(pallet_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE OrderSpec (
|
CREATE TABLE OrderSpec (
|
||||||
order_id INT,
|
order_id INT,
|
||||||
cookie_id INT,
|
cookie_name VARCHAR(255),
|
||||||
quantity INT,
|
quantity INT,
|
||||||
PRIMARY KEY (order_id, cookie_id),
|
PRIMARY KEY (order_id, cookie_name),
|
||||||
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
|
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
|
||||||
FOREIGN KEY (cookie_id) REFERENCES Cookie(cookie_id)
|
FOREIGN KEY (cookie_name) REFERENCES Cookie(name)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE Ingredient (
|
CREATE TABLE Ingredient (
|
||||||
ingredient_id INT AUTO_INCREMENT PRIMARY KEY,
|
ingredient_name VARCHAR(255) PRIMARY KEY,
|
||||||
name VARCHAR(255),
|
|
||||||
stock INT,
|
stock INT,
|
||||||
unit VARCHAR(50),
|
unit VARCHAR(50),
|
||||||
delivery_date DATE,
|
delivery_date DATE,
|
||||||
|
@ -55,10 +52,10 @@ CREATE TABLE Ingredient (
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE Recipe (
|
CREATE TABLE Recipe (
|
||||||
ingredient_id INT,
|
ingredient_name VARCHAR(255),
|
||||||
cookie_id INT,
|
cookie_name VARCHAR(255),
|
||||||
amount FLOAT,
|
amount FLOAT,
|
||||||
PRIMARY KEY (ingredient_id, cookie_id),
|
PRIMARY KEY (ingredient_name, cookie_name),
|
||||||
FOREIGN KEY (ingredient_id) REFERENCES Ingredient(ingredient_id),
|
FOREIGN KEY (ingredient_name) REFERENCES Ingredient(ingredient_name),
|
||||||
FOREIGN KEY (cookie_id) REFERENCES Cookie(cookie_id)
|
FOREIGN KEY (cookie_name) REFERENCES Cookie(name)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue