Skip to main content

System Status: 

SQL Where Clause Review

See how SQL where clauses work.

In SQL, where clauses set the search conditions in a select statement.

Note: If you don't know the SQL programming language, you can use QueryLink by clicking the Queries button in FinancialLink, EmployeeLink, Student/ Class Info tools, and DataLink.

Remember, if you have more than one search condition within your statement, you must connect them with AND or OR.

Search condition Usage
between Specifies a numeric range that includes the endpoints in a chosen row:
where column_name between value1 AND value2
in [not in] Includes or excludes a particular set of data that matches one of a list of values:
where column_name in(value1,value2,value3)
like [not like] Like compares two character strings for a partial match:
Percent sign (%) — any string of characters, 0 or more characters in length
Underscore (_) — any single character
Not like retrieves all rows that do not satisfy a partial match.
null Finds all rows where the value in the selected column is null:
where column_name is (not) null
all, any All retrieves all data within the specified table.
Any retrieves more specific data in the relevant search.
exists [not exists] Use in conjunction with a subquery to determine if the relevant data exists. If so, the exists condition is satisfied, and the search is conducted for specified data within a table.

For more detailed instructions on SQL, enroll in a SQL training class.

For more information, contact the Data Warehouse team.