Mapping SQL to Relational Algebra
A given SQL query typically has many translations to RA.
For example:
SELECT s.name, e.subj
FROM Students s, Enrolments e
WHERE s.id = e.sid AND e.mark > 50;
|
is equivalent to any of
- πs.name,e.subj( σs.id=e.sid ∧ e.mark>50 ( Students × Enrolments ) )
- πs.name,e.subj( σs.id=e.sid ( σe.mark>50 ( Students × Enrolments ) ) )
- πs.name,e.subj( σe.mark>50 ( Students ⋈s.id=e.sid Enrolments ) ) )
|