What is this Site!!

All about Real time requirements in Orale Stay Tune!!
Showing posts with label Range and List operators. Show all posts
Showing posts with label Range and List operators. Show all posts

Friday, February 8, 2008


>>Previous>>


Comparison Operators


One can use comparison operators like >,<, >=, =<, =, <>, !=, !>, !<, () Example SELECT emp_id,lname,fname FROM employee WHERE pub_id='0877'


Range

One can retrieve rows based on a range of value using the BETWEEN keyword

Example

Select lname, emp_if
FROM Employee
WHERE hire_date between '10/1/92' AND '12/31/92'

OR

Select lname, emp_iD
FROM Employee
WHERE lname NOT between 'a' AND 'e'

Smaller value must come first in BETWEEN clause

Also one must enclose range in quotes if its character data types or date data types


Lists

One can use IN Keyword to match rows in a list

SELECT Column_list
FROM table_name
WHERE column_name [NOT] IN (value_list)
Example

SELECT emp_id, lname, fname
FROM employee where pub_id IN ('0877','9990')

OR

SELECT emp_id, lname, fname, pub_id
FROM employee where pub_id NOT IN ('0877','9990')

One can use the NOT operator to exclude a certain set of data and retrieve the rest. The NOT operator excludes all records that meet the criteria one specifies


>>>Next>>>