table inheritance

Started by Renaud Tthonnartalmost 25 years ago3 messagesgeneral
Jump to latest
#1Renaud Tthonnart
thonnart@amwdb.u-strasbg.fr

Hi!

Could someone give me a easy example of creating and using table
inheritance?

Thank you!

Sincerely,
Renaud THONNART

#2Janning Vygen
vygen@planwerk6.de
In reply to: Renaud Tthonnart (#1)
Re: table inheritance

Am Sonntag, 13. Mai 2001 15:28 schrieb Renaud Thonnart:

Hi!

Could someone give me a easy example of creating and using table
inheritance?

lokk in the tutorial shipped with postgres:
Chapter 6. Advanced Postgres SQL Features (advanced.htm)

-- from postgres tutorial ---
Inheritance

Let's create two classes. The capitals class contains state capitals which
are also cities. Naturally, the capitals class should inherit from cities.

CREATE TABLE cities (
name text,
population float,
altitude int -- (in ft)
);

CREATE TABLE capitals (
state char(2)
) INHERITS (cities);

[.....]

janning

--
Planwerk 6 /websolutions
Herzogstra���e 86
40215 D���sseldorf

fon 0211-6015919
fax 0211-6015917
http://www.planwerk6.de

#3Renaud Tthonnart
thonnart@amwdb.u-strasbg.fr
In reply to: Renaud Tthonnart (#1)
Re: table inheritance

Thanks for your help Janning !
Renaud THONNART

Janning Vygen wrote:

Show quoted text

Am Sonntag, 13. Mai 2001 15:28 schrieb Renaud Thonnart:

Hi!

Could someone give me a easy example of creating and using table
inheritance?

lokk in the tutorial shipped with postgres:
Chapter 6. Advanced Postgres SQL Features (advanced.htm)

-- from postgres tutorial ---
Inheritance

Let's create two classes. The capitals class contains state capitals which
are also cities. Naturally, the capitals class should inherit from cities.

CREATE TABLE cities (
name text,
population float,
altitude int -- (in ft)
);

CREATE TABLE capitals (
state char(2)
) INHERITS (cities);

[.....]

janning

--
Planwerk 6 /websolutions
Herzogstra�e 86
40215 D�sseldorf

fon 0211-6015919
fax 0211-6015917
http://www.planwerk6.de

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl