Question: Based on company database (a) Explain what would be retrieved by the following query SELECT DISTINCT PNUMBER FROM PROJECT WHERE PNUMBER IN (SELECT PNUMBER FROM

 Based on company database (a) Explain what would be retrieved by

Based on company database (a) Explain what would be retrieved by the following query SELECT DISTINCT PNUMBER FROM PROJECT WHERE PNUMBER IN (SELECT PNUMBER FROM PROJECT, DEPARTMENT, EMPLOYEE WHERE DNUM-DNUMBER AND MGRSSN = SSN AND LNAME = 'Smith') OR PNUMBER IN (SELECT PNO FROM WORKS ON, EMPLOYEE WHERE ESSN = SSN AND LNAME = 'Smith'); (b) Explain what would be retrieved by the following query select distinct pnumber from project, department, employee, works_on where (dnum= dnumber and mgrssn=ssn and lname='smith') or (Pnumber = pno and essn = ssn and lname='smith'); (c) Write a SQL statement to retrieve a list of all project names of the projects, which involve an employee whose last name is 'Smith' as a worker on the project, or as a manager of the department that controls the project (d) Write a SQL to retrieve a list of employees and the projects they are working on, ordered by the employee's department, and within each department ordered alphabetically by employee last name (e) Write a SQL statement to retrieve the project number, project name, and the number of employees who work on that project for each project. (f) Explain a view, and explain the view created by the following SQL statement: CREATE VIEW WORKS ON AS SELECT FNAME, LNAME, PNAME, HOURS FROM EMPLOYEE, PROJECT, WORKS ON WHERE SSN = ESSN AND PNO-PNUMBER

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!