Re: Column Naming Question
From: --CELKO-- <71062.1056_at_compuserve.com>
Date: 6 May 2003 11:04:44 -0700
Message-ID: <c0d87ec0.0305061004.158b1425_at_posting.google.com>
PRIMARY KEY (uploader_id, borower_id, file_name)); Received on Tue May 06 2003 - 20:04:44 CEST
Date: 6 May 2003 11:04:44 -0700
Message-ID: <c0d87ec0.0305061004.158b1425_at_posting.google.com>
>> Since these two fields [sic] will be foreign keys relating to
Users.user_id (read ISO-11179 rules for dat element names) how can I
contain this data in the table - I can't have two columns called
user_id in my Files table...
Think about the semantics; users are a domain, while lenders and borrowers from that domain. This is a 3-ary relationship. I have made guesses about the business rules when I wrote the constriants -- that's why we ask people to post DDL and specs.
CREATE TABLE Checkouts
(uploader_id INTEGER NOT NULL -- lender
REFERENCES Users(user_id) ON UPDATE CASCADE, borrower_id INTEGER NOT NULL REFERENCES Users(user_id) ON UPDATE CASCADE, file_name VARCHAR(128) NOT NULL REFERENCES Files(file_name) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (uploader_id, borower_id, file_name)); Received on Tue May 06 2003 - 20:04:44 CEST