|
6 | 6 | -- |
7 | 7 | -- Copyright (c) 1994, Regents of the University of California |
8 | 8 | -- |
9 | | --- $Id: advanced.source,v 1.4 2001/09/02 23:27:50petere Exp $ |
| 9 | +-- $Id: advanced.source,v 1.5 2002/04/11 21:18:50tgl Exp $ |
10 | 10 | -- |
11 | 11 | --------------------------------------------------------------------------- |
12 | 12 |
|
13 | 13 | ----------------------------- |
14 | 14 | -- Inheritance: |
15 | | ---S table can inherit from zero or more tables. A query can reference |
| 15 | +--A table can inherit from zero or more tables. A query can reference |
16 | 16 | --either all rows of a table or all rows of a table plus all of its |
17 | 17 | --descendants. |
18 | 18 | ----------------------------- |
@@ -41,19 +41,19 @@ INSERT INTO capitals VALUES ('Madison', 1.913E+5, 845, 'WI'); |
41 | 41 | SELECT * FROM cities; |
42 | 42 | SELECT * FROM capitals; |
43 | 43 |
|
44 | | --- like before, a regular query references rows of the base table only |
45 | | - |
46 | | -SELECT name, altitude |
47 | | -FROM cities |
48 | | -WHERE altitude > 500; |
49 | | - |
50 | | --- on the other hand, you can find all cities, including capitals, that |
51 | | --- are located at an altitude of 500 'ft or higher by: |
| 44 | +-- You can find all cities, including capitals, that |
| 45 | +-- are located at an altitude of 500 ft or higher by: |
52 | 46 |
|
53 | 47 | SELECT c.name, c.altitude |
54 | | -FROM cities* c |
| 48 | +FROM cities c |
55 | 49 | WHERE c.altitude > 500; |
56 | 50 |
|
| 51 | +-- To scan rows of the parent table only, use ONLY: |
| 52 | + |
| 53 | +SELECT name, altitude |
| 54 | +FROM ONLY cities |
| 55 | +WHERE altitude > 500; |
| 56 | + |
57 | 57 |
|
58 | 58 | -- clean up (you must remove the children first) |
59 | 59 | DROP TABLE capitals; |
|