Table of Contents

Notes on LimeSurvey

Table Structure

Tables with Survey Id - sid column name

Column NamePosition
lr_surveys1
lr_survey_permissions1
lr_assessments2
lr_groups2
lr_quota2
lr_quota_members2
lr_saved_control2
lr_questions3

Tables with Question Id - qid column name

Column NamePosition
lr_questions1
lr_defaultvalues1
lr_answers1
lr_conditions2
lr_question_attributes2
lr_quota_members3

Tables with Group Id - gid column name

Column NamePosition
lr_groups1
lr_assessments4
lr_questions4

SQLs used to get Table Structure

SELECT * FROM `COLUMNS` WHERE `TABLE_SCHEMA` = 'a22_limesurvey' AND column_name = 'sid'
SELECT concat('|',TABLE_NAME,'|',ORDINAL_POSITION,'|') FROM `COLUMNS` 
WHERE `TABLE_SCHEMA` = 'a22_limesurvey' AND column_name = 'gid'
ORDER BY COLUMN_KEY DESC, ORDINAL_POSITION, TABLE_NAME
SELECT concat('|',TABLE_NAME,'|') FROM `COLUMNS` WHERE `TABLE_SCHEMA` = 'a22_limesurvey' AND column_name = 'qid'
SELECT group_name, question, code, answer
FROM
lr_groups, lr_questions, lr_answers
WHERE
lr_groups.gid = lr_questions.gid
AND
lr_answers.qid = lr_questions.qid
AND
lr_questions.sid = 88593
ORDER BY group_order, question_order, sortorder 
SELECT group_name, question
FROM
lr_groups, lr_questions
WHERE
lr_groups.gid = lr_questions.gid
AND
lr_questions.sid = 88593
ORDER BY group_order, question_order