0

Ok, so my question is this. If I had two tables, quizzes, and users,
where each user 'has many' quizzes, then one could simply just add a user_id column to the quizzes table to create this link.

However, how would I implement a has many-has many relationship?

For example, I'm currently making a quiz site for a friend who's a teacher. Rather than having a group based authentication system, he wants to be able to set each individual student specific rights to view each quiz. So, each student has many quizzes (s)he can view, but each quiz also can be viewed by many students. What would the best way to set up this database be?

My current plan is to have a third table, called permissions (or something similar), with two columns, both of which are foreign keys. a user_id column and a quiz_id column, and whatever records exist in this table are quizzes that the specified student is allowed to view. Is there a better/faster(execution time wise) way to do this?

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by zmariow
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.