คำนวณจำนวนครั้งที่คนไข้ 14836 ใส่ท่อช่วยหายใจ #1 ตั้งแต่ 506 วันที่แล้ว ไม่จำเป็นต้องใช้ตารางทั้งหมด
calculate the number of times patient 14836 had a chest tube #1 since 506 days ago.It is not neccessary to use all the tables.
 inputevents_cv:  row_id [ number]  subject_id [ number]  hadm_id [ number]  icustay_id [ number]  charttime [ time]  itemid [ number]  amount [ number] 
SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14836)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'chest tube #1' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime) >= DATETIME(CURRENT_TIME(), '-506 day')