List:General Discussion« Previous MessageNext Message »
From:John Meyer Date:September 17 2009 1:46am
Subject:Re: What should it be in MySql? In C, it's an array of integers.
View as plain text  
Pete Wilson wrote:
>> Break them out into a separate table linked via the primary
>> key.
>>     
>
> How elegant! Thanks.
>
> -- Pete
>
>   


it's nothing not taught in Database Design 101.  Typically you would 
have a setup like this

USERS
USER_ID <--primary key
USER_NAME
USER_IP

ASSOC_NUMBERS
A_ID  <--primary key
USER_ID <-- foreign key linked to users
A_NUMBER <---one of the integers that you would store

Alternatively, you can skip the A_ID and have a compound key of USER_ID 
and A_NUMBER on the ASSOC_NUMBERS table. I prefer the A_ID, though.  
Another way I've read about (though I can't remember the article) is 
that certain types of databases do allow you to store an array.  These 
are normally used for databases that need to be very, very small (like 
on an embedded chip).  However, the way I described is usually the 
default for relational databases.


Thread
What should it be in MySql? In C, it's an array of integers.Pete Wilson17 Sep
  • Re: What should it be in MySql? In C, it's an array of integers.John Meyer17 Sep
    • Re: What should it be in MySql? In C, it's an array of integers.Kyong Kim17 Sep
    • Re: What should it be in MySql? In C, it's an array of integers.Pete Wilson17 Sep
      • Re: What should it be in MySql? In C, it's an array of integers.John Meyer17 Sep
        • Re: What should it be in MySql? In C, it's an array of integers.Johan De Meersman17 Sep
          • Re: What should it be in MySql? In C, it's an array of integers.John Meyer17 Sep