Relational Algebra Tutorial

Database | Home | Next page











 


The union operation yields the results that appear in either or both of two relations. It is a binary operation denoted by the symbol .

An example query would be to find the name of all bank customers who have either an account or a loan or both. To find this result we will need the information in the depositor relation and in the borrower relation. To find the names of all customers with a loan in the bank we would write:

customer-name (borrower)

and to find the names of all customers with an account in the bank, we would write:

customer-name (depositor)

Then by using the union operation on these two queries we have the query we need to obtain the wanted results. The final query is written as:

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

The result of the query is the following:

customer-name

Johnson
Smith
Hayes
Turner
Jones
Lindsay
Jackson
Curry
Williams
Adams

 

Database | Home | Top of page | Next page