Database design is not good, allocation is very important.
Previously encountered a demand, is now abstracted for each member can add some tasks for themselves
Naturally, the table is very well designed
Table 1:taskid, UserID, Content, status, Createtime
Later added demand, to the administrator can add tasks for members
Naturally, add three more tables.
Table 2:staskid, content, Createtime
Table 3:allotid, Staskid, userid, Isdel distribution table
Table 4:id, Staskid, UserID, Status complete State table
Then table 2, table 3, table 4 through a variety of joins into the form of table 1, and then through the Union as a table,
Finally found that many of the previous numerical statistics and so on to change, all because the back of a staskid and different.
And then think about it, if we were to design it from the start
Table 5:taskid, type, content, createtime (more than one type, which distinguishes whether the member created it himself or created by the administrator)
Table 3:allotid, TaskID, userid, Isdel distribution table
Table 4:id, TaskID, UserID, Status complete State table
In this case, the extensibility will be better ...
Database design is not good, allocation is very important.