One-to-Many or Many-to-Many MySQL relationship
Posted on 2013-12-29
I have a question (I am probably over-thinking this, too). I am creating a PHP database driven quiz application. I have four tables: users, tests, questions, and answers. I am a little confused on how to relate the users table to the tests table, and here is why...
Is it a one-to-many (one user can take multiple tests) relationship or is it a many-to-many (many users can take multiple tests and many tests can have multiple users) relationship?
I have the tests related to their questions via the test_id and the questions related to their answers with the question_id. However, how do I structure my users table correctly to relate the tests to the users and the users to the tests? Again, I am most likely over-thinking this and making it WAY more complex than it is supposed to be, but that's why I'm here, right?