Relational Algebra Tutorial

Database | Home | Next page











 


The select operation is a unary operation, which means it operates on one relation. Its function is to select tuples that satisfy a given predicate. To denote selection, the lowercase Greek letter sigma () is used. The predicate appears as a subscript to . The argument relation is given in parentheses following the .

For example, to select those tuples of the loan relation where the branch is "Perryridge," we write:

branch-home = "Perryridge" (loan)

The results of the query are the following:

branch-name
loan-number
amount
Perryridge
Perryridge
L-15
L-16
1500
1300

Comparisons like =, , <, >, can also be used in the selection predicate. An example query using a comparison is to find all tuples in which the amount lent is more than $1200 would be written:

amount > 1200 (loan)

 

Database | Home | Top of page | Next page