คำนวณอัตราการรอดชีวิตสองปีของผู้ป่วยที่ได้รับยาดิลเทียเซมหลังจากได้รับการวินิจฉัยว่าเป็นโรค dysarthria ไม่จำเป็นที่จะต้องใช้ตารางทั้งหมด
calculate the two year survival rate among the patients who were prescribed diltiazem after they were diagnosed with dysarthria.It is not neccessary to use all the tables.
 microbiologyevents:  row_id [ number]  subject_id [ number]  hadm_id [ number]  charttime [ time]  spec_type_desc [ text]  org_name [ text] 
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'dysarthria') GROUP BY admissions.subject_id HAVING MIN(diagnoses_icd.charttime) = diagnoses_icd.charttime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.charttime) > 2 * 365) AS t2 JOIN (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'diltiazem') AS t3 ON t2.subject_id = t3.subject_id WHERE t2.charttime < t3.startdate) AS t4 JOIN patients ON t4.subject_id = patients.subject_id