Good time of day.
I'm new to PostgreSQL and I have following question:
There are two tables users and groups. Accordingly, users can belong to groups. And here the question of how better data in the table to compare with each other?
Option 1 - create separate table users_in_group
Option 2 - to create in the table field group Array, and to make users.
Prompt please, whether to consider the second option, and what is their fundamental difference?
skye.Satterfield72 answered on June 26th 19 at 14:22
The user can simultaneously be in multiple groups?
If Yes - make a table like:
If a user can belong to only 1 group, then just add USERS table column Group_ID and write down the group ID to which the user belongs.
Bianka0 answered on June 26th 19 at 14:24
There is another option: the group list which is stored in each user.
Ispolzuyte the option which will give the minimum required effort (cost) for your particular problem.