Search code examples
phpmysqlpermissionsnormalizationtable-relationships

MYSQL / PHP - Efficient method for attaching users to a project


I'm building a system that has a user table and a project table. I'm trying to determine the most efficient way to connect users to a project.

I'm was thinking about a table that records the relationship, but I wasn't sure if a serialized list in one field would work just as well.


Solution

  • A join table (e.g. UserJoinProject) would be my preference and would be well normalized. Assuming you have an ID column as a primary key for projects and for users.

    Serializing the list will make it difficult for mysql to do any kind of operation on that data.