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