Consider two ways to compute the names of employees who earn more than $100,000 and whose age

Question:

Consider two ways to compute the names of employees who earn more than $100,000 and whose age is equal to their manager's age. First, a nested query:
Consider two ways to compute the names of employees who

Second, a query that uses a view definition:
SELECT E1.ename
FROM Emp E1, MgrAge A
WHERE E1.dname = A.dname AND E1.sal > 100 AND E1.age = A.age
CREATE VIEW MgrAge (dname, age)
AS SELECT D.dname, E.age
FROM Emp E, Dept D
WHERE D.mgr = E.ename
1. Describe a situation in which the first query is likely to outperform the second query.
2. Describe a situation in which the second query is likely to outperform the first query.
3. Can you construct an equivalent query that is likely to beat both these queries when every employee who earns more than $100,000 is either 35 or 40 years old? Explain briefly.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Database management systems

ISBN: 978-0072465631

3rd edition

Authors: Raghu Ramakrishan, Johannes Gehrke, Scott Selikoff

Question Posted: