added example files for aggregators and random

This commit is contained in:
Sven Vogel 2023-12-08 16:12:11 +01:00
parent 51658937a1
commit eb7bfd31cf
3 changed files with 16 additions and 0 deletions

12
tasks/aggregators.sql Normal file
View File

@ -0,0 +1,12 @@
USE tutorial;
SELECT count(annualSalaryGrossEUR_Amount) FROM Employee;
SELECT sum(annualSalaryGrossEUR_Amount) FROM Employee;
SELECT avg(annualSalaryGrossEUR_Amount) FROM Employee;
SELECT Department.name, round(avg(annualSalaryGrossEUR_Amount), 2) AS salary
FROM Employee
LEFT JOIN Department ON Employee.departmentId = Department.id
GROUP BY departmentId
HAVING salary > 48000
ORDER BY salary DESC;

3
tasks/pricePerSqm.sql Normal file
View File

@ -0,0 +1,3 @@
USE tutorial;
SELECT round(EUR_rentalAmount / Room.M2_area, 2) AS 'price per m²' FROM Room;

1
tasks/rands.sql Normal file
View File

@ -0,0 +1 @@
SELECT floor(rand() * (8.0 - 2.0) + 2.0);