WHERE

Used to specify a selection criteria for specific records:

mysql> select First, Surname from Students WHERE Town=’London’;
+-------+---------+
| First | Surname |
+-------+---------+
| Pam   | Frost   |
| David | Smith   |
| Julia | James   |
+-------+---------+
3 rows in set (0.00 sec)

In this example, just the First and Surname fields have been requested for the criteria WHERE Town=’London’

 

 

Operators 

^ Match at Beginning of Line
= Equal
<> Not equal
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
BETWEEN Between an inclusive range
LIKE Search for a pattern
IN To specify multiple possible values for a column

 

This example selects records where the Score is less than 70:

mysql> select First, Surname from Students WHERE Score < ’70’;
+-------+---------+
| First | Surname |
+-------+---------+
| Andy  | Jones   |
| Phil  | Watson  |
| Terry | Waite   |
+-------+---------+
3 rows in set (0.00 sec)

Leave a Reply