add some more querrys

This commit is contained in:
Johannes Jöns 2024-02-09 07:25:34 +01:00
parent ae1ccbd629
commit b819055d87
2 changed files with 73 additions and 1 deletions

View file

@ -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'
};

View file

@ -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