Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

Delegate authority and responsibility.

Answered: 1 week ago

Question

=+ Of the HR issues mentioned in the case,

Answered: 1 week ago