How can I store an indefinite amount of stuff in a field of my database table? -
is a simple version of the website that I'm designing: users can be related to one or more groups as soon as They want as many groups as they log in when they log in. Ideally, in my user table, I should get an array or something that I will continue to add the ID of those groups which the user Join
In addition, although I know that this is not necessary, I need a column in my group table that contains the indefinite amount of user ID in that group. (Side Q: Is the user related to a particular group ID more user-friendly than getting all the users of the group?)
Does my question come in handy? Mainly I want to be able to fill a column with an indefinite list of IDs ... the only way I can think is that it is making something like a super-long mantra and in that list JSON is there or in some It is encoded, but ewww please and thank you
Oh and its a mysql database (my website is in php), but for 2 years php development I have decided to waste php recently and i Refuse it And the ASP .NET Web App is the only way I feel that I will apply it to any type of database on which I will need it.
Your intuition is correct; You do not want to have a column of limitless length to keep the user's groups, instead, create a table like There may be several rows in a single user_group_membership with the column:
user_id
group_id
user_id , each one Can be from
user_id but a different
group_id . You will represent membership in several groups by adding multiple rows in this table.
Comments
Post a Comment