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?

"have a third table"... that's the way to go. It's the best practice and it will keep your database design clean... if you're worried about performance, you should consider caching mechanisms... Using PHP? Check this excellent article: http://papermashup.com/using-memcache-with-php/
Cheers :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.