I'm modeling a MySQL database where key entities are documents. Among several other fields, these documents relate to one or more phases of a given project.
There are 4 basic values (let's call them A, B, C and D), and the phase property value is a set of 1 to 4 of them. For example, a document may relate only to phase A, phases A and B, phases B, C and D, etc.
I see several ways to model this, but I am in doubt about which would be the most appropriate. The options I considered:
- 4 "Boolean" columns (
TINYINT(1)
), one for each phase. - A single binary column, with 4 bits (
BIT(4)
). - A column of type set :
SET('A','B','C','D')
. - Relationship table.
I will need to get / display both the list of phases of a given document and the list of documents linked to a certain phase.
What would be the most appropriate structure in this case? What criteria should I take into account to make this decision?