selection operation in relational algebra, unary operations in relational model, unary selection operation in relational algebra
SELECT (σ) in Relational Algebra
| 
Operation | 
SELECT | ||||||||||||||||||||||||||||||||
| 
Type of operation | 
Unary | ||||||||||||||||||||||||||||||||
| 
Syntax | 
σ <selection
  condition> (R) 
In
  the above expression, 
σ – selection operator
   
<selection condition> - <Attribute> <comparison
  operator> <value/other attribute> 
comparison operators are {=,
  <, <=, >, >=, <>} 
 
More
  than one conditions can be used and those conditions can be connected using
  logical connectives ^ (and), v (or), and ¬ (not). 
Example:        
regno = ‘BIT001’ ^
  age<65 
student.regno =
  subject_taken.regno v age > 20 ^ age<65 
R – Relation name [or
  another expression] | ||||||||||||||||||||||||||||||||
| 
Function | 
Selects all
  tuples (records) that satisfy the selection condition from a relation R (or
  an expression). 
It filters
  records according to the condition. It deals with the tuples (records) of a relation. In SQL, the selection operation is specified in WHERE clause of the query. | ||||||||||||||||||||||||||||||||
| 
Example 1 | 
RA: σage>15
  (student) 
SQL: SELECT * FROM student WHERE age>15; 
 
Result: Finds all
  students with age greater than 15 
 | ||||||||||||||||||||||||||||||||
| 
Example 2 | 
RA: σage>15^phone=9202092020 (student) 
SQL: SELECT * FROM student WHERE age>15 and
  phone = 9202092020; 
Result:
  Finds
  all students whose age greater than 15 and having phone 9202092020. 
 | 
*****************
Go to Relational Algebra Operations page
 
No comments:
Post a Comment