select type
from survsimp_surveys
where survey_id = :survey_id
select question_id, question_text, abstract_data_type
from survsimp_questions
where survey_id = :survey_id
order by sort_key
select count(*) as n_responses, (case when boolean_answer = 't' then 'True' when boolean_answer = 'f' then 'False' end) as boolean_answer
from $question_responses_table
where question_id = :question_id
group by boolean_answer
order by boolean_answer desc
select count(*) as n_responses, number_answer
from $question_responses_table
where question_id = :question_id
group by number_answer
order by number_answer
select avg(number_answer) as mean, stddev(number_answer) as standard_deviation
from $question_responses_table
where question_id = :question_id
select count(*) as n_responses, label, qc.choice_id
from $question_responses_table qr, survsimp_question_choices qc
where qr.choice_id = qc.choice_id
and qr.question_id = :question_id
group by label, sort_order, qc.choice_id
order by sort_order
select type
from survsimp_surveys
where survey_id = :survey_id
select count(*)
from $responses_table
where survey_id = :survey_id