4 table joining

sandy143 · June 24, 2022
create table emp(e_id int(5),e_name varchar(15));
insert into emp values(101,'sandeep');
insert into emp values(102,'bargav');
insert into emp values(103,'shiva');
insert into emp values(104,'naresh');
select * from emp;
create table details(e_id int(5),d_id int(5),salary int(10));
insert into details values(201,1001,1000);
insert into details values(202,1002,2000);
insert into details values(203,1003,3000);
insert into details values(204,1004,4000);
select * from details;
create table department(d_id int(5),d_name varchar(15),manager varchar (15));
insert into department values(3001,'account','raju');
insert into department values(3002,'sales','mahesh');
insert into department values(3003,'maketing','suresh');
insert into department values(3004,'finance','nani');
select * from department;

create table office(manager varchar(15),joining_date varchar(15),experience int(1));
insert into office values('sri','01-jan-2000',3);
insert into office values('ravi','07-feb-2019',4);
insert into office values('radha','04-jun-2010',5);
insert into office values('krishana','apr-05-2013',7);

select e_name,d_name,salary,joining_date,experience
 from emp e ,details d,department dp,office f 
where e.e_id =d.e_id and d.d_id =dp.d_id and dp.manager= f.manager;

Output
(Run the program to view its output)

Comments

Please sign up or log in to contribute to the discussion.