Re: Relationships - Mailing list pgsql-novice

From Joel Burton
Subject Re: Relationships
Date
Msg-id Pine.LNX.4.21.0101111132540.14673-100000@olympus.scw.org
Whole thread Raw
In response to Relationships  ("Mike Hammonds" <mhammonds@knowledgeinenergy.com>)
List pgsql-novice
> How do I create relationships in PgSQL or in PgAdmin?

Same way in most SQL-based databases: through the DDL statements such as
CREATE TABLE or ALTER TABLE.

For example

CREATE TABLE PARENT (ID INT PRIMARY KEY, LNAME TEXT);
CREATE TABLE CHILD  (PID INT REFERENCES PARENT, LNAME TEXT);

will "create a relationship" between the parent and child tables.
(If you're coming from a background in Access or something similar,
this creates a relationship
with "referential integrity" but without any cascades--PG supports
cascading; see CREATE TABLE man for details)

--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


pgsql-novice by date:

Previous
From: "Mike Hammonds"
Date:
Subject: Relationships
Next
From: Rosa Maria Carro Salas
Date:
Subject: RecordSets, getString and charSets