I have a requirement that I need to have 35 days data needs to be stored in a db table. The data is used only for calculation and not for any retrieval (not used in select query where clause).
Is having them as 35 columns in the table the only way to design the table? Or any other effective design approach can be followed?
Note: SQL Server is used here and a FK is there on this table.
If you just need to access all 35 fields in one go, and you know you won’t need additional fields, the table with 35 columns may well be the best design.
Alternatively, you could try something like this:
For the price of JOIN, this may give you a bit more flexibility in case you ever need to change the number of days – you just change the CHECK. Also, this may be slightly more space-efficient if large majority of your days are NULL.