Skip to content

Instantly share code, notes, and snippets.

@jtwohiou
Created August 16, 2019 13:40
Show Gist options
  • Save jtwohiou/b2b0f5d0c0eb247e8fa4ecf73e2ee617 to your computer and use it in GitHub Desktop.
Save jtwohiou/b2b0f5d0c0eb247e8fa4ecf73e2ee617 to your computer and use it in GitHub Desktop.
SELECT \cohort_groups\.\id\ AS t0_r0, \cohort_groups\.\school_id\ AS t0_r1, \cohort_groups\.\created_at\ AS t0_r2, \cohort_groups\.\updated_at\ AS t0_r3, \cohort_groups\.\deleted_at\ AS t0_r4, \cohorts\.\id\ AS t1_r0, \cohorts\.\school_id\ AS t1_r1, \cohorts\.\name\ AS t1_r2, \cohorts\.\description\ AS t1_r3, \cohorts\.\created_at\ AS t1_r4, \cohorts\.\updated_at\ AS t1_r5, \cohorts\.\active\ AS t1_r6, \cohorts\.\class_code\ AS t1_r7, \cohorts\.\teacher_id\ AS t1_r8, \cohorts\.\curriculum_id\ AS t1_r9, \cohorts\.\default\ AS t1_r10, \cohorts\.\estimated_start_date\ AS t1_r11, \cohorts\.\surveys_enabled\ AS t1_r12, \cohorts\.\deleted_at\ AS t1_r13, \cohorts\.\ceremony_date\ AS t1_r14, \cohorts\.\class_size\ AS t1_r15, \cohorts\.\salesforce_id\ AS t1_r16, \cohorts\.\class_type\ AS t1_r17, \cohorts\.\est_number_of_students\ AS t1_r18, \cohorts\.\estimated_end_date\ AS t1_r19, \cohorts\.\implementation_period_id\ AS t1_r20, \cohorts\.\active_at\ AS t1_r21, \cohorts\.\visible\ AS t1_r22, \cohorts\.\promotion_source_cohort_id\ AS t1_r23, \cohorts\.\grade_level\ AS t1_r24, \cohorts\.\duplication_date\ AS t1_r25, \cohorts\.\sponsor_history\ AS t1_r26, \cohorts\.\clever_id\ AS t1_r27, \cohorts\.\clever_archived_date\ AS t1_r28, \cohorts\.\rollover_to_curriculum_id\ AS t1_r29, \cohorts\.\cohort_group_id\ AS t1_r30, \curriculums\.\id\ AS t2_r0, \curriculums\.\name\ AS t2_r1, \curriculums\.\created_at\ AS t2_r2, \curriculums\.\updated_at\ AS t2_r3, \curriculums\.\support_email\ AS t2_r4, \curriculums\.\sandbox\ AS t2_r5, \curriculums\.\help_center_url\ AS t2_r6, \curriculums\.\marketing_url\ AS t2_r7, \curriculums\.\grade_level\ AS t2_r8, \curriculums\.\final_exam_activity_id\ AS t2_r9, \curriculums\.\customization_settings\ AS t2_r10, \curriculums\.\legacy\ AS t2_r11, \curriculums\.\permissions\ AS t2_r12, \curriculums\.\market\ AS t2_r13, \curriculums\.\video_demo_url\ AS t2_r14, \curriculums\.\subject_fit\ AS t2_r15, \curriculums\.\estimated_length\ AS t2_r16, \curriculums\.\level_1\ AS t2_r17, \curriculums\.\default_logo\ AS t2_r18, \curriculums\.\supported_locales\ AS t2_r19, \curriculums\.\curriculum_type\ AS t2_r20, \curriculums\.\default_implementation_period\ AS t2_r21, \curriculums\.\dashboard_hidden\ AS t2_r22, \curriculums\.\foundry_id\ AS t2_r23, \curriculums\.\available_hidden\ AS t2_r24, \curriculums\.\intro_email\ AS t2_r25, \curriculums\.\in_development\ AS t2_r26, \curriculums\.\error_status\ AS t2_r27, \teachers\.\id\ AS t3_r0, \teachers\.\school_id\ AS t3_r1, \teachers\.\active\ AS t3_r2, \teachers\.\created_at\ AS t3_r3, \teachers\.\updated_at\ AS t3_r4, \teachers\.\user_id\ AS t3_r5, \teachers\.\title\ AS t3_r6, \teachers\.\department_id\ AS t3_r7, \teachers\.\grade_level\ AS t3_r8, \teachers\.\department_name\ AS t3_r9, \teachers\.\curriculum_id\ AS t3_r10, \teachers\.\deleted_at\ AS t3_r11, \teachers\.\salesforce_id\ AS t3_r12, \teachers\.\hub_id\ AS t3_r13, \teachers\.\roster\ AS t3_r14, \teachers\.\active_at\ AS t3_r15, \teachers\.\created_source\ AS t3_r16, \teachers\.\curriculum_visible\ AS t3_r17, \users\.\id\ AS t4_r0, \users\.\email\ AS t4_r1, \users\.\encrypted_password\ AS t4_r2, \users\.\reset_password_token\ AS t4_r3, \users\.\reset_password_sent_at\ AS t4_r4, \users\.\remember_created_at\ AS t4_r5, \users\.\sign_in_count\ AS t4_r6, \users\.\current_sign_in_at\ AS t4_r7, \users\.\last_sign_in_at\ AS t4_r8, \users\.\current_sign_in_ip\ AS t4_r9, \users\.\last_sign_in_ip\ AS t4_r10, \users\.\created_at\ AS t4_r11, \users\.\updated_at\ AS t4_r12, \users\.\sso\ AS t4_r13, \users\.\login\ AS t4_r14, \users\.\phone\ AS t4_r15, \users\.\role\ AS t4_r16, \users\.\sso_id\ AS t4_r17, \users\.\sso_partner_id\ AS t4_r18, \users\.\registration_code\ AS t4_r19, \users\.\zipcode\ AS t4_r20, \users\.\first_name\ AS t4_r21, \users\.\last_name\ AS t4_r22, \users\.\terms\ AS t4_r23, \users\.\deleted_at\ AS t4_r24, \users\.\custom_value\ AS t4_r25, \users\.\provider\ AS t4_r26, \users\.\uid\ AS t4_r27, \users\.\age_verified\ AS t4_r28, \users\.\type\ AS t4_r29, \users\.\year_of_study\ AS t4_r30, \users\.\sex\ AS t4_r31, \users\.\household_id\ AS t4_r32, \users\.\anonymous\ AS t4_r33, \users\.\age_status\ AS t4_r34, \users\.\suspended_at\ AS t4_r35, \users\.\uuid\ AS t4_r36, \users\.\prompt_link_account\ AS t4_r37, \users\.\clever_archived_date\ AS t4_r38, \users\.\clever_school_admin\ AS t4_r39, \enrollments\.\id\ AS t5_r0, \enrollments\.\cohort_id\ AS t5_r1, \enrollments\.\created_at\ AS t5_r2, \enrollments\.\updated_at\ AS t5_r3, \enrollments\.\user_id\ AS t5_r4, \enrollments\.\active\ AS t5_r5, \enrollments\.\deleted_at\ AS t5_r6, \enrollments\.\rec_intersession_email\ AS t5_r7, \enrollments\.\report_data\ AS t5_r8, \enrollments\.\state\ AS t5_r9, \enrollments\.\intersession_end_date\ AS t5_r10, \enrollments\.\intersession_start_date\ AS t5_r11, \enrollments\.\last_reminder_email\ AS t5_r12, \enrollments\.\last_reminder_email_at\ AS t5_r13, \enrollments\.\active_at\ AS t5_r14, \enrollments\.\activity_progress_count\ AS t5_r15, \enrollments\.\age_status\ AS t5_r16, \enrollments\.\hidden\ AS t5_r17, \enrollments\.\backfill_date\ AS t5_r18, \enrollments\.\previous_cohort_id\ AS t5_r19, \enrollments\.\transferred_at\ AS t5_r20, \enrollments\.\transferred_source\ AS t5_r21, \users_enrollments\.\id\ AS t6_r0, \users_enrollments\.\email\ AS t6_r1, \users_enrollments\.\encrypted_password\ AS t6_r2, \users_enrollments\.\reset_password_token\ AS t6_r3, \users_enrollments\.\reset_password_sent_at\ AS t6_r4, \users_enrollments\.\remember_created_at\ AS t6_r5, \users_enrollments\.\sign_in_count\ AS t6_r6, \users_enrollments\.\current_sign_in_at\ AS t6_r7, \users_enrollments\.\last_sign_in_at\ AS t6_r8, \users_enrollments\.\current_sign_in_ip\ AS t6_r9, \users_enrollments\.\last_sign_in_ip\ AS t6_r10, \users_enrollments\.\created_at\ AS t6_r11, \users_enrollments\.\updated_at\ AS t6_r12, \users_enrollments\.\sso\ AS t6_r13, \users_enrollments\.\login\ AS t6_r14, \users_enrollments\.\phone\ AS t6_r15, \users_enrollments\.\role\ AS t6_r16, \users_enrollments\.\sso_id\ AS t6_r17, \users_enrollments\.\sso_partner_id\ AS t6_r18, \users_enrollments\.\registration_code\ AS t6_r19, \users_enrollments\.\zipcode\ AS t6_r20, \users_enrollments\.\first_name\ AS t6_r21, \users_enrollments\.\last_name\ AS t6_r22, \users_enrollments\.\terms\ AS t6_r23, \users_enrollments\.\deleted_at\ AS t6_r24, \users_enrollments\.\custom_value\ AS t6_r25, \users_enrollments\.\provider\ AS t6_r26, \users_enrollments\.\uid\ AS t6_r27, \users_enrollments\.\age_verified\ AS t6_r28, \users_enrollments\.\type\ AS t6_r29, \users_enrollments\.\year_of_study\ AS t6_r30, \users_enrollments\.\sex\ AS t6_r31, \users_enrollments\.\household_id\ AS t6_r32, \users_enrollments\.\anonymous\ AS t6_r33, \users_enrollments\.\age_status\ AS t6_r34, \users_enrollments\.\suspended_at\ AS t6_r35, \users_enrollments\.\uuid\ AS t6_r36, \users_enrollments\.\prompt_link_account\ AS t6_r37, \users_enrollments\.\clever_archived_date\ AS t6_r38, \users_enrollments\.\clever_school_admin\ AS t6_r39, \schools\.\id\ AS t7_r0, \schools\.\name\ AS t7_r1, \schools\.\active\ AS t7_r2, \schools\.\created_at\ AS t7_r3, \schools\.\updated_at\ AS t7_r4, \schools\.\school_type\ AS t7_r5, \schools\.\grade\ AS t7_r6, \schools\.\state_id\ AS t7_r7, \schools\.\region\ AS t7_r8, \schools\.\district\ AS t7_r9, \schools\.\student_classification\ AS t7_r10, \schools\.\course_type\ AS t7_r11, \schools\.\credit_type\ AS t7_r12, \schools\.\brought_to_you_text\ AS t7_r13, \schools\.\url\ AS t7_r14, \schools\.\custom_css_url\ AS t7_r15, \schools\.\logo_url\ AS t7_r16, \schools\.\custom_template\ AS t7_r17, \schools\.\program_name\ AS t7_r18, \schools\.\sim_type\ AS t7_r19, \schools\.\intersession_length\ AS t7_r20, \schools\.\site_code\ AS t7_r21, \schools\.\demo\ AS t7_r22, \schools\.\regcode_required\ AS t7_r23, \schools\.\regcode_regex\ AS t7_r24, \schools\.\regcode_label\ AS t7_r25, \schools\.\regcode_description\ AS t7_r26, \schools\.\deleted_at\ AS t7_r27, \schools\.\salesforce_id\ AS t7_r28, \schools\.\custom_label\ AS t7_r29, \schools\.\custom_regex\ AS t7_r30, \schools\.\custom_required\ AS t7_r31, \schools\.\master_school_id\ AS t7_r32, \schools\.\atwork_529_only\ AS t7_r33, \schools\.\start_date\ AS t7_r34, \schools\.\campaign\ AS t7_r35, \schools\.\campaign_licenses\ AS t7_r36, \schools\.\sandbox_app_id\ AS t7_r37, \schools\.\require_dob\ AS t7_r38, \schools\.\show_dob\ AS t7_r39, \schools\.\disable_supplemental_question_sets\ AS t7_r40, \schools\.\advisor_group_type\ AS t7_r41, \schools\.\active_at\ AS t7_r42, \schools\.\account_manager_id\ AS t7_r43, \schools\.\internal_sample\ AS t7_r44, \schools\.\city\ AS t7_r45, \schools\.\hide_from_self_registration\ AS t7_r46, \schools\.\disable_underage_branding\ AS t7_r47, \schools\.\chat_counter\ AS t7_r48, \schools\.\uuid\ AS t7_r49, \schools\.\clever_id\ AS t7_r50, \schools\.\district_id\ AS t7_r51, \schools\.\logout_redirect_url\ AS t7_r52, \schools\.\clever_archived_date\ AS t7_r53, \schools\.\last_foundry_export_at\ AS t7_r54, \schools\.\save_surveys_results_outside_us\ AS t7_r55, \districts\.\id\ AS t8_r0, \districts\.\name\ AS t8_r1, \districts\.\master_district_id\ AS t8_r2, \districts\.\mdr_number\ AS t8_r3, \districts\.\clever_id\ AS t8_r4, \districts\.\clever_access_token\ AS t8_r5, \districts\.\deleted_at\ AS t8_r6, \districts\.\clever_pause_start_date\ AS t8_r7, \districts\.\clever_pause_end_date\ AS t8_r8, \districts\.\clever_login_url\ AS t8_r9, \districts\.\clever_archived_date\ AS t8_r10, \districts\.\clever_detached_data\ AS t8_r11 FROM \cohort_groups\ INNER JOIN \cohorts\ ON \cohorts\.\cohort_group_id\ = \cohort_groups\.\id\ AND \cohorts\.\deleted_at\ IS NULL AND \cohorts\.\active\ IN ('t', 'f') LEFT OUTER JOIN \cohorts\ \cohorts_cohort_groups_join\ ON \cohorts_cohort_groups_join\.\cohort_group_id\ = \cohort_groups\.\id\ AND \cohorts_cohort_groups_join\.\deleted_at\ IS NULL AND \cohorts_cohort_groups_join\.\active\ IN ('t', 'f') LEFT OUTER JOIN \curriculums\ ON \curriculums\.\id\ = \cohorts_cohort_groups_join\.\curriculum_id\ LEFT OUTER JOIN \cohorts\ \cohorts_cohort_groups_join_2\ ON \cohorts_cohort_groups_join_2\.\cohort_group_id\ = \cohort_groups\.\id\ AND \cohorts_cohort_groups_join_2\.\deleted_at\ IS NULL AND \cohorts_cohort_groups_join_2\.\active\ IN ('t', 'f') LEFT OUTER JOIN \teachers\ ON \teachers\.\id\ = \cohorts_cohort_groups_join_2\.\teacher_id\ AND \teachers\.\deleted_at\ IS NULL LEFT OUTER JOIN \users\ ON \users\.\id\ = \teachers\.\user_id\ AND \users\.\deleted_at\ IS NULL LEFT OUTER JOIN \cohorts\ \cohorts_cohort_groups_join_3\ ON \cohorts_cohort_groups_join_3\.\cohort_group_id\ = \cohort_groups\.\id\ AND \cohorts_cohort_groups_join_3\.\deleted_at\ IS NULL AND \cohorts_cohort_groups_join_3\.\active\ IN ('t', 'f')
LEFT OUTER JOIN \enrollments\ ON \enrollments\.\cohort_id\ = \cohorts_cohort_groups_join_3\.\id\ AND \enrollments\.\deleted_at\ IS NULL AND (\enrollments\.\user_id\ IS NOT NULL) LEFT OUTER JOIN \users\ \users_enrollments\ ON \users_enrollments\.\id\ = \enrollments\.\user_id\ AND \users_enrollments\.\deleted_at\ IS NULL LEFT OUTER JOIN \schools\ ON \schools\.\id\ = \cohort_groups\.\school_id\ AND \schools\.\deleted_at\ IS NULL LEFT OUTER JOIN \districts\ ON \districts\.\id\ = \schools\.\district_id\ AND \districts\.\deleted_at\ IS NULL WHERE \cohort_groups\.\deleted_at\ IS NULL AND \cohort_groups\.\school_id\ = 116590 AND \cohorts\.\implementation_period_id\ IN (52, 53, 54) AND \curriculums\.\id\ IN (3, 4, 5, 6, 12, 13, 14, 16, 7, 17, 18, 24, 25, 26, 30, 38, 39, 42, 41, 40, 43, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment