Skip to content

Instantly share code, notes, and snippets.

@s4parke
Created July 21, 2017 17:06
Show Gist options
  • Save s4parke/eff7332d38a3160f9474e915b4bf74a9 to your computer and use it in GitHub Desktop.
Save s4parke/eff7332d38a3160f9474e915b4bf74a9 to your computer and use it in GitHub Desktop.
MySQL views for MSS intervention
-- Generated from prepared statements T1-T4
CREATE VIEW t1_responses AS
SELECT participant_id, max(case prop_key when 't1_ethnicity' then prop_value else null end) AS t1_ethnicity,max(case prop_key when 't1_race_list' then prop_value else null end) AS t1_race_list,max(case prop_key when 't1_race_textbox' then prop_value else null end) AS t1_race_textbox,max(case prop_key when 't1_education' then prop_value else null end) AS t1_education,max(case prop_key when 't1_income' then prop_value else null end) AS t1_income,max(case prop_key when 't1_marital' then prop_value else null end) AS t1_marital,max(case prop_key when 't1_distress' then prop_value else null end) AS t1_distress,max(case prop_key when 't1_eyes' then prop_value else null end) AS t1_eyes,max(case prop_key when 't1_hair' then prop_value else null end) AS t1_hair,max(case prop_key when 't1_skincolor' then prop_value else null end) AS t1_skincolor,max(case prop_key when 't1_skinreaction' then prop_value else null end) AS t1_skinreaction,max(case prop_key when 't1_freckles' then prop_value else null end) AS t1_freckles,max(case prop_key when 't1_moles' then prop_value else null end) AS t1_moles,max(case prop_key when 't1_sunburn_lifetime' then prop_value else null end) AS t1_sunburn_lifetime,max(case prop_key when 't1_tanningbed_ever' then prop_value else null end) AS t1_tanningbed_ever,max(case prop_key when 't1_tanningbed_times' then prop_value else null end) AS t1_tanningbed_times,max(case prop_key when 't1_tanningbed_afterdiagnosis' then prop_value else null end) AS t1_tanningbed_afterdiagnosis,max(case prop_key when 't1_melanoma_familyhistory' then prop_value else null end) AS t1_melanoma_familyhistory,max(case prop_key when 't1_melanoma_relative_list' then prop_value else null end) AS t1_melanoma_relative_list,max(case prop_key when 't1_knowledge_1' then prop_value else null end) AS t1_knowledge_1,max(case prop_key when 't1_knowledge_2' then prop_value else null end) AS t1_knowledge_2,max(case prop_key when 't1_knowledge_3' then prop_value else null end) AS t1_knowledge_3,max(case prop_key when 't1_knowledge_4' then prop_value else null end) AS t1_knowledge_4,max(case prop_key when 't1_knowledge_5' then prop_value else null end) AS t1_knowledge_5,max(case prop_key when 't1_knowledge_6' then prop_value else null end) AS t1_knowledge_6,max(case prop_key when 't1_knowledge_7' then prop_value else null end) AS t1_knowledge_7,max(case prop_key when 't1_knowledge_8' then prop_value else null end) AS t1_knowledge_8,max(case prop_key when 't1_knowledge_9' then prop_value else null end) AS t1_knowledge_9,max(case prop_key when 't1_knowledge_10' then prop_value else null end) AS t1_knowledge_10,max(case prop_key when 't1_knowledge_11' then prop_value else null end) AS t1_knowledge_11,max(case prop_key when 't1_knowledge_12' then prop_value else null end) AS t1_knowledge_12,max(case prop_key when 't1_knowledge_13' then prop_value else null end) AS t1_knowledge_13,max(case prop_key when 't1_abcdef_a' then prop_value else null end) AS t1_abcdef_a,max(case prop_key when 't1_abcdef_b' then prop_value else null end) AS t1_abcdef_b,max(case prop_key when 't1_abcdef_c' then prop_value else null end) AS t1_abcdef_c,max(case prop_key when 't1_abcdef_d' then prop_value else null end) AS t1_abcdef_d,max(case prop_key when 't1_abcdef_e' then prop_value else null end) AS t1_abcdef_e,max(case prop_key when 't1_abcdef_f' then prop_value else null end) AS t1_abcdef_f,max(case prop_key when 't1_worry_1' then prop_value else null end) AS t1_worry_1,max(case prop_key when 't1_worry_2' then prop_value else null end) AS t1_worry_2,max(case prop_key when 't1_worry_3' then prop_value else null end) AS t1_worry_3,max(case prop_key when 't1_worry_4' then prop_value else null end) AS t1_worry_4,max(case prop_key when 't1_severity_1' then prop_value else null end) AS t1_severity_1,max(case prop_key when 't1_severity_2' then prop_value else null end) AS t1_severity_2,max(case prop_key when 't1_severity_3' then prop_value else null end) AS t1_severity_3,max(case prop_key when 't1_severity_4' then prop_value else null end) AS t1_severity_4,max(case prop_key when 't1_severity_5' then prop_value else null end) AS t1_severity_5,max(case prop_key when 't1_severity_6' then prop_value else null end) AS t1_severity_6,max(case prop_key when 't1_risk_1' then prop_value else null end) AS t1_risk_1,max(case prop_key when 't1_risk_2' then prop_value else null end) AS t1_risk_2,max(case prop_key when 't1_risk_3' then prop_value else null end) AS t1_risk_3,max(case prop_key when 't1_risk_4' then prop_value else null end) AS t1_risk_4,max(case prop_key when 't1_controllability_1' then prop_value else null end) AS t1_controllability_1,max(case prop_key when 't1_controllability_2' then prop_value else null end) AS t1_controllability_2,max(case prop_key when 't1_controllability_3' then prop_value else null end) AS t1_controllability_3,max(case prop_key when 't1_controllability_4' then prop_value else null end) AS t1_controllability_4,max(case prop_key when 't1_phys_lastskincheck_t1' then prop_value else null end) AS t1_phys_lastskincheck_t1,max(case prop_key when 't1_phys_fullskincheck_t1' then prop_value else null end) AS t1_phys_fullskincheck_t1,max(case prop_key when 't1_phys_reasonskincheck_t1' then prop_value else null end) AS t1_phys_reasonskincheck_t1,max(case prop_key when 't1_ssc_yn_t1' then prop_value else null end) AS t1_ssc_yn_t1,max(case prop_key when 't1_ssc_times_t1' then prop_value else null end) AS t1_ssc_times_t1,max(case prop_key when 't1_ssc_last_t1' then prop_value else null end) AS t1_ssc_last_t1,max(case prop_key when 't1_ssc_scalp' then prop_value else null end) AS t1_ssc_scalp,max(case prop_key when 't1_ssc_face' then prop_value else null end) AS t1_ssc_face,max(case prop_key when 't1_ssc_neck' then prop_value else null end) AS t1_ssc_neck,max(case prop_key when 't1_ssc_shoulders' then prop_value else null end) AS t1_ssc_shoulders,max(case prop_key when 't1_ssc_frontarms' then prop_value else null end) AS t1_ssc_frontarms,max(case prop_key when 't1_ssc_backarms' then prop_value else null end) AS t1_ssc_backarms,max(case prop_key when 't1_ssc_chest' then prop_value else null end) AS t1_ssc_chest,max(case prop_key when 't1_ssc_stomach' then prop_value else null end) AS t1_ssc_stomach,max(case prop_key when 't1_ssc_upperback' then prop_value else null end) AS t1_ssc_upperback,max(case prop_key when 't1_ssc_lowerback' then prop_value else null end) AS t1_ssc_lowerback,max(case prop_key when 't1_ssc_frontlegs' then prop_value else null end) AS t1_ssc_frontlegs,max(case prop_key when 't1_ssc_backlegs' then prop_value else null end) AS t1_ssc_backlegs,max(case prop_key when 't1_ssc_bottomfeet' then prop_value else null end) AS t1_ssc_bottomfeet,max(case prop_key when 't1_ssc_buttocks' then prop_value else null end) AS t1_ssc_buttocks,max(case prop_key when 't1_ssc_genitals' then prop_value else null end) AS t1_ssc_genitals,max(case prop_key when 't1_ssc_mirror' then prop_value else null end) AS t1_ssc_mirror,max(case prop_key when 't1_ssc_help' then prop_value else null end) AS t1_ssc_help,max(case prop_key when 't1_ssc_molemap' then prop_value else null end) AS t1_ssc_molemap,max(case prop_key when 't1_physrec_ssc_1_t1' then prop_value else null end) AS t1_physrec_ssc_1_t1,max(case prop_key when 't1_physrec_ssc_2_t1' then prop_value else null end) AS t1_physrec_ssc_2_t1,max(case prop_key when 't1_physrec_ssc_3_t1' then prop_value else null end) AS t1_physrec_ssc_3_t1,max(case prop_key when 't1_ssc_beliefs_1' then prop_value else null end) AS t1_ssc_beliefs_1,max(case prop_key when 't1_ssc_beliefs_2' then prop_value else null end) AS t1_ssc_beliefs_2,max(case prop_key when 't1_ssc_beliefs_3' then prop_value else null end) AS t1_ssc_beliefs_3,max(case prop_key when 't1_ssc_beliefs_4' then prop_value else null end) AS t1_ssc_beliefs_4,max(case prop_key when 't1_ssc_beliefs_5' then prop_value else null end) AS t1_ssc_beliefs_5,max(case prop_key when 't1_ssc_beliefs_6' then prop_value else null end) AS t1_ssc_beliefs_6,max(case prop_key when 't1_ssc_beliefs_7' then prop_value else null end) AS t1_ssc_beliefs_7,max(case prop_key when 't1_ssc_beliefs_8' then prop_value else null end) AS t1_ssc_beliefs_8,max(case prop_key when 't1_ssc_beliefs_9' then prop_value else null end) AS t1_ssc_beliefs_9,max(case prop_key when 't1_ssc_beliefs_10' then prop_value else null end) AS t1_ssc_beliefs_10,max(case prop_key when 't1_ssc_beliefs_11' then prop_value else null end) AS t1_ssc_beliefs_11,max(case prop_key when 't1_ssc_beliefs_12' then prop_value else null end) AS t1_ssc_beliefs_12,max(case prop_key when 't1_ssc_beliefs_13' then prop_value else null end) AS t1_ssc_beliefs_13,max(case prop_key when 't1_ssc_beliefs_14' then prop_value else null end) AS t1_ssc_beliefs_14,max(case prop_key when 't1_ssc_beliefs_15' then prop_value else null end) AS t1_ssc_beliefs_15,max(case prop_key when 't1_ssc_beliefs_16' then prop_value else null end) AS t1_ssc_beliefs_16,max(case prop_key when 't1_ssc_beliefs_17' then prop_value else null end) AS t1_ssc_beliefs_17,max(case prop_key when 't1_ssc_beliefs_18' then prop_value else null end) AS t1_ssc_beliefs_18,max(case prop_key when 't1_ssc_beliefs_19' then prop_value else null end) AS t1_ssc_beliefs_19,max(case prop_key when 't1_ssc_beliefs_20' then prop_value else null end) AS t1_ssc_beliefs_20,max(case prop_key when 't1_ssc_beliefs_21' then prop_value else null end) AS t1_ssc_beliefs_21,max(case prop_key when 't1_ssc_selfeff_1' then prop_value else null end) AS t1_ssc_selfeff_1,max(case prop_key when 't1_ssc_selfeff_2' then prop_value else null end) AS t1_ssc_selfeff_2,max(case prop_key when 't1_ssc_selfeff_3' then prop_value else null end) AS t1_ssc_selfeff_3,max(case prop_key when 't1_ssc_selfeff_4' then prop_value else null end) AS t1_ssc_selfeff_4,max(case prop_key when 't1_ssc_selfeff_5' then prop_value else null end) AS t1_ssc_selfeff_5,max(case prop_key when 't1_ssc_selfeff_6' then prop_value else null end) AS t1_ssc_selfeff_6,max(case prop_key when 't1_ssc_selfeff_7' then prop_value else null end) AS t1_ssc_selfeff_7,max(case prop_key when 't1_ssc_selfeff_8' then prop_value else null end) AS t1_ssc_selfeff_8,max(case prop_key when 't1_ssc_selfeff_9' then prop_value else null end) AS t1_ssc_selfeff_9,max(case prop_key when 't1_ssc_selfeff_10' then prop_value else null end) AS t1_ssc_selfeff_10,max(case prop_key when 't1_ssc_selfeff_11' then prop_value else null end) AS t1_ssc_selfeff_11,max(case prop_key when 't1_ssc_selfeff_12' then prop_value else null end) AS t1_ssc_selfeff_12,max(case prop_key when 't1_ssc_norm_1' then prop_value else null end) AS t1_ssc_norm_1,max(case prop_key when 't1_ssc_norm_2' then prop_value else null end) AS t1_ssc_norm_2,max(case prop_key when 't1_sunburn_t1' then prop_value else null end) AS t1_sunburn_t1,max(case prop_key when 't1_sunscreen_t1' then prop_value else null end) AS t1_sunscreen_t1,max(case prop_key when 't1_shirt_t1' then prop_value else null end) AS t1_shirt_t1,max(case prop_key when 't1_pants_t1' then prop_value else null end) AS t1_pants_t1,max(case prop_key when 't1_hat_t1' then prop_value else null end) AS t1_hat_t1,max(case prop_key when 't1_sunglasses_t1' then prop_value else null end) AS t1_sunglasses_t1,max(case prop_key when 't1_shade_t1' then prop_value else null end) AS t1_shade_t1,max(case prop_key when 't1_tanoutside_t1' then prop_value else null end) AS t1_tanoutside_t1,max(case prop_key when 't1_physrec_sunscreen_t1' then prop_value else null end) AS t1_physrec_sunscreen_t1,max(case prop_key when 't1_physrec_shirt_t1' then prop_value else null end) AS t1_physrec_shirt_t1,max(case prop_key when 't1_physrec_hat_t1' then prop_value else null end) AS t1_physrec_hat_t1,max(case prop_key when 't1_physrec_shade_t1' then prop_value else null end) AS t1_physrec_shade_t1,max(case prop_key when 't1_sunscreen_benefit1' then prop_value else null end) AS t1_sunscreen_benefit1,max(case prop_key when 't1_sunscreen_benefit2' then prop_value else null end) AS t1_sunscreen_benefit2,max(case prop_key when 't1_sunscreen_benefit3' then prop_value else null end) AS t1_sunscreen_benefit3,max(case prop_key when 't1_shirt_benefit1' then prop_value else null end) AS t1_shirt_benefit1,max(case prop_key when 't1_shirt_benefit2' then prop_value else null end) AS t1_shirt_benefit2,max(case prop_key when 't1_shirt_benefit3' then prop_value else null end) AS t1_shirt_benefit3,max(case prop_key when 't1_hat_benefit1' then prop_value else null end) AS t1_hat_benefit1,max(case prop_key when 't1_hat_benefit2' then prop_value else null end) AS t1_hat_benefit2,max(case prop_key when 't1_hat_benefit3' then prop_value else null end) AS t1_hat_benefit3,max(case prop_key when 't1_shade_benefit1' then prop_value else null end) AS t1_shade_benefit1,max(case prop_key when 't1_shade_benefit2' then prop_value else null end) AS t1_shade_benefit2,max(case prop_key when 't1_shade_benefit3' then prop_value else null end) AS t1_shade_benefit3,max(case prop_key when 't1_sunscreen_barrier1' then prop_value else null end) AS t1_sunscreen_barrier1,max(case prop_key when 't1_sunscreen_barrier2' then prop_value else null end) AS t1_sunscreen_barrier2,max(case prop_key when 't1_sunscreen_barrier3' then prop_value else null end) AS t1_sunscreen_barrier3,max(case prop_key when 't1_sunscreen_barrier4' then prop_value else null end) AS t1_sunscreen_barrier4,max(case prop_key when 't1_sunscreen_barrier5' then prop_value else null end) AS t1_sunscreen_barrier5,max(case prop_key when 't1_sunscreen_barrier6' then prop_value else null end) AS t1_sunscreen_barrier6,max(case prop_key when 't1_sunscreen_barrier7' then prop_value else null end) AS t1_sunscreen_barrier7,max(case prop_key when 't1_sunscreen_barrier8' then prop_value else null end) AS t1_sunscreen_barrier8,max(case prop_key when 't1_shirt_barrier1' then prop_value else null end) AS t1_shirt_barrier1,max(case prop_key when 't1_shirt_barrier2' then prop_value else null end) AS t1_shirt_barrier2,max(case prop_key when 't1_shirt_barrier3' then prop_value else null end) AS t1_shirt_barrier3,max(case prop_key when 't1_shirt_barrier4' then prop_value else null end) AS t1_shirt_barrier4,max(case prop_key when 't1_shirt_barrier5' then prop_value else null end) AS t1_shirt_barrier5,max(case prop_key when 't1_shirt_barrier6' then prop_value else null end) AS t1_shirt_barrier6,max(case prop_key when 't1_hat_barrier1' then prop_value else null end) AS t1_hat_barrier1,max(case prop_key when 't1_hat_barrier2' then prop_value else null end) AS t1_hat_barrier2,max(case prop_key when 't1_hat_barrier3' then prop_value else null end) AS t1_hat_barrier3,max(case prop_key when 't1_hat_barrier4' then prop_value else null end) AS t1_hat_barrier4,max(case prop_key when 't1_hat_barrier5' then prop_value else null end) AS t1_hat_barrier5,max(case prop_key when 't1_shade_barrier1' then prop_value else null end) AS t1_shade_barrier1,max(case prop_key when 't1_shade_barrier2' then prop_value else null end) AS t1_shade_barrier2,max(case prop_key when 't1_shade_barrier3' then prop_value else null end) AS t1_shade_barrier3,max(case prop_key when 't1_shade_barrier4' then prop_value else null end) AS t1_shade_barrier4,max(case prop_key when 't1_selfeff_sunscreen' then prop_value else null end) AS t1_selfeff_sunscreen,max(case prop_key when 't1_selfeff_shirt' then prop_value else null end) AS t1_selfeff_shirt,max(case prop_key when 't1_selfeff_pants' then prop_value else null end) AS t1_selfeff_pants,max(case prop_key when 't1_selfeff_hat' then prop_value else null end) AS t1_selfeff_hat,max(case prop_key when 't1_selfeff_shade' then prop_value else null end) AS t1_selfeff_shade,max(case prop_key when 't1_norm_descriptive_1' then prop_value else null end) AS t1_norm_descriptive_1,max(case prop_key when 't1_norm_descriptive_2' then prop_value else null end) AS t1_norm_descriptive_2,max(case prop_key when 't1_norm_descriptive_3' then prop_value else null end) AS t1_norm_descriptive_3,max(case prop_key when 't1_norm_descriptive_4' then prop_value else null end) AS t1_norm_descriptive_4,max(case prop_key when 't1_norm_descriptive_5' then prop_value else null end) AS t1_norm_descriptive_5,max(case prop_key when 't1_norm_injunctive_1' then prop_value else null end) AS t1_norm_injunctive_1,max(case prop_key when 't1_norm_injunctive_2' then prop_value else null end) AS t1_norm_injunctive_2,max(case prop_key when 't1_norm_injunctive_3' then prop_value else null end) AS t1_norm_injunctive_3,max(case prop_key when 't1_norm_injunctive_4' then prop_value else null end) AS t1_norm_injunctive_4,max(case prop_key when 't1_norm_injunctive_5' then prop_value else null end) AS t1_norm_injunctive_5,max(case prop_key when 't1_phys_reasoncheck_other_t1' then prop_value else null end) AS t1_phys_reasoncheck_other_t1 FROM participant_data
WHERE participant_id > 30
GROUP BY participant_id;
CREATE VIEW t2_responses AS
SELECT participant_id, max(case prop_key when 't2_distress' then prop_value else null end) AS t2_distress,max(case prop_key when 't2_knowledge_1' then prop_value else null end) AS t2_knowledge_1,max(case prop_key when 't2_knowledge_2' then prop_value else null end) AS t2_knowledge_2,max(case prop_key when 't2_knowledge_3' then prop_value else null end) AS t2_knowledge_3,max(case prop_key when 't2_knowledge_4' then prop_value else null end) AS t2_knowledge_4,max(case prop_key when 't2_knowledge_5' then prop_value else null end) AS t2_knowledge_5,max(case prop_key when 't2_knowledge_6' then prop_value else null end) AS t2_knowledge_6,max(case prop_key when 't2_knowledge_7' then prop_value else null end) AS t2_knowledge_7,max(case prop_key when 't2_knowledge_8' then prop_value else null end) AS t2_knowledge_8,max(case prop_key when 't2_knowledge_9' then prop_value else null end) AS t2_knowledge_9,max(case prop_key when 't2_knowledge_10' then prop_value else null end) AS t2_knowledge_10,max(case prop_key when 't2_knowledge_11' then prop_value else null end) AS t2_knowledge_11,max(case prop_key when 't2_knowledge_12' then prop_value else null end) AS t2_knowledge_12,max(case prop_key when 't2_knowledge_13' then prop_value else null end) AS t2_knowledge_13,max(case prop_key when 't2_abcdef_a' then prop_value else null end) AS t2_abcdef_a,max(case prop_key when 't2_abcdef_b' then prop_value else null end) AS t2_abcdef_b,max(case prop_key when 't2_abcdef_c' then prop_value else null end) AS t2_abcdef_c,max(case prop_key when 't2_abcdef_d' then prop_value else null end) AS t2_abcdef_d,max(case prop_key when 't2_abcdef_e' then prop_value else null end) AS t2_abcdef_e,max(case prop_key when 't2_abcdef_f' then prop_value else null end) AS t2_abcdef_f,max(case prop_key when 't2_worry_1' then prop_value else null end) AS t2_worry_1,max(case prop_key when 't2_worry_2' then prop_value else null end) AS t2_worry_2,max(case prop_key when 't2_worry_3' then prop_value else null end) AS t2_worry_3,max(case prop_key when 't2_worry_4' then prop_value else null end) AS t2_worry_4,max(case prop_key when 't2_severity_1' then prop_value else null end) AS t2_severity_1,max(case prop_key when 't2_severity_2' then prop_value else null end) AS t2_severity_2,max(case prop_key when 't2_severity_3' then prop_value else null end) AS t2_severity_3,max(case prop_key when 't2_severity_4' then prop_value else null end) AS t2_severity_4,max(case prop_key when 't2_severity_5' then prop_value else null end) AS t2_severity_5,max(case prop_key when 't2_severity_6' then prop_value else null end) AS t2_severity_6,max(case prop_key when 't2_risk_1' then prop_value else null end) AS t2_risk_1,max(case prop_key when 't2_risk_2' then prop_value else null end) AS t2_risk_2,max(case prop_key when 't2_risk_3' then prop_value else null end) AS t2_risk_3,max(case prop_key when 't2_risk_4' then prop_value else null end) AS t2_risk_4,max(case prop_key when 't2_controllability_1' then prop_value else null end) AS t2_controllability_1,max(case prop_key when 't2_controllability_2' then prop_value else null end) AS t2_controllability_2,max(case prop_key when 't2_controllability_3' then prop_value else null end) AS t2_controllability_3,max(case prop_key when 't2_controllability_4' then prop_value else null end) AS t2_controllability_4,max(case prop_key when 't2_phys_lastskincheck_t2' then prop_value else null end) AS t2_phys_lastskincheck_t2,max(case prop_key when 't2_phys_fullskincheck_t2' then prop_value else null end) AS t2_phys_fullskincheck_t2,max(case prop_key when 't2_phys_reasoncheck_list_t2' then prop_value else null end) AS t2_phys_reasoncheck_list_t2,max(case prop_key when 't2_phys_reasoncheck_other_t2' then prop_value else null end) AS t2_phys_reasoncheck_other_t2,max(case prop_key when 't2_remove_mole_t2' then prop_value else null end) AS t2_remove_mole_t2,max(case prop_key when 't2_skin_cancer_t2' then prop_value else null end) AS t2_skin_cancer_t2,max(case prop_key when 't2_skin_cancer_types_t2' then prop_value else null end) AS t2_skin_cancer_types_t2,max(case prop_key when 't2_skin_cancer_types_t2_other' then prop_value else null end) AS t2_skin_cancer_types_t2_other,max(case prop_key when 't2_ssc_yn_t2' then prop_value else null end) AS t2_ssc_yn_t2,max(case prop_key when 't2_ssc_times_t2' then prop_value else null end) AS t2_ssc_times_t2,max(case prop_key when 't2_ssc_last_t2' then prop_value else null end) AS t2_ssc_last_t2,max(case prop_key when 't2_ssc_scalp' then prop_value else null end) AS t2_ssc_scalp,max(case prop_key when 't2_ssc_face' then prop_value else null end) AS t2_ssc_face,max(case prop_key when 't2_ssc_neck' then prop_value else null end) AS t2_ssc_neck,max(case prop_key when 't2_ssc_shoulders' then prop_value else null end) AS t2_ssc_shoulders,max(case prop_key when 't2_ssc_frontarms' then prop_value else null end) AS t2_ssc_frontarms,max(case prop_key when 't2_ssc_backarms' then prop_value else null end) AS t2_ssc_backarms,max(case prop_key when 't2_ssc_chest' then prop_value else null end) AS t2_ssc_chest,max(case prop_key when 't2_ssc_stomach' then prop_value else null end) AS t2_ssc_stomach,max(case prop_key when 't2_ssc_upperback' then prop_value else null end) AS t2_ssc_upperback,max(case prop_key when 't2_ssc_lowerback' then prop_value else null end) AS t2_ssc_lowerback,max(case prop_key when 't2_ssc_frontlegs' then prop_value else null end) AS t2_ssc_frontlegs,max(case prop_key when 't2_ssc_backlegs' then prop_value else null end) AS t2_ssc_backlegs,max(case prop_key when 't2_ssc_bottomfeet' then prop_value else null end) AS t2_ssc_bottomfeet,max(case prop_key when 't2_ssc_buttocks' then prop_value else null end) AS t2_ssc_buttocks,max(case prop_key when 't2_ssc_genitals' then prop_value else null end) AS t2_ssc_genitals,max(case prop_key when 't2_ssc_mirror' then prop_value else null end) AS t2_ssc_mirror,max(case prop_key when 't2_ssc_help' then prop_value else null end) AS t2_ssc_help,max(case prop_key when 't2_ssc_molemap' then prop_value else null end) AS t2_ssc_molemap,max(case prop_key when 't2_ssc_beliefs_1' then prop_value else null end) AS t2_ssc_beliefs_1,max(case prop_key when 't2_ssc_beliefs_2' then prop_value else null end) AS t2_ssc_beliefs_2,max(case prop_key when 't2_ssc_beliefs_3' then prop_value else null end) AS t2_ssc_beliefs_3,max(case prop_key when 't2_ssc_beliefs_4' then prop_value else null end) AS t2_ssc_beliefs_4,max(case prop_key when 't2_ssc_beliefs_5' then prop_value else null end) AS t2_ssc_beliefs_5,max(case prop_key when 't2_ssc_beliefs_6' then prop_value else null end) AS t2_ssc_beliefs_6,max(case prop_key when 't2_ssc_beliefs_7' then prop_value else null end) AS t2_ssc_beliefs_7,max(case prop_key when 't2_ssc_beliefs_8' then prop_value else null end) AS t2_ssc_beliefs_8,max(case prop_key when 't2_ssc_beliefs_9' then prop_value else null end) AS t2_ssc_beliefs_9,max(case prop_key when 't2_ssc_beliefs_10' then prop_value else null end) AS t2_ssc_beliefs_10,max(case prop_key when 't2_ssc_beliefs_11' then prop_value else null end) AS t2_ssc_beliefs_11,max(case prop_key when 't2_ssc_beliefs_12' then prop_value else null end) AS t2_ssc_beliefs_12,max(case prop_key when 't2_ssc_beliefs_13' then prop_value else null end) AS t2_ssc_beliefs_13,max(case prop_key when 't2_ssc_beliefs_14' then prop_value else null end) AS t2_ssc_beliefs_14,max(case prop_key when 't2_ssc_beliefs_15' then prop_value else null end) AS t2_ssc_beliefs_15,max(case prop_key when 't2_ssc_beliefs_16' then prop_value else null end) AS t2_ssc_beliefs_16,max(case prop_key when 't2_ssc_beliefs_17' then prop_value else null end) AS t2_ssc_beliefs_17,max(case prop_key when 't2_ssc_beliefs_18' then prop_value else null end) AS t2_ssc_beliefs_18,max(case prop_key when 't2_ssc_beliefs_19' then prop_value else null end) AS t2_ssc_beliefs_19,max(case prop_key when 't2_ssc_beliefs_20' then prop_value else null end) AS t2_ssc_beliefs_20,max(case prop_key when 't2_ssc_beliefs_21' then prop_value else null end) AS t2_ssc_beliefs_21,max(case prop_key when 't2_ssc_selfeff_1' then prop_value else null end) AS t2_ssc_selfeff_1,max(case prop_key when 't2_ssc_selfeff_2' then prop_value else null end) AS t2_ssc_selfeff_2,max(case prop_key when 't2_ssc_selfeff_3' then prop_value else null end) AS t2_ssc_selfeff_3,max(case prop_key when 't2_ssc_selfeff_4' then prop_value else null end) AS t2_ssc_selfeff_4,max(case prop_key when 't2_ssc_selfeff_5' then prop_value else null end) AS t2_ssc_selfeff_5,max(case prop_key when 't2_ssc_selfeff_6' then prop_value else null end) AS t2_ssc_selfeff_6,max(case prop_key when 't2_ssc_selfeff_7' then prop_value else null end) AS t2_ssc_selfeff_7,max(case prop_key when 't2_ssc_selfeff_8' then prop_value else null end) AS t2_ssc_selfeff_8,max(case prop_key when 't2_ssc_selfeff_9' then prop_value else null end) AS t2_ssc_selfeff_9,max(case prop_key when 't2_ssc_selfeff_10' then prop_value else null end) AS t2_ssc_selfeff_10,max(case prop_key when 't2_ssc_selfeff_11' then prop_value else null end) AS t2_ssc_selfeff_11,max(case prop_key when 't2_ssc_selfeff_12' then prop_value else null end) AS t2_ssc_selfeff_12,max(case prop_key when 't2_sunburn_t2' then prop_value else null end) AS t2_sunburn_t2,max(case prop_key when 't2_sunscreen_t2' then prop_value else null end) AS t2_sunscreen_t2,max(case prop_key when 't2_shirt_t2' then prop_value else null end) AS t2_shirt_t2,max(case prop_key when 't2_pants_t2' then prop_value else null end) AS t2_pants_t2,max(case prop_key when 't2_hat_t2' then prop_value else null end) AS t2_hat_t2,max(case prop_key when 't2_sunglasses_t2' then prop_value else null end) AS t2_sunglasses_t2,max(case prop_key when 't2_shade_t2' then prop_value else null end) AS t2_shade_t2,max(case prop_key when 't2_tanoutside_t2' then prop_value else null end) AS t2_tanoutside_t2,max(case prop_key when 't2_sunscreen_benefit1' then prop_value else null end) AS t2_sunscreen_benefit1,max(case prop_key when 't2_sunscreen_benefit2' then prop_value else null end) AS t2_sunscreen_benefit2,max(case prop_key when 't2_sunscreen_benefit3' then prop_value else null end) AS t2_sunscreen_benefit3,max(case prop_key when 't2_shirt_benefit1' then prop_value else null end) AS t2_shirt_benefit1,max(case prop_key when 't2_shirt_benefit2' then prop_value else null end) AS t2_shirt_benefit2,max(case prop_key when 't2_shirt_benefit3' then prop_value else null end) AS t2_shirt_benefit3,max(case prop_key when 't2_hat_benefit1' then prop_value else null end) AS t2_hat_benefit1,max(case prop_key when 't2_hat_benefit2' then prop_value else null end) AS t2_hat_benefit2,max(case prop_key when 't2_hat_benefit3' then prop_value else null end) AS t2_hat_benefit3,max(case prop_key when 't2_shade_benefit1' then prop_value else null end) AS t2_shade_benefit1,max(case prop_key when 't2_shade_benefit2' then prop_value else null end) AS t2_shade_benefit2,max(case prop_key when 't2_shade_benefit3' then prop_value else null end) AS t2_shade_benefit3,max(case prop_key when 't2_sunscreen_barrier1' then prop_value else null end) AS t2_sunscreen_barrier1,max(case prop_key when 't2_sunscreen_barrier2' then prop_value else null end) AS t2_sunscreen_barrier2,max(case prop_key when 't2_sunscreen_barrier3' then prop_value else null end) AS t2_sunscreen_barrier3,max(case prop_key when 't2_sunscreen_barrier4' then prop_value else null end) AS t2_sunscreen_barrier4,max(case prop_key when 't2_sunscreen_barrier5' then prop_value else null end) AS t2_sunscreen_barrier5,max(case prop_key when 't2_sunscreen_barrier6' then prop_value else null end) AS t2_sunscreen_barrier6,max(case prop_key when 't2_sunscreen_barrier7' then prop_value else null end) AS t2_sunscreen_barrier7,max(case prop_key when 't2_sunscreen_barrier8' then prop_value else null end) AS t2_sunscreen_barrier8,max(case prop_key when 't2_shirt_barrier1' then prop_value else null end) AS t2_shirt_barrier1,max(case prop_key when 't2_shirt_barrier2' then prop_value else null end) AS t2_shirt_barrier2,max(case prop_key when 't2_shirt_barrier3' then prop_value else null end) AS t2_shirt_barrier3,max(case prop_key when 't2_shirt_barrier4' then prop_value else null end) AS t2_shirt_barrier4,max(case prop_key when 't2_shirt_barrier5' then prop_value else null end) AS t2_shirt_barrier5,max(case prop_key when 't2_shirt_barrier6' then prop_value else null end) AS t2_shirt_barrier6,max(case prop_key when 't2_hat_barrier1' then prop_value else null end) AS t2_hat_barrier1,max(case prop_key when 't2_hat_barrier2' then prop_value else null end) AS t2_hat_barrier2,max(case prop_key when 't2_hat_barrier3' then prop_value else null end) AS t2_hat_barrier3,max(case prop_key when 't2_hat_barrier4' then prop_value else null end) AS t2_hat_barrier4,max(case prop_key when 't2_hat_barrier5' then prop_value else null end) AS t2_hat_barrier5,max(case prop_key when 't2_shade_barrier1' then prop_value else null end) AS t2_shade_barrier1,max(case prop_key when 't2_shade_barrier2' then prop_value else null end) AS t2_shade_barrier2,max(case prop_key when 't2_shade_barrier3' then prop_value else null end) AS t2_shade_barrier3,max(case prop_key when 't2_shade_barrier4' then prop_value else null end) AS t2_shade_barrier4,max(case prop_key when 't2_selfeff_sunscreen' then prop_value else null end) AS t2_selfeff_sunscreen,max(case prop_key when 't2_selfeff_shirt' then prop_value else null end) AS t2_selfeff_shirt,max(case prop_key when 't2_selfeff_pants' then prop_value else null end) AS t2_selfeff_pants,max(case prop_key when 't2_selfeff_hat' then prop_value else null end) AS t2_selfeff_hat,max(case prop_key when 't2_selfeff_shade' then prop_value else null end) AS t2_selfeff_shade,max(case prop_key when 't2_impact_effect_1' then prop_value else null end) AS t2_impact_effect_1,max(case prop_key when 't2_impact_effect_2' then prop_value else null end) AS t2_impact_effect_2,max(case prop_key when 't2_impact_effect_3' then prop_value else null end) AS t2_impact_effect_3,max(case prop_key when 't2_impact_effect_4' then prop_value else null end) AS t2_impact_effect_4,max(case prop_key when 't2_impact_effect_5' then prop_value else null end) AS t2_impact_effect_5,max(case prop_key when 't2_impact_effect_6' then prop_value else null end) AS t2_impact_effect_6,max(case prop_key when 't2_impact_effect_7' then prop_value else null end) AS t2_impact_effect_7,max(case prop_key when 't2_impact_effect_8' then prop_value else null end) AS t2_impact_effect_8,max(case prop_key when 't2_impact_effect_9' then prop_value else null end) AS t2_impact_effect_9,max(case prop_key when 't2_impact_effect_10' then prop_value else null end) AS t2_impact_effect_10,max(case prop_key when 't2_impact_effect_11' then prop_value else null end) AS t2_impact_effect_11,max(case prop_key when 't2_impact_effect_12' then prop_value else null end) AS t2_impact_effect_12,max(case prop_key when 't2_impact_effect_13' then prop_value else null end) AS t2_impact_effect_13,max(case prop_key when 't2_impact_effect_14' then prop_value else null end) AS t2_impact_effect_14,max(case prop_key when 't2_impact_effect_15' then prop_value else null end) AS t2_impact_effect_15,max(case prop_key when 't2_impact_effect_16' then prop_value else null end) AS t2_impact_effect_16,max(case prop_key when 't2_impact_effect_17' then prop_value else null end) AS t2_impact_effect_17,max(case prop_key when 't2_impact_effect_18' then prop_value else null end) AS t2_impact_effect_18,max(case prop_key when 't2_impact_effect_19' then prop_value else null end) AS t2_impact_effect_19,max(case prop_key when 't2_impact_effect_20' then prop_value else null end) AS t2_impact_effect_20,max(case prop_key when 't2_impact_effect_21' then prop_value else null end) AS t2_impact_effect_21,max(case prop_key when 't2_impact_effect_22' then prop_value else null end) AS t2_impact_effect_22,max(case prop_key when 't2_intervention_adherence_1' then prop_value else null end) AS t2_intervention_adherence_1,max(case prop_key when 't2_intervention_adherence_2' then prop_value else null end) AS t2_intervention_adherence_2,max(case prop_key when 't2_intervention_adherence_3' then prop_value else null end) AS t2_intervention_adherence_3,max(case prop_key when 't2_intervention_adherence_4' then prop_value else null end) AS t2_intervention_adherence_4,max(case prop_key when 't2_intervention_adherence_5' then prop_value else null end) AS t2_intervention_adherence_5,max(case prop_key when 't2_intervention_adherence_6' then prop_value else null end) AS t2_intervention_adherence_6,max(case prop_key when 't2_intervention_adherence_7' then prop_value else null end) AS t2_intervention_adherence_7,max(case prop_key when 't2_intervention_adherence_8' then prop_value else null end) AS t2_intervention_adherence_8,max(case prop_key when 't2_intervention_adherence_9' then prop_value else null end) AS t2_intervention_adherence_9,max(case prop_key when 't2_intervention_adherence_10' then prop_value else null end) AS t2_intervention_adherence_10,max(case prop_key when 't2_intervention_adherence_11' then prop_value else null end) AS t2_intervention_adherence_11,max(case prop_key when 't2_intervention_adherence_12' then prop_value else null end) AS t2_intervention_adherence_12,max(case prop_key when 't2_intervention_adherence_13' then prop_value else null end) AS t2_intervention_adherence_13,max(case prop_key when 't2_intervention_adherence_14' then prop_value else null end) AS t2_intervention_adherence_14,max(case prop_key when 't2_intervention_adherence_15' then prop_value else null end) AS t2_intervention_adherence_15,max(case prop_key when 't2_intervention_adherence_16' then prop_value else null end) AS t2_intervention_adherence_16,max(case prop_key when 't2_intervention_adherence_17' then prop_value else null end) AS t2_intervention_adherence_17,max(case prop_key when 't2_intervention_adherence_18' then prop_value else null end) AS t2_intervention_adherence_18,max(case prop_key when 't2_intervention_adherence_19' then prop_value else null end) AS t2_intervention_adherence_19,max(case prop_key when 't2_intervention_adherence_20' then prop_value else null end) AS t2_intervention_adherence_20,max(case prop_key when 't2_intervention_adherence_21' then prop_value else null end) AS t2_intervention_adherence_21,max(case prop_key when 't2_intervention_adherence_22' then prop_value else null end) AS t2_intervention_adherence_22,max(case prop_key when 't2_intervention_adherence_23' then prop_value else null end) AS t2_intervention_adherence_23,max(case prop_key when 't2_intervention_adherence_23_a' then prop_value else null end) AS t2_intervention_adherence_23_a,max(case prop_key when 't2_evaluation_utility_1' then prop_value else null end) AS t2_evaluation_utility_1,max(case prop_key when 't2_evaluation_utility_2' then prop_value else null end) AS t2_evaluation_utility_2,max(case prop_key when 't2_evaluation_utility_3' then prop_value else null end) AS t2_evaluation_utility_3,max(case prop_key when 't2_evaluation_utility_4' then prop_value else null end) AS t2_evaluation_utility_4,max(case prop_key when 't2_evaluation_utility_5' then prop_value else null end) AS t2_evaluation_utility_5,max(case prop_key when 't2_evaluation_utility_6' then prop_value else null end) AS t2_evaluation_utility_6,max(case prop_key when 't2_evaluation_utility_7' then prop_value else null end) AS t2_evaluation_utility_7,max(case prop_key when 't2_evaluation_utility_8' then prop_value else null end) AS t2_evaluation_utility_8,max(case prop_key when 't2_evaluation_utility_9' then prop_value else null end) AS t2_evaluation_utility_9,max(case prop_key when 't2_evaluation_utility_10' then prop_value else null end) AS t2_evaluation_utility_10,max(case prop_key when 't2_evaluation_utility_11' then prop_value else null end) AS t2_evaluation_utility_11,max(case prop_key when 't2_evaluation_utility_12' then prop_value else null end) AS t2_evaluation_utility_12,max(case prop_key when 't2_evaluation_utility_13' then prop_value else null end) AS t2_evaluation_utility_13,max(case prop_key when 't2_evaluation_utility_14' then prop_value else null end) AS t2_evaluation_utility_14,max(case prop_key when 't2_evaluation_utility_15' then prop_value else null end) AS t2_evaluation_utility_15,max(case prop_key when 't2_evaluation_utility_16' then prop_value else null end) AS t2_evaluation_utility_16,max(case prop_key when 't2_evaluation_utility_17' then prop_value else null end) AS t2_evaluation_utility_17,max(case prop_key when 't2_evaluation_utility_18' then prop_value else null end) AS t2_evaluation_utility_18 FROM participant_data
WHERE participant_id > 30
GROUP BY participant_id;
CREATE VIEW t3_responses AS
SELECT participant_id, max(case prop_key when 't3_distress' then prop_value else null end) AS t3_distress,max(case prop_key when 't3_knowledge_1' then prop_value else null end) AS t3_knowledge_1,max(case prop_key when 't3_knowledge_2' then prop_value else null end) AS t3_knowledge_2,max(case prop_key when 't3_knowledge_3' then prop_value else null end) AS t3_knowledge_3,max(case prop_key when 't3_knowledge_4' then prop_value else null end) AS t3_knowledge_4,max(case prop_key when 't3_knowledge_5' then prop_value else null end) AS t3_knowledge_5,max(case prop_key when 't3_knowledge_6' then prop_value else null end) AS t3_knowledge_6,max(case prop_key when 't3_knowledge_7' then prop_value else null end) AS t3_knowledge_7,max(case prop_key when 't3_knowledge_8' then prop_value else null end) AS t3_knowledge_8,max(case prop_key when 't3_knowledge_9' then prop_value else null end) AS t3_knowledge_9,max(case prop_key when 't3_knowledge_10' then prop_value else null end) AS t3_knowledge_10,max(case prop_key when 't3_knowledge_11' then prop_value else null end) AS t3_knowledge_11,max(case prop_key when 't3_knowledge_12' then prop_value else null end) AS t3_knowledge_12,max(case prop_key when 't3_knowledge_13' then prop_value else null end) AS t3_knowledge_13,max(case prop_key when 't3_abcdef_a' then prop_value else null end) AS t3_abcdef_a,max(case prop_key when 't3_abcdef_b' then prop_value else null end) AS t3_abcdef_b,max(case prop_key when 't3_abcdef_c' then prop_value else null end) AS t3_abcdef_c,max(case prop_key when 't3_abcdef_d' then prop_value else null end) AS t3_abcdef_d,max(case prop_key when 't3_abcdef_e' then prop_value else null end) AS t3_abcdef_e,max(case prop_key when 't3_abcdef_f' then prop_value else null end) AS t3_abcdef_f,max(case prop_key when 't3_worry_1' then prop_value else null end) AS t3_worry_1,max(case prop_key when 't3_worry_2' then prop_value else null end) AS t3_worry_2,max(case prop_key when 't3_worry_3' then prop_value else null end) AS t3_worry_3,max(case prop_key when 't3_worry_4' then prop_value else null end) AS t3_worry_4,max(case prop_key when 't3_severity_1' then prop_value else null end) AS t3_severity_1,max(case prop_key when 't3_severity_2' then prop_value else null end) AS t3_severity_2,max(case prop_key when 't3_severity_3' then prop_value else null end) AS t3_severity_3,max(case prop_key when 't3_severity_4' then prop_value else null end) AS t3_severity_4,max(case prop_key when 't3_severity_5' then prop_value else null end) AS t3_severity_5,max(case prop_key when 't3_severity_6' then prop_value else null end) AS t3_severity_6,max(case prop_key when 't3_risk_1' then prop_value else null end) AS t3_risk_1,max(case prop_key when 't3_risk_2' then prop_value else null end) AS t3_risk_2,max(case prop_key when 't3_risk_3' then prop_value else null end) AS t3_risk_3,max(case prop_key when 't3_risk_4' then prop_value else null end) AS t3_risk_4,max(case prop_key when 't3_controllability_1' then prop_value else null end) AS t3_controllability_1,max(case prop_key when 't3_controllability_2' then prop_value else null end) AS t3_controllability_2,max(case prop_key when 't3_controllability_3' then prop_value else null end) AS t3_controllability_3,max(case prop_key when 't3_controllability_4' then prop_value else null end) AS t3_controllability_4,max(case prop_key when 't3_phys_lastskincheck_t3' then prop_value else null end) AS t3_phys_lastskincheck_t3,max(case prop_key when 't3_phys_fullskincheck_t3' then prop_value else null end) AS t3_phys_fullskincheck_t3,max(case prop_key when 't3_phys_reasoncheck_list_t3' then prop_value else null end) AS t3_phys_reasoncheck_list_t3,max(case prop_key when 't3_phys_reasoncheck_other_t3' then prop_value else null end) AS t3_phys_reasoncheck_other_t3,max(case prop_key when 't3_remove_mole_t3' then prop_value else null end) AS t3_remove_mole_t3,max(case prop_key when 't3_skin_cancer_t3' then prop_value else null end) AS t3_skin_cancer_t3,max(case prop_key when 't3_skin_cancer_types_t3' then prop_value else null end) AS t3_skin_cancer_types_t3,max(case prop_key when 't3_skin_cancer_types_t3_other' then prop_value else null end) AS t3_skin_cancer_types_t3_other,max(case prop_key when 't3_ssc_yn_t3' then prop_value else null end) AS t3_ssc_yn_t3,max(case prop_key when 't3_ssc_times_t3' then prop_value else null end) AS t3_ssc_times_t3,max(case prop_key when 't3_ssc_last_t3' then prop_value else null end) AS t3_ssc_last_t3,max(case prop_key when 't3_ssc_scalp' then prop_value else null end) AS t3_ssc_scalp,max(case prop_key when 't3_ssc_face' then prop_value else null end) AS t3_ssc_face,max(case prop_key when 't3_ssc_neck' then prop_value else null end) AS t3_ssc_neck,max(case prop_key when 't3_ssc_shoulders' then prop_value else null end) AS t3_ssc_shoulders,max(case prop_key when 't3_ssc_frontarms' then prop_value else null end) AS t3_ssc_frontarms,max(case prop_key when 't3_ssc_backarms' then prop_value else null end) AS t3_ssc_backarms,max(case prop_key when 't3_ssc_chest' then prop_value else null end) AS t3_ssc_chest,max(case prop_key when 't3_ssc_stomach' then prop_value else null end) AS t3_ssc_stomach,max(case prop_key when 't3_ssc_upperback' then prop_value else null end) AS t3_ssc_upperback,max(case prop_key when 't3_ssc_lowerback' then prop_value else null end) AS t3_ssc_lowerback,max(case prop_key when 't3_ssc_frontlegs' then prop_value else null end) AS t3_ssc_frontlegs,max(case prop_key when 't3_ssc_backlegs' then prop_value else null end) AS t3_ssc_backlegs,max(case prop_key when 't3_ssc_bottomfeet' then prop_value else null end) AS t3_ssc_bottomfeet,max(case prop_key when 't3_ssc_buttocks' then prop_value else null end) AS t3_ssc_buttocks,max(case prop_key when 't3_ssc_genitals' then prop_value else null end) AS t3_ssc_genitals,max(case prop_key when 't3_ssc_mirror' then prop_value else null end) AS t3_ssc_mirror,max(case prop_key when 't3_ssc_help' then prop_value else null end) AS t3_ssc_help,max(case prop_key when 't3_ssc_molemap' then prop_value else null end) AS t3_ssc_molemap,max(case prop_key when 't3_ssc_beliefs_1' then prop_value else null end) AS t3_ssc_beliefs_1,max(case prop_key when 't3_ssc_beliefs_2' then prop_value else null end) AS t3_ssc_beliefs_2,max(case prop_key when 't3_ssc_beliefs_3' then prop_value else null end) AS t3_ssc_beliefs_3,max(case prop_key when 't3_ssc_beliefs_4' then prop_value else null end) AS t3_ssc_beliefs_4,max(case prop_key when 't3_ssc_beliefs_5' then prop_value else null end) AS t3_ssc_beliefs_5,max(case prop_key when 't3_ssc_beliefs_6' then prop_value else null end) AS t3_ssc_beliefs_6,max(case prop_key when 't3_ssc_beliefs_7' then prop_value else null end) AS t3_ssc_beliefs_7,max(case prop_key when 't3_ssc_beliefs_8' then prop_value else null end) AS t3_ssc_beliefs_8,max(case prop_key when 't3_ssc_beliefs_9' then prop_value else null end) AS t3_ssc_beliefs_9,max(case prop_key when 't3_ssc_beliefs_10' then prop_value else null end) AS t3_ssc_beliefs_10,max(case prop_key when 't3_ssc_beliefs_11' then prop_value else null end) AS t3_ssc_beliefs_11,max(case prop_key when 't3_ssc_beliefs_12' then prop_value else null end) AS t3_ssc_beliefs_12,max(case prop_key when 't3_ssc_beliefs_13' then prop_value else null end) AS t3_ssc_beliefs_13,max(case prop_key when 't3_ssc_beliefs_14' then prop_value else null end) AS t3_ssc_beliefs_14,max(case prop_key when 't3_ssc_beliefs_15' then prop_value else null end) AS t3_ssc_beliefs_15,max(case prop_key when 't3_ssc_beliefs_16' then prop_value else null end) AS t3_ssc_beliefs_16,max(case prop_key when 't3_ssc_beliefs_17' then prop_value else null end) AS t3_ssc_beliefs_17,max(case prop_key when 't3_ssc_beliefs_18' then prop_value else null end) AS t3_ssc_beliefs_18,max(case prop_key when 't3_ssc_beliefs_19' then prop_value else null end) AS t3_ssc_beliefs_19,max(case prop_key when 't3_ssc_beliefs_20' then prop_value else null end) AS t3_ssc_beliefs_20,max(case prop_key when 't3_ssc_beliefs_21' then prop_value else null end) AS t3_ssc_beliefs_21,max(case prop_key when 't3_ssc_selfeff_1' then prop_value else null end) AS t3_ssc_selfeff_1,max(case prop_key when 't3_ssc_selfeff_2' then prop_value else null end) AS t3_ssc_selfeff_2,max(case prop_key when 't3_ssc_selfeff_3' then prop_value else null end) AS t3_ssc_selfeff_3,max(case prop_key when 't3_ssc_selfeff_4' then prop_value else null end) AS t3_ssc_selfeff_4,max(case prop_key when 't3_ssc_selfeff_5' then prop_value else null end) AS t3_ssc_selfeff_5,max(case prop_key when 't3_ssc_selfeff_6' then prop_value else null end) AS t3_ssc_selfeff_6,max(case prop_key when 't3_ssc_selfeff_7' then prop_value else null end) AS t3_ssc_selfeff_7,max(case prop_key when 't3_ssc_selfeff_8' then prop_value else null end) AS t3_ssc_selfeff_8,max(case prop_key when 't3_ssc_selfeff_9' then prop_value else null end) AS t3_ssc_selfeff_9,max(case prop_key when 't3_ssc_selfeff_10' then prop_value else null end) AS t3_ssc_selfeff_10,max(case prop_key when 't3_ssc_selfeff_11' then prop_value else null end) AS t3_ssc_selfeff_11,max(case prop_key when 't3_ssc_selfeff_12' then prop_value else null end) AS t3_ssc_selfeff_12,max(case prop_key when 't3_sunburn_t3' then prop_value else null end) AS t3_sunburn_t3,max(case prop_key when 't3_sunscreen_t3' then prop_value else null end) AS t3_sunscreen_t3,max(case prop_key when 't3_shirt_t3' then prop_value else null end) AS t3_shirt_t3,max(case prop_key when 't3_pants_t3' then prop_value else null end) AS t3_pants_t3,max(case prop_key when 't3_hat_t3' then prop_value else null end) AS t3_hat_t3,max(case prop_key when 't3_sunglasses_t3' then prop_value else null end) AS t3_sunglasses_t3,max(case prop_key when 't3_shade_t3' then prop_value else null end) AS t3_shade_t3,max(case prop_key when 't3_tanoutside_t3' then prop_value else null end) AS t3_tanoutside_t3,max(case prop_key when 't3_sunscreen_benefit1' then prop_value else null end) AS t3_sunscreen_benefit1,max(case prop_key when 't3_sunscreen_benefit2' then prop_value else null end) AS t3_sunscreen_benefit2,max(case prop_key when 't3_sunscreen_benefit3' then prop_value else null end) AS t3_sunscreen_benefit3,max(case prop_key when 't3_shirt_benefit1' then prop_value else null end) AS t3_shirt_benefit1,max(case prop_key when 't3_shirt_benefit2' then prop_value else null end) AS t3_shirt_benefit2,max(case prop_key when 't3_shirt_benefit3' then prop_value else null end) AS t3_shirt_benefit3,max(case prop_key when 't3_hat_benefit1' then prop_value else null end) AS t3_hat_benefit1,max(case prop_key when 't3_hat_benefit2' then prop_value else null end) AS t3_hat_benefit2,max(case prop_key when 't3_hat_benefit3' then prop_value else null end) AS t3_hat_benefit3,max(case prop_key when 't3_shade_benefit1' then prop_value else null end) AS t3_shade_benefit1,max(case prop_key when 't3_shade_benefit2' then prop_value else null end) AS t3_shade_benefit2,max(case prop_key when 't3_shade_benefit3' then prop_value else null end) AS t3_shade_benefit3,max(case prop_key when 't3_sunscreen_barrier1' then prop_value else null end) AS t3_sunscreen_barrier1,max(case prop_key when 't3_sunscreen_barrier2' then prop_value else null end) AS t3_sunscreen_barrier2,max(case prop_key when 't3_sunscreen_barrier3' then prop_value else null end) AS t3_sunscreen_barrier3,max(case prop_key when 't3_sunscreen_barrier4' then prop_value else null end) AS t3_sunscreen_barrier4,max(case prop_key when 't3_sunscreen_barrier5' then prop_value else null end) AS t3_sunscreen_barrier5,max(case prop_key when 't3_sunscreen_barrier6' then prop_value else null end) AS t3_sunscreen_barrier6,max(case prop_key when 't3_sunscreen_barrier7' then prop_value else null end) AS t3_sunscreen_barrier7,max(case prop_key when 't3_sunscreen_barrier8' then prop_value else null end) AS t3_sunscreen_barrier8,max(case prop_key when 't3_shirt_barrier1' then prop_value else null end) AS t3_shirt_barrier1,max(case prop_key when 't3_shirt_barrier2' then prop_value else null end) AS t3_shirt_barrier2,max(case prop_key when 't3_shirt_barrier3' then prop_value else null end) AS t3_shirt_barrier3,max(case prop_key when 't3_shirt_barrier4' then prop_value else null end) AS t3_shirt_barrier4,max(case prop_key when 't3_shirt_barrier5' then prop_value else null end) AS t3_shirt_barrier5,max(case prop_key when 't3_shirt_barrier6' then prop_value else null end) AS t3_shirt_barrier6,max(case prop_key when 't3_hat_barrier1' then prop_value else null end) AS t3_hat_barrier1,max(case prop_key when 't3_hat_barrier2' then prop_value else null end) AS t3_hat_barrier2,max(case prop_key when 't3_hat_barrier3' then prop_value else null end) AS t3_hat_barrier3,max(case prop_key when 't3_hat_barrier4' then prop_value else null end) AS t3_hat_barrier4,max(case prop_key when 't3_hat_barrier5' then prop_value else null end) AS t3_hat_barrier5,max(case prop_key when 't3_shade_barrier1' then prop_value else null end) AS t3_shade_barrier1,max(case prop_key when 't3_shade_barrier2' then prop_value else null end) AS t3_shade_barrier2,max(case prop_key when 't3_shade_barrier3' then prop_value else null end) AS t3_shade_barrier3,max(case prop_key when 't3_shade_barrier4' then prop_value else null end) AS t3_shade_barrier4,max(case prop_key when 't3_selfeff_sunscreen' then prop_value else null end) AS t3_selfeff_sunscreen,max(case prop_key when 't3_selfeff_shirt' then prop_value else null end) AS t3_selfeff_shirt,max(case prop_key when 't3_selfeff_pants' then prop_value else null end) AS t3_selfeff_pants,max(case prop_key when 't3_selfeff_hat' then prop_value else null end) AS t3_selfeff_hat,max(case prop_key when 't3_selfeff_shade' then prop_value else null end) AS t3_selfeff_shade FROM participant_data
WHERE participant_id > 30
GROUP BY participant_id;
CREATE VIEW t4_responses AS
SELECT participant_id, max(case prop_key when 't4_distress' then prop_value else null end) AS t4_distress,max(case prop_key when 't4_knowledge_1' then prop_value else null end) AS t4_knowledge_1,max(case prop_key when 't4_knowledge_2' then prop_value else null end) AS t4_knowledge_2,max(case prop_key when 't4_knowledge_3' then prop_value else null end) AS t4_knowledge_3,max(case prop_key when 't4_knowledge_4' then prop_value else null end) AS t4_knowledge_4,max(case prop_key when 't4_knowledge_5' then prop_value else null end) AS t4_knowledge_5,max(case prop_key when 't4_knowledge_6' then prop_value else null end) AS t4_knowledge_6,max(case prop_key when 't4_knowledge_7' then prop_value else null end) AS t4_knowledge_7,max(case prop_key when 't4_knowledge_8' then prop_value else null end) AS t4_knowledge_8,max(case prop_key when 't4_knowledge_9' then prop_value else null end) AS t4_knowledge_9,max(case prop_key when 't4_knowledge_10' then prop_value else null end) AS t4_knowledge_10,max(case prop_key when 't4_knowledge_11' then prop_value else null end) AS t4_knowledge_11,max(case prop_key when 't4_knowledge_12' then prop_value else null end) AS t4_knowledge_12,max(case prop_key when 't4_knowledge_13' then prop_value else null end) AS t4_knowledge_13,max(case prop_key when 't4_abcdef_a' then prop_value else null end) AS t4_abcdef_a,max(case prop_key when 't4_abcdef_b' then prop_value else null end) AS t4_abcdef_b,max(case prop_key when 't4_abcdef_c' then prop_value else null end) AS t4_abcdef_c,max(case prop_key when 't4_abcdef_d' then prop_value else null end) AS t4_abcdef_d,max(case prop_key when 't4_abcdef_e' then prop_value else null end) AS t4_abcdef_e,max(case prop_key when 't4_abcdef_f' then prop_value else null end) AS t4_abcdef_f,max(case prop_key when 't4_worry_1' then prop_value else null end) AS t4_worry_1,max(case prop_key when 't4_worry_2' then prop_value else null end) AS t4_worry_2,max(case prop_key when 't4_worry_3' then prop_value else null end) AS t4_worry_3,max(case prop_key when 't4_worry_4' then prop_value else null end) AS t4_worry_4,max(case prop_key when 't4_controllability_1' then prop_value else null end) AS t4_controllability_1,max(case prop_key when 't4_controllability_2' then prop_value else null end) AS t4_controllability_2,max(case prop_key when 't4_controllability_3' then prop_value else null end) AS t4_controllability_3,max(case prop_key when 't4_controllability_4' then prop_value else null end) AS t4_controllability_4,max(case prop_key when 't4_phys_lastskincheck_t4' then prop_value else null end) AS t4_phys_lastskincheck_t4,max(case prop_key when 't4_phys_fullskincheck_t4' then prop_value else null end) AS t4_phys_fullskincheck_t4,max(case prop_key when 't4_phys_reasoncheck_list_t4' then prop_value else null end) AS t4_phys_reasoncheck_list_t4,max(case prop_key when 't4_phys_reasoncheck_other_t4' then prop_value else null end) AS t4_phys_reasoncheck_other_t4,max(case prop_key when 't4_skin_cancer_t4' then prop_value else null end) AS t4_skin_cancer_t4,max(case prop_key when 't4_skin_cancer_types_t4' then prop_value else null end) AS t4_skin_cancer_types_t4,max(case prop_key when 't4_skin_cancer_types_t4_other' then prop_value else null end) AS t4_skin_cancer_types_t4_other,max(case prop_key when 't4_ssc_yn_t4' then prop_value else null end) AS t4_ssc_yn_t4,max(case prop_key when 't4_ssc_last_t4' then prop_value else null end) AS t4_ssc_last_t4,max(case prop_key when 't4_ssc_scalp' then prop_value else null end) AS t4_ssc_scalp,max(case prop_key when 't4_ssc_face' then prop_value else null end) AS t4_ssc_face,max(case prop_key when 't4_ssc_neck' then prop_value else null end) AS t4_ssc_neck,max(case prop_key when 't4_ssc_shoulders' then prop_value else null end) AS t4_ssc_shoulders,max(case prop_key when 't4_ssc_frontarms' then prop_value else null end) AS t4_ssc_frontarms,max(case prop_key when 't4_ssc_backarms' then prop_value else null end) AS t4_ssc_backarms,max(case prop_key when 't4_ssc_chest' then prop_value else null end) AS t4_ssc_chest,max(case prop_key when 't4_ssc_stomach' then prop_value else null end) AS t4_ssc_stomach,max(case prop_key when 't4_ssc_upperback' then prop_value else null end) AS t4_ssc_upperback,max(case prop_key when 't4_ssc_lowerback' then prop_value else null end) AS t4_ssc_lowerback,max(case prop_key when 't4_ssc_frontlegs' then prop_value else null end) AS t4_ssc_frontlegs,max(case prop_key when 't4_ssc_backlegs' then prop_value else null end) AS t4_ssc_backlegs,max(case prop_key when 't4_ssc_bottomfeet' then prop_value else null end) AS t4_ssc_bottomfeet,max(case prop_key when 't4_ssc_buttocks' then prop_value else null end) AS t4_ssc_buttocks,max(case prop_key when 't4_ssc_genitals' then prop_value else null end) AS t4_ssc_genitals,max(case prop_key when 't4_ssc_mirror' then prop_value else null end) AS t4_ssc_mirror,max(case prop_key when 't4_ssc_help' then prop_value else null end) AS t4_ssc_help,max(case prop_key when 't4_ssc_molemap' then prop_value else null end) AS t4_ssc_molemap,max(case prop_key when 't4_physrec_ssc_1_t4' then prop_value else null end) AS t4_physrec_ssc_1_t4,max(case prop_key when 't4_physrec_ssc_2_t4' then prop_value else null end) AS t4_physrec_ssc_2_t4,max(case prop_key when 't4_physrec_ssc_3_t4' then prop_value else null end) AS t4_physrec_ssc_3_t4,max(case prop_key when 't4_sunburn_t4' then prop_value else null end) AS t4_sunburn_t4,max(case prop_key when 't4_sunscreen_t4' then prop_value else null end) AS t4_sunscreen_t4,max(case prop_key when 't4_shirt_t4' then prop_value else null end) AS t4_shirt_t4,max(case prop_key when 't4_pants_t4' then prop_value else null end) AS t4_pants_t4,max(case prop_key when 't4_hat_t4' then prop_value else null end) AS t4_hat_t4,max(case prop_key when 't4_sunglasses_t4' then prop_value else null end) AS t4_sunglasses_t4,max(case prop_key when 't4_shade_t4' then prop_value else null end) AS t4_shade_t4,max(case prop_key when 't4_tanoutside_t4' then prop_value else null end) AS t4_tanoutside_t4,max(case prop_key when 't4_tanningbed_yn_t4' then prop_value else null end) AS t4_tanningbed_yn_t4,max(case prop_key when 't4_tanningbed_times_t4' then prop_value else null end) AS t4_tanningbed_times_t4,max(case prop_key when 't4_physrec_sunscreen_t4' then prop_value else null end) AS t4_physrec_sunscreen_t4,max(case prop_key when 't4_physrec_shirt_t4' then prop_value else null end) AS t4_physrec_shirt_t4,max(case prop_key when 't4_physrec_hat_t4' then prop_value else null end) AS t4_physrec_hat_t4,max(case prop_key when 't4_physrec_shade_t4' then prop_value else null end) AS t4_physrec_shade_t4,max(case prop_key when 't4_remove_mole_t4' then prop_value else null end) AS t4_remove_mole_t4,max(case prop_key when 't4_ssc_times_t4' then prop_value else null end) AS t4_ssc_times_t4 FROM participant_data
WHERE participant_id > 30
GROUP BY participant_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment