__Orgs__
id
name
__Seasons__
id
org_id fk(orgs.id)
name
__Teams__
id
season_id fk(seasons.id)
name
__TeamFees__
id
team_id fk(teams.id)
*org_id<--- (?put extra fk here to avoid many joins?)
NO.
instead of it
use triggers before insert/update
CREATE FUNCTION foo() RETURNS TRIGGER AS $$
BEGIN
SELECT org_id INTO new.org_id FROM __seasons__ WHERE id=new.season_id;
END;
$$ LANGUAGE plpgsql;
et cetera.
AND now other way lead you to the future.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql