| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Column Naming Question
>> 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,
![]() |
![]() |