Re: Flamewar object databases vs. relational databases (was: Unknown SQL)
Date: Sat, 21 Jul 2001 23:29:42 GMT
Message-ID: <f0f51c80.0106041056.783aa2fc_at_posting.google.com>
> Could you please provide samples for insert and select statements?
> Thanks!
Sure.
CREATE TABLE cities (name text,population int,altitude int); CREATE TABLE capitals (state char(2)) INHERITS (cities);
Insert a city (not a state capital):
INSERT INTO cities VALUES ('Provo', 350000, 4500);
Insert a state capital:
INSERT INTO capitals ('Salt Lake City', 500000, 5000, 'UT');
Select all cities:
SELECT * FROM cities;
| name | population | altitude | Provo | 350000 | 4500 | Salt Lake City | 500000 | 5000
Select all captials:
SELECT * FROM capitals;
| name | population | altitude | state | Salt Lake City | 500000 | 5000 | UT
Select only cities:
SELECT * FROM ONLY cities;
| name | population | altitude | Provo | 350000 | 4500
> Lee, someone, whoever:
> Does this conform to relational theories?
> Is there a common standard for select statements?
This is a non-standard extension to SQL. It actually supports multiple inheritance. SQL99 supports this type single inheritance but uses a different syntax.
Adam Ruth Received on Sun Jul 22 2001 - 01:29:42 CEST