human
Schema:
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Dorm (dormid, dorm_name, student_capacity, gender)
Dorm_amenity (amenid, amenity_name)
Has_amenity (dormid, amenid)
Lives_in (stuid, dormid, room_number)
Please answer with SQL.
assistant
Sure, I understand.
human
Can you provide me with the names of the dorms that have both TV Lounge and Study Room as amenities?
assistant
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';
human
What is the Dorm ID of Dorm-plex 2000?
assistant
SELECT dormid FROM dorm WHERE dorm_name = 'Dorm-plex 2000';
human
What is the student capacity of Dorm-plex 2000?
assistant
SELECT student_capacity FROM dorm WHERE dorm_name = "Dorm-plex 2000" ;