Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Gregory Anuhin
Gregory Anuhin
3,719 Points

Question about database tables organization for project

my target is to create quiz for memorizing english words.

for each user I have to create a new table in mysql with words knowledge?

just i think if every user will have table with 2000 words it can be a problem . How to orginize the table in the right way ?

thank you

2 Answers

so you have a user table, words table with two fields english & russian, quiz table which holds info about user quizzes, and finally a user_quiz or something that links quiz table to words table so that you know which words were in which quiz.

This way user can have multiple quizzes open and when you assign a new quiz, just make sure that you don't give user same word....

Actually one bad thing about this design is the words table.. you shouldn't have two fields or design it like that unless you are 100% sure you won't extend this to another language say French etc.. because if you do that, then there are better ways of doing that such as:

words id, language, word, parent_id

parent_id is the id in words table for a word in Russian.. so if you had <Welcome> in Russia, if its id = 1, when you translate <Welcome> to English, you would give it 1 as parent_id so that it is easier for you to reference.. this way you can extend your quiz to other languages..

I have no idea what your project is about even after reading your post.. but clearly you are right creating 1000s tables for each user is a bad idea...

what does this mean:
"my target is to create quiz for memorizing english words?"

what are the requirements or how does this work..

Gregory Anuhin
Gregory Anuhin
3,719 Points

example: user entered to the quiz of translating words from english to russian. he did the quiz using element. Now i need to give him score or points for each of the words he wrote right.

then next time he is trying to pass the same quiz or test whatever. My target here is to know if the user is already know current words, if he knows so i wont give him points for that.

sorry for my english , I'm not a native speaker