

















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















































Lecture 13: Relational Algebra
With only minor additions and adaptations, yesterday’s bit of
pure maths becomes a useful theory of databases.
The plan for todays lectures is to
start with a simple SQL query
develop the maths until we can express that same query in
relational algebra
along the way, see what algebraic rules we can use to
manipulate it
This material is from [E&N §6.1 - 6.5, §8.4]
Assignment 1 is on the course web page, due 5pm, Friday
5th September. No marks for late submissions.
Assignment 1 is on the course web page, due 5pm, Friday
5th September. No marks for late submissions.
both paper and electronic submission required
please read assignment sheet carefully and understand
what is required
Assignment 1 is on the course web page, due 5pm, Friday
5th September. No marks for late submissions.
both paper and electronic submission required
please read assignment sheet carefully and understand
what is required
see the “pick and pack” example
Assignment 1 is on the course web page, due 5pm, Friday
5th September. No marks for late submissions.
both paper and electronic submission required
please read assignment sheet carefully and understand
what is required
see the “pick and pack” example
Mid-semester exam is on Wednesday 10th September,
starting 12:50, for one hour, at Melville Hall.
last years mid-test paper is on the course web page
Our toy organisation wants to review employees in finance and
administration departments.
(Database from Lab 1)
Our toy organisation wants to review employees in finance and
administration departments.
(Database from Lab 1)
SELECT enumber,fname,lname,dname
FROM employee,department
WHERE (dname=’Administration’ OR dname=’Finance’)
AND dnumber=dno;
We will express this query as mathematics.
We write | A | for the number of elements in a set A.
We write | A | for the number of elements in a set A.
Here’s a few cute facts about set size.
i ∈ I Ai
i ∈ I | Ai |
We write | A | for the number of elements in a set A.
Here’s a few cute facts about set size.
i ∈ I Ai
i ∈ I | Ai |
ie | • | is a product homomorphism
We write | A | for the number of elements in a set A.
Here’s a few cute facts about set size.
i ∈ I Ai
i ∈ I | Ai |
ie | • | is a product homomorphism
| A ∩ B | ≤ | A | and | A ∩ B | ≤ | B |
We write | A | for the number of elements in a set A.
Here’s a few cute facts about set size.
i ∈ I Ai
i ∈ I | Ai |
ie | • | is a product homomorphism
| A ∩ B | ≤ | A | and | A ∩ B | ≤ | B |
Recall that an indexed set is a set whose elements have
names.
We can use those names to extract the elements.
Recall that an indexed set is a set whose elements have
names.
We can use those names to extract the elements.
π city { city = Paris , custID = 11 } = { city = Paris }
π 1 , 3 ( 2 , 11 , 42 ) = ( 2 , 42 )