List:General Discussion« Previous MessageNext Message »
From:fbsd_user Date:March 8 2006 4:40am
Subject:Table with multiple primary keys - How
View as plain text  
What I am trying to do here is have 3 separate primary keys.
Creating a mysql select on either of the Logon_id, email_addr, 
or last_name fields will do a single read to the matching value. 
Like having 3 different indexes into the same table. 
I don't want those 3 field concatenated together as a single key.

Is this table definition correct?

create table members (
        logon_id            varchar(15),
        email_addr          varchar(30),
	  last_name           varchar(30),
	  member_type         char(1),
        email_verified      char(1),
	  logon_pw            varchar(15),
	  date_added          date,
        last_login          timestamp,
        first_name          varchar(30),
        addr1               varchar(30),
        addr2               varchar(30),
        city                varchar(20),
        state               varchar(20),
        zip                 varchar(15),
	  phone_home          varchar(15),
        phone_office        varchar(15),
        phone_cell          varchar(15),
        mothers_maiden_name varchar(30),
	  ip_of_useratsignup  varchar(16),
	  primary key(login_id, email_addr, last_name)
	);

Thread
Table with multiple primary keys - Howfbsd_user8 Mar
  • Re: Table with multiple primary keys - HowDan Nelson8 Mar
  • Re: Table with multiple primary keys - HowRhino8 Mar
  • Re: Table with multiple primary keys - Howmysql8 Mar
    • RE: Table with multiple primary keys - Howfbsd_user8 Mar