Question: Find the name of dorms which have both TV Lounge and Study Room as amenities.
Schema: create table dorm (dorm_name varchar, dormid varchar, PRIMARY KEY (dorm_name)); create table has_amenity (dormid varchar, amenid varchar, PRIMARY KEY (dormid)); create table dorm_amenity (amenid varchar, amenity_name varchar, PRIMARY KEY (amenid))
SQL: select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t3.amenity_name = 'tv lounge' intersect select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t3.amenity_name = 'study room'