Relational Algebra Tutorial

Database | Home











 


The set-difference operation, denoted by the -, results in finding tuples taht are in one relation but are not in another. The expression r - s results in a relation containing those tuples in r abut not in s.

For example, the query to find all customers of the bank who have an account but not a loan, is written as:

customer-name (depositor) - customer-name (borrower)

The result of the query is the following:

customer-name

Johnson
Turner
Lindsay

For a set difference to be valid, it must be taken between compatible operations just as in the union operation.

Database | Home | Top of page