VL2023240506367 Ast03
VL2023240506367 Ast03
B.Tech
Database Systems Lab
Lab assignment -3
Name: Dependent
The combination of Employee SSN and Dependent Name must be a Primary Key.
Dep No D Location
1 Houston
1 Chicago
2 New York
2 San Francisco
3 Salt Lake City
4 Stafford
4 Bellaire
5 Sugarland
5 Houston
Data for Table - Works_On
1. Find the employee who is getting highest salary in the department research
2. Find the employees who earn the same salary as the minimum salary for each
Department
3. Find the employee whose salary is greater than average salary of department 2
4. List out all the department names with their individual employees strength
5. Find out the department name having highest employee strength
6. List out all the departments and average salary drawn by their employees
7. Find maximum average salary for each department.
8. Create a view to display the employee details who is working in IT department.
9. Create a logical table to store employee details who is getting salary more than 10000.
10. Create a table to store the employees details based on the department no
PART-B (Joins)
Aim: To understand how to relate and access data from multiple tables.
1. Retrieve the names of all employees in department 5 who work more than 10 hours
per week on ProductX project.
2. List the names of all employees who have a dependent with the same first name as
themselves.
3. Find the names of all the employees who are directly supervised by ‘Franklin Wong’.
4. Retrieve the names of all who do not work on any project.
5. Find the names and addresses of all employees who work on atleast one project
located in Houston but whose department has no location in Houston.
6. List the names of all managers who have no dependents.
7. List the employee’s names and the department names if they happen to manage a
department.
8. For each project retrieve the project number, project name and the number of
employees who work on that project.
9. For each project, list the project name and the total hours per week (by all employees)
spent on that project.
10. Retrieve the names of the employees who have 2 or more dependents.