Case Study: Storing, Querying, and Analyzing Performance: Pt. 1
December 8, 2000
How do you structure a table to store information on a questionnaire that has two types of responses options and checkboxes?
Type 1 Single Option
Type 2 Multiple Options
Table Set Up:
A table was created with company information.
Another Table was created with the following answer information.
The table setup does a good job holding the company information and answer information for option button type questions but what about checkbox answers? To solve this problem we decided to store the information as integer values representing the binary notation of the numbers.
For example, if a question has 8 possible choices we would have a matrix with the following.
By summing the values together you can get the integer you need to store in your database. If all 8 boxes were checked your value is 255. If only box 2 and 5 are checked the value is 18.
In my follow-up article I will demonstrate how to query for specific results.