sql - What tables structure is better? -
I am developing a multiuser task manager application, but I stumbled on the database schema design. I have user tables, categories and course work tables. Each task falls under exactly one category. So in the DDL words I need to have one-to-many "relationships" between the category and the job, right? Apart from this, I am sure that I need "one-to-many" relationship between users and working organizations. (Please correct me if I'm wrong). For the "category - user" relationship, here I am seriously considering two options and I need to tell you who is right and why:
-
"Many - Many "relationships" that means that the user can have multiple categories and vise-versa;
-
"One-to-many" relationship where each category can belong only to one user in this category in this category, the same table as "Work", "Family" etc. There are going to be many lines (since it is difficult to come up with some new and original about categories), which will only be different "user" column value.
What is the common approach in this situation?
This is a difficult question because both methods have the advantages. You probably have to better define your problem and what you want to do.
I am working on a similar structure, with such structure:
- A user table, basic information
- one ( "This work should not start until the completion of the first work" / Em>) by allowing the self-related work table, 'Projects' (a task with a parent) and work to do the work
- A multi-to-many allocation table, by adding multiple users to multiple tasks ( "This work user 1 and Should be done by manual work with a ")
And here is your question back: Users consider how to organize your backlog?
- If your project is more like a to-do list, then you do not need Don Allocation Table;
- If users should be allowed to create their own categories, then you should probably create
user-categories
- if the user has to select the category created before a common list , Then you do not need that user FK
- Anyway, if a user can classify allocated tasks, then this category will be a foreign key in the table allocation table, so every user Can categorize their own functions
In my experience, you should delay the decision of the class and ask their users; They will tell you in the right direction.
You can also easily create that
user-catagories
table, because it is more flexible than the alternative and ignoring that data duplication. It is probably a bad idea to use a list of basic categories with multiple relationships with the user, because the user can decide to rename a category and all other users will be affected by this action.
Comments
Post a Comment