Question: Find the names of all patients who have an undergoing treatment and are staying in room 111.
Schema: create table undergoes (patient varchar, stay varchar, PRIMARY KEY (patient)); create table stay (stayid varchar, room varchar, PRIMARY KEY (stayid)); create table patient (name varchar, ssn varchar, PRIMARY KEY (name))
SQL: select distinct t2.name from undergoes as t1 join patient as t2 on t1.patient = t2.ssn join stay as t3 on t1.stay = t3.stayid where t3.room = 111