~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/where.rst

  • Committer: Brian Aker
  • Date: 2010-06-09 16:23:25 UTC
  • mto: This revision was merged to the branch mainline in revision 1609.
  • Revision ID: brian@gaz-20100609162325-1x09l345c6ulzrdt
MergeĀ enumĀ test

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
 
        SELECT column_name(s)
9
 
        FROM table_name
10
 
        WHERE column_name operator value
11
 
        
12
 
**Simple WHERE Clause Example**
13
 
 
14
 
The "Persons" table:
15
 
 
16
 
+---------+------------+----------+----------+--------+
17
 
|Id       |LastName    |FirstName |Address   |  City  |
18
 
+=========+============+==========+==========+========+
19
 
| 1       | Larson     | Sue      |3 Cherry  | Chicago|
20
 
+---------+------------+----------+----------+--------+
21
 
| 2       | Roberts    | Teri     |21 Brown  | Chicago|
22
 
+---------+------------+----------+----------+--------+
23
 
| 3       | Peterson   | Kari     |30 Mell   | Reno   |
24
 
+---------+------------+----------+----------+--------+
25
 
 
26
 
If you want to select only the persons living in the city "Chicago" from the table above, use the following SELECT statement: ::
27
 
 
28
 
        SELECT * FROM Persons
29
 
        WHERE City='Chicago'
30
 
 
31
 
The result-set will look like this:
32
 
 
33
 
+---------+------------+----------+----------+--------+
34
 
| Id      |LastName    |FirstName |Address   |City    |
35
 
+---------+------------+----------+----------+--------+
36
 
|1        | Larson     | Sue      |3 Cherry  | Chicago|
37
 
+---------+------------+----------+----------+--------+
38
 
|2        | Roberts    | Teri     |21 Brown  | Chicago|
39
 
+---------+------------+----------+----------+--------+