Dbms Answers
Dbms Answers
Dbms Answers
1. Retrieve the name and address of all employees who work for the ‘Research’ department
DEPARTMENT.DNUMBER = EMPLOYEE.DNUMBER;
2. For each employee, retrieve the employee’s first and last name, and the first and last name
of his or her immediate supervisor.
3. Retrieve the name of each employee who works on allthe projects controlled by department
number 5
FROM EMPLOYEE
( (SELECT PNUMBER
FROM PROJECT
WHERE DNUM = 5)
EXCEPT
(SELECT PNO
FROM WORKS_ON
4. Make a list of all project numbers for projects that involve an employee whose last name is
'Smith' as a worker or as a manager of the department that controls the project.
UNION
FROM PROJECT
LNAME = ‘Smith’)
OR
5. Retrieve the SSN of all employees who work on project number 1,2, or 3
SELECT DISTINCT ESSN
FROM WORKS_ON
WHERE PNO IN (1,2,3);
3) (sample question for CIAT 2) Find the names, street address, and cities of residence for all
employees who work for
employee, wor ks
and company-name = ' Fir st Bank Cor por at ion' and salar y > 10000)
4) Find the names of all employees in the database who earn more than every employee
of 'First Bank Corporation'. Assume that all people work for at most one company.
select employee-name
f r om wor ks
f r om wor ks