[prev] 5 [next]

Recap on Implementing Selection

Selection =  select * from  R  where  C
  • yields a subset of R tuples satisfying condition C
  • a very important (frequent) operation in relational databases
Types of selection determined by type of condition
  • one:  select * from  R  where id =  k
  • pmr:  select * from  R  where age=65  (1-d)

             select * from  R  where age=65 and gender='m'  (n-d)
  • rng:   select * from  R  where age≥18 and age≤21  (1-d)

             select * from  R  where age between 18 and 21  (n-d)
                                                 and height between 160 and 190