Oracle
Comparison Conditions
Figo Kim
2006. 8. 27. 00:18
- BETWEEN ... AND ... : Between two values (inclusive)
ex) BETWEEN lower_value AND higher_value
- IN (set) Match any of a list of values
The IN condition can be used with any data type.
If characters or dates are used in the list, they must be enclosed by single quotation marks.('')
SELECT employee_id, last_name, salary, manager_id
FROM employees
WHERE manager_id IN (100,101,201); - LIKE : Match a character pattern
To perform wildcard searches of valied search string values.
Search conditions ca contain either literal characters or numbers.
- % denotes zero or many characters.
- "_" denotes one character.
- When you need to have an exact match for the actaul '%' and _ character, use the ESCAPE option
SELECT first_name
FROM employees
WHERE first_name LIKE 'S%'
SELECT employee_id, last_name,job_id
FROM employees
WHERE job_id LIKE '%SA\_%' ESCAPE'\'
- IS NULL : Is a null value (IS NOT NULL)
SELECT last_name,manager_id
FROM employees
WHERE manager_id IS NULL
- ETC : =,<,>,>=,<=,<>,^=, !=