SELECT Where
Specifies the search condition for the rows returned by the query.
Syntax​
[ WHERE <search_condition> ]
Arguments​
\< search_condition > Defines the condition to be met for the rows to be returned. There is no limit to the number of predicates that can be included in a search condition.
<search_condition> ::=
{ ( <search_condition> ) }
[ { AND | OR } { <predicate> | ( <search_condition> ) } ]
[ ,...n ]
<predicate> ::=
{ expression { = | ! = | > | > = | < | < = } expression
| ISNULL(expression)
| ~ "regex_expression"
Examples​
The following examples show how to use some common search conditions in the WHERE
clause.
A. Finding a row by using a simple equality​
SELECT sector
FROM companies
WHERE name = "Boston Properties"
B. Finding rows that contain a value as part of a string​
SELECT symbol
FROM financial.companies
WHERE symbol ~ "^[a-eA-E]*$"
C. Finding rows by using a comparison operator​
SELECT symbol, price
FROM financial.pricing
WHERE price <= 500
D. Finding rows that meet any of two conditions​
SELECT *
FROM financial.companies
WHERE name = "Humana Inc." OR name = "Ecolab Inc."
E. Finding rows that must meet several conditions​
SELECT symbol
FROM financial.pricing
WHERE pricing < 100 AND 52_week_low > 90