Database Management System (DBMS) Lab Assignment 05

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Database Management System (DBMS) Lab Assignment 05

1. Create the table following table

A . Table Name : Employee

Column Name Data Type Size Constraints

Emp_id Integer 10 Primary Key

Emp_name Varchar 30 Not Null

Salary Integer 10

Department Varchar 30

Gender Varchar 10

Data for Employee Table :

Emp_id Emp_name Salary Department Gender

1 Madhav 500000 IT Male

2 Arushi 550000 HR Female

3 Hari 1000000 IT Male

4 Lokesh 470000 HR Male

5 Shiva 750000 Payroll Male

B . Table Name : Project

Column Name Data Type Size Constraints

Project_id Integer 10 Primary Key

Emp_id Integer 10 Not Null

Project_name Varchar 30
Data for Project Table :

Project_id Emp_id Project_name

1 1 Fast Track

2 1 GRS

3 1 Survey Management

4 2 HR Management

5 3 Fast Track

6 3 GRS

7 3 DDS

8 4 HR Management

9 6 GL Management

2. Display the structure of all the tables.

3. Display the Cartesian product of above two tables.

4. Retrieve emp_name, project_name order by Emp_name from "Employee" and "Project"

for those employees which have assigned projects already.


5. Retrieve emp_name, project_name order by Emp_name from "Employee" and "Project"

for those employees who have assigned projects already and also who have not

assigned any projects yet.

6. Retrieve emp_name, project_name from “Employee” and “Project” for those projects

assigned to the employees and also the projects that are not assigned to anyone yet.

7. Write a query to find out the project names which are not assigned to any of the

employees.

8. Write a query to find out the employee names who has not assigned any project.
9. Retrieve emp_name, project_name from “Employee” and “Project” for all the records

from both the tables.

10. Retrieve emp_name, project_name from “Employee” and “Project” for all the employees

who have not assigned any projects yet and also all projects which are not assigned to

any employees yet.

11. Delete records from projects table where project_name is Survey Management

12. Display the Count of projects that are assigned to emp_name = Madhav

13. Display the Count of employees who are assigned to project Fast Track.

14. Display the emp_name, project_name where the project_name is HR Management.

15. Display the emp_name, project_name where the employee salary is greater than 50000

and project_name is GRS.

You might also like