SQL Basic
SQL Advanced
SQL Functions
| SQL Where |
|
The WHERE clause is used to filter records. The WHERE ClauseThe WHERE clause is used to extract only those records that fulfill a specified criterion. SQL WHERE Syntax
WHERE Clause ExampleThe "Persons" table:
Now we want to select only the persons living in the city "Sandnes" from the table above. We use the following SELECT statement:
The result-set will look like this:
Quotes Around Text FieldsSQL uses single quotes around text values (most database systems will also accept double quotes). Although, numeric values should not be enclosed in quotes. For text values:
For numeric values:
Operators Allowed in the WHERE ClauseWith the WHERE clause, the following operators can be used:
Note: In some versions of SQL the <> operator may be written as != |
SQL Where