Exercise 20.8 For each of the following queries, identify one possible reason why an optimizer might not find a good plan. Rewrite the query so that a good plan is likely to be found. Any available indexes or known constraints are listed before each query; assume that the relation schemas are consistent with the attributes referred to in the query.
SELECT E.dnoFROM Employee EWHERE E.age=20 OR E.age=10
SELECT E.dnoFROM Employee EWHERE E.age<20 AND E.age>10
SELECT E.dnoFROM Employee EWHERE 2*E.age<20
SELECT DISTINCT *FROM Employee E
SELECT AVG (E.sal)FROM Employee EGROUP BY E.dnoHAVING E.dno=22
SELECT S.sidFROM Sailors S, Reserves RWHERE S.sid=R.sid
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.