Re: [GENERAL] What to do with no foreign keys - Mailing list pgsql-general

From Sferacarta Software
Subject Re: [GENERAL] What to do with no foreign keys
Date
Msg-id 0526.980710@bo.nettuno.it
Whole thread Raw
In response to What to do with no foreign keys  (Brian <signal@shreve.net>)
Responses Re: [GENERAL] What to do with no foreign keys  (Bruce Tong <zztong@laxmi.ev.net>)
List pgsql-general
Hello Brian,

giovedì, 9 luglio 98, you wrote:



B> If I have two tables, which are like this:

B> baseball_team
B> -------------
B> team_name
B> number_of_players
B> games_played
B> total_runs


B> baseball_game
B> -------------
B> home_team_name
B> visitor_team_name
B> home_runs
B> visitor_runs



B> How can I insure that for example "home_team_name" is one of
B> "baseball_team.team_name"?

B> I have seen in books things like:

B> PRIMARY KEY: home_team
B> FOREIGN KEY: home_team JOIN TO baseball_team.team_name

B> is there anyway to do this in postgresql? Bascially I have like 12 tables,
B> and alot of them have a field "username".  I want to insure that
B> "username" in all tables, is a valid username in "passwd.username".

B> Brian


B> /-------------------------- signal@shreve.net -----------------------------\
B> | Brian Feeny                | USR TC Hubs | ShreveNet Inc. (318)222-2638  |
B> | Network Administrator      | Perl, Linux | Web hosting, online stores,   |
B> | ShreveNet Inc.             |  USR Pilot  | Dial-Up 14.4-56k, ISDN & LANs |
B> | 89 CRX DX w/MPFI, lots of  |-=*:Quake:*=-| http://www.shreve.net/        |
B> | mods/Homepage coming soon  |LordSignal/SN| Quake server: 208.206.76.47   |
B> \-------------------------- 318-222-2638 x109 -----------------------------/


Take a look at .../contrib/spi/refint.example.

Best regards,
 Jose'                            mailto:sferac@bo.nettuno.it



pgsql-general by date:

Previous
From: Sferacarta Software
Date:
Subject: Re[2]: [GENERAL] COALESCE() or NVL()
Next
From: Bruce Tong
Date:
Subject: Re: [GENERAL] What to do with no foreign keys