I have a project which has three tables: Team Questions Options For each team there will be X number of questions & few might have options (single select or multiple checkbox) along with user contact details. Once user fills the form I need to save the data into Database. Example1: Team - Technology Question - Programming Language Options - C, C++, Java Example2: Team - Technology Question - Phone Number Options - Null (i mean to get textbox here) This is just example.. like this i will have several fields. My confusion here is:- How should i plan the table structure such that data retrieval is easier? Edit method is a must & how can i retrieve Whatever user entered + to show the same questions & also options such that user entered is selected or highlighted (checkbox or single select)? Kindly assist. Your help is really required! I am trying to do this iN ASP.NET MVC4 with AJAX. Thanks, Shashank
•How should i plan the table structure such that data retrieval is easier? I would suggest you to have the questions and options in a single table like CREATE TABLE questions ( question_id VARCHAR(4) PRIMARY KEY, team_id VARCHAR(4), --use it as a foregin key if needed.This field is used to classify the questions based on the teams question_type INT, --you can set it like 0-check box type,1-radio button,2-text box question_text VARCHAR(300), options VARCHAR(600), --can be either comma seperated or space sperated ) Code (markup): by the way,you may need to have another table to hold the responses given by the user for these questions. For example,like "user_answers" CREATE TABLE user_answers ( question_id VARCHAR(4), user_id VARCHAR(4), answer VARCHAR(300), --comma seperated so that we can parse the responses later. create_ts DATETIME, last_update_user VARCHAR(4) --initially this can be the user_id.If you have edited it,then it should change to your id or like "admin" ) Code (markup): I know the table structure is not so perfect and can be improved lot.But hope this helps in clarifying your above queries...