Question
(a) Explain the following query in English (based on the company database) SELECT FNAME, LNAME, SSN FROM EMPLOYEE WHERE NOT EXISTS (SELECT * FROM WORKS_ON
(a) Explain the following query in English (based on the company database) SELECT FNAME, LNAME, SSN FROM EMPLOYEE WHERE NOT EXISTS (SELECT * FROM WORKS_ON B WHERE (B.PNO IN (SELECT PNUMBER FROM PROJECT WHERE DNUM = 5) AND NOT EXISTS (SELECT * FROM WORKS_ON C WHERE C.ESSN = SSN AND C.PNO = B.PNO)) ); (b) Modify the query to list employees who work on any of the projects controlled by department number 5. (c) Write SQL statements (in MySQL) to get intersection, difference, and union sets of the following two tables. SELECT PNAME FROM PROJECT, DEPARTMENT, EMPLOYEE WHERE DNUM=DNUMBER AND MGRSSN=SSN AND LNAME='Wong'; SELECT PNAME FROM PROJECT, WORKS_ON, EMPLOYEE WHERE PNUMBER=PNO AND ESSN=SSN AND LNAME='Smith'; (d) Based on the company database, write a SQL statement to retrieve the project number, project name, and number of employees who work on that project with a condition that at least two employees must work on each project. (e) Explain why updates on materialized view are often difficult to perform. (f) Create a view named WhoWorks that includes tuples of the employees SSN, first name, last name, birth date, project name, and number of hours (for an employee works
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started