Saturday, November 13, 2010

BETWEEN and IN operators

The operators IN and BETWEEN facilitates selection of particular rows based on range or list of values.

'IN' operator is used to specify a list of values.

e.g.

SQL> select first_name,last_name from employees where first_name IN ('Anthony','Sarah','Kevin');

would list employees whose first_name is either of the list.


'BETWEEN' operator is used to specify a range of values.

e.g.

SQL> select first_name,last_name from employees where salary between 1000 and 3000;

would list employees whose salary is between 1000 and 3000, both inclusive.


Have a question or comment? Post it below!


0 Comments:

Post a Comment