Compare commits
No commits in common. "b819055d8729dc905b142765ec20c344807cce50" and "f74bf93786a85d376e60dbca8aa3252fe29f6688" have entirely different histories.
b819055d87
...
f74bf93786
2 changed files with 3 additions and 84 deletions
|
@ -936,67 +936,3 @@ 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'
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Find ingredients included in recipe
|
||||
# Find ingridents included in recipe
|
||||
SELECT ingredient.designation AS Ingredient FROM RecipeContainsIngredients WHERE recipe.name = 'Tomato Basil Salad';
|
||||
|
||||
# get Ingredients where carbohydrates are lower than 40
|
||||
|
@ -13,19 +13,13 @@ 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
|
||||
|
@ -34,14 +28,3 @@ WHEN $after.stock < 10 THEN (
|
|||
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;
|
Loading…
Add table
Add a link
Reference in a new issue