1994.4.10
by Marisa Plumb
added outline for functions, modified clause related docs |
1 |
Where
|
2 |
=====
|
|
1994.4.9
by Marisa Plumb
changes to clause file organization |
3 |
|
4 |
The WHERE clause is used to extract only those records that fulfill a specified criterion. |
|
5 |
||
2165.2.5
by Andrew Hutchings
Make fixes to temporal docs |
6 |
Simple SQL WHERE Syntax: |
7 |
||
8 |
.. code-block:: mysql |
|
1994.4.9
by Marisa Plumb
changes to clause file organization |
9 |
|
10 |
SELECT column_name(s) |
|
11 |
FROM table_name |
|
12 |
WHERE column_name operator value |
|
13 |
||
1994.5.1
by Stewart Smith
WHERE clause example is just a simple one |
14 |
**Simple WHERE Clause Example**
|
1994.4.9
by Marisa Plumb
changes to clause file organization |
15 |
|
16 |
The "Persons" table: |
|
17 |
||
18 |
+---------+------------+----------+----------+--------+ |
|
19 |
|Id |LastName |FirstName |Address | City | |
|
20 |
+=========+============+==========+==========+========+ |
|
21 |
| 1 | Larson | Sue |3 Cherry | Chicago|
|
|
22 |
+---------+------------+----------+----------+--------+ |
|
1994.4.10
by Marisa Plumb
added outline for functions, modified clause related docs |
23 |
| 2 | Roberts | Teri |21 Brown | Chicago|
|
1994.4.9
by Marisa Plumb
changes to clause file organization |
24 |
+---------+------------+----------+----------+--------+ |
1994.4.10
by Marisa Plumb
added outline for functions, modified clause related docs |
25 |
| 3 | Peterson | Kari |30 Mell | Reno |
|
1994.4.9
by Marisa Plumb
changes to clause file organization |
26 |
+---------+------------+----------+----------+--------+ |
27 |
||
2165.2.5
by Andrew Hutchings
Make fixes to temporal docs |
28 |
If you want to select only the persons living in the city "Chicago" from the table above, use the following SELECT statement: |
29 |
||
30 |
.. code-block:: mysql |
|
1994.4.9
by Marisa Plumb
changes to clause file organization |
31 |
|
32 |
SELECT * FROM Persons |
|
33 |
WHERE City='Chicago' |
|
34 |
||
35 |
The result-set will look like this: |
|
36 |
||
37 |
+---------+------------+----------+----------+--------+ |
|
38 |
| Id |LastName |FirstName |Address |City |
|
|
2165.2.5
by Andrew Hutchings
Make fixes to temporal docs |
39 |
+=========+============+==========+==========+========+ |
1994.4.9
by Marisa Plumb
changes to clause file organization |
40 |
|1 | Larson | Sue |3 Cherry | Chicago| |
41 |
+---------+------------+----------+----------+--------+ |
|
42 |
|2 | Roberts | Teri |21 Brown | Chicago| |
|
1994.5.1
by Stewart Smith
WHERE clause example is just a simple one |
43 |
+---------+------------+----------+----------+--------+ |