คำนวณอัตราการรอดชีวิตห้าปีในผู้ป่วยที่ได้รับยาเซฟาโซลิน 2 กรัมใน ns 100 มล. ivpb หลังจากได้รับการวินิจฉัยว่าเป็นโรคหลอดอาหาร ไม่จำเป็นต้องใช้ตารางทั้งหมด
calculate the five year survival rate among the patients who were prescribed cefazolin 2 gm in ns 100 ml ivpb after they were diagnosed with esophageal ca.It is not neccessary to use all the tables.
 cost:  costid [ number]  uniquepid [ text]  patienthealthsystemstayid [ number]  eventtype [ text]  eventid [ number]  chargetime [ time]  cost [ number] 
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 5 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'esophageal ca' GROUP BY patient.uniquepid HAVING MIN(diagnosis.diagnosistime) = diagnosis.diagnosistime) AS t1) AS t2 JOIN (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'cefazolin 2 gm in ns 100 ml ivpb') AS t3 ON t2.uniquepid = t3.uniquepid WHERE t2.diagnosistime < t3.drugstarttime) AS t4 JOIN patient ON t4.uniquepid = patient.uniquepid