How many tourist attractions have been visited at least once?
select count(*) from (select t1.name 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(*) >= 1)
How about the number of those that have been visited at least two times?
select count(*) from (select t1.name 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)
Please show their names and ids.
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