0% found this document useful (0 votes)
13 views2 pages

Group by Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Group by Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Write the query to get the department and department wise


total(sum) salary from "EmployeeDetail" table.

SELECT DEPARTMENT,SUM(SALARY) FROM


EMPLOYEEDETAIL GROUP BY DEPARTMENT;

2. Write the query to get the department and department wise


total(sum) salary, display it in ascending order according to sum of
salary.

SELECT DEPARTMENT,SUM(SALARY) FROM


EMPLOYEEDETAIL GROUP BY DEPARTMENT
ORDER BY SUM(SALARY);

3. Write the query to get the department and department wise


total(sum) salary, display it in descending order according of total
salary.

SELECT DEPARTMENT,SUM(SALARY) FROM


EMPLOYEEDETAIL GROUP BY DEPARTMENT
ORDER BY SUM(SALARY) DESC;

4. Write the query to get the department, total no. of departments,


total(sum) salary with respect to department from
"EmployeeDetail" table.

SELECT DEPARTMENT,
COUNT(DEPARTMENT),SUM(SALARY) FROM
EMPLOYEEDETAIL GROUP BY DEPARTMENT;

5. Get department wise average salary from "EmployeeDetail" table


order by average salary in ascending order.

SELECT DEPARTMENT, AVG(SALARY) FROM


EMPLOYEEDETAIL GROUP BY DEPARTMENT ORDER BY
AVG(SALARY);

6. Get department wise maximum salary from "EmployeeDetail" table


order by salary ascending.
7. Get department wise minimum salary from "EmployeeDetail" table
order by salary ascending.
8. Write down the query to fetch Project name assigned to more than
one Employee.
Column_Name: project
SELECT PROJECT, COUNT(PROJECT) FROM
EMPLOYEEDETAIL GROUP BY PROJECT HAVING
COUNT(PROJECT)>1;

You might also like