Employee (SSN, name, age, dno)

Q. Let the following relational schema be given-
Employee (SSN, name, age, dno)
Salary (SSN, salary)
Works_on (Projects#, SSN)
Project (Projects#, project_name, location)
For each of the following queries give an expression in SQL-
(i) Display the names of projects at “Delhi”.
(ii) Find the project_name of employee whose salary is greater than 10000.
(iii) Retrieve the name and SSN of employee working on project# A 100.

Solution:
(i) Select project_name from Project where location = “Delhi”;

(ii) select project_name from Project where Projects# in (select Projects# from Works_on, Salary where Works_on.SSN = Salary.SSN having Salary > 10000)

(iii) select name, SSN from Employee, where SSN in (select SSN from Works_on where Projects# = A 100);

Related topics

Professor Jayesh video tutorial

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.