Hello. Suppose there is a table with columns user_id and user_group , the remaining columns are not important. One user can belong to several groups, that is, it turns out that user_id not unique. It is obvious that several users can belong to one user_group , therefore user_group not unique.
But the user_id and user_group is unique, so the question arises - is it possible to make a primary key in two columns and in general, is it normal? How to organize a table in this case?
primary key(user_id, user_group)- Mikeuser_id/user_groupcan be repeated, and only a pair will be considered unique? - Nik