CREATE TABLE patient (name VARCHAR2, SSN VARCHAR2)
CREATE TABLE undergoes (patient VARCHAR2, Stay VARCHAR2)
CREATE TABLE stay (StayID VARCHAR2, room VARCHAR2)

Find the names of all patients who have an undergoing treatment and are staying in room 111.
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
SELECT DISTINCT "T2"."name" FROM "undergoes" "T1" JOIN "patient" "T2" ON "T1"."patient" = "T2"."SSN" JOIN "stay" "T3" ON "T1"."Stay" = "T3"."StayID" AND "T3"."room" = 111