What to do with no foreign keys

From: Brian <signal(at)shreve(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: What to do with no foreign keys
Date: 1998-07-09 19:33:13
Message-ID: Pine.LNX.3.96.980709141741.13012A-100000@mercury.shreve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If I have two tables, which are like this:

baseball_team
-------------
team_name
number_of_players
games_played
total_runs

baseball_game
-------------
home_team_name
visitor_team_name
home_runs
visitor_runs

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

I have seen in books things like:

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

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

Brian

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeffrey Napolitano 1998-07-09 20:52:15 Moving Databases
Previous Message Kurt Seel 1998-07-09 16:56:27 upgrade question