The SQL statements comprising the DDL for the COMPANY Database are given to you.
ID: 3912577 • 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.
9. [9A] Create a View ProjectInfo that has the project name, controlling department name, number of employees, and total hours worked per week on the project for each project with more than one employee working on it. [9B] Show the contents of this view.
Explanation / Answer
If you have any doubts, please give me comment....
9A)
CREATE VIEW Project_Info AS
SELECT Pname, Dname, COUNT(W.Essn), SUM(W.Hours)
FROM PROJECT P, DEPARTMENT D, WORKS_ON W
WHERE P.Dnum=D.Dnumber AND P.Pnumber=W.Pno
GROUP BY Pno;
9B)
SELECT * FROM ProjectInfo;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.