Focus Global Community

Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: Database Math Storage Question


Senior Member

Status: Offline
Posts: 183
Date:
Database Math Storage Question
Permalink   
 


So, me and a friend of mine were throwing around ideas on how to store a list of 39 genres (like Action, Adventure) and not make it a taxing task on the database.

My idea was to have a list of 39 columns with the layout being,

Code:
Show_Name, Action, Adventure... (Etc)
Star Trek,      1

So you would have a 1 value in the genre that it is and then do a query like "SELECT Star Trek WHERE Action = '1'" (That may not work I just came up with it on the spot)

Now here is his idea that I need help with on the math.

He suggests that I use a list of numbers like this...

Code:
0002, 0004, 0008, 0020, 0040, 0080, 0200, 0400, 0800, 2000, 4000, 8000 



... And give each genre a value so that if they select multiple genres it will never add up to another one. (Example: If they select 0002 and 00020 and 0008 the value would equal 0030. We avoid using 30 so each combination would have its own number I guess)

Well we are debating on what is better and if we do go with Idea #2 what the numbers would be. I am sure there is some math way to figure it out that I am unaware of so I'm counting on you :P



If you can think of a better way to do it I would love to hear it! Thanks!



__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.

Tweet this page Post to Digg Post to Del.icio.us


Create your own FREE Forum
Report Abuse
Powered by ActiveBoard