0

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.

mopoke
  • 10,555
  • 1
  • 31
  • 31
Tim
  • 962
  • 3
  • 9
  • 25

2 Answers2

1

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.

mopoke
  • 10,555
  • 1
  • 31
  • 31
  • Okay that makes sense. I just wondered about the size of a db that contains many relationships – Tim Dec 29 '09 at 03:04
  • Size shouldn't be an issue in terms of storage and you're unlikely to save much (if any) by keeping the relationship in one of the other tables. – mopoke Dec 29 '09 at 03:07
0

If it is many to many relationship then you can create another table which just associates project id with a user id.

Sri
  • 5,805
  • 10
  • 50
  • 68