I have a note assignment system where it is allowed to reply, replica and / or rejoinder, what is the best way to store it in the database?
contestacao
, replica
, treplica
) tipo
I have a note assignment system where it is allowed to reply, replica and / or rejoinder, what is the best way to store it in the database?
contestacao
, replica
, treplica
) tipo
It depends on what you want.
This allows you to enter multiple contests, replicas, and replicas for each note (which I believe is not your goal). The control by the system is greater, since there are 3 tables, and if it is the case to bring the records in a single query, you can force the system to use unions , which is not good for performance. Great for cases where interesting to access only one table of each type at a time.
For the scope of business, I think it is the most appropriate, considering that each note may have only one answer, one reply and one rejoinder. It's also the simplest to get and upgrade, but it does not fit multiple records of contests, replicas, and replicas.
This case is interesting when you want to save on the number of queries and minimize the amount of joins used by the system. It is also in case your system allows for a variable amount of contestations, replicas, and replicas. It may be necessary to add an index by type, which makes the table larger in the database.