Reprence Html CSS javascript PHP MySQL Bootsrap

The MySQL WHERE Clause

The WHERE clause is used to filter records.

It is used to extract only those records that fulfill a specified condition.


WHERE Syntax

9


10

Demo Database

Below is a selection from the "Customers" table in the Northwind sample database:

11

WHERE Clause Example

The following SQL statement selects all the customers from "Mexico":


Text Fields vs. Numeric Fields

SQL requires single quotes around text values (most database systems will also allow double quotes). However, numeric fields should not be enclosed in quotes:


Operators in The WHERE Clause

The following operators can be used in the WHERE clause:

12