MySQL Forums
Forum List  »  Newbie

Re: Two tables with non-unique column
Posted by: Phillip Ward
Date: February 27, 2014 05:57AM

Change the Primary Key on T2 to be a composite key on both OrganisationId and UserId.

create table T2 
( organisationId integer not null 
, userId integer not null 
, primary key ( organisationId, userId ) 
) ;

You probably want foreign keys back to T1 and the organisations "master" table as well.

Regards,
Phill W.

Options: ReplyQuote


Subject
Written By
Posted
February 26, 2014 08:44AM
Re: Two tables with non-unique column
February 27, 2014 05:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.