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
List the title and rating for each item.
assistant
SELECT T1.title , T2.rating FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id;
human
Order by increasing rating.
assistant
SELECT T1.title , T2.rating FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id ORDER BY T2.rating ASC;
human
How many received a rating below 5?
assistant
SELECT COUNT( * ) FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5 ;