Relational schema


#1

Consider the following relations:
Emp (eno, ename, title, city)
Project (pno, pname, budget)
Works (eno, pno)
Pay (title, salary)
Which query finds what fraction of the budget is spend on salaries for the people working on that project.

A)SELECT P.pno, pname, sal/budget AS frac
FROM project P, (SELECT pno, sum(salary) AS sal
FROM works, Emp,Pay
WHERE works.eno=Emp.eno AND Emp.title=Pay.title
GROUP by pno) AS Q
WHERE P.no=Q.pno
B)SELECT P.pno, pname, sum(salary)/budget AS frac
FROM project P, works W,Emp E, Pay
WHERE P.pno=W.pno AND W.eno = E.eno AND E.title=Pay.title
GROUP BY P.pno, budget
C)Both A and B
D)None of these


#2

I think it’s C. Since you can draw a temp table and try to execute the queries.