Unnamed: 0
int64
0
60k
input
stringlengths
76
562
answer
stringlengths
18
557
900
<question>: What is the average, minimum, maximum, and total transaction amount? <context>: CREATE TABLE Financial_transactions (transaction_amount INTEGER)
SELECT AVG(transaction_amount), MIN(transaction_amount), MAX(transaction_amount), SUM(transaction_amount) FROM Financial_transactions
901
<question>: Show ids for all transactions whose amounts are greater than the average. <context>: CREATE TABLE Financial_transactions (transaction_id VARCHAR, transaction_amount INTEGER)
SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT AVG(transaction_amount) FROM Financial_transactions)
902
<question>: Show the transaction types and the total amount of transactions. <context>: CREATE TABLE Financial_transactions (transaction_type VARCHAR, transaction_amount INTEGER)
SELECT transaction_type, SUM(transaction_amount) FROM Financial_transactions GROUP BY transaction_type
903
<question>: Show the account name, id and the number of transactions for each account. <context>: CREATE TABLE Financial_transactions (account_id VARCHAR); CREATE TABLE Accounts (account_name VARCHAR, account_id VARCHAR)
SELECT T2.account_name, T1.account_id, COUNT(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id
904
<question>: Show the account id with most number of transactions. <context>: CREATE TABLE Financial_transactions (account_id VARCHAR)
SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY COUNT(*) DESC LIMIT 1
905
<question>: Show the account id and name with at least 4 transactions. <context>: CREATE TABLE Financial_transactions (account_id VARCHAR); CREATE TABLE Accounts (account_name VARCHAR, account_id VARCHAR)
SELECT T1.account_id, T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id HAVING COUNT(*) >= 4
906
<question>: Show all product sizes. <context>: CREATE TABLE Products (product_size VARCHAR)
SELECT DISTINCT product_size FROM Products
907
<question>: Show all product colors. <context>: CREATE TABLE Products (product_color VARCHAR)
SELECT DISTINCT product_color FROM Products
908
<question>: Show the invoice number and the number of transactions for each invoice. <context>: CREATE TABLE Financial_transactions (invoice_number VARCHAR)
SELECT invoice_number, COUNT(*) FROM Financial_transactions GROUP BY invoice_number
909
<question>: What is the invoice number and invoice date for the invoice with most number of transactions? <context>: CREATE TABLE Invoices (invoice_number VARCHAR, invoice_date VARCHAR); CREATE TABLE Financial_transactions (invoice_number VARCHAR)
SELECT T2.invoice_number, T2.invoice_date FROM Financial_transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number GROUP BY T1.invoice_number ORDER BY COUNT(*) DESC LIMIT 1
910
<question>: How many invoices do we have? <context>: CREATE TABLE Invoices (Id VARCHAR)
SELECT COUNT(*) FROM Invoices
911
<question>: Show invoice dates and order id and details for all invoices. <context>: CREATE TABLE Invoices (invoice_date VARCHAR, order_id VARCHAR); CREATE TABLE Orders (order_details VARCHAR, order_id VARCHAR)
SELECT T1.invoice_date, T1.order_id, T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id
912
<question>: Show the order ids and the number of invoices for each order. <context>: CREATE TABLE Invoices (order_id VARCHAR)
SELECT order_id, COUNT(*) FROM Invoices GROUP BY order_id
913
<question>: What is the order id and order details for the order more than two invoices. <context>: CREATE TABLE Orders (order_id VARCHAR, order_details VARCHAR); CREATE TABLE Invoices (order_id VARCHAR)
SELECT T2.order_id, T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id GROUP BY T2.order_id HAVING COUNT(*) > 2
914
<question>: What is the customer last name, id and phone number with most number of orders? <context>: CREATE TABLE Orders (customer_id VARCHAR); CREATE TABLE Customers (customer_last_name VARCHAR, phone_number VARCHAR, customer_id VARCHAR)
SELECT T2.customer_last_name, T1.customer_id, T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1
915
<question>: Show all product names without an order. <context>: CREATE TABLE Products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE Order_items (product_id VARCHAR); CREATE TABLE Products (product_name VARCHAR)
SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id
916
<question>: Show all product names and the total quantity ordered for each product name. <context>: CREATE TABLE Products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE Order_items (product_quantity INTEGER, product_id VARCHAR)
SELECT T2.product_name, SUM(T1.product_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name
917
<question>: Show the order ids and the number of items in each order. <context>: CREATE TABLE Order_items (order_id VARCHAR)
SELECT order_id, COUNT(*) FROM Order_items GROUP BY order_id
918
<question>: Show the product ids and the number of unique orders containing each product. <context>: CREATE TABLE Order_items (product_id VARCHAR, order_id VARCHAR)
SELECT product_id, COUNT(DISTINCT order_id) FROM Order_items GROUP BY product_id
919
<question>: Show all product names and the number of customers having an order on each product. <context>: CREATE TABLE Order_items (product_id VARCHAR, order_id VARCHAR); CREATE TABLE Orders (order_id VARCHAR); CREATE TABLE Products (product_name VARCHAR, product_id VARCHAR)
SELECT T2.product_name, COUNT(*) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T3.order_id = T1.order_id GROUP BY T2.product_name
920
<question>: Show order ids and the number of products in each order. <context>: CREATE TABLE Order_items (order_id VARCHAR, product_id VARCHAR)
SELECT order_id, COUNT(DISTINCT product_id) FROM Order_items GROUP BY order_id
921
<question>: Show order ids and the total quantity in each order. <context>: CREATE TABLE Order_items (order_id VARCHAR, product_quantity INTEGER)
SELECT order_id, SUM(product_quantity) FROM Order_items GROUP BY order_id
922
<question>: How many products were not included in any order? <context>: CREATE TABLE products (product_id VARCHAR); CREATE TABLE Order_items (product_id VARCHAR)
SELECT COUNT(*) FROM products WHERE NOT product_id IN (SELECT product_id FROM Order_items)
923
<question>: How many churches opened before 1850 are there? <context>: CREATE TABLE Church (Open_Date INTEGER)
SELECT COUNT(*) FROM Church WHERE Open_Date < 1850
924
<question>: Show the name, open date, and organizer for all churches. <context>: CREATE TABLE Church (name VARCHAR, open_date VARCHAR, organized_by VARCHAR)
SELECT name, open_date, organized_by FROM Church
925
<question>: List all church names in descending order of opening date. <context>: CREATE TABLE church (name VARCHAR, open_date VARCHAR)
SELECT name FROM church ORDER BY open_date DESC
926
<question>: Show the opening year in whcih at least two churches opened. <context>: CREATE TABLE church (open_date VARCHAR)
SELECT open_date FROM church GROUP BY open_date HAVING COUNT(*) >= 2
927
<question>: Show the organizer and name for churches that opened between 1830 and 1840. <context>: CREATE TABLE church (organized_by VARCHAR, name VARCHAR, open_date INTEGER)
SELECT organized_by, name FROM church WHERE open_date BETWEEN 1830 AND 1840
928
<question>: Show all opening years and the number of churches that opened in that year. <context>: CREATE TABLE church (open_date VARCHAR)
SELECT open_date, COUNT(*) FROM church GROUP BY open_date
929
<question>: Show the name and opening year for three churches that opened most recently. <context>: CREATE TABLE church (name VARCHAR, open_date VARCHAR)
SELECT name, open_date FROM church ORDER BY open_date DESC LIMIT 3
930
<question>: How many female people are older than 30 in our record? <context>: CREATE TABLE people (is_male VARCHAR, age VARCHAR)
SELECT COUNT(*) FROM people WHERE is_male = 'F' AND age > 30
931
<question>: Show the country where people older than 30 and younger than 25 are from. <context>: CREATE TABLE people (country VARCHAR, age INTEGER)
SELECT country FROM people WHERE age < 25 INTERSECT SELECT country FROM people WHERE age > 30
932
<question>: Show the minimum, maximum, and average age for all people. <context>: CREATE TABLE people (age INTEGER)
SELECT MIN(age), MAX(age), AVG(age) FROM people
933
<question>: Show the name and country for all people whose age is smaller than the average. <context>: CREATE TABLE people (name VARCHAR, country VARCHAR, age INTEGER)
SELECT name, country FROM people WHERE age < (SELECT AVG(age) FROM people)
934
<question>: Show the pair of male and female names in all weddings after year 2014 <context>: CREATE TABLE wedding (male_id VARCHAR, female_id VARCHAR, year INTEGER); CREATE TABLE people (name VARCHAR, people_id VARCHAR)
SELECT T2.name, T3.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id WHERE T1.year > 2014
935
<question>: Show the name and age for all male people who don't have a wedding. <context>: CREATE TABLE wedding (name VARCHAR, age VARCHAR, is_male VARCHAR, people_id VARCHAR, male_id VARCHAR); CREATE TABLE people (name VARCHAR, age VARCHAR, is_male VARCHAR, people_id VARCHAR, male_id VARCHAR)
SELECT name, age FROM people WHERE is_male = 'T' AND NOT people_id IN (SELECT male_id FROM wedding)
936
<question>: Show all church names except for those that had a wedding in year 2015. <context>: CREATE TABLE church (name VARCHAR); CREATE TABLE wedding (church_id VARCHAR, year VARCHAR); CREATE TABLE church (name VARCHAR, church_id VARCHAR)
SELECT name FROM church EXCEPT SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id = T2.church_id WHERE T2.year = 2015
937
<question>: Show all church names that have hosted least two weddings. <context>: CREATE TABLE wedding (church_id VARCHAR); CREATE TABLE church (name VARCHAR, church_id VARCHAR)
SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id = T2.church_id GROUP BY T1.church_id HAVING COUNT(*) >= 2
938
<question>: Show the names for all females from Canada having a wedding in year 2016. <context>: CREATE TABLE people (name VARCHAR, people_id VARCHAR, country VARCHAR, is_male VARCHAR); CREATE TABLE wedding (female_id VARCHAR, year VARCHAR)
SELECT T2.name FROM wedding AS T1 JOIN people AS T2 ON T1.female_id = T2.people_id WHERE T1.year = 2016 AND T2.is_male = 'F' AND T2.country = 'Canada'
939
<question>: How many weddings are there in year 2016? <context>: CREATE TABLE wedding (YEAR VARCHAR)
SELECT COUNT(*) FROM wedding WHERE YEAR = 2016
940
<question>: Show the church names for the weddings of all people older than 30. <context>: CREATE TABLE church (name VARCHAR, church_id VARCHAR); CREATE TABLE people (people_id VARCHAR, age VARCHAR); CREATE TABLE wedding (male_id VARCHAR, female_id VARCHAR, church_id VARCHAR)
SELECT T4.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id JOIN church AS T4 ON T4.church_id = T1.church_id WHERE T2.age > 30 OR T3.age > 30
941
<question>: Show all countries and the number of people from each country. <context>: CREATE TABLE people (country VARCHAR)
SELECT country, COUNT(*) FROM people GROUP BY country
942
<question>: How many churches have a wedding in year 2016? <context>: CREATE TABLE wedding (church_id VARCHAR, YEAR VARCHAR)
SELECT COUNT(DISTINCT church_id) FROM wedding WHERE YEAR = 2016
943
<question>: How many artists do we have? <context>: CREATE TABLE artist (Id VARCHAR)
SELECT COUNT(*) FROM artist
944
<question>: Show all artist name, age, and country ordered by the yeared they joined. <context>: CREATE TABLE artist (name VARCHAR, age VARCHAR, country VARCHAR, Year_Join VARCHAR)
SELECT name, age, country FROM artist ORDER BY Year_Join
945
<question>: What are all distinct country for artists? <context>: CREATE TABLE artist (country VARCHAR)
SELECT DISTINCT country FROM artist
946
<question>: Show all artist names and the year joined who are not from United States. <context>: CREATE TABLE artist (name VARCHAR, year_join VARCHAR, country VARCHAR)
SELECT name, year_join FROM artist WHERE country <> 'United States'
947
<question>: How many artists are above age 46 and joined after 1990? <context>: CREATE TABLE artist (age VARCHAR, year_join VARCHAR)
SELECT COUNT(*) FROM artist WHERE age > 46 AND year_join > 1990
948
<question>: What is the average and minimum age of all artists from United States. <context>: CREATE TABLE artist (age INTEGER, country VARCHAR)
SELECT AVG(age), MIN(age) FROM artist WHERE country = 'United States'
949
<question>: What is the name of the artist who joined latest? <context>: CREATE TABLE artist (name VARCHAR, year_join VARCHAR)
SELECT name FROM artist ORDER BY year_join DESC LIMIT 1
950
<question>: How many exhibition are there in year 2005 or after? <context>: CREATE TABLE exhibition (YEAR VARCHAR)
SELECT COUNT(*) FROM exhibition WHERE YEAR >= 2005
951
<question>: Show theme and year for all exhibitions with ticket prices lower than 15. <context>: CREATE TABLE exhibition (theme VARCHAR, YEAR VARCHAR, ticket_price INTEGER)
SELECT theme, YEAR FROM exhibition WHERE ticket_price < 15
952
<question>: Show all artist names and the number of exhibitions for each artist. <context>: CREATE TABLE artist (name VARCHAR, artist_id VARCHAR); CREATE TABLE exhibition (artist_id VARCHAR)
SELECT T2.name, COUNT(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id
953
<question>: What is the name and country for the artist with most number of exhibitions? <context>: CREATE TABLE exhibition (artist_id VARCHAR); CREATE TABLE artist (name VARCHAR, country VARCHAR, artist_id VARCHAR)
SELECT T2.name, T2.country FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id ORDER BY COUNT(*) DESC LIMIT 1
954
<question>: Show names for artists without any exhibition. <context>: CREATE TABLE artist (name VARCHAR, artist_id VARCHAR); CREATE TABLE exhibition (name VARCHAR, artist_id VARCHAR)
SELECT name FROM artist WHERE NOT artist_id IN (SELECT artist_id FROM exhibition)
955
<question>: What is the theme and artist name for the exhibition with a ticket price higher than the average? <context>: CREATE TABLE exhibition (ticket_price INTEGER); CREATE TABLE exhibition (theme VARCHAR, artist_id VARCHAR, ticket_price INTEGER); CREATE TABLE artist (name VARCHAR, artist_id VARCHAR)
SELECT T1.theme, T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.ticket_price > (SELECT AVG(ticket_price) FROM exhibition)
956
<question>: Show the average, minimum, and maximum ticket prices for exhibitions for all years before 2009. <context>: CREATE TABLE exhibition (ticket_price INTEGER, YEAR INTEGER)
SELECT AVG(ticket_price), MIN(ticket_price), MAX(ticket_price) FROM exhibition WHERE YEAR < 2009
957
<question>: Show theme and year for all exhibitions in an descending order of ticket price. <context>: CREATE TABLE exhibition (theme VARCHAR, YEAR VARCHAR, ticket_price VARCHAR)
SELECT theme, YEAR FROM exhibition ORDER BY ticket_price DESC
958
<question>: What is the theme, date, and attendance for the exhibition in year 2004? <context>: CREATE TABLE exhibition_record (date VARCHAR, attendance VARCHAR, exhibition_id VARCHAR); CREATE TABLE exhibition (theme VARCHAR, exhibition_id VARCHAR, year VARCHAR)
SELECT T2.theme, T1.date, T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T2.year = 2004
959
<question>: Show all artist names who didn't have an exhibition in 2004. <context>: CREATE TABLE exhibition (artist_id VARCHAR, year VARCHAR); CREATE TABLE artist (name VARCHAR); CREATE TABLE artist (name VARCHAR, artist_id VARCHAR)
SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.year = 2004
960
<question>: Show the theme for exhibitions with both records of an attendance below 100 and above 500. <context>: CREATE TABLE exhibition (theme VARCHAR, exhibition_id VARCHAR); CREATE TABLE exhibition_record (exhibition_id VARCHAR, attendance INTEGER)
SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance < 100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 500
961
<question>: How many exhibitions have a attendance more than 100 or have a ticket price below 10? <context>: CREATE TABLE exhibition_record (exhibition_id VARCHAR, attendance VARCHAR); CREATE TABLE exhibition (exhibition_id VARCHAR, ticket_price VARCHAR)
SELECT COUNT(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 100 OR T2.ticket_price < 10
962
<question>: Show all artist names with an average exhibition attendance over 200. <context>: CREATE TABLE artist (name VARCHAR, artist_id VARCHAR); CREATE TABLE exhibition (exhibition_id VARCHAR, artist_id VARCHAR); CREATE TABLE exhibition_record (exhibition_id VARCHAR, attendance INTEGER)
SELECT T3.name FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id JOIN artist AS T3 ON T3.artist_id = T2.artist_id GROUP BY T3.artist_id HAVING AVG(T1.attendance) > 200
963
<question>: Find the id of the item whose title is "orange". <context>: CREATE TABLE item (i_id VARCHAR, title VARCHAR)
SELECT i_id FROM item WHERE title = "orange"
964
<question>: List all information in the item table. <context>: CREATE TABLE item (Id VARCHAR)
SELECT * FROM item
965
<question>: Find the number of reviews. <context>: CREATE TABLE review (Id VARCHAR)
SELECT COUNT(*) FROM review
966
<question>: How many users are there? <context>: CREATE TABLE useracct (Id VARCHAR)
SELECT COUNT(*) FROM useracct
967
<question>: Find the average and maximum rating of all reviews. <context>: CREATE TABLE review (rating INTEGER)
SELECT AVG(rating), MAX(rating) FROM review
968
<question>: Find the highest rank of all reviews. <context>: CREATE TABLE review (rank INTEGER)
SELECT MIN(rank) FROM review
969
<question>: How many different users wrote some reviews? <context>: CREATE TABLE review (u_id VARCHAR)
SELECT COUNT(DISTINCT u_id) FROM review
970
<question>: How many different items were reviewed by some users? <context>: CREATE TABLE review (i_id VARCHAR)
SELECT COUNT(DISTINCT i_id) FROM review
971
<question>: Find the number of items that did not receive any review. <context>: CREATE TABLE review (i_id VARCHAR); CREATE TABLE item (i_id VARCHAR)
SELECT COUNT(*) FROM item WHERE NOT i_id IN (SELECT i_id FROM review)
972
<question>: Find the names of users who did not leave any review. <context>: CREATE TABLE review (name VARCHAR, u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR)
SELECT name FROM useracct WHERE NOT u_id IN (SELECT u_id FROM review)
973
<question>: Find the names of goods that receive a rating of 10. <context>: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating VARCHAR)
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating = 10
974
<question>: Find the titles of items whose rating is higher than the average review rating of all items. <context>: CREATE TABLE review (rating INTEGER); CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER)
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > (SELECT AVG(rating) FROM review)
975
<question>: Find the titles of items that received any rating below 5. <context>: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER)
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5
976
<question>: Find the titles of items that received both a rating higher than 8 and a rating below 5. <context>: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER)
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > 8 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5
977
<question>: Find the names of items whose rank is higher than 3 and whose average rating is above 5. <context>: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rank INTEGER, rating INTEGER)
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rank > 3 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id HAVING AVG(T2.rating) > 5
978
<question>: Find the name of the item with the lowest average rating. <context>: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER)
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id ORDER BY AVG(T2.rating) LIMIT 1
979
<question>: List the titles of all items in alphabetic order . <context>: CREATE TABLE item (title VARCHAR)
SELECT title FROM item ORDER BY title
980
<question>: Find the name of the user who gives the most reviews. <context>: CREATE TABLE useracct (name VARCHAR, u_id VARCHAR); CREATE TABLE review (u_id VARCHAR)
SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id ORDER BY COUNT(*) DESC LIMIT 1
981
<question>: Find the name and id of the item with the highest average rating. <context>: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER)
SELECT T1.title, T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id ORDER BY AVG(T2.rating) DESC LIMIT 1
982
<question>: Find the name and id of the good with the highest average rank. <context>: CREATE TABLE review (i_id VARCHAR, rank INTEGER); CREATE TABLE item (title VARCHAR, i_id VARCHAR)
SELECT T1.title, T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id ORDER BY AVG(T2.rank) DESC LIMIT 1
983
<question>: For each user, return the name and the average rating of reviews given by them. <context>: CREATE TABLE review (rating INTEGER, u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR)
SELECT T1.name, AVG(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id
984
<question>: For each user, find their name and the number of reviews written by them. <context>: CREATE TABLE useracct (name VARCHAR, u_id VARCHAR); CREATE TABLE review (u_id VARCHAR)
SELECT T1.name, COUNT(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id
985
<question>: Find the name of the user who gave the highest rating. <context>: CREATE TABLE review (u_id VARCHAR, rating VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR)
SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id ORDER BY T2.rating DESC LIMIT 1
986
<question>: Find the name of the source user with the highest average trust score. <context>: CREATE TABLE useracct (name VARCHAR, u_id VARCHAR); CREATE TABLE trust (source_u_id VARCHAR)
SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.source_u_id GROUP BY T2.source_u_id ORDER BY AVG(trust) DESC LIMIT 1
987
<question>: Find each target user's name and average trust score. <context>: CREATE TABLE trust (target_u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR)
SELECT T1.name, AVG(trust) FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id GROUP BY T2.target_u_id
988
<question>: Find the name of the target user with the lowest trust score. <context>: CREATE TABLE trust (target_u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR)
SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id ORDER BY trust LIMIT 1
989
<question>: Find the names of the items that did not receive any review. <context>: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (title VARCHAR, i_id VARCHAR)
SELECT title FROM item WHERE NOT i_id IN (SELECT i_id FROM review)
990
<question>: Find the number of users who did not write any review. <context>: CREATE TABLE review (u_id VARCHAR); CREATE TABLE useracct (u_id VARCHAR)
SELECT COUNT(*) FROM useracct WHERE NOT u_id IN (SELECT u_id FROM review)
991
<question>: How many players are there? <context>: CREATE TABLE player (Id VARCHAR)
SELECT COUNT(*) FROM player
992
<question>: List the names of players in ascending order of votes. <context>: CREATE TABLE player (Player_name VARCHAR, Votes VARCHAR)
SELECT Player_name FROM player ORDER BY Votes
993
<question>: What are the gender and occupation of players? <context>: CREATE TABLE player (Gender VARCHAR, Occupation VARCHAR)
SELECT Gender, Occupation FROM player
994
<question>: List the name and residence for players whose occupation is not "Researcher". <context>: CREATE TABLE player (Player_name VARCHAR, residence VARCHAR, Occupation VARCHAR)
SELECT Player_name, residence FROM player WHERE Occupation <> "Researcher"
995
<question>: Show the names of sponsors of players whose residence is either "Brandon" or "Birtle". <context>: CREATE TABLE player (Sponsor_name VARCHAR, Residence VARCHAR)
SELECT Sponsor_name FROM player WHERE Residence = "Brandon" OR Residence = "Birtle"
996
<question>: What is the name of the player with the largest number of votes? <context>: CREATE TABLE player (Player_name VARCHAR, Votes VARCHAR)
SELECT Player_name FROM player ORDER BY Votes DESC LIMIT 1
997
<question>: Show different occupations along with the number of players in each occupation. <context>: CREATE TABLE player (Occupation VARCHAR)
SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation
998
<question>: Please show the most common occupation of players. <context>: CREATE TABLE player (Occupation VARCHAR)
SELECT Occupation FROM player GROUP BY Occupation ORDER BY COUNT(*) DESC LIMIT 1
999
<question>: Show the residences that have at least two players. <context>: CREATE TABLE player (Residence VARCHAR)
SELECT Residence FROM player GROUP BY Residence HAVING COUNT(*) >= 2