0% found this document useful (0 votes)
2 views

Lab Assignment-6

The document outlines a lab assignment focused on SQL queries involving grouping and joins. It includes tasks such as inserting records, counting employees and departments, displaying employee details, and calculating salaries based on various criteria. The assignment emphasizes the use of SQL to manipulate and retrieve data from two related tables: DEPT and EMP.

Uploaded by

kanz2912
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lab Assignment-6

The document outlines a lab assignment focused on SQL queries involving grouping and joins. It includes tasks such as inserting records, counting employees and departments, displaying employee details, and calculating salaries based on various criteria. The assignment emphasizes the use of SQL to manipulate and retrieve data from two related tables: DEPT and EMP.

Uploaded by

kanz2912
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

LAB ASSIGNMENT-6

Group By and Joins in SQL (Part-I)


TABLE DEPT (DEPTNO, DEPTNAME)

TABLE EMP (EMPNO, EMPNAME, DEPTNO, JOB, SALARY): DEPTNO is a foreign


key w.r.t to DEPT Table.

Answer the following SQL Queries

1. Insert 10 appropriate records in each table as per the SQL queries mentioned below.

2. List the total number of employees?

3. List the total no of departments?

4. Display the employee details of each department for which they are working.

5. List the total, maximum, & minimum salary for deptno 30?

6. Display the name of the employee getting maximum salary?

7. Display the total salary for each department?

8. Display the total salary for each job.

9. Display the total salary for each job within each department.

10. Display the average salary for each job in deptno 20.

11. Display the total salary for each job excluding the ‘manager’ and ‘salesman’ job.

12. Display the average salary for each job in deptno 20, but only display those jobs where
average salary is greater than 2000 & display the output in descending order of salary?
13. Display the total no of employees for each department excluding the deptno 10 & display
only those departments where more than five employees work. Display the output in
descending order of total no of employees?

14. Display the total no of employees for each department excluding the ‘comp’ dept & display
only those departments where more than five employees work. Display the output in
descending order of total no of employees?

15. Display total number of emp working in each job in each dept.

16. List all the department name and their employees name even if for a department there is no
employees (A newly created department).

17. List all the employees name and their department name even if for an employee there is no
department assigned (A newly joined employee).

18. List all the departments name and their employees name irrespective whether for a
department any employees are there are not, and irrespective whether for an employee
there is any department assigned or not.

You might also like