The document outlines various SQL queries involving grouping, subqueries, aggregations and filtering on employee data:
1. Group employee data by department to display the maximum salary for each department.
2. Use subqueries to filter employee data based on conditions like department number, job, salary level compared to other employees, hire date, and more.
3. Perform aggregations like counting employees by job, department, job and department combinations, and filtering counts like clerks by department.
4. Find maximum, minimum, and top 3 salaries overall and by groups like department and job.
5. List departments that have no employees.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
29 views1 page
Group by
The document outlines various SQL queries involving grouping, subqueries, aggregations and filtering on employee data:
1. Group employee data by department to display the maximum salary for each department.
2. Use subqueries to filter employee data based on conditions like department number, job, salary level compared to other employees, hire date, and more.
3. Perform aggregations like counting employees by job, department, job and department combinations, and filtering counts like clerks by department.
4. Find maximum, minimum, and top 3 salaries overall and by groups like department and job.
5. List departments that have no employees.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Group-by
1. Display max sal dept wise
2. Count no of emp job wise 3. Count no of emp deptwise & jobwise 4. Count no of clerks from each dept 5. Display deptno where atleast 4 employes are working
SUB QUERIES
1. DISPLAY DETAILS OF EMP WHOSE DEPTNO SAME AS SMITH DEPTNO
2. DISPLAY DETAILS OF EMP WHOSE JOB SAME AS BLAKES JOB 3. DISPLAY DETAILS OF EMP WHOSE SAL MORE THAN ALLEN SAL 4. DISPLAY DETAILS OF EMP WHO ARE SENIOR TO MILLER 5. DISPLAY ALL ACCOUNTING DEPT EMPS WHO ARE RECEIVING SAL MORE THAN ALLEN SAL 6. DISPLAY DETAILS OF EMP WHOSE JOB SAME AS ACCOUNTING DEPT JOBS 7. DISPLAY DETAILS OF 4 & 5 GRADE EMP WHOSE JOB SAME AS ACCOUNTING & RESEARCHING 8. Display the name of the empployee who earns highest salary. 9. Display the employee number and name for employee working as clerk and earning highest salary among clerks. 10. Display the names of salesman who earns a salary more than the highest salary of any clerk. 11. Display the names of clerks who earn a salary more than the lowest salary of any salesman. 12. Display the names of the employees who earn highest salary in their respective departments. 13. Display the names of the employees who earn highest salaries in their respective job groups. 14. Display the employee names who are working in accounting department. 15. Display the employee names who are working in NEW YORK 16. Display second max sal from emp 17. Find the 3rd MAX salary in the emp table 18. Find the 3rd Min salary in the emp table 19. How to get 3 Max salaries ? 20. How to get 3 Min salaries ? 21. Display the details of employees whose sal is more than any employee of the dept 10 22. Display the details of employees whose sal is more than all employee of the dept 10 23. List dept no., Dept name for all the departments in which there are no employees in the department.