FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE, FOREIGN KEY (course_id) REFERENCES courses(course_id) ON DELETE CASCADE ...
case axp_appsearch_data_v2.hltype when 'iview' then concat('i',axp_appsearch_data_v2.structname) when 'tstruct' then concat('t',axp_appsearch_data_v2.structname) else ...