Google Search

Custom Search

Thursday, July 2, 2009

Oracle SQL Operators for WHERE Clauses

Operator

Meaning

=

Equals

<

Less than

>

Greater than

<=

Less than or equal to

>=

Greater than or equal to

<>

Not equal to

BETWEEN

low AND

high

Greater than or equal to the low value and less than or equal to the

high value

EXISTS

(subquery)

At least one row is present in the subquery

IN (list or

subquery)

Equals one of the values in the list

LIKE

pattern

Matches the pattern

NOT BETWEEN

low AND high

Less than the low value or greater than the high value

NOT

EXISTS

(subquery)

No rows are present in the subquery

NOT IN

(list or

subquery)

Does not equal any of the values in the list

NOT LIKE

pattern

Does not match the pattern

IS

Used only with NULL as the value

IS NOT

Used only with NULL as the value

= ALL (list

or

subquery)

Equal to every value in the list

Note: If the list has at least two values, this test will fail.

!= ALL (list

or

subquery)

Does not equal even one of the values in the list

Note: This is identical to the NOT IN operator.

<>

or

subquery)

Less than all of the values in the list

> ALL (list or

subquery)

Greater than all of the values in the list

<= ALL (list

or subquery)

Less than or equal to all of the values in the list

>= ALL (list

or subquery)

Greater than or equal to all of the values in the list

= ANY (list or

subquery)

Equal to at least one value in the list

Note: This is identical to the IN operator.

<>

subquery)

Less than at least one value in the list

> ANY (list or

subquery)

Greater than at least one value in the list

<= ANY (list

or subquery)

Less than or equal to at least one value in the list

>= ANY (list

or subquery)

Greater than or equal to at least one value in the list

!= ANY (list

or subquery)

Does not equal every one of the values in the list

Note: If the list has at least two values, this test will fail.