Lab 06 RDBMS
Lab 06 RDBMS
LAB # 6
GROUP FUNCTIONS
OBJECTIVE
THEORY
Group functions operate on sets of rows to give one result per group
.
37
Lab # 6: Group Functions SWE-209
38
Lab # 6: Group Functions SWE-209
You can divide rows in a table into smaller groups by using the GROUP BY clause.
All columns in the SELECT list that are not in group functions must be in the
GROUP BY clause.
39
Lab # 6: Group Functions SWE-209
40
Lab # 6: Group Functions SWE-209
When you use the HAVING clause, the Oracle server restricts groups as follows:
1. Rows are grouped.
2. The group function is applied.
3. Groups matching the HAVING clause are displayed.
41
Lab # 6: Group Functions SWE-209
LAB TASKS:
i. Make a list of all project numbers for projects that involve an employee whose last
name is ‘Scott’, either as a worker or as a manager of the department that controls
the project.
ii. Show the resulting salaries if every employee working on the ‘IoT’ project is
given a 10 percentraise.
iii. Find the sum of the salaries of all employees of the ‘Accounts’ department, as
well as the maximum salary, the minimum salary, and the average salary in this
department
iv. Retrieve the name of each employee who works on all the projects controlled by
department number (use NOT EXISTS operator).
v. 5 For each department that has more than five employees, retrieve the department
number and the number of its employees who are making more than Rs.6,00,000.
42