Sei sulla pagina 1di 3

DATABASE ASSIGNMENT

STUDENT ID: 16/pcsa/504


Outline:
There are four tables, viz., student, alumni, faculty and retired staff as given below. Try to
answer the following queries.
STD

ALUM

RTD

FAC

1. Find those faculties who are alumni


ANS:
Select * from faculty_mstr where fac_name in (select fac_name from alumni);
2. Fetch the details of a faculty who draws the highest salary
ANS:
Select * from faculty_mstr where salary = (select max(salary) from faculty_mstr);
3. Fetch the details of a faculty who draws the lowest salary
ANS:
Select * from faculty_mstr where salary = (select min(salary) from faculty_mstr);

4. Find out the details of retired staff who draw a pension greater than average salary of
faculty in their respective department
ANS:

Select * from retired where pension > all (select avg(salary) from faculty_mstr group by
dept) ;
5. Find the details of eldest alumni who were faculties and now retired.
ANS:
Select * from alumni where s_name in (select fac_name from faculty_mstr ) and s_name
in(select r_name from retired);

Potrebbero piacerti anche