Try not to look at the problem formally, mechanically. Describe what is happening in aa few sentences then look at them. This is how:
- I am tracking users and user interests that a user chooses.
2. user_id will pick all their interests from some list of available interests (golf, tennis, bowling...).
Let's rewrite the two sentences:. First note nouns from the two sentences users , user interests, interests . Nouns will become entities in your database. One user can choose many interests, and we record that in entity user interests. Other users chooses their interests. Same interest may be chosen by several users. This gives us the following diagram
[Users] ----choose --<[User Interests] >---from----[Pool of users]
Both relationships (----<) are one to many, and that is not going to change. The question of cardinality depends on business rules.
If there is a business rule that says "Each user must have at least one interest" which is the same as "Users without interests are not allowed in database" then relationship Users to User Interests is 1 to 1 or many. If there is no business rule requesting at least one interest per user relationship would be 1 to zero or many.
Entity [Pool of interests] is not likely to request that each Interest from Pool of Interests appears at least once in [Users Interests], so relationship between [Pool of Interests] and [User Interests] would be 1 to zero or many.
Relationship 1 to 1 or many is OK in theory. However, inn todays database management systems it is not possible to enforce 1 to 1 or many in a declarative way. There is no constraint to enforce such rule, so we must write code somewhere. Front end is a good place to enforce such rule.
If we have 1 to many, what about 1 to zero.? This could literally mean that User must not have any Interests. That is illogical rule. If we want to track which user has which interests, such rule is contradictory to the database goal - to support tracking users and their interests.
Relationship 1 to 1 is actually always 1 to zero or 1. For example, we want to track user fees. There are no rules for fees, and it is secret peace of data. We will need a new entity, [User Fees], which allows only one row per user. In [Users] we have only one row per User, and fee cannot exist without user, so we have relationship [Users ] to [User Fees ]= one to one. Can we have 1 to zero or 1 in this case? Again, in theory it is a valid request. In practice, it is difficult to enforce.
Zidar's Theorem: The best code is no code at all...