Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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