human
Schema:
Ref_Hotel_Star_Ratings (star_rating_code, star_rating_description)
Locations (Location_ID, Location_Name, Address, Other_Details)
Ref_Attraction_Types (Attraction_Type_Code, Attraction_Type_Description)
Visitors (Tourist_ID, Tourist_Details)
Features (Feature_ID, Feature_Details)
Hotels (hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details)
Tourist_Attractions (Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details)
Street_Markets (Market_ID, Market_Details)
Shops (Shop_ID, Shop_Details)
Museums (Museum_ID, Museum_Details)
Royal_Family (Royal_Family_ID, Royal_Family_Details)
Theme_Parks (Theme_Park_ID, Theme_Park_Details)
Visits (Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details)
Photos (Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details)
Staff (Staff_ID, Tourist_Attraction_ID, Name, Other_Details)
Tourist_Attraction_Features (Tourist_Attraction_ID, Feature_ID)
Please answer with SQL.
assistant
Sure, I understand.
human
Hello! Can you provide me with a list of all the names and ids for all tourist attractions?
assistant
SELECT Name , Tourist_Attraction_ID FROM Tourist_Attractions;
human
Great! Can you filter this list to show only the names and ids for tourist attractions that were visited 2 or more times?
assistant
SELECT T1.Name , T2.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID HAVING COUNT( * ) > = 2 ;