The SQL statements comprising the DDL for the COMPANY Database are given to you.
ID: 3912571 • Letter: T
Question
The SQL statements comprising the DDL for the COMPANY Database are given to you. For that database, answer the following queries. Create the files Q1 to Q10 in PostgreSQL. Do follow the restrictions stated for individual queries. When a query asks for "name" of employees, retrieve both, the first and the last names.
5. Retrieve the names of all employees who work on all projects [every project] located in either Bellaire or Sugarland. That is, if p1, p2, and p3 are located in Bellaire; and p4 and p5 are located in Sugarland; then I want an employee who works on p1, p2, p3, p4, and p5.
https://users.cs.fiu.edu/~navlakha/4710/CreateCompany.sql
Explanation / Answer
If you have any doubts, please give me comment...
SELECT fname, lname
FROM employee
WHERE NOT EXISTS(
SELECT *
FROM project
WHERE plocation ='Bellaire' OR plocation = 'Sugarland' AND NOT EXISTS(
SELECT *
FROM works_on
WHERE essn = ssn AND pno = pnumber
)
);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.