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 number of users who posted some tweets.
assistant
SELECT count(DISTINCT UID) FROM tweets
human
Find the maximum and total number of followers of all users.
assistant
SELECT max(followers) , sum(followers) FROM user_profiles
human
Find the number of followers for each user.
assistant
SELECT count(*) FROM follows GROUP BY f1
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
human
How many followers does each user have?
assistant
SELECT count(*) FROM follows
human
How many users are there?
assistant
SELECT COUNT( * ) FROM user_profiles ;