CREATE TABLE dorm_amenity (amenid NUMBER, amenity_name CLOB)
CREATE TABLE student (stuid NUMBER, lname CLOB, fname CLOB, age NUMBER, sex CLOB, major NUMBER, advisor NUMBER, city_code CLOB)
CREATE TABLE dorm (dormid NUMBER, dorm_name CLOB, student_capacity NUMBER, gender CLOB)
CREATE TABLE has_amenity (dormid NUMBER, amenid NUMBER)
CREATE TABLE lives_in (stuid NUMBER, dormid NUMBER, room_number NUMBER)

What are the first and last names of all students who are living in a dorm with a TV Lounge?
SELECT T1.fname, T1.lname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge')
WITH "_u_0" AS (SELECT "T3"."dormid" FROM "has_amenity" "T3" JOIN "dorm_amenity" "T4" ON "T3"."amenid" = "T4"."amenid" AND "T4"."amenity_name" = 'TV Lounge' GROUP BY "dormid") SELECT "T1"."fname", "T1"."lname" FROM "student" "T1" JOIN "lives_in" "T2" ON "T1"."stuid" = "T2"."stuid" LEFT JOIN "_u_0" "_u_0" ON "T2"."dormid" = "_u_0"."" WHERE NOT "_u_0"."" IS NULL