Optimize the following SQL Query by using Query Tree and Heuristic Rules:
SELECT C.Fname, E.Fname
FROM Employee AS E, Customer AS C, Order AS O
WHERE E.EMP_ID=O.E_ID AND C.City='Jeddah' AND C.Customer_ID=O.C_ID AND E.EMP_ID='12943'
You should show the Initial Query Tree and add a screenshot of the Query Tree after applying each rule.
This is the query tree:
Query Tree:
Algebra symbol π > EMP_ID, E_ID, CUSTOMER_ID, C_ID, CITY, FNAME
EMP_ID = E_ID
CUSTOMER_ID = C_ID
σ (parser) EMP_ID = '12469'
σ
CITY = 'Jeddah'
Entities: Employee, Customer, Order
Here, σ is for parsing value o, keeping the entity values Employee, Customer, Order values denoted as oo, and attributes as TT.
-> o is for intersecting or joining the table.