From 780917069d15b97668827a26e6527f1fe19d90df Mon Sep 17 00:00:00 2001 From: Ivan Bogosavljevic <136277150+Nuvve@users.noreply.github.com> Date: Tue, 16 Apr 2024 22:40:30 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Fick=20problem=20n=C3=A4r=20tablen=20hette?= =?UTF-8?q?=20Order=20bytte=20till=20Orders=20ist=C3=A4llet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqlCode | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sqlCode b/sqlCode index 5571df5..2205047 100644 --- a/sqlCode +++ b/sqlCode @@ -3,7 +3,7 @@ DROP TABLE IF EXISTS Recipe; DROP TABLE IF EXISTS Ingredient; DROP TABLE IF EXISTS Cookie; DROP TABLE IF EXISTS Pallet; -DROP TABLE IF EXISTS Order; +DROP TABLE IF EXISTS Orders; DROP TABLE IF EXISTS Customer; CREATE TABLE Customer ( @@ -12,7 +12,7 @@ CREATE TABLE Customer ( address VARCHAR(255) ); -CREATE TABLE Order ( +CREATE TABLE Orders ( order_id INT AUTO_INCREMENT PRIMARY KEY, customer_id INT, delivery_date DATE, @@ -26,7 +26,7 @@ CREATE TABLE Pallet ( manufacture_date DATE, delivery_date DATE, blocked BOOLEAN, - FOREIGN KEY (order_id) REFERENCES Order(order_id) + FOREIGN KEY (order_id) REFERENCES Orders(order_id) ); CREATE TABLE Cookie ( @@ -41,7 +41,7 @@ CREATE TABLE OrderSpec ( cookie_id INT, quantity INT, 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) ); From ad45f94f23b4b840eb9f5dcc2dd95383776ab237 Mon Sep 17 00:00:00 2001 From: Ivan Bogosavljevic <136277150+Nuvve@users.noreply.github.com> Date: Tue, 16 Apr 2024 23:27:14 +0200 Subject: [PATCH 2/2] Create initialdata --- initialdata | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 initialdata diff --git a/initialdata b/initialdata new file mode 100644 index 0000000..70e21a7 --- /dev/null +++ b/initialdata @@ -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);