I need some help optimizing my database schema
- by Steffan
Here's a layout of my data:
Heading 1:
Sub heading
Sub heading
Sub heading
Sub heading
Sub heading
Heading 2:
Sub heading
Sub heading
Sub heading
Sub heading
Sub heading
Heading 3:
Sub heading
Sub heading
Sub heading
Sub heading
Sub heading
Heading 4:
Sub heading
Sub heading
Sub heading
Sub heading
Sub heading
Heading 5:
Sub heading
Sub heading
Sub heading
Sub heading
Sub heading
These headings need to have a 'Completion Status' boolean value which gets linked to a user Id.
Currently, this is how my table looks:
id | userID | field_1 | field_2 | field_3 | field_4 | etc...
-----------------------------------------------------------------------
1 | 1 | 0 | 0 | 1 | 0 |
-----------------------------------------------------------------------
2 | 2 | 1 | 0 | 1 | 1 |
Each field represents one Sub Heading. Having this many columns in my table looks awfully inefficient...
How can I go about optimizing this? I can't think of any way to neaten it up :/