JD_Toims - 9:10 pm on Dec 16, 2013 (gmt 0)
While denormalizing is an option to solve a real performance issue (not the only option), but I'd never consider it unless it is in fact a real problem - if you never had the data normalized you've no idea if it is a problem or not and even then only if it can't be fixed otherwise.
I had one of the DBs I tested on at 3NF ;)
[I will say it was quite some time ago so MySQL may have [likely has] improved in the interim, but I won't take the time to go back an renormalize, because it's worked fine with a single table design for enough years to not bother with when I could be doing much more productive things with my time than fixing that which is not broken -- I'm going to bow-out of the storage discussion, unless there's another specific question about it, because it's really a matter of styles, imo -- Google ran on a "big table" design until the Caffeine update and WebmasterWorld still runs on a single flat-file DB, so there's some precedent for the type of storage I use.]
I think the biggest challenge is the awards because some will have none, others will have one or two while a few will have all three.
Personally [this'll make swa66 scream -- lol] I'd store them in a single col as a numerical csv list EG 0 for none; 1,2 for award one and award two; 2,4 for awards two and four; etc, because then you don't have to update the DB table to add another award.
The way you have the DB laid out, you'd have to add a new col for every new award, but if you put them all in the awards col as a csv list you can add, or delete the awards available by simply changing what's in the col and the array that's being associated with the numerical values in the col.
# Note: This only applies if you don't want to be able to select everyone with award 3 -- If you want to do that, then you'd have to use separate cols to be efficient, but I'd probably keep a "total awards" csv list col too so I could grab that rather than needing all the individual cols for "all awards" -- I know, I know, it's not normalized that way, because I'm storing the same info twice :( [lol]
Then once the data is in PHP it's simple to use an array with the numbers from the DB csv list as keys.
# Get the data from the DB here.
# I'll let you figure out how to format whatever from there.