Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: mysql, checkbox, set, processing

by shemp (Deacon)
on Aug 31, 2005 at 21:24 UTC ( [id://488233]=note: print w/replies, xml ) Need Help??


in reply to Re: mysql, checkbox, set, processing
in thread mysql, checkbox, set, processing

Yes, set seems like a good idea at first glance but it WILL bite you later on. When you set up the table definition, you specify all the values that are acceptable in the set. Then when you realize you need another valid value in the set, you need to alter the table definition. And you need to keep the original set items in the same order because the storage is actually numeric aliases, and when you redefine the column, it doesnt woory about the stored values. When you want to remove a value from the set the situation is worse, because then you can't retain the same positioning of all the set elements in the definition.

A much better solution is to use a lookup table with the valid values you'd put in the set. But you need an intermediate table to facilitate the many-to-many relation that occurs with a set.

Similar arguements for the ENUM datatype, but easier to implement with the lookup table because there is no many-to-many relation.


I use the most powerful debugger available: print!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://488233]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-18 01:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found