combined_text
stringlengths
106
1.05k
###question:What is the average, minimum, maximum, and total transaction amount?###answer:SELECT AVG(transaction_amount), MIN(transaction_amount), MAX(transaction_amount), SUM(transaction_amount) FROM Financial_transactions###context:CREATE TABLE Financial_transactions (transaction_amount INTEGER)
###question:Show ids for all transactions whose amounts are greater than the average.###answer:SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT AVG(transaction_amount) FROM Financial_transactions)###context:CREATE TABLE Financial_transactions (transaction_id VARCHAR, transaction_amount INTEGER)
###question:Show the transaction types and the total amount of transactions.###answer:SELECT transaction_type, SUM(transaction_amount) FROM Financial_transactions GROUP BY transaction_type###context:CREATE TABLE Financial_transactions (transaction_type VARCHAR, transaction_amount INTEGER)
###question:Show the account name, id and the number of transactions for each account.###answer: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###context:CREATE TABLE Financial_transactions (account_id VARCHAR); CREATE TABLE Accounts (account_name VARCHAR, account_id VARCHAR)
###question:Show the account id with most number of transactions.###answer:SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE Financial_transactions (account_id VARCHAR)
###question:Show the account id and name with at least 4 transactions.###answer: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###context:CREATE TABLE Financial_transactions (account_id VARCHAR); CREATE TABLE Accounts (account_name VARCHAR, account_id VARCHAR)
###question:Show all product sizes.###answer:SELECT DISTINCT product_size FROM Products###context:CREATE TABLE Products (product_size VARCHAR)
###question:Show all product colors.###answer:SELECT DISTINCT product_color FROM Products###context:CREATE TABLE Products (product_color VARCHAR)
###question:Show the invoice number and the number of transactions for each invoice.###answer:SELECT invoice_number, COUNT(*) FROM Financial_transactions GROUP BY invoice_number###context:CREATE TABLE Financial_transactions (invoice_number VARCHAR)
###question:What is the invoice number and invoice date for the invoice with most number of transactions?###answer: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###context:CREATE TABLE Invoices (invoice_number VARCHAR, invoice_date VARCHAR); CREATE TABLE Financial_transactions (invoice_number VARCHAR)
###question:How many invoices do we have?###answer:SELECT COUNT(*) FROM Invoices###context:CREATE TABLE Invoices (Id VARCHAR)
###question:Show invoice dates and order id and details for all invoices.###answer: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###context:CREATE TABLE Invoices (invoice_date VARCHAR, order_id VARCHAR); CREATE TABLE Orders (order_details VARCHAR, order_id VARCHAR)
###question:Show the order ids and the number of invoices for each order.###answer:SELECT order_id, COUNT(*) FROM Invoices GROUP BY order_id###context:CREATE TABLE Invoices (order_id VARCHAR)
###question:What is the order id and order details for the order more than two invoices.###answer: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###context:CREATE TABLE Orders (order_id VARCHAR, order_details VARCHAR); CREATE TABLE Invoices (order_id VARCHAR)
###question:What is the customer last name, id and phone number with most number of orders?###answer: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###context:CREATE TABLE Orders (customer_id VARCHAR); CREATE TABLE Customers (customer_last_name VARCHAR, phone_number VARCHAR, customer_id VARCHAR)
###question:Show all product names without an order.###answer: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###context:CREATE TABLE Products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE Order_items (product_id VARCHAR); CREATE TABLE Products (product_name VARCHAR)
###question:Show all product names and the total quantity ordered for each product name.###answer: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###context:CREATE TABLE Products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE Order_items (product_quantity INTEGER, product_id VARCHAR)
###question:Show the order ids and the number of items in each order.###answer:SELECT order_id, COUNT(*) FROM Order_items GROUP BY order_id###context:CREATE TABLE Order_items (order_id VARCHAR)
###question:Show the product ids and the number of unique orders containing each product.###answer:SELECT product_id, COUNT(DISTINCT order_id) FROM Order_items GROUP BY product_id###context:CREATE TABLE Order_items (product_id VARCHAR, order_id VARCHAR)
###question:Show all product names and the number of customers having an order on each product.###answer: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###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)
###question:Show order ids and the number of products in each order.###answer:SELECT order_id, COUNT(DISTINCT product_id) FROM Order_items GROUP BY order_id###context:CREATE TABLE Order_items (order_id VARCHAR, product_id VARCHAR)
###question:Show order ids and the total quantity in each order.###answer:SELECT order_id, SUM(product_quantity) FROM Order_items GROUP BY order_id###context:CREATE TABLE Order_items (order_id VARCHAR, product_quantity INTEGER)
###question:How many products were not included in any order?###answer:SELECT COUNT(*) FROM products WHERE NOT product_id IN (SELECT product_id FROM Order_items)###context:CREATE TABLE products (product_id VARCHAR); CREATE TABLE Order_items (product_id VARCHAR)
###question:How many churches opened before 1850 are there?###answer:SELECT COUNT(*) FROM Church WHERE Open_Date < 1850###context:CREATE TABLE Church (Open_Date INTEGER)
###question:Show the name, open date, and organizer for all churches.###answer:SELECT name, open_date, organized_by FROM Church###context:CREATE TABLE Church (name VARCHAR, open_date VARCHAR, organized_by VARCHAR)
###question:List all church names in descending order of opening date.###answer:SELECT name FROM church ORDER BY open_date DESC###context:CREATE TABLE church (name VARCHAR, open_date VARCHAR)
###question:Show the opening year in whcih at least two churches opened.###answer:SELECT open_date FROM church GROUP BY open_date HAVING COUNT(*) >= 2###context:CREATE TABLE church (open_date VARCHAR)
###question:Show the organizer and name for churches that opened between 1830 and 1840.###answer:SELECT organized_by, name FROM church WHERE open_date BETWEEN 1830 AND 1840###context:CREATE TABLE church (organized_by VARCHAR, name VARCHAR, open_date INTEGER)
###question:Show all opening years and the number of churches that opened in that year.###answer:SELECT open_date, COUNT(*) FROM church GROUP BY open_date###context:CREATE TABLE church (open_date VARCHAR)
###question:Show the name and opening year for three churches that opened most recently.###answer:SELECT name, open_date FROM church ORDER BY open_date DESC LIMIT 3###context:CREATE TABLE church (name VARCHAR, open_date VARCHAR)
###question:How many female people are older than 30 in our record?###answer:SELECT COUNT(*) FROM people WHERE is_male = 'F' AND age > 30###context:CREATE TABLE people (is_male VARCHAR, age VARCHAR)
###question:Show the country where people older than 30 and younger than 25 are from.###answer:SELECT country FROM people WHERE age < 25 INTERSECT SELECT country FROM people WHERE age > 30###context:CREATE TABLE people (country VARCHAR, age INTEGER)
###question:Show the minimum, maximum, and average age for all people.###answer:SELECT MIN(age), MAX(age), AVG(age) FROM people###context:CREATE TABLE people (age INTEGER)
###question:Show the name and country for all people whose age is smaller than the average.###answer:SELECT name, country FROM people WHERE age < (SELECT AVG(age) FROM people)###context:CREATE TABLE people (name VARCHAR, country VARCHAR, age INTEGER)
###question:Show the pair of male and female names in all weddings after year 2014###answer: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###context:CREATE TABLE wedding (male_id VARCHAR, female_id VARCHAR, year INTEGER); CREATE TABLE people (name VARCHAR, people_id VARCHAR)
###question:Show the name and age for all male people who don't have a wedding.###answer:SELECT name, age FROM people WHERE is_male = 'T' AND NOT people_id IN (SELECT male_id FROM 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)
###question:Show all church names except for those that had a wedding in year 2015.###answer: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###context:CREATE TABLE church (name VARCHAR); CREATE TABLE wedding (church_id VARCHAR, year VARCHAR); CREATE TABLE church (name VARCHAR, church_id VARCHAR)
###question:Show all church names that have hosted least two weddings.###answer: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###context:CREATE TABLE wedding (church_id VARCHAR); CREATE TABLE church (name VARCHAR, church_id VARCHAR)
###question:Show the names for all females from Canada having a wedding in year 2016.###answer: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'###context:CREATE TABLE people (name VARCHAR, people_id VARCHAR, country VARCHAR, is_male VARCHAR); CREATE TABLE wedding (female_id VARCHAR, year VARCHAR)
###question:How many weddings are there in year 2016?###answer:SELECT COUNT(*) FROM wedding WHERE YEAR = 2016###context:CREATE TABLE wedding (YEAR VARCHAR)
###question:Show the church names for the weddings of all people older than 30.###answer: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###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)
###question:Show all countries and the number of people from each country.###answer:SELECT country, COUNT(*) FROM people GROUP BY country###context:CREATE TABLE people (country VARCHAR)
###question:How many churches have a wedding in year 2016?###answer:SELECT COUNT(DISTINCT church_id) FROM wedding WHERE YEAR = 2016###context:CREATE TABLE wedding (church_id VARCHAR, YEAR VARCHAR)
###question:How many artists do we have?###answer:SELECT COUNT(*) FROM artist###context:CREATE TABLE artist (Id VARCHAR)
###question:Show all artist name, age, and country ordered by the yeared they joined.###answer:SELECT name, age, country FROM artist ORDER BY Year_Join###context:CREATE TABLE artist (name VARCHAR, age VARCHAR, country VARCHAR, Year_Join VARCHAR)
###question:What are all distinct country for artists?###answer:SELECT DISTINCT country FROM artist###context:CREATE TABLE artist (country VARCHAR)
###question:Show all artist names and the year joined who are not from United States.###answer:SELECT name, year_join FROM artist WHERE country <> 'United States'###context:CREATE TABLE artist (name VARCHAR, year_join VARCHAR, country VARCHAR)
###question:How many artists are above age 46 and joined after 1990?###answer:SELECT COUNT(*) FROM artist WHERE age > 46 AND year_join > 1990###context:CREATE TABLE artist (age VARCHAR, year_join VARCHAR)
###question:What is the average and minimum age of all artists from United States.###answer:SELECT AVG(age), MIN(age) FROM artist WHERE country = 'United States'###context:CREATE TABLE artist (age INTEGER, country VARCHAR)
###question:What is the name of the artist who joined latest?###answer:SELECT name FROM artist ORDER BY year_join DESC LIMIT 1###context:CREATE TABLE artist (name VARCHAR, year_join VARCHAR)
###question:How many exhibition are there in year 2005 or after?###answer:SELECT COUNT(*) FROM exhibition WHERE YEAR >= 2005###context:CREATE TABLE exhibition (YEAR VARCHAR)
###question:Show theme and year for all exhibitions with ticket prices lower than 15.###answer:SELECT theme, YEAR FROM exhibition WHERE ticket_price < 15###context:CREATE TABLE exhibition (theme VARCHAR, YEAR VARCHAR, ticket_price INTEGER)
###question:Show all artist names and the number of exhibitions for each artist.###answer:SELECT T2.name, COUNT(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id###context:CREATE TABLE artist (name VARCHAR, artist_id VARCHAR); CREATE TABLE exhibition (artist_id VARCHAR)
###question:What is the name and country for the artist with most number of exhibitions?###answer: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###context:CREATE TABLE exhibition (artist_id VARCHAR); CREATE TABLE artist (name VARCHAR, country VARCHAR, artist_id VARCHAR)
###question:Show names for artists without any exhibition.###answer:SELECT name FROM artist WHERE NOT artist_id IN (SELECT artist_id FROM exhibition)###context:CREATE TABLE artist (name VARCHAR, artist_id VARCHAR); CREATE TABLE exhibition (name VARCHAR, artist_id VARCHAR)
###question:What is the theme and artist name for the exhibition with a ticket price higher than the average?###answer: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)###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)
###question:Show the average, minimum, and maximum ticket prices for exhibitions for all years before 2009.###answer:SELECT AVG(ticket_price), MIN(ticket_price), MAX(ticket_price) FROM exhibition WHERE YEAR < 2009###context:CREATE TABLE exhibition (ticket_price INTEGER, YEAR INTEGER)
###question:Show theme and year for all exhibitions in an descending order of ticket price.###answer:SELECT theme, YEAR FROM exhibition ORDER BY ticket_price DESC###context:CREATE TABLE exhibition (theme VARCHAR, YEAR VARCHAR, ticket_price VARCHAR)
###question:What is the theme, date, and attendance for the exhibition in year 2004?###answer: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###context:CREATE TABLE exhibition_record (date VARCHAR, attendance VARCHAR, exhibition_id VARCHAR); CREATE TABLE exhibition (theme VARCHAR, exhibition_id VARCHAR, year VARCHAR)
###question:Show all artist names who didn't have an exhibition in 2004.###answer: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###context:CREATE TABLE exhibition (artist_id VARCHAR, year VARCHAR); CREATE TABLE artist (name VARCHAR); CREATE TABLE artist (name VARCHAR, artist_id VARCHAR)
###question:Show the theme for exhibitions with both records of an attendance below 100 and above 500.###answer: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###context:CREATE TABLE exhibition (theme VARCHAR, exhibition_id VARCHAR); CREATE TABLE exhibition_record (exhibition_id VARCHAR, attendance INTEGER)
###question:How many exhibitions have a attendance more than 100 or have a ticket price below 10?###answer: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###context:CREATE TABLE exhibition_record (exhibition_id VARCHAR, attendance VARCHAR); CREATE TABLE exhibition (exhibition_id VARCHAR, ticket_price VARCHAR)
###question:Show all artist names with an average exhibition attendance over 200.###answer: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###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)
###question:Find the id of the item whose title is "orange".###answer:SELECT i_id FROM item WHERE title = "orange"###context:CREATE TABLE item (i_id VARCHAR, title VARCHAR)
###question:List all information in the item table.###answer:SELECT * FROM item###context:CREATE TABLE item (Id VARCHAR)
###question:Find the number of reviews.###answer:SELECT COUNT(*) FROM review###context:CREATE TABLE review (Id VARCHAR)
###question:How many users are there?###answer:SELECT COUNT(*) FROM useracct###context:CREATE TABLE useracct (Id VARCHAR)
###question:Find the average and maximum rating of all reviews.###answer:SELECT AVG(rating), MAX(rating) FROM review###context:CREATE TABLE review (rating INTEGER)
###question:Find the highest rank of all reviews.###answer:SELECT MIN(rank) FROM review###context:CREATE TABLE review (rank INTEGER)
###question:How many different users wrote some reviews?###answer:SELECT COUNT(DISTINCT u_id) FROM review###context:CREATE TABLE review (u_id VARCHAR)
###question:How many different items were reviewed by some users?###answer:SELECT COUNT(DISTINCT i_id) FROM review###context:CREATE TABLE review (i_id VARCHAR)
###question:Find the number of items that did not receive any review.###answer:SELECT COUNT(*) FROM item WHERE NOT i_id IN (SELECT i_id FROM review)###context:CREATE TABLE review (i_id VARCHAR); CREATE TABLE item (i_id VARCHAR)
###question:Find the names of users who did not leave any review.###answer:SELECT name FROM useracct WHERE NOT u_id IN (SELECT u_id FROM review)###context:CREATE TABLE review (name VARCHAR, u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR)
###question:Find the names of goods that receive a rating of 10.###answer:SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating = 10###context:CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating VARCHAR)
###question:Find the titles of items whose rating is higher than the average review rating of all items.###answer: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)###context:CREATE TABLE review (rating INTEGER); CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER)
###question:Find the titles of items that received any rating below 5.###answer:SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5###context:CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER)
###question:Find the titles of items that received both a rating higher than 8 and a rating below 5.###answer: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###context:CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER)
###question:Find the names of items whose rank is higher than 3 and whose average rating is above 5.###answer: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###context:CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rank INTEGER, rating INTEGER)
###question:Find the name of the item with the lowest average rating.###answer: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###context:CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER)
###question:List the titles of all items in alphabetic order .###answer:SELECT title FROM item ORDER BY title###context:CREATE TABLE item (title VARCHAR)
###question:Find the name of the user who gives the most reviews.###answer: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###context:CREATE TABLE useracct (name VARCHAR, u_id VARCHAR); CREATE TABLE review (u_id VARCHAR)
###question:Find the name and id of the item with the highest average rating.###answer: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###context:CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER)
###question:Find the name and id of the good with the highest average rank.###answer: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###context:CREATE TABLE review (i_id VARCHAR, rank INTEGER); CREATE TABLE item (title VARCHAR, i_id VARCHAR)
###question:For each user, return the name and the average rating of reviews given by them.###answer: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###context:CREATE TABLE review (rating INTEGER, u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR)
###question:For each user, find their name and the number of reviews written by them.###answer:SELECT T1.name, COUNT(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id###context:CREATE TABLE useracct (name VARCHAR, u_id VARCHAR); CREATE TABLE review (u_id VARCHAR)
###question:Find the name of the user who gave the highest rating.###answer: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###context:CREATE TABLE review (u_id VARCHAR, rating VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR)
###question:Find the name of the source user with the highest average trust score.###answer: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###context:CREATE TABLE useracct (name VARCHAR, u_id VARCHAR); CREATE TABLE trust (source_u_id VARCHAR)
###question:Find each target user's name and average trust score.###answer: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###context:CREATE TABLE trust (target_u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR)
###question:Find the name of the target user with the lowest trust score.###answer:SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id ORDER BY trust LIMIT 1###context:CREATE TABLE trust (target_u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR)
###question:Find the names of the items that did not receive any review.###answer:SELECT title FROM item WHERE NOT i_id IN (SELECT i_id FROM review)###context:CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (title VARCHAR, i_id VARCHAR)
###question:Find the number of users who did not write any review.###answer:SELECT COUNT(*) FROM useracct WHERE NOT u_id IN (SELECT u_id FROM review)###context:CREATE TABLE review (u_id VARCHAR); CREATE TABLE useracct (u_id VARCHAR)
###question:How many players are there?###answer:SELECT COUNT(*) FROM player###context:CREATE TABLE player (Id VARCHAR)
###question:List the names of players in ascending order of votes.###answer:SELECT Player_name FROM player ORDER BY Votes###context:CREATE TABLE player (Player_name VARCHAR, Votes VARCHAR)
###question:What are the gender and occupation of players?###answer:SELECT Gender, Occupation FROM player###context:CREATE TABLE player (Gender VARCHAR, Occupation VARCHAR)
###question:List the name and residence for players whose occupation is not "Researcher".###answer:SELECT Player_name, residence FROM player WHERE Occupation <> "Researcher"###context:CREATE TABLE player (Player_name VARCHAR, residence VARCHAR, Occupation VARCHAR)
###question:Show the names of sponsors of players whose residence is either "Brandon" or "Birtle".###answer:SELECT Sponsor_name FROM player WHERE Residence = "Brandon" OR Residence = "Birtle"###context:CREATE TABLE player (Sponsor_name VARCHAR, Residence VARCHAR)
###question:What is the name of the player with the largest number of votes?###answer:SELECT Player_name FROM player ORDER BY Votes DESC LIMIT 1###context:CREATE TABLE player (Player_name VARCHAR, Votes VARCHAR)
###question:Show different occupations along with the number of players in each occupation.###answer:SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation###context:CREATE TABLE player (Occupation VARCHAR)
###question:Please show the most common occupation of players.###answer:SELECT Occupation FROM player GROUP BY Occupation ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE player (Occupation VARCHAR)
###question:Show the residences that have at least two players.###answer:SELECT Residence FROM player GROUP BY Residence HAVING COUNT(*) >= 2###context:CREATE TABLE player (Residence VARCHAR)