~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/where.rst

  • Committer: Lee Bieber
  • Date: 2011-01-08 01:57:02 UTC
  • mfrom: (1994.4.21 drizzle)
  • mto: This revision was merged to the branch mainline in revision 2063.
  • Revision ID: kalebral@gmail.com-20110108015702-d9mc4jwppb9vej94
Merge Marisa - latest doc updates, fix sphinx warnings

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
SQL WHERE Syntax ::
 
7
 
 
8
        SELECT column_name(s)
 
9
        FROM table_name
 
10
        WHERE column_name operator value
 
11
        
 
12
**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
+---------+------------+----------+----------+--------+
 
 
b'\\ No newline at end of file'