arrays in mysql

This is a discussion on arrays in mysql within the MySQL Database forums, part of the Database Forums category; Is there an accepted way to store arrays in mysql(5.0). Joe...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-20-2007
Joe
 
Posts: n/a
Default arrays in mysql

Is there an accepted way to store arrays in mysql(5.0).

Joe


Reply With Quote
  #2 (permalink)  
Old 12-20-2007
Paul Lautman
 
Posts: n/a
Default Re: arrays in mysql

Joe wrote:
> Is there an accepted way to store arrays in mysql(5.0).
>
> Joe


Yes, as a one-to-many relationship between 2 tables. This is the accepted
way for storing arrays in any relational database.


Reply With Quote
  #3 (permalink)  
Old 12-20-2007
J.O. Aho
 
Posts: n/a
Default Re: arrays in mysql

Joe wrote:
> Is there an accepted way to store arrays in mysql(5.0).


serialize it before you store it, then you get a "string" of the whole array.

--

//Aho
Reply With Quote
  #4 (permalink)  
Old 12-20-2007
Paul Lautman
 
Posts: n/a
Default Re: arrays in mysql

J.O. Aho wrote:
> Joe wrote:
>> Is there an accepted way to store arrays in mysql(5.0).

>
> serialize it before you store it, then you get a "string" of the
> whole array.


Err, this is a relational database yes?
Arrays should be stored as one-to-many relationships.


Reply With Quote
  #5 (permalink)  
Old 12-20-2007
Joe
 
Posts: n/a
Default Re: arrays in mysql

Thanks much for the prompt reply. Could you recommend a book i might buy? I
have several
but they never touch the subject of arrays. Thanks again

Joe
"J.O. Aho" <user@example.net> wrote in message
news:5t08tmF1bkv4aU1@mid.individual.net...
> Joe wrote:
> > Is there an accepted way to store arrays in mysql(5.0).

>
> serialize it before you store it, then you get a "string" of the whole

array.
>
> --
>
> //Aho



Reply With Quote
  #6 (permalink)  
Old 12-21-2007
Peter H. Coffin
 
Posts: n/a
Default Re: arrays in mysql

On Thu, 20 Dec 2007 22:55:47 -0000, Paul Lautman wrote:
> J.O. Aho wrote:
>> Joe wrote:
>>> Is there an accepted way to store arrays in mysql(5.0).

>>
>> serialize it before you store it, then you get a "string" of the
>> whole array.

>
> Err, this is a relational database yes?
> Arrays should be stored as one-to-many relationships.


Depends a bit on whether one is representing or *storing* the array in
question. If you don't care to access it within the databse, a lot of
things are fair.. (:

--
91. I will not ignore the messenger that stumbles in exhausted and obviously
agitated until my personal grooming or current entertainment is finished.
It might actually be important.
--Peter Anspach's list of things to do as an Evil Overlord
Reply With Quote
  #7 (permalink)  
Old 12-21-2007
J.O. Aho
 
Posts: n/a
Default Re: arrays in mysql

Paul Lautman wrote:
> J.O. Aho wrote:
>> Joe wrote:
>>> Is there an accepted way to store arrays in mysql(5.0).

>> serialize it before you store it, then you get a "string" of the
>> whole array.

>
> Err, this is a relational database yes?


Yes, but we really don't know how Joe want to use his array, so if he just
interested in storing the data, it's a far simpler method to store it than
building a one to many relation table.

> Arrays should be stored as one-to-many relationships.


Absolutely if he will use the data in the database.

--

//Aho
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:47 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0