diff --git a/data/data.surrealql b/data/data.surrealql index 8b89af2..6b8670d 100644 --- a/data/data.surrealql +++ b/data/data.surrealql @@ -936,3 +936,67 @@ CREATE SupplierContainsIngredients CONTENT { 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 index 00ef9cd..1823129 100644 --- a/data/newqueerys.surrealql +++ b/data/newqueerys.surrealql @@ -13,11 +13,19 @@ 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