instruction: how many patients have stayed in the hospital for more than 9 days with the diagnosis icd9 code 311?
response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "9" AND diagnoses.icd9_code = "311"