In another post, I came across some interesting methods to design the database schema. The methods were:
- Boolean Method
- Multiple Column Method
- Bridge Table Method
Can anybody post a link or describe briefly about the above mentioned tec开发者_如何学Chniques, because I tried searching them on Google and found nothing.
For a reference the post that I came across is this one
The original post is talking about modelling a 1-to-many relationship, where a record belongs to many groups.
There's not a lot of detail in that post so I'm making inferences in giving definitions:
Boolean method
Probably using a bitmask field to store membership of groups. Each group would correspond to a bit value. Requires a grasp of boolean logic to be able to query effectively.
Multiple column method
Extending the record to add one column per group to indicate membership. This is essentially a more human-readable implementation of the boolean method, but is painful to maintain when more groups are added.
Bridge table method
This one goes by several names (Wikipedia has it under the entry for junction table) - a new table is created, defining the link between the primary keys of the two source tables. This is the most robust solution.
精彩评论