And besides...
Quote:
|
I’m guessing it has to do with wanting some sort of column count- how many yesses, how many nos, etc
|
How is having them in separate columns any better than having them in one column?
Assuming you used an ENUM column (just for example...if you prefer using a CHAR or INT column that would work as well) such as
Code:
CREATE TABLE whatever (
question1 ENUM('yes','no','maybe'),
question2 ENUM('yes','no','maybe'),
question3 ENUM('yes','no','maybe')
...
);
Then you could count the answers to, say, question2 thus:
Code:
SELECT SUM(IF(question2='yes',1,0)) AS q2Yes,
SUM(IF(question2='no',1,0)) AS q2No,
SUM(IF(question2='maybe',1,0)) AS q2Maybe
FROM whatever
Further, the huge advantage to this is that if they change their minds later and add a 4th choice (e.g., "n/a") then no columns need be added to the table. You could simply do
Code:
ALTER TABLE whatever MODIFY COLUMN question2 ENUM('yes','no','maybe','n/a')
Or if you used a CHAR or TINYINT column no changes at all are needed.