Answer the question
In order to leave comments, you need to log in
What is the best way to compare tables?
Good day.
I am new to PostgreSQL and I have the following question:
There are two tables users and groups. Accordingly, users can enter groups. And here the question is, in what way is it better to compare the data of the table with each other?
Option 1 - create a separate table users_in_group Option
2 - create an Array type field in the group table, and add users there.
Please tell me, is it worth considering the second option, and what is their fundamental difference?
Answer the question
In order to leave comments, you need to log in
Can a user be in multiple groups at the same time?
If so, make a table like:
User_ID||Group_ID
If a user can only belong to the 1st group, then simply add the Group_ID column to the USERS table and write down the ID of the group to which the user belongs.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question