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 |
||
1994.5.1
by Stewart Smith
WHERE clause example is just a simple one |
6 |
Simple SQL WHERE Syntax ::
|
1994.4.9
by Marisa Plumb
changes to clause file organization |
7 |
|
8 |
SELECT column_name(s)
|
|
9 |
FROM table_name
|
|
10 |
WHERE column_name operator value
|
|
11 |
|
|
1994.5.1
by Stewart Smith
WHERE clause example is just a simple one |
12 |
**Simple WHERE Clause Example**
|
1994.4.9
by Marisa Plumb
changes to clause file organization |
13 |
|
14 |
The "Persons" table: |
|
15 |
||
16 |
+---------+------------+----------+----------+--------+ |
|
17 |
|Id |LastName |FirstName |Address | City | |
|
18 |
+=========+============+==========+==========+========+ |
|
19 |
| 1 | Larson | Sue |3 Cherry | Chicago|
|
|
20 |
+---------+------------+----------+----------+--------+ |
|
1994.4.10
by Marisa Plumb
added outline for functions, modified clause related docs |
21 |
| 2 | Roberts | Teri |21 Brown | Chicago|
|
1994.4.9
by Marisa Plumb
changes to clause file organization |
22 |
+---------+------------+----------+----------+--------+ |
1994.4.10
by Marisa Plumb
added outline for functions, modified clause related docs |
23 |
| 3 | Peterson | Kari |30 Mell | Reno |
|
1994.4.9
by Marisa Plumb
changes to clause file organization |
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| |
|
1994.5.1
by Stewart Smith
WHERE clause example is just a simple one |
39 |
+---------+------------+----------+----------+--------+ |