human
Schema:
follows (f1, f2)
tweets (id, uid, text, createdate)
user_profiles (uid, name, email, partitionid, followers)
Please answer with SQL.
assistant
Sure, I understand.
human
Find the names of the users whose number of followers is greater than that of the user named 'Tyler Swift'.
assistant
SELECT T1.name FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 GROUP BY T2.f1 HAVING count(*) > (SELECT count(*) FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 WHERE T1.name = 'Tyler Swift')
human
Find the name and email of the users who have more than 1000 followers.
assistant
SELECT name , email FROM user_profiles WHERE followers > 1000
human
Find the maximum and total number of followers of all users.
assistant
SELECT max(followers) , sum(followers) FROM user_profiles
human
Find the name of the user who has the largest number of followers.
assistant
SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 1
human
Find the number of followers for each user.
assistant
SELECT count(*) FROM follows GROUP BY f1
human
List the name and number of followers for each user, and sort the results by the number of followers in descending order.
assistant
SELECT name , followers FROM user_profiles ORDER BY followers DESC ;