The where clause in a select statement specifies the search conditions that determine which rows are retrieved. The general format is:
select select_list from table_list where search_conditions
Search conditions, or qualifications, in the where clause include:
Comparison operators (=, <, >, and so on)
where advance * 2 > total_sales * price
Ranges (between and not between)
where total_sales between 4095 and 12000
Lists (in, not in)
where state in ("CA", "IN", "MD")
Character matches (like and not like)
where phone not like "415%"
Unknown values (is null and is not null)
where advance is null
Combinations of search conditions (and, or)
where advance < 5000 or total_sales between 2000 and 2500
The where keyword can also introduce:
Join conditions (see Chapter 4, “Joins: Retrieving Data from Several Tables”)
Subqueries (see Chapter 5, “Subqueries: Using Queries Within Other Queries”)
The only where condition that you can use on text columns is like (or not like).
For more information on search conditions, see the “where Clause” section in the Reference Manual.
Copyright © 2005. Sybase Inc. All rights reserved. |