Hi Samrat, all!

Samrat Kar wrote:
> Hello,
> 
>  
> 
> How to store multiple values in a single field? Is there any array data type
> concept in mysql?

"Multiple values in a single field" would be an explicit violation of
the relational model (on which the SQL language is based) and cause all
kinds of trouble in your queries.

Ever and again, developers use some kind of encoding to store a
combination of values (like flags in a bit field) in one database field,
but in many cases this makes queries very hard to write, and may prevent
optimization of the SQL statement.

It depends on your application, especially on whether this field will be
used in search conditions ("... WHERE combined_field has flag_X ..."),
to decide about a sensible approach.
In general, I would prefer separate fields for different flags, and a
separate table for a truly multi-valued field (like multiple postal or
mail addresses for a person).


HTH,
Jörg

-- 
Joerg Bruehe,  MySQL Build Team,  joerg.bru...@sun.com
Sun Microsystems GmbH,   Komturstrasse 18a,   D-12099 Berlin
Geschaeftsfuehrer: Juergen Kunz
Amtsgericht Muenchen: HRB161028


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to