Is there a way to create a program to rewrite a query in an optimal form. If so, how? What can I do to implement this.
Rewrite
SELECT EMPOYEE.EMPNO, POSITION
FROM EMPLOYEE E, JOBHISTORY J
WHERE E.EMPNO = J.EMPNO
AND STARTDATE <= ENDDATE
AND SALARY <= 3000
into
SELECT EMPLOYEE.EMPNO, POSITION
FROM EMPLOYEE E, JOBHISTORY J
WHERE E.EMPNO = J.EMPNO
AND SALARY <= 3000;
because "AND STARTDATE <= ENDDATE is not needed in the first query.