diff --git a/data/create_strucure.surrealql b/data/create_strucure.surrealql index 26b6c2d..8efddbe 100644 --- a/data/create_strucure.surrealql +++ b/data/create_strucure.surrealql @@ -71,5 +71,5 @@ DEFINE FIELD ingredient ON TABLE SupplierContainsIngredients TYPE record; +DEFINE FIELD order ON TABLE OrderContainsIngredients TYPE record; DEFINE FIELD ingredient ON TABLE OrderContainsIngredients TYPE record; diff --git a/data/data.surrealql b/data/data.surrealql index ffabfa5..6b8670d 100644 --- a/data/data.surrealql +++ b/data/data.surrealql @@ -1,10 +1,22 @@ -CREATE Customer:2001 CONTENT { - last_name: 'Wellensteyn', - first_name: 'Kira', - birth_date: '1990-05-05', - phone: '040/443322', - email: 'k.wellensteyn@yahoo.de', - address: Address:2001 +CREATE Address:101 CONTENT { + street: 'Dorfstraße', + house_number: '74', + postal_code: '24354', + city: 'Weseby' +}; + +CREATE Address:102 CONTENT { + street: 'Westerjork 74', + house_number: '76', + postal_code: '21635', + city: 'Jork' +}; + +CREATE Address:103 CONTENT { + street: 'Molkereiwegkundekunde', + house_number: '13', + postal_code: '19217', + city: 'Dechow' }; CREATE Address:2001 CONTENT { @@ -14,15 +26,6 @@ CREATE Address:2001 CONTENT { city: 'Hamburg' }; -CREATE Customer:2002 CONTENT { - last_name: 'Foede', - first_name: 'Dorothea', - birth_date: '2000-03-24', - phone: '040/543822', - email: 'd.foede@web.de', - address: Address:2002 -}; - CREATE Address:2002 CONTENT { street: 'Ohmstraße', house_number: '23', @@ -30,15 +33,6 @@ CREATE Address:2002 CONTENT { city: 'Hamburg' }; -CREATE Customer:2003 CONTENT { - last_name: 'Leberer', - first_name: 'Sigrid', - birth_date: '1989-09-21', - phone: '0175/1234588', - email: 'sigrid@leberer.de', - address: Address:2003 -}; - CREATE Address:2003 CONTENT { street: 'Bilser Berg', house_number: '6', @@ -46,15 +40,6 @@ CREATE Address:2003 CONTENT { city: 'Hamburg' }; -CREATE Customer:2004 CONTENT { - last_name: 'Soerensen', - first_name: 'Hanna', - birth_date: '1974-04-03', - phone: '040/634578', - email: 'h.soerensen@yahoo.de', - address: Address:2004 -}; - CREATE Address:2004 CONTENT { street: 'Alter Teichweg', house_number: '95', @@ -62,15 +47,6 @@ CREATE Address:2004 CONTENT { city: 'Hamburg' }; -CREATE Customer:2005 CONTENT { - last_name: 'Schnitter', - first_name: 'Marten', - birth_date: '1964-04-17', - phone: '0176/447587', - email: 'schni_mart@gmail.com', - address: Address:2005 -}; - CREATE Address:2005 CONTENT { street: 'Stübels', house_number: '10', @@ -78,15 +54,6 @@ CREATE Address:2005 CONTENT { city: 'Barsbüttel' }; -CREATE Customer:2006 CONTENT { - last_name: 'Maurer', - first_name: 'Belinda', - birth_date: '1978-09-09', - phone: '040/332189', - email: 'belinda1978@yahoo.de', - address: Address:2006 -}; - CREATE Address:2006 CONTENT { street: 'Grotelertwiete', house_number: '4a', @@ -94,15 +61,6 @@ CREATE Address:2006 CONTENT { city: 'Hamburg' }; -CREATE Customer:2007 CONTENT { - last_name: 'Gessert', - first_name: 'Armin', - birth_date: '1978-01-29', - phone: '040/67890', - email: 'armin@gessert.de', - address: Address:2007 -}; - CREATE Address:2007 CONTENT { street: 'Küstersweg', house_number: '3', @@ -110,15 +68,6 @@ CREATE Address:2007 CONTENT { city: 'Hamburg' }; -CREATE Customer:2008 CONTENT { - last_name: 'Haessig', - first_name: 'Jean-Marc', - birth_date: '1982-08-30', - phone: '0178-67013390', - email: 'jm@haessig.de', - address: Address:2008 -}; - CREATE Address:2008 CONTENT { street: 'Neugrabener Bahnhofstraße', house_number: '30', @@ -126,15 +75,6 @@ CREATE Address:2008 CONTENT { city: 'Hamburg' }; -CREATE Customer:2009 CONTENT { - last_name: 'Urocki', - first_name: 'Eric', - birth_date: '1999-12-04', - phone: '0152-96701390', - email: 'urocki@outlook.de', - address: Address:2009 -}; - CREATE Address:2009 CONTENT { street: 'Elbchaussee', house_number: '228', @@ -149,13 +89,6 @@ CREATE Supplier:101 CONTENT { address: Address:101 }; -CREATE Address:101 CONTENT { - street: 'Dorfstraße', - house_number: '74', - postal_code: '24354', - city: 'Weseby' -}; - CREATE Supplier:102 CONTENT { name: 'Obst-Hof Altes Land', phone: '04162-4523', @@ -163,13 +96,6 @@ CREATE Supplier:102 CONTENT { address: Address:102 }; -CREATE Address:102 CONTENT { - street: 'Westerjork 74', - house_number: '76', - postal_code: '21635', - city: 'Jork' -}; - CREATE Supplier:103 CONTENT { name: 'Molkerei Henning', phone: '038873-8976', @@ -177,11 +103,85 @@ CREATE Supplier:103 CONTENT { address: Address:103 }; -CREATE Address:103 CONTENT { - street: 'Molkereiwegkundekunde', - house_number: '13', - postal_code: '19217', - city: 'Dechow' +CREATE Customer:2001 CONTENT { + last_name: 'Wellensteyn', + first_name: 'Kira', + birth_date: '1990-05-05', + phone: '040/443322', + email: 'k.wellensteyn@yahoo.de', + address: Address:2001 +}; + +CREATE Customer:2002 CONTENT { + last_name: 'Foede', + first_name: 'Dorothea', + birth_date: '2000-03-24', + phone: '040/543822', + email: 'd.foede@web.de', + address: Address:2002 +}; + +CREATE Customer:2003 CONTENT { + last_name: 'Leberer', + first_name: 'Sigrid', + birth_date: '1989-09-21', + phone: '0175/1234588', + email: 'sigrid@leberer.de', + address: Address:2003 +}; + +CREATE Customer:2004 CONTENT { + last_name: 'Soerensen', + first_name: 'Hanna', + birth_date: '1974-04-03', + phone: '040/634578', + email: 'h.soerensen@yahoo.de', + address: Address:2004 +}; + +CREATE Customer:2005 CONTENT { + last_name: 'Schnitter', + first_name: 'Marten', + birth_date: '1964-04-17', + phone: '0176/447587', + email: 'schni_mart@gmail.com', + address: Address:2005 +}; + +CREATE Customer:2006 CONTENT { + last_name: 'Maurer', + first_name: 'Belinda', + birth_date: '1978-09-09', + phone: '040/332189', + email: 'belinda1978@yahoo.de', + address: Address:2006 +}; + +CREATE Customer:2007 CONTENT { + last_name: 'Gessert', + first_name: 'Armin', + birth_date: '1978-01-29', + phone: '040/67890', + email: 'armin@gessert.de', + address: Address:2007 +}; + +CREATE Customer:2008 CONTENT { + last_name: 'Haessig', + first_name: 'Jean-Marc', + birth_date: '1982-08-30', + phone: '0178-67013390', + email: 'jm@haessig.de', + address: Address:2008 +}; + +CREATE Customer:2009 CONTENT { + last_name: 'Urocki', + first_name: 'Eric', + birth_date: '1999-12-04', + phone: '0152-96701390', + email: 'urocki@outlook.de', + address: Address:2009 }; CREATE Ingredient:1001 CONTENT { @@ -194,13 +194,6 @@ CREATE Ingredient:1001 CONTENT { protein: 1.6 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 5.0, - delivery_time: 3, - supplier: Supplier:101, - ingredient: Ingredient:1001 -}; - CREATE Ingredient:1002 CONTENT { designation: 'Zwiebel', unit: 'Stück', @@ -211,13 +204,6 @@ CREATE Ingredient:1002 CONTENT { protein: 1.20 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 4.0, - delivery_time: 2, - supplier: Supplier:101, - ingredient: Ingredient:1002 -}; - CREATE Ingredient:1003 CONTENT { designation: 'Tomate', unit: 'Stück', @@ -228,13 +214,6 @@ CREATE Ingredient:1003 CONTENT { protein: 1 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 6.0, - delivery_time: 3, - supplier: Supplier:101, - ingredient: Ingredient:1003 -}; - CREATE Ingredient:1004 CONTENT { designation: 'Schalotte', unit: 'Stück', @@ -245,13 +224,6 @@ CREATE Ingredient:1004 CONTENT { protein: 1.5 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 3.5, - delivery_time: 2, - supplier: Supplier:101, - ingredient: Ingredient:1004 -}; - CREATE Ingredient:1005 CONTENT { designation: 'Karotte', unit: 'Stück', @@ -262,13 +234,6 @@ CREATE Ingredient:1005 CONTENT { protein: 0.9 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 4.0, - delivery_time: 3, - supplier: Supplier:101, - ingredient: Ingredient:1005 -}; - CREATE Ingredient:1006 CONTENT { designation: 'Kartoffel', unit: 'Stück', @@ -279,13 +244,6 @@ CREATE Ingredient:1006 CONTENT { protein: 2 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 3.0, - delivery_time: 2, - supplier: Supplier:101, - ingredient: Ingredient:1006 -}; - CREATE Ingredient:1007 CONTENT { designation: 'Rucola', unit: 'Bund', @@ -296,13 +254,6 @@ CREATE Ingredient:1007 CONTENT { protein: 2.6 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 5.0, - delivery_time: 3, - supplier: Supplier:101, - ingredient: Ingredient:1007 -}; - CREATE Ingredient:1008 CONTENT { designation: 'Lauch', unit: 'Stück', @@ -313,13 +264,6 @@ CREATE Ingredient:1008 CONTENT { protein: 2.1 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 4.5, - delivery_time: 2, - supplier: Supplier:101, - ingredient: Ingredient:1008 -}; - CREATE Ingredient:1009 CONTENT { designation: 'Knoblauch', unit: 'Stück', @@ -330,13 +274,6 @@ CREATE Ingredient:1009 CONTENT { protein: 6.1 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 3.5, - delivery_time: 2, - supplier: Supplier:101, - ingredient: Ingredient:1009 -}; - CREATE Ingredient:1010 CONTENT { designation: 'Basilikum', unit: 'Bund', @@ -347,13 +284,6 @@ CREATE Ingredient:1010 CONTENT { protein: 3.1 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 5.5, - delivery_time: 3, - supplier: Supplier:101, - ingredient: Ingredient:1010 -}; - CREATE Ingredient:1011 CONTENT { designation: 'Süßkartoffel', unit: 'Stück', @@ -364,13 +294,6 @@ CREATE Ingredient:1011 CONTENT { protein: 1.6 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 6.0, - delivery_time: 3, - supplier: Supplier:101, - ingredient: Ingredient:1011 -}; - CREATE Ingredient:1012 CONTENT { designation: 'Schnittlauch', unit: 'Bund', @@ -381,13 +304,6 @@ CREATE Ingredient:1012 CONTENT { protein: 3 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 5.0, - delivery_time: 3, - supplier: Supplier:101, - ingredient: Ingredient:1012 -}; - CREATE Ingredient:2001 CONTENT { designation: 'Apfel', unit: 'Stück', @@ -398,13 +314,6 @@ CREATE Ingredient:2001 CONTENT { protein: 0.3 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 7.0, - delivery_time: 4, - supplier: Supplier:102, - ingredient: Ingredient:2001 -}; - CREATE Ingredient:3001 CONTENT { designation: 'Vollmilch. 3.5%', unit: 'Liter', @@ -415,13 +324,6 @@ CREATE Ingredient:3001 CONTENT { protein: 3.4 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 5.0, - delivery_time: 3, - supplier: Supplier:103, - ingredient: Ingredient:3001 -}; - CREATE Ingredient:3002 CONTENT { designation: 'Mozzarella', unit: 'Packung', @@ -432,13 +334,6 @@ CREATE Ingredient:3002 CONTENT { protein: 18.1 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 6.5, - delivery_time: 4, - supplier: Supplier:103, - ingredient: Ingredient:3002 -}; - CREATE Ingredient:3003 CONTENT { designation: 'Butter', unit: 'Stück', @@ -449,13 +344,6 @@ CREATE Ingredient:3003 CONTENT { protein: 0.7 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 7.0, - delivery_time: 4, - supplier: Supplier:103, - ingredient: Ingredient:3003 -}; - CREATE Ingredient:4001 CONTENT { designation: 'Ei', unit: 'Stück', @@ -466,14 +354,7 @@ CREATE Ingredient:4001 CONTENT { protein: 11.9 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 4.5, - delivery_time: 3, - supplier: Supplier:102, - ingredient: Ingredient:4001 -}; - -CREATE Ingredient:5001 CONTENT { +CREATE Ingredient:4002 CONTENT { designation: 'Wiener Würstchen', unit: 'Paar', net_price: 1.8, @@ -483,14 +364,7 @@ CREATE Ingredient:5001 CONTENT { protein: 9.9 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 6.0, - delivery_time: 4, - supplier: Supplier:101, - ingredient: Ingredient:5001 -}; - -CREATE Ingredient:9001 CONTENT { +CREATE Ingredient:5001 CONTENT { designation: 'Tofu-Würstchen', unit: 'Stück', net_price: 1.8, @@ -500,13 +374,6 @@ CREATE Ingredient:9001 CONTENT { protein: 17 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 7.5, - delivery_time: 4, - supplier: Supplier:103, - ingredient: Ingredient:9001 -}; - CREATE Ingredient:6408 CONTENT { designation: 'Couscous', unit: 'Packung', @@ -517,13 +384,6 @@ CREATE Ingredient:6408 CONTENT { protein: 12 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 5.0, - delivery_time: 3, - supplier: Supplier:102, - ingredient: Ingredient:6408 -}; - CREATE Ingredient:7043 CONTENT { designation: 'Gemüsebrühe', unit: 'Würfel', @@ -534,13 +394,6 @@ CREATE Ingredient:7043 CONTENT { protein: 0.5 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 3.0, - delivery_time: 2, - supplier: Supplier:101, - ingredient: Ingredient:7043 -}; - CREATE Ingredient:6300 CONTENT { designation: 'Kichererbsen', unit: 'Dose', @@ -551,72 +404,36 @@ CREATE Ingredient:6300 CONTENT { protein: 9 }; -CREATE SupplierContainsIngredients CONTENT { - delivery_cost: 4.0, - delivery_time: 3, - supplier: Supplier:103, - ingredient: Ingredient:6300 -}; - CREATE Order:3001 CONTENT { invoice_amount: 25.50, - order_date: 2024-02-08T10:00:00, + order_date: "2024-02-08T10:00:00", customer: Customer:2001, }; CREATE Order:3002 CONTENT { invoice_amount: 35.80, - order_date: 2024-02-08T11:30:00, + order_date: "2024-02-08T11:30:00", customer: Customer:2002, }; CREATE Order:3003 CONTENT { invoice_amount: 42.60, - order_date: 2024-02-08T13:15:00, + order_date: "2024-02-08T13:15:00", customer: Customer:2003, }; CREATE Order:3004 CONTENT { invoice_amount: 18.90, - order_date: 2024-02-08T14:45:00, + order_date: "2024-02-08T14:45:00", customer: Customer:2004, }; CREATE Order:3005 CONTENT { invoice_amount: 50.25, - order_date: 2024-02-08T16:20:00, + order_date: "2024-02-08T16:20:00", customer: Customer:2005, }; -CREATE OrderContainsIngredients CONTENT { - quantity: 2, - order: Order:3001, - ingredient: Ingredient:1001, -}; - -CREATE OrderContainsIngredients CONTENT { - quantity: 3, - order: Order:3001, - ingredient: Ingredient:1002, -}; - -CREATE OrderContainsIngredients CONTENT { - quantity: 1, - order: Order:3002, - ingredient: Ingredient:1003, -}; - -CREATE OrderContainsIngredients CONTENT { - quantity: 4, - order: Order:3002, - ingredient: Ingredient:1004, -}; - -CREATE OrderContainsIngredients CONTENT { - quantity: 2, - order: Order:3003, - ingredient: Ingredient:1005, -}; CREATE Recipe:4001 CONTENT { preparation_time: 30, @@ -653,152 +470,533 @@ CREATE Recipe:4005 CONTENT { instructions: '1. Heat olive oil in a large paella pan over medium heat. 2. Add chopped onions, bell peppers, and garlic, and sauté until softened. 3. Stir in Arborio rice and cook for 2-3 minutes. 4. Add vegetable broth, saffron, diced tomatoes, and a pinch of salt. 5. Bring to a simmer and cook for 20-25 minutes, stirring occasionally. 6. Add cooked vegetables such as peas, artichoke hearts, and roasted red peppers. 7. Cook for an additional 5-10 minutes until the rice is tender and the vegetables are heated through. 8. Garnish with chopped parsley and lemon wedges before serving.', }; -CREATE RecipeContainsIngredients CONTENT { +CREATE Supplier:101 CONTENT { + name: 'Bio-Hof Müller', + phone: '04354-9080', + email: 'mueller@biohof.de', + address: Address:101 +}; + +CREATE Supplier:102 CONTENT { + name: 'Obst-Hof Altes Land', + phone: '04162-4523', + email: 'info@biohof-altesland.de', + address: Address:102 +}; + +CREATE Supplier:103 CONTENT { + name: 'Molkerei Henning', + phone: '038873-8976', + email: 'info@molkerei-henning.de', + address: Address:103 +}; + +CREATE Address:101 CONTENT { + street: 'Dorfstraße', + house_number: '74', + postal_code: '24354', + city: 'Weseby' +}; + +CREATE Address:102 CONTENT { + street: 'Westerjork 74', + house_number: '76', + postal_code: '21635', + city: 'Jork' +}; + +CREATE Address:103 CONTENT { + street: 'Molkereiwegkundekunde', + house_number: '13', + postal_code: '19217', + city: 'Dechow' +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 5.0, + delivery_time: 3, + supplier: Supplier:101, + ingredient: Ingredient:1001 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 4.0, + delivery_time: 2, + supplier: Supplier:101, + ingredient: Ingredient:1002 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 6.0, + delivery_time: 3, + supplier: Supplier:101, + ingredient: Ingredient:1003 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 3.5, + delivery_time: 2, + supplier: Supplier:101, + ingredient: Ingredient:1004 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 4.0, + delivery_time: 3, + supplier: Supplier:101, + ingredient: Ingredient:1005 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 3.0, + delivery_time: 2, + supplier: Supplier:101, + ingredient: Ingredient:1006 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 5.0, + delivery_time: 3, + supplier: Supplier:101, + ingredient: Ingredient:1007 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 4.5, + delivery_time: 2, + supplier: Supplier:101, + ingredient: Ingredient:1008 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 3.5, + delivery_time: 2, + supplier: Supplier:101, + ingredient: Ingredient:1009 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 5.5, + delivery_time: 3, + supplier: Supplier:101, + ingredient: Ingredient:1010 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 6.0, + delivery_time: 3, + supplier: Supplier:101, + ingredient: Ingredient:1011 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 5.0, + delivery_time: 3, + supplier: Supplier:101, + ingredient: Ingredient:1012 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 7.0, + delivery_time: 4, + supplier: Supplier:102, + ingredient: Ingredient:2001 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 5.0, + delivery_time: 3, + supplier: Supplier:103, + ingredient: Ingredient:3001 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 6.5, + delivery_time: 4, + supplier: Supplier:103, + ingredient: Ingredient:3002 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 7.0, + delivery_time: 4, + supplier: Supplier:103, + ingredient: Ingredient:3003 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 4.5, + delivery_time: 3, + supplier: Supplier:102, + ingredient: Ingredient:4001 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 6.0, + delivery_time: 4, + supplier: Supplier:101, + ingredient: Ingredient:5001 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 3.5, + delivery_time: 2, + supplier: Supplier:103, + ingredient: Ingredient:6408 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 2.0, + delivery_time: 2, + supplier: Supplier:101, + ingredient: Ingredient:7043 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 2.5, + delivery_time: 2, + supplier: Supplier:101, + ingredient: Ingredient:6300 +}; + +CREATE OrderContainsIngredients CONTENT { + quantity: 2, + order: Order:3001, + ingredient: Ingredient:1001 +}; + +CREATE OrderContainsIngredients CONTENT { quantity: 3, + order: Order:3001, + ingredient: Ingredient:1002 +}; + +CREATE OrderContainsIngredients CONTENT { + quantity: 1, + order: Order:3002, + ingredient: Ingredient:1003 +}; + +CREATE OrderContainsIngredients CONTENT { + quantity: 1, + order: Order:3003, + ingredient: Ingredient:1004 +}; + +CREATE OrderContainsIngredients CONTENT { + quantity: 2, + order: Order:3004, + ingredient: Ingredient:1005 +}; + +CREATE OrderContainsIngredients CONTENT { + quantity: 1, + order: Order:3005, + ingredient: Ingredient:1006 +}; + +CREATE OrderContainsIngredients CONTENT { + quantity: 3, + order: Order:3005, + ingredient: Ingredient:1007 +}; + +CREATE OrderContainsIngredients CONTENT { + quantity: 2, + order: Order:3005, + ingredient: Ingredient:1008 +}; + +CREATE OrderContainsIngredients CONTENT { + quantity: 1, + order: Order:3005, + ingredient: Ingredient:1009 +}; + +CREATE OrderContainsIngredients CONTENT { + quantity: 2, + order: Order:3005, + ingredient: Ingredient:1010 +}; + +CREATE OrderContainsIngredients CONTENT { + quantity: 1, + order: Order:3005, + ingredient: Ingredient:1011 +}; + +CREATE OrderContainsIngredients CONTENT { + quantity: 3, + order: Order:3005, + ingredient: Ingredient:1012 +}; + +CREATE RecipeContainsIngredients CONTENT { + amount: 3, recipe: Recipe:4001, ingredient: Ingredient:1001, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 2, + amount: 2, recipe: Recipe:4001, ingredient: Ingredient:1002, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4001, ingredient: Ingredient:1003, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4001, ingredient: Ingredient:1004, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4001, ingredient: Ingredient:1005, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4002, ingredient: Ingredient:1003, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 2, + amount: 2, recipe: Recipe:4002, ingredient: Ingredient:1004, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4002, ingredient: Ingredient:1005, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4003, ingredient: Ingredient:1002, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 2, + amount: 2, recipe: Recipe:4003, ingredient: Ingredient:1004, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 2, + amount: 2, recipe: Recipe:4003, ingredient: Ingredient:1005, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4003, ingredient: Ingredient:1006, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4003, ingredient: Ingredient:1007, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4003, ingredient: Ingredient:1008, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4003, ingredient: Ingredient:1009, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4004, ingredient: Ingredient:1003, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 2, + amount: 2, recipe: Recipe:4004, ingredient: Ingredient:1007, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4004, ingredient: Ingredient:1010, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4005, ingredient: Ingredient:1005, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4005, ingredient: Ingredient:1006, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4005, ingredient: Ingredient:1007, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 2, + amount: 2, recipe: Recipe:4005, ingredient: Ingredient:1008, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4005, ingredient: Ingredient:1009, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4005, ingredient: Ingredient:1011, }; CREATE RecipeContainsIngredients CONTENT { - quantity: 1, + amount: 1, recipe: Recipe:4005, ingredient: Ingredient:1012, }; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 4.0, + delivery_time: 2, + supplier: Supplier:102, + ingredient: Ingredient:3003 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 3.0, + delivery_time: 2, + supplier: Supplier:102, + ingredient: Ingredient:6408 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 5.0, + delivery_time: 3, + supplier: Supplier:102, + ingredient: Ingredient:7043 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 6.0, + delivery_time: 4, + supplier: Supplier:102, + ingredient: Ingredient:6300 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 5.0, + delivery_time: 3, + supplier: Supplier:103, + ingredient: Ingredient:4001 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 6.0, + delivery_time: 4, + supplier: Supplier:103, + ingredient: Ingredient:5001 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 7.5, + delivery_time: 4, + supplier: Supplier:103, + ingredient: Ingredient:9001 +}; + +CREATE SupplierContainsIngredients CONTENT { + delivery_cost: 4.0, + delivery_time: 3, + supplier: Supplier:101, + ingredient: Ingredient:3002 +}; + +CREATE Customer:2012 CONTENT { + last_name: 'Wong', + first_name: 'Emily', + birth_date: '1990-03-15', + phone: '040/555555', + email: 'emily.wong@example.com', + address: Address:2012 +}; + +CREATE Address:2012 CONTENT { + street: 'Rose Street', + house_number: '8', + postal_code: '22000', + city: 'Berlin' +}; + +CREATE Customer:2013 CONTENT { + last_name: 'Müller', + first_name: 'Andreas', + birth_date: '1983-12-04', + phone: '030/123456', + email: 'andreas.mueller@example.com', + address: Address:2013 +}; + +CREATE Address:2013 CONTENT { + street: 'Lindenallee', + house_number: '12', + postal_code: '22333', + city: 'Berlin' +}; + +CREATE Customer:2014 CONTENT { + last_name: 'Jansen', + first_name: 'Sophie', + birth_date: '1978-06-22', + phone: '030/987654', + email: 'sophie.jansen@example.com', + address: Address:2014 +}; + +CREATE Address:2014 CONTENT { + street: 'Birkenweg', + house_number: '3', + postal_code: '22666', + city: 'Berlin' +}; + +CREATE Customer:2015 CONTENT { + last_name: 'Schmidt', + first_name: 'Marcel', + birth_date: '1995-08-10', + phone: '030/112233', + email: 'marcel.schmidt@example.com', + address: Address:2015 +}; + +CREATE Address:2015 CONTENT { + street: 'Ahornstraße', + house_number: '17', + postal_code: '22999', + city: 'Berlin' +}; diff --git a/data/newqueerys.surrealql b/data/newqueerys.surrealql new file mode 100644 index 0000000..1823129 --- /dev/null +++ b/data/newqueerys.surrealql @@ -0,0 +1,47 @@ +# Find ingredients included in recipe +SELECT ingredient.designation AS Ingredient FROM RecipeContainsIngredients WHERE recipe.name = 'Tomato Basil Salad'; + +# get Ingredients where carbohydrates are lower than 40 +SELECT designation FROM Ingredient WHERE carbohydrates <= 40; + +# find user that ingredients +SELECT order.customer.first_name AS Name FROM OrderContainsIngredients WHERE ingredient.designation = 'Schalotte'; + +# Get total amount spend by each customer +SELECT string::concat(customer.first_name, ' ', customer.last_name) as customer, math::sum(invoice_amount) AS total_spent +FROM Order +GROUP BY customer; + +# Total number of deliver cost per supplyer +SELECT supplier.name AS supplier, math::sum(delivery_cost) AS total_delivery_cost +FROM SupplierContainsIngredients +GROUP BY supplier; + +# Get cheapest delivery price +SELECT ingredient.designation AS ingredient , math::min(delivery_cost) AS min_delivery_price +FROM SupplierContainsIngredients +GROUP BY ingredient; + +# Amount of Customers per city +SELECT address.city AS city, COUNT() AS customer_count +FROM Customer +GROUP BY city; + +# Stock low warning +DEFINE EVENT ingredient_stock_low ON TABLE Ingredient +WHEN $after.stock < 10 THEN ( + CREATE alert SET message = "Stock for ingredient " || $after.designation || " is low.", + ingredient_id = $value.id, + created_at = time::now() +); + +# User Data Exporting +LET $customer = 'd.foede@web.de'; +SELECT *, address.*, (SELECT * FROM Order WHERE customer.email = $customer) AS orders FROM Customer WHERE email = $customer; + +# Delete User Data +LET $customer = SELECT id FROM Customer WHERE email = 'd.foede@web.de'; +DELETE $customer.address; +DELETE OrderContainsIngredients WHERE order.customer = $customer; +DELETE Order WHERE customer = $customer; +DELETE $customer; \ No newline at end of file