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
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
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
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 and email of the users who have more than 1000 followers.
assistant
SELECT name , email FROM user_profiles WHERE followers > 1000
human
Find the name and email for the users who have more than one follower.
assistant
SELECT T1.name , T1.email FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 GROUP BY T2.f1 HAVING COUNT( * ) > 1 ;