Thursday, October 22, 2015

Relational Algebra: Select Operator



Relational Algebra

A query language is a language in which a user requests information from the database. These languages can be categorized as either procedural or non-procedural. The relational algebra is procedural. Here I introduce the SELECT operator in relational algebra.

 The SELECT Operation          

The select operation selects tuples that satisfy a given condition. The select operation is denoted by the Greek letter sigma (σ) The condition appears as a subscript to σ. The relation is enclosed in parenthesis after the σ.

Considering the Banking Enterprise problem, if we want to select those tuples of the loan relation where the branch is “Kakrail”, we write:


 σ                      (Loan) 
     branch_name=“kakrail” 
               
 
Another problem to find all tuples of loan relation in which the amount lent is more than Tk1000 can be solved as :

 σ         (Loan)
     amount>1000           
               
             
              














In general, we allow comparisons using =, !=, <, <=, >, >= in the selection condition.

To find those tuples of loan relation in which the amount lent is more than Tk1000 made by Kakrail branch, we write:



         σ                                           (Loan)
             branch_name=”kakrail” Λ amount>1000
 

Here Λ stands for AND.


 






        


 



No comments:

Post a Comment