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 maximum and total number of followers of all users.
assistant
SELECT max(followers) , sum(followers) FROM user_profiles
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 user followed by the least number of people.
assistant
SELECT name , email FROM user_profiles ORDER BY followers LIMIT 1
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
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
human
List the names of 5 users followed by the largest number of other users.
assistant
SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 5 ;