It's not exactly many-to-many relationship. For example: I have a User table and a Role table. The constraint is a user can have 0-5 roles and a role can be assigned to many users.
How to model this in database? Thanks
EDIT: I'm looking for some standard solution on database side for this model. There are similar scenarios like above. For example: user password history: One user will have max 10 previous passwords stored in pwd_history table. It's kind of one-to-(0-10) relationship.
But seems to me there is no standard solution on database side. (@Branko's solution (2) below looks good though. ) I guess the best practice for this model is to enforce on client side, making these numbers configurable in property file and implementing client logic to handle this.