human
Schema:
item (i_id, title)
review (a_id, u_id, i_id, rating, rank)
useracct (u_id, name)
trust (source_u_id, target_u_id, trust)
Please answer with SQL.
assistant
Sure, I understand.
human
Find the names of users who did not leave any review.
assistant
SELECT name FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review)
human
For each user, find their name and the number of reviews written by them.
assistant
SELECT T1.name , count(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id
human
Find the number of users who did not write any review.
assistant
SELECT count(*) FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review)
human
How many different items were reviewed by some users?
assistant
SELECT count(DISTINCT i_id) FROM review
human
How many different users wrote some reviews?
assistant
SELECT count(DISTINCT u_id) FROM review
human
How many users are there?
assistant
SELECT COUNT( * ) FROM useracct ;