Search code examples
mysqlmultiple-value

How to save multiple data in 1 column SQL


I know, there already is similar questions, but I can't find a good answer at my problem.

I'm developing a social network, I have all my users in a table, but each users must be able to save multiple post from the website.

My Question is:

How can I store all the saved post for each user without creating a new table for each users. I know this is bad to do this, so I'm looking for an alternative


Solution

  • If I understand you correctly, you just need a middle table (for example names user_post) that have 2 columns : user_id and post_id

    this is a simple implementation of a many-to-many relationship