I am trying to create a “Task” schema in my database. One field is “blockedBy” which represents another Task that is blocking this current task.
I am new to SQL Server and databases in general. How can I create the table properly? It seems like the only valid options are numbers or text.
Should I just store the ID number of the other “Task” in the “blockedBy” field or is there a better way?
I assume:
Here’s my proposal of columns, and an example of how the data would look like:
Wake up task in row 4 is blocked by Sleep task in Row 3.
Table fields will have datatype:
If you anticipate multiple existing tasks blocking a task, break up the table into 2 tables: AllTasks and BlockedTasks. AllTasks table will not have TaskBlockedBy field anymore and BlockedTasks and its data will look like this:
This indicates that task of Wake Up was blocked by Sleep and what the user drank before sleeping.
HTH