I'm designing a database for measure time elapsed between the execution of some tasks over an item.
I have two options to do this, but I don´t know which one is my best choice:
Design a table with a dedicated field for each measurement parameter, to have a single row for a specific item with all the measurement parameters.
ItemId | TimeTask1 | TimeTask2 | TimeTask3 | TimeTask4 | ... | TimeTaskN
Design a table with generic fields, to have a row for each measurement parameter and identify the actual task they belong to.
ItemId | TaskId | TimeElapsed
What do you think?
11 Oct '12 - 19:21
I think second way is good approach. There is a flaw in first way. We can't determine
how many task will be performed on particular item. There can more than TaskN... If you design your table in first way then task count is fixed. Then We have to add a column to the table to store time taken by taskN+1..... taskN+N. So second way suits to your requirement.
11 Oct '12 - 21:47
The second way is preferred, but it all depends on how you intend to use the data.
11 Oct '12 - 20:15
The second option is the preferred (normalized) way to do it.
As a bonus you can add a row for a task whenever it's done, your application does not need to wait for all tasks to be done before it can write it to the database.
12 Oct '12 - 11:01
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)