SQL Practical 5
SQL Practical 5
01 Suresh E1 25000 M1
02 Ramesh E2 22000 M1
03 Dinesh E3 21000 M2
04 Kalpesh E4 20000 M1
05 Alpesh E5 21600 M3
06 Adesh E6 26000 M5
07 Rajesh E7 27000 M3
08 Zareen E8 30000 M4
09 Seema E9 20000 M2
M1 Dipak 01
M2 Saniya 02
M3 Amar 01
M4 Robin 03
M5 Sunita 04
3)Branch
Branch No Branch
01 Andheri
02 Sion
03 Dadar
04 Churchgate
05 Thane
4) Project
Project Project of the department Staff appointed for the project
P1 Admin E1
P2 ICT M1
P3 Sales E5
P4 Admin M4
P5 Accounts E6
P6 HR E4
Create a Project .
create table project(project_id varchar(20) , project_name varchar(20),staff varchar(20));
Fetch the details of the employee and branch which they belong to
SELECT e.emply_name,b.branch_no from Company e inner join branch b on
e.branch_no=b.branch_no;
Fetch the details of the employee and all branch which they belong to
SELECT e.emply_name,b.branch_no from Company e right join branch b on
e.branch_no=b.branch_no;
Fetch the details of all the employees, their manager, their department and the project
they work on.
SELECT e.emply_name,b.branch_no, m.manager_name, p. project_name from Company e left
join branch b on e.branch_no=b.branch_no
join manager m on m.manager_id=e.manager_id left join project p on p.staff=e.emp_id;