Revision section 3 Flashcards
1
Q
What do you need to do for:
Write the relational algebra expression for the following query:
SELECT E.NAME, P.NAME
FROM EMPLOYEE E, PROJECT P
WHERE P.PID = E.PID AND E.SALARY > 50000
A
Write the canonical expression
project(select(join))
It doesn’t ask for the most optimal.
2
Q
When creating an optimisation tree, if there are only 2 relations which one goes on the LHS?
A
The PK.
3
Q
What is the IN operator for?
A
It is short hand for OR
ie., ID in (1,2) is ID in 1 or 2