You are on page 1of 2

Experiment 13

Q1. Retrieve Fname,ssn,Dno and Dname of all employees who work in HR department.

Select Fname,SSN,employee1.Dno,Dname FROM(Employee1 JOIN Department1 ON


Employee1.dno=Department1.dno) where Dname='HR';

FNAME SSN DNO DNAME


Ameer 457cs18002 3 HR

Q2. Display all department details of those departments located in Belgaum using JOIN operation.

Select * FROM(Department1 JOIN Dept_loc1 ON Department1.Dno=Dept_loc1.Dno) where


Dloc='Belgaum';

DNAME DNO MGR_SSN MGR_START_DATE DNO DLOC


Accounts 1 457cs18001 19-APR-07 1 Belgaum

Q3. Display employee no. and project name of those working in AI project.

Select ESSN,Pname FROM(Project1 JOIN Works_on1 ON Project1.Pno=Works_on1.Pno) where


Pname='AI';

ESSN PNAME
457cs17019 AI

Q4.For each department display Dno and total no of employees arrenge the count in desending order
using JOIN operation.

select employee1.Dno,COUNT(*) from (Employee1 JOIN Department1 ON


Employee1.dno=Department1.dno) group by employee1.Dno order by count(*) desc;

DNO COUNT(*)
1 2
3 1
4 1
2 1
Q5.For every project located in belgaum list Pno,Dno,Dept_MGR_SSN,Lname,address,DOB.

select lname,address,bdate,dname,dno,pno,Mgr_ssn from ((Project1 JOIN Department1 ON


Project1.dno=Department1.dno) JOIN Employee1 ON Mgr_ssn=SSN) where Ploc='Belgaum';

LNAME ADDRESS BDATE DNAME DNO PNO MGR_SSN


Khan Wall street 97 California. 04-JUN-90 Accounts 1 1 457cs18001

Q6.Display employee no. Fname,salary,Dname of those whose salary is between 5000 and 40000.

select fname,lname,salary,dname from (employee1 JOIN department1 ON


employee1.dno=department1.dno) where (salary between 5000 AND 40000);

FNAME LNAME SAL ARY DNAME


Bhavesh Bhosale 10000 IT
Amitabh Khan 25000 Accounts

You might also like