~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/where.rst

  • Committer: Brian Aker
  • Date: 2010-12-30 15:50:18 UTC
  • mto: This revision was merged to the branch mainline in revision 2041.
  • Revision ID: brian@tangent.org-20101230155018-bacjzhn8vfd57his
Update support since we support this syntax now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Where
2
 
=====
3
 
 
4
 
The WHERE clause is used to extract only those records that fulfill a specified criterion.
5
 
 
6
 
Simple SQL WHERE Syntax:
7
 
 
8
 
.. code-block:: mysql
9
 
 
10
 
        SELECT column_name(s)
11
 
        FROM table_name
12
 
        WHERE column_name operator value
13
 
        
14
 
**Simple WHERE Clause Example**
15
 
 
16
 
The "Persons" table:
17
 
 
18
 
+---------+------------+----------+----------+--------+
19
 
|Id       |LastName    |FirstName |Address   |  City  |
20
 
+=========+============+==========+==========+========+
21
 
| 1       | Larson     | Sue      |3 Cherry  | Chicago|
22
 
+---------+------------+----------+----------+--------+
23
 
| 2       | Roberts    | Teri     |21 Brown  | Chicago|
24
 
+---------+------------+----------+----------+--------+
25
 
| 3       | Peterson   | Kari     |30 Mell   | Reno   |
26
 
+---------+------------+----------+----------+--------+
27
 
 
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
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    |
39
 
+=========+============+==========+==========+========+
40
 
|1        | Larson     | Sue      |3 Cherry  | Chicago|
41
 
+---------+------------+----------+----------+--------+
42
 
|2        | Roberts    | Teri     |21 Brown  | Chicago|
43
 
+---------+------------+----------+----------+--------+