Professional Documents
Culture Documents
Aggregate Functions Grouping - Question
Aggregate Functions Grouping - Question
Lab Module
3. Retrieve the total number of rooms for the properties in each city.
6. Retrieve the minimum, maximum and average rent of flat properties that will be
rent.
1. Calculate the total number of staffs who are female. Rename column as
Number Of Female Staff. Display sex column as well.
2. Retrieve the total number of staffs who are assistants. Display position column
as well.
3. List the total salary for each gender.
4. Get the minimum, maximum and average salary for each branch.
5. Get the number of staffs who work at B003 and B007. Please include
BranchNo in your column list.
6. Produce a report of the number of properties handled by each staff.
7. Find out how many properties are owned by ‘C093’.
8. Find out how many properties are viewed by ‘CR56’ and ‘CR76’.
9. The normal rental rate for each property is between RM300 and RM400. How
many properties that do not have this rental rate? Name the column as
TOTALPROPERTIES.
10. List the total number of employees in each branch for those branches with
more than 1 employee. Create an appropriate heading for the columns of the
results table.
11. Find those branches that have two or more female staff.
12. Find those owners that have two or more properties. Sort the output in
descending order of branchno.
Connolly, T. & Begg, C. (2015) Database Systems: A Practical Approach To Design, Implementation, And
Management. 12th Edition. Addison-Wesley.
2
More Exercises
Show the SQL statement, Relational Algebra (RA) and the expected result for
each of the following user queries:
Connolly, T. & Begg, C. (2015) Database Systems: A Practical Approach To Design, Implementation, And
Management. 12th Edition. Addison-Wesley.