This commit is contained in:
Ivan Bogosavljevic 2024-04-17 00:21:00 +02:00
commit 7d8a89b417
2 changed files with 50 additions and 4 deletions

46
initialdata Normal file
View file

@ -0,0 +1,46 @@
INSERT INTO Customer(name, address) VALUES
('Finkakor AB', 'Helsingborg'),
('Småbröd AB', 'Malmö'),
('Kaffebröd AB', 'Landskrona'),
('Bjudkakor AB', 'Ystad'),
('Kalaskakor AB', 'Trelleborg'),
('Partykakor AB', 'Kristianstad'),
('Gästkakor AB', 'Hässleholm'),
('Skånekakor AB', 'Perstorp');
INSERT INTO Cookie(name) VALUES
('Nut ring'),
('Nut cookie'),
('Amneris'),
('Tango'),
('Almond delight'),
('Berliner');
INSERT INTO Ingredient(name, stock, unit) VALUES
('Bread crumbs', 500000, 'g'),
('Butter', 500000, 'g'),
('Chocolate', 500000, 'g'),
('Chopped almonds', 500000, 'g'),
('Cinnamon', 500000, 'g'),
('Egg whites', 500000, 'ml'),
('Eggs', 500000, 'g'),
('Fine-ground nuts', 500000, 'g'),
('Flour', 500000, 'g'),
('Ground, roasted nuts', 500000, 'g'),
('Icing sugar', 500000, 'g'),
('Marzipan', 500000, 'g'),
('Potato starch', 500000, 'g'),
('Roasted, chopped nuts', 500000, 'g'),
('Sodium bicarbonate', 500000, 'g'),
('Sugar', 500000, 'g'),
('Vanilla sugar', 500000, 'g'),
('Vanilla', 500000, 'g'),
('Wheat flour', 500000, 'g');
INSERT INTO Recipe (ingredient_id, cookie_id, amount) VALUES
(2, 1, 450),(9, 1, 450),(11, 1, 190),(14, 1, 225),
(2, 2, 125),(3, 2, 50),(6, 2, 350),(8, 2, 750),(10, 2, 625),(16, 2, 375),
(2, 3, 250),(7, 3, 250),(12, 3, 750),(13, 3, 25),(19, 3, 25),
(2, 4, 200),(9, 4, 300),(15, 4, 4),(16, 4, 250),(18, 4, 2),
(2, 5, 400),(4, 5, 279),(5, 5, 10),(9, 5, 400),(16, 5, 270),
(2, 6, 250),(3, 6, 50),(7, 6, 50),(9, 6, 350),(11, 6, 100),(17, 6, 5);

View file

@ -3,7 +3,7 @@ DROP TABLE IF EXISTS Recipe;
DROP TABLE IF EXISTS Ingredient; DROP TABLE IF EXISTS Ingredient;
DROP TABLE IF EXISTS Cookie; DROP TABLE IF EXISTS Cookie;
DROP TABLE IF EXISTS Pallet; DROP TABLE IF EXISTS Pallet;
DROP TABLE IF EXISTS Order; DROP TABLE IF EXISTS Orders;
DROP TABLE IF EXISTS Customer; DROP TABLE IF EXISTS Customer;
CREATE TABLE Customer ( CREATE TABLE Customer (
@ -12,7 +12,7 @@ CREATE TABLE Customer (
address VARCHAR(255) address VARCHAR(255)
); );
CREATE TABLE Order ( CREATE TABLE Orders (
order_id INT AUTO_INCREMENT PRIMARY KEY, order_id INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT, customer_id INT,
delivery_date DATE, delivery_date DATE,
@ -26,7 +26,7 @@ CREATE TABLE Pallet (
manufacture_date DATE, manufacture_date DATE,
delivery_date DATE, delivery_date DATE,
blocked BOOLEAN, blocked BOOLEAN,
FOREIGN KEY (order_id) REFERENCES Order(order_id) FOREIGN KEY (order_id) REFERENCES Orders(order_id)
); );
CREATE TABLE Cookie ( CREATE TABLE Cookie (
@ -41,7 +41,7 @@ CREATE TABLE OrderSpec (
cookie_id INT, cookie_id INT,
quantity INT, quantity INT,
PRIMARY KEY (order_id, cookie_id), PRIMARY KEY (order_id, cookie_id),
FOREIGN KEY (order_id) REFERENCES Order(order_id), FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (cookie_id) REFERENCES Cookie(cookie_id) FOREIGN KEY (cookie_id) REFERENCES Cookie(cookie_id)
); );