Previous |
Next
What is the SQL WHERE clause?The SQL WHERE clause is that part of SQL statements that specifies which data is to be accessed. It establishes conditions that control the results of a SQL statements. Why Use the SQL WHERE clause?Anytime you want to access certain rows within a table use the SQL WHERE clause. You could use it to:
How To Use the SQL WHERE ClauseThe SQL WHERE clause is used as follows. SQL WHERE Clause Syntax
Each condition tests column(s) using comparison operator(s). The following basic comparison operators are supported:
The comparison may involve literal value(s) that are constants like:
Alphanumeric literals are enclosed in single quotes ('XXX'). SQL WHERE Clause Example 1 The product table contains four rows, including one row with a product_status_code with a value of Inactive. We will use the SQL WHERE clause to filter for Active rows:
Results from the execution of the SQL SELECT statement with the WHERE clause are as follows:
SQL WHERE Clause Example 2 The customer table contains five rows, including two rows that have credit_balance_amt greater than credit_limit_amt. We will use the SQL WHERE clause to filter for Active rows:
Results from the execution of the SQL SELECT statement with the WHERE clause are as follows:
|
SQL OVERVIEW
SQL BASICS
SQL SELECT
SQL WHERE
SQL INSERT
SQL UPDATE
SQL DELETE
SQL ADMINISTRATION
SQL CREATE DATABASE
SQL DROP DATABASE
SQL CREATE TABLE
SQL ALTER TABLE
SQL DROP TABLE
SQL CREATE INDEX
SQL DROP INDEX
SQL ADD FOREIGN KEY
SQL DROP FOREIGN KEY
SQL CREATE VIEW
SQL DROP VIEW
SQL ADVANCED
SQL CONCAT
SQL SUBSTRING
SQL TRIM
SQL AND & OR
SQL IN
SQL BETWEEN
SQL LIKE
SQL DISTINCT
SQL GROUP BY
SQL AGGREGATE
SQL HAVING
SQL ORDER BY
SQL JOIN
SQL OUTER JOIN
SQL SYNTAX
| HOME | SQL OVERVIEW | SQL BASICS | SQL ADMINISTRATION | SQL ADVANCED | SQL SYNTAX |
| Copyright© 1999-2006, First Place Software, Inc. |






