select count(*)
from survey_question_responses
where question_id=:question_id
select presentation_type, presentation_options, abstract_data_type,
sort_order as anchor
from survey_questions
where question_id=:question_id
select name,section_id from survey_sections
where survey_id=:survey_id and block_section_p='f'
order by sort_key
select label from survey_question_choices
where question_id=:question_id
order by sort_order
select
question_id,
question_text,
abstract_data_type,
presentation_alignment,
presentation_options,
sort_order as question_number,
required_p,
sort_order
from survey_questions
where question_id = :question_id
select max(sort_order) from survey_questions where question_id=:question_id
update survey_questions
set question_text=:question_text,
section_id=:section_id,
sort_order=:anchor,
active_p=:active_p,
required_p=:required_p,
presentation_type=:presentation_type,
presentation_options=:presentation_options
where question_id=:question_id
select choice_id from survey_question_choices
where question_id=:question_id
order by sort_order
insert into survey_question_choices
(choice_id, question_id, label, sort_order)
values (:new_choice_id, :question_id, :choice_label, :sort_order)
update survey_question_choices
set label=:choice_label where choice_id=:choice_id_to_update
delete from survey_question_choices where choice_id = :choice_id_to_delete
select name from survey_sections where section_id=:section_id