I need some help optimizing my database schema
Posted
by Steffan
on Stack Overflow
See other posts from Stack Overflow
or by Steffan
Published on 2010-06-03T06:19:20Z
Indexed on
2010/06/03
6:24 UTC
Read the original article
Hit count: 377
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 :/
© Stack Overflow or respective owner