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
which item has the highest rating?
assistant
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id ORDER by rating desc LIMIT 1;
human
what is the average rating?
assistant
SELECT AVG ( rating ) FROM review;
human
what items have higher rating than 7?
assistant
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > 7;
human
what is item id of cup?
assistant
SELECT i_id FROM item WHERE title = 'cup';
human
what is item id 4?
assistant
SELECT title FROM item WHERE i_id = 4;
human
please list all items
assistant
SELECT * FROM item ;