Domain Relational Calculus
Tom Kelliher, CS 318
Feb. 27, 2002
Collect assignment. Distribute next assignment.
Read 7.2, 7.5.
Tuple relational calculus.
- Introduction to DRC.
- Examples.
- Practice.
The ``Big Merge.''
- Visual query languages (QBE, Access) are based upon this.
- Simple example DRC query:
- General form of a TRC query:
where:
- is a domain variable which ranges over all possible
values for that domain.
- Condition is (these are similar to TRC):
- Atomic:
- , asserting that the tuple formed by
the s is in relation R.
- or .
- Two conditions combined using AND or OR, or one condition
modified by NOT.
- A condition (C), Relation (R), and domain variable (X) combined
as
- The s in the target may be the only free variables.
- The meaning of a DRC query is similar to that of a TRC query.
- Retrieve names of all professors who have taught
MGT123
:
This can be abbreviated:
(Non-target free variables are implicitly existentially quantified used the
universal domain.)
- All courses that have been taken by every student:
- Find all students who have ever taken a course from every professor
who has ever taught a course.
- Retrieve IDs of students who did not take any courses in F2001:
- Find potential student graders for this semester's courses:
Write DRC queries to answer the following:
- Retrieve name of student with largest ID number.
- Names of all professors who have taught CS318.
- The names of all sophomores who received A's during the F2001
semester.
- The IDs of all students who took exactly one course during the F2001
semester.
- The IDs of all students who have taken a course with me.
- The IDs of all students who have taken every course I've taught.
Thomas P. Kelliher
Fri Feb 22 09:44:24 EST 2002
Tom Kelliher