You are on page 1of 5

LAB#06: DATABASE MANAGEMNET SYSTEM SSUET/QR/114

LAB # 6
GROUP FUNCTIONS

OBJECTIVE
• Identify the available group functions
• Describe the use of group functions
• Group data by using the group by clause
• Include or exclude grouped rows by using the having clause

LAB TASKS

Write SQL queries to


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.

Page 1
This study source was downloaded by 100000815639689 from CourseHero.com on 05-10-2022 20:53:05 GMT -05:00

https://www.coursehero.com/file/142820707/lab-6-ARINApdf/
LAB#06: DATABASE MANAGEMNET SYSTEM SSUET/QR/114

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).

Page 2
This study source was downloaded by 100000815639689 from CourseHero.com on 05-10-2022 20:53:05 GMT -05:00

https://www.coursehero.com/file/142820707/lab-6-ARINApdf/
LAB#06: DATABASE MANAGEMNET SYSTEM SSUET/QR/114

v. 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.

2. From the following table,

TABLE:

i. write a SQL query to find the highest grade of the customers for each of the city. Return
city, maximum grade.

Page 3
This study source was downloaded by 100000815639689 from CourseHero.com on 05-10-2022 20:53:05 GMT -05:00

https://www.coursehero.com/file/142820707/lab-6-ARINApdf/
LAB#06: DATABASE MANAGEMNET SYSTEM SSUET/QR/114

Page 4
This study source was downloaded by 100000815639689 from CourseHero.com on 05-10-2022 20:53:05 GMT -05:00

https://www.coursehero.com/file/142820707/lab-6-ARINApdf/
LAB#06: DATABASE MANAGEMNET SYSTEM SSUET/QR/114

ii. write a SQL query to find the total number of Salesman in each city. Return total salesman
and city name.

iii. Write a SQL query to compute the average grade for unique city. Return average price and city
name.

Page 5
This study source was downloaded by 100000815639689 from CourseHero.com on 05-10-2022 20:53:05 GMT -05:00

https://www.coursehero.com/file/142820707/lab-6-ARINApdf/
Powered by TCPDF (www.tcpdf.org)

You might also like