How many users are followed by Mary?
select count ( * ) from user_profiles as t1 join follows as t2 on t1.uid = t2.f2 where t1.name = "Mary"
What about by Susan?
select count ( * ) from user_profiles as t1 join follows as t2 on t1.uid = t2.f2 where t1.name = "Susan"
I mean the users followed by either.
select t2.f1 from user_profiles as t1 join follows as t2 on t1.uid = t2.f2 where t1.name = "Mary" or t1.name = "Susan"
What are the names of those users?
select uid, name from user_profiles where uid in ( select t2.f1 from user_profiles as t1 join follows as t2 on t1.uid = t2.f2 where t1.name = "Mary" or t1.name = "Susan" )