I am creating an application which contains questions and answers(objective type) , so that i vl store question and 4 answers in questions table and i will store the correct answer in answers table
Structure of tables
questions
id int(4) primary key
question text
answer1 text
answer2 text
answer3 text
answer4 text
answers
id int(4) Foreign Key
answer int(1)
now what i need is in answers table the value for answer should be only (1 or 2 or 3 or 4) so i have to predefine it and the user should not enter other value…
How to Do This…
Use
enumorsetfor predefined permitted values:like:
answers ENUM('1','2','3','4')see: mysql SET & ENUM