mysql - How to structure/normalize this database? -


i need make database should hold 50 questions, 3 possible answers each question , value of each answer.

enter image description here

this first guess feels wrong , i'm not sure how access values properly. suggestions on how structure this?

this seems correct way:

questions table --------------- id title ...  answers table ------------- id question_id answer value 

one way be

questions table --------------- id title ...  values table ------------ id value   answers table ------------- id question_id answer value_id 

then answers of specific question do

select a.*, v.value answers join questions q on q.id = a.question_id join values v on v.id = a.value_id q.title = 'what name of dr. who' 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -