Introduction to Relational Calculus

by K. Yue

1. Introduction

Example:

{i | i ∈ I ∧ i % 2 =0}
{i | i ∈ I, i % 2 =0} -- set builder form.

{t | ∃r ∈R, r.firstname = t.firstname, r.lastname = t.lastname}

Alternatively, we can use the set builder form in the LHS before |:

{(r.firstname, r.lastname) | r ∈ R}

R(A,B,C,D) / S(C,D)

{(a,b) | ∀(c,d) ∈ S((a,b,c,d) ∈ R))}

Exercises:

How do you use RC to implement RA operations?

2. TRC

Exercise:

Work on some of the query questions listed in the Supplies database example in TRC.

3. DRC

Exercise:

Work on some of the query questions listed in the Supplies database example in DRC.