I am trying to create a database with a table called MEETING.
So every instance of a meeting, just like real life can contain a variable amount of people in it.
So meeting1 (inside MEETING) may contain user1, user2, user3.
but meetings2 (again inside MEETING) may contain user1, user4, user6, user7.
How would I go about handling such a scenario. I was thinking of creating an array, but I am not sure how to do it.
You would use what is called a join table. You would have three tables: MEETING, USER, and the join table (it could be called MEETING_USER or something like that). Your user table would contain information about each user (at the very least, some identifier and a username). Each meeting would also have a unique ID as well. Your join table would then have rows in the format , with a new entry for each user at a meeting. This facilitates what is called a many-to-many relation since each meeting can have many users and each user can attend many meetings.
Some sql engines in MySQL allow you to add “foreign key mappings” so that it runs pretty fast when searching for all users in a meeting or all meetings a user has attended. Other database servers (MSSQL, etc) also support this kind of thing.
Example:
If Meeting 1 was attended by users 1 and 3, the join table would have the following entries in it somewhere:
If Meeting 2 was attended by everyone, the join table would have these entries put in it: