interaction_utterance
sequencelengths
0
6
interaction_query
sequencelengths
0
6
final_utterance
stringlengths
19
224
final_query
stringlengths
22
577
db_id
stringclasses
140 values
[ "Show me the name of all the customers.", "What about those good customers?", "Also show me their genders.", "Order them by their last name." ]
[ "SELECT first_name , last_name FROM customers", "SELECT first_name , last_name FROM customers WHERE good_or_bad_customer = 'good'", "SELECT first_name , last_name , gender_mf FROM customers WHERE good_or_bad_customer = 'good'", "SELECT first_name , last_name , gender_mf FROM customers WHERE good_or_bad_customer = 'good' ORDER BY last_name" ]
What are the first name, last name, and gender of all the good customers? Order by their last name.
SELECT first_name , last_name , gender_mf FROM customers WHERE good_or_bad_customer = 'good' ORDER BY last_name
products_for_hire
[ "How many times has any product been booked?", "Show me the product at each time.", "What about their booked amount?", "Show me the maximum, minimum, and average of them." ]
[ "SELECT count(*) FROM products_booked", "SELECT product_id FROM products_booked", "SELECT booked_count FROM products_booked", "SELECT max(booked_count) , min(booked_count) , avg(booked_count) FROM products_booked" ]
What are the maximum, minimum, and average booked count for the products booked?
SELECT max(booked_count) , min(booked_count) , avg(booked_count) FROM products_booked
products_for_hire
[ "Show me all the product names.", "What are their description?", "What about their daily hire costs?", "Only show the cost of those which has 'Book' in its name." ]
[ "SELECT product_name FROM products_for_hire", "SELECT product_name, product_description FROM products_for_hire", "SELECT product_name, daily_hire_cost FROM products_for_hire", "SELECT daily_hire_cost FROM Products_for_hire WHERE product_name LIKE '%Book%'" ]
What are the daily hire costs for the products with substring 'Book' in its name?
SELECT daily_hire_cost FROM Products_for_hire WHERE product_name LIKE '%Book%'
products_for_hire
[ "Show me the id of products that have been booked.", "Show me their maximum booked amount.", "Give me the id of those which has been booked with amount higher than 200.", "What about the id of products which are not one of those?", "How many are there?" ]
[ "SELECT DISTINCT product_id FROM products_booked", "SELECT product_id, MAX(booked_amount) FROM products_booked GROUP BY product_id", "SELECT product_id FROM products_booked WHERE booked_amount > 200", "SELECT product_id FROM products_for_hire WHERE product_id NOT IN ( SELECT product_id FROM products_booked WHERE booked_amount > 200)", "SELECT count(*) FROM Products_for_hire WHERE product_id NOT IN ( SELECT product_id FROM products_booked WHERE booked_amount > 200 )" ]
How many products are never booked with amount higher than 200?
SELECT count(*) FROM Products_for_hire WHERE product_id NOT IN ( SELECT product_id FROM products_booked WHERE booked_amount > 200 )
products_for_hire
[ "Show me the first name of good customers.", "What coupon amounts did they own?", "What about those owned by bad customers?", "Show me the coupon amounts owned by both of them." ]
[ "SELECT first_name from CUSTOMERS where good_or_bad_customer = 'good'", "SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'good'", "SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'bad'", "SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'good' INTERSECT SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'bad'" ]
What are the coupon amount of the coupons owned by both good and bad customers?
SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'good' INTERSECT SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'bad'
products_for_hire
[ "How many payment types are there?", "Show me the date of payments using Check as payment type.", "Also include those with amount paid higher than 300." ]
[ "SELECT DISTINCT payment_type_code FROM payments", "SELECT payment_date FROM payments WHERE payment_type_code = 'Check'", "SELECT payment_date FROM payments WHERE amount_paid > 300 OR payment_type_code = 'Check'" ]
What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check'
SELECT payment_date FROM payments WHERE amount_paid > 300 OR payment_type_code = 'Check'
products_for_hire
[ "Tell me Kamila Porczyk's age.", "How about Mariusz Zalejski's age?", "Tell me the names of editors of age either 24 or 25." ]
[ "SELECT Age FROM editor WHERE Name = \"Kamila Porczyk\"", "SELECT Age FROM editor WHERE Name = \"Mariusz Zalejski\"", "SELECT Name FROM editor WHERE Age = 24 OR Age = 25" ]
Show the names of editors of age either 24 or 25.
SELECT Name FROM editor WHERE Age = 24 OR Age = 25
journal_committee
[ "Tell me Szymon Wydra's journal's themes.", "How old is he?", "What is the name of the youngest editor?" ]
[ "SELECT T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T2.Name = \"Szymon Wydra\"", "SELECT Age FROM editor WHERE Name = \"Szymon Wydra\"", "SELECT Name FROM editor ORDER BY Age ASC LIMIT 1" ]
What is the name of the youngest editor?
SELECT Name FROM editor ORDER BY Age ASC LIMIT 1
journal_committee
[ "Tell me the work types of Anna Powierza.", "What is her age?", "Tell me the most common age of editors." ]
[ "SELECT T1.Work_Type FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID WHERE T2.Name = \"Anna Powierza\"", "SELECT Age FROM editor WHERE Name = \"Anna Powierza\"", "SELECT Age FROM editor GROUP BY Age ORDER BY COUNT(*) DESC LIMIT 1" ]
Please show the most common age of editors.
SELECT Age FROM editor GROUP BY Age ORDER BY COUNT(*) DESC LIMIT 1
journal_committee
[ "Tell me the number of journals of editor Szymon Wydra?", "Tell me about the sales of journals of editor Szymon Wydra.", "What are the names of editors and the theme of journals for which they serve on committees?" ]
[ "SELECT COUNT(*) FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T2.Name = \"Szymon Wydra\"", "SELECT T3.Sales FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T2.Name = \"Szymon Wydra\"", "SELECT T2.Name , T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID" ]
Show the names of editors and the theme of journals for which they serve on committees.
SELECT T2.Name , T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID
journal_committee
[ "Tell me the date of the journal with the theme Tampa Bay Buccaneers.", "Who is its editor?", "I want to know the names and ages of editors and the theme of journals for which they serve on committees, in ascending alphabetical order of theme." ]
[ "SELECT Date FROM journal WHERE Theme = \"Tampa Bay Buccaneers\"", "SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Theme = \"Tampa Bay Buccaneers\"", "SELECT T2.Name , T2.age , T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID ORDER BY T3.Theme ASC" ]
Show the names and ages of editors and the theme of journals for which they serve on committees, in ascending alphabetical order of theme.
SELECT T2.Name , T2.age , T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID ORDER BY T3.Theme ASC
journal_committee
[ "Tell me Anna Powierza's journal's themes.", "How about her sales?", "What are the names of editors that are on the committee of journals with sales bigger than 3000?" ]
[ "SELECT T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T2.Name = \"Anna Powierza\"", "SELECT T3.Sales FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T2.Name = \"Anna Powierza\"", "SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Sales > 3000" ]
Show the names of editors that are on the committee of journals with sales bigger than 3000.
SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Sales > 3000
journal_committee
[ "Tell me Marek Siudym's age.", "Show me his journals.", "Okay, now I want to know the id, name of each editor and the number of journal committees they are on." ]
[ "SELECT Age FROM editor WHERE Name = \"Marek Siudym\"", "SELECT T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T2.Name = \"Marek Siudym\"", "SELECT T1.editor_id , T1.Name , COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.editor_id" ]
Show the id, name of each editor and the number of journal committees they are on.
SELECT T1.editor_id , T1.Name , COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.editor_id
journal_committee
[ "Tell me the sales of the journal with theme Jacksonville Jaguars.", "Who is its editor?", "tell me the names of editors that are on at least two journal committees." ]
[ "SELECT Sales FROM journal WHERE Theme = \"Jacksonville Jaguars\"", "SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Theme = \"Jacksonville Jaguars\"", "SELECT T1.Name FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.Name HAVING COUNT(*) >= 2" ]
Show the names of editors that are on at least two journal committees.
SELECT T1.Name FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.Name HAVING COUNT(*) >= 2
journal_committee
[ "tell me the number of journal committees of editor Kamila Porczyk.", "Okay, I want to know the themes of his journals.", "Tell me the names of editors that are not on any journal committee." ]
[ "SELECT COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID WHERE T1.Name = \"Kamila Porczyk\"", "SELECT T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T2.Name = \"Szymon Wydra\"", "SELECT Name FROM editor WHERE editor_id NOT IN (SELECT editor_id FROM journal_committee)" ]
List the names of editors that are not on any journal committee.
SELECT Name FROM editor WHERE editor_id NOT IN (SELECT editor_id FROM journal_committee)
journal_committee
[ "Tell me the themes of Marek Siudym's journals.", "Okay, tell me the date of the journal with theme \"at Jacksonville Jaguars\".", "list the date, theme and sales of the journal which did not have any of the listed editors serving on committee." ]
[ "SELECT T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T2.Name = \"Marek Siudym\"", "SELECT Date FROM journal WHERE Theme = \"at Jacksonville Jaguars\"", "SELECT date , theme , sales FROM journal EXCEPT SELECT T1.date , T1.theme , T1.sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID" ]
List the date, theme and sales of the journal which did not have any of the listed editors serving on committee.
SELECT date , theme , sales FROM journal EXCEPT SELECT T1.date , T1.theme , T1.sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID
journal_committee
[ "What is the total amount purchased for each product?", "List the ids of products in decreasing order of their total amount purchased.", "Just give me the top three." ]
[ "SELECT product_id, total_amount_purchased FROM product_suppliers", "SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC", "SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3" ]
What are the ids of the top three products that were purchased in the largest amount?
SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3
department_store
[ "List all the product ids.", "Order them by the product price.", "Show the product id and product type of the cheapest product." ]
[ "SELECT product_id FROM products", "SELECT product_id FROM products ORDER BY product_price", "SELECT product_id , product_type_code FROM products ORDER BY product_price LIMIT 1" ]
What are the product id and product type of the cheapest product?
SELECT product_id , product_type_code FROM products ORDER BY product_price LIMIT 1
department_store
[ "What are all the product types?", "Show me all the distinct product types.", "How many are there?" ]
[ "SELECT product_type_code FROM products", "SELECT DISTINCT product_type_code FROM products", "SELECT count(DISTINCT product_type_code) FROM products" ]
Find the number of different product types.
SELECT count(DISTINCT product_type_code) FROM products
department_store
[ "Show all the information about customer addresses.", "What is the address id of customer 10?", "What are address details of customer 10?" ]
[ "Select * from customer_addresses", "Select address_id from customer_addresses where customer_id = 10", "SELECT T1.address_details FROM addresses AS T1 JOIN customer_addresses AS T2 ON T1.address_id = T2.address_id WHERE T2.customer_id = 10" ]
Return the address of customer 10.
SELECT T1.address_details FROM addresses AS T1 JOIN customer_addresses AS T2 ON T1.address_id = T2.address_id WHERE T2.customer_id = 10
department_store
[ "Show all staff information.", "What are the staff ids and genders of all staffs?", "What are the staff ids and genders of all staffs whose job title is Department Manager?" ]
[ "SELECT * FROM staff", "SELECT staff_id , staff_gender FROM staff", "SELECT T1.staff_id , T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = \"Department Manager\"" ]
What are the staff ids and genders of all staffs whose job title is Department Manager?
SELECT T1.staff_id , T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Department Manager"
department_store
[ "Show all the customers.", "How many customers are there?", "For each payment method, find how many customers use it." ]
[ "SELECT * FROM customers", "SELECT count(*) FROM customers", "SELECT payment_method_code , count(*) FROM customers GROUP BY payment_method_code" ]
For each payment method, return how many customers use it.
SELECT payment_method_code , count(*) FROM customers GROUP BY payment_method_code
department_store
[ "Show all the order items.", "Show the number of times each product was ordered.", "What is the id of the product that was ordered the most often?" ]
[ "SELECT * FROM order_items", "SELECT count(*) FROM order_items GROUP BY product_id", "SELECT product_id FROM order_items GROUP BY product_id ORDER BY count(*) DESC LIMIT 1" ]
What is the id of the product that was ordered the most often?
SELECT product_id FROM order_items GROUP BY product_id ORDER BY count(*) DESC LIMIT 1
department_store
[ "Show all the customer information.", "How many orders did each customer make?", "Which customer made the largest number of orders?", "What are the name, phone number and email address of this customer?" ]
[ "SELECT * FROM customers", "SELECT count(*) FROM customer_orders GROUP BY customer_id", "SELECT * FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id ORDER BY count(*) DESC LIMIT 1", "SELECT T1.customer_name , T1.customer_phone , T1.customer_email FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id ORDER BY count(*) DESC LIMIT 1" ]
What are the name, phone number and email address of the customer who made the largest number of orders?
SELECT T1.customer_name , T1.customer_phone , T1.customer_email FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id ORDER BY count(*) DESC LIMIT 1
department_store
[ "Show all the products.", "Group all the products by product type.", "What is the average price for each type of product?" ]
[ "SELECT * FROM products", "SELECT * FROM products GROUP BY product_type_code", "SELECT product_type_code , avg(product_price) FROM products GROUP BY product_type_code" ]
What is the average price for each type of product?
SELECT product_type_code , avg(product_price) FROM products GROUP BY product_type_code
department_store
[ "What are all the department stores?", "What are all the department stores that the store chain South has?", "How many are there?" ]
[ "SELECT * FROM department_stores", "SELECT * FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id WHERE T2.dept_store_chain_name = \"South\"", "SELECT count(*) FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id WHERE T2.dept_store_chain_name = \"South\"" ]
How many department stores does the store chain South have?
SELECT count(*) FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id WHERE T2.dept_store_chain_name = "South"
department_store
[ "Show all the staff.", "Sort all the staff by their assigned date in a descending manner.", "What is the name and job title of the staff who was assigned the latest?" ]
[ "SELECT * FROM staff", "SELECT * FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1", "SELECT T1.staff_name , T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1" ]
What is the name and job title of the staff who was assigned the latest?
SELECT T1.staff_name , T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1
department_store
[ "What are all the products?", "Which products are supplied by supplier id 3?", "Give me the product type, name and price for these products." ]
[ "SELECT * FROM products", "SELECT * FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 3", "SELECT T2.product_type_code , T2.product_name , T2.product_price FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 3" ]
Give me the product type, name and price for all the products supplied by supplier id 3.
SELECT T2.product_type_code , T2.product_name , T2.product_price FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 3
department_store
[ "Find all the customers.", "Which customers have order status Pending? Show their names.", "Sort them in the order of customer id." ]
[ "SELECT * FROM customers", "SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = \"Pending\"", "SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = \"Pending\" ORDER BY T2.customer_id" ]
Return the distinct name of customers whose order status is Pending, in the order of customer id.
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Pending" ORDER BY T2.customer_id
department_store
[ "Show all the customers.", "Which customers have both New and Pending orders?", "Show these customers' names and addresses." ]
[ "SELECT * FROM customers", "SELECT * FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = \"New\" INTERSECT SELECT * FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = \"Pending\"", "SELECT T1.customer_name , T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = \"New\" INTERSECT SELECT T1.customer_name , T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = \"Pending\"" ]
Find the name and address of the customers who have both New and Pending orders.
SELECT T1.customer_name , T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "New" INTERSECT SELECT T1.customer_name , T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Pending"
department_store
[ "Show me all the products.", "Which products are supplied by supplier id 2?", "Which products are more expensive than the average price of all products?", "Return ids of all the products that are supplied by supplier id 2 and are more expensive than the average price of all products." ]
[ "SELECT * FROM products", "SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2", "SELECT product_id FROM products WHERE product_price > (SELECT avg(product_price) FROM products)", "SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2 AND T2.product_price > (SELECT avg(product_price) FROM products)" ]
Return ids of all the products that are supplied by supplier id 2 and are more expensive than the average price of all products.
SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2 AND T2.product_price > (SELECT avg(product_price) FROM products)
department_store
[ "Which department store has a marketing department?", "Which department store has both a marketing and a managing department?", "Give me their id and name." ]
[ "SELECT * FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = \"marketing\"", "SELECT * FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = \"marketing\" INTERSECT SELECT * FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = \"managing\"", "SELECT T2.dept_store_id , T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = \"marketing\" INTERSECT SELECT T2.dept_store_id , T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = \"managing\"" ]
What is the id and name of the department store that has both marketing and managing department?
SELECT T2.dept_store_id , T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = "marketing" INTERSECT SELECT T2.dept_store_id , T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = "managing"
department_store
[ "Count the number of department stores each department store chain has.", "Which department store chain has the largest number of department stores?", "What are the ids of the top two department store chains by number of department stores?" ]
[ "SELECT count(*) FROM department_stores GROUP BY dept_store_chain_id", "SELECT * FROM department_stores GROUP BY dept_store_chain_id ORDER BY count(*) DESC LIMIT 1", "SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY count(*) DESC LIMIT 2" ]
What are the ids of the two department store chains with the largest number of department stores?
SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY count(*) DESC LIMIT 2
department_store
[ "Count the number of staff for each department.", "Which department has the least number of staff?", "What is the id of this department?" ]
[ "SELECT count(*) FROM staff_department_assignments GROUP BY department_id", "SELECT * FROM staff_department_assignments GROUP BY department_id ORDER BY count(*) LIMIT 1", "SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY count(*) LIMIT 1" ]
What is the id of the department with the least number of staff?
SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY count(*) LIMIT 1
department_store
[ "Show all the product types.", "Order all the products by their types.", "Give me the maximum and minimum price for each product type." ]
[ "SELECT product_type_code FROM products", "SELECT * FROM products ORDER BY product_type_code", "SELECT product_type_code , max(product_price) , min(product_price) FROM products GROUP BY product_type_code" ]
For each product type, return the maximum and minimum price.
SELECT product_type_code , max(product_price) , min(product_price) FROM products GROUP BY product_type_code
department_store
[ "What are all the product types?", "What is the average price of products?", "Find the product type whose average price is higher than the average price of all products." ]
[ "SELECT product_type_code FROM products", "SELECT avg(product_price) FROM products", "SELECT product_type_code FROM products GROUP BY product_type_code HAVING avg(product_price) > (SELECT avg(product_price) FROM products)" ]
Find the product type whose average price is higher than the average price of all products.
SELECT product_type_code FROM products GROUP BY product_type_code HAVING avg(product_price) > (SELECT avg(product_price) FROM products)
department_store
[ "Show all the staff.", "What is the assignment period for each staff?", "Find the id and name of the staff who has been assigned for the shortest period." ]
[ "SELECT * FROM staff", "SELECT date_assigned_to - date_assigned_from FROM Staff_Department_Assignments", "SELECT T1.staff_id , T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY date_assigned_to - date_assigned_from LIMIT 1" ]
Find the id and name of the staff who has been assigned for the shortest period.
SELECT T1.staff_id , T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY date_assigned_to - date_assigned_from LIMIT 1
department_store
[ "What is the price of each product?", "Which product costs between 600 and 700?", "Give me their product names and ids." ]
[ "SELECT product_price FROM products", "SELECT * FROM products WHERE product_price BETWEEN 600 AND 700", "SELECT product_name , product_id FROM products WHERE product_price BETWEEN 600 AND 700" ]
Return the names and ids of all products whose price is between 600 and 700.
SELECT product_name , product_id FROM products WHERE product_price BETWEEN 600 AND 700
department_store
[ "Show all distinct customer ids.", "When was the first time some orders were cancelled?", "Find the ids of all distinct customers who made orders after this date." ]
[ "SELECT DISTINCT customer_id FROM Customer_Orders", "SELECT min(order_date) FROM Customer_Orders WHERE order_status_code = \"Cancelled\"", "SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date > (SELECT min(order_date) FROM Customer_Orders WHERE order_status_code = \"Cancelled\")" ]
Find the ids of all distinct customers who made order after some orders that were Cancelled.
SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date > (SELECT min(order_date) FROM Customer_Orders WHERE order_status_code = "Cancelled")
department_store
[ "Show the information about all the staff department assignments.", "When was the latest department assignment of Clerical Staff?", "What is id of the staff who had a Staff Department Assignment earlier than this date?" ]
[ "SELECT * FROM Staff_Department_Assignments", "SELECT max(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code = 'Clerical Staff'", "SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to < (SELECT max(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code = 'Clerical Staff')" ]
What is id of the staff who had a Staff Department Assignment earlier than any Clerical Staff?
SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to < (SELECT max(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code = 'Clerical Staff')
department_store
[ "Give me the information about all the customers.", "Which customers have an address that contains TN?", "What are their names and ids?" ]
[ "SELECT * FROM customers", "SELECT * FROM customers WHERE customer_address LIKE \"%TN%\"", "SELECT customer_name , customer_id FROM customers WHERE customer_address LIKE \"%TN%\"" ]
What are the names and ids of customers whose address contains TN?
SELECT customer_name , customer_id FROM customers WHERE customer_address LIKE "%TN%"
department_store
[ "Show all the staff department assignments.", "Which staff was assigned in 2016?", "What are their names and genders?" ]
[ "SELECT * FROM staff_department_assignments", "SELECT * FROM staff_department_assignments WHERE date_assigned_from LIKE \"2016%\"", "SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.date_assigned_from LIKE \"2016%\"" ]
Return the name and gender of the staff who was assigned in 2016.
SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.date_assigned_from LIKE "2016%"
department_store
[ "Return all the staff department assignments.", "Count the number of assignments for each staff.", "List the names of staff who have been assigned multiple jobs." ]
[ "SELECT * FROM staff_department_assignments", "SELECT COUNT (*) FROM staff_department_assignments GROUP BY staff_id", "SELECT T1.staff_name FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id GROUP BY T2.staff_id HAVING COUNT (*) > 1" ]
List the name of staff who has been assigned multiple jobs.
SELECT T1.staff_name FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id GROUP BY T2.staff_id HAVING COUNT (*) > 1
department_store
[ "Find the information about all the suppliers.", "Sort them in the alphabetical order of their addresses.", "Show the name and phone number of all suppliers in the alphabetical order of their addresses." ]
[ "SELECT * FROM Suppliers", "SELECT * FROM Suppliers AS T1 JOIN supplier_addresses AS T2 ON T1.supplier_id = T2.supplier_id JOIN addresses AS T3 ON T2.address_id = T3.address_id ORDER BY T3.address_details", "SELECT T1.supplier_name , T1.supplier_phone FROM Suppliers AS T1 JOIN supplier_addresses AS T2 ON T1.supplier_id = T2.supplier_id JOIN addresses AS T3 ON T2.address_id = T3.address_id ORDER BY T3.address_details" ]
List the name and phone number of all suppliers in the alphabetical order of their addresses.
SELECT T1.supplier_name , T1.supplier_phone FROM Suppliers AS T1 JOIN supplier_addresses AS T2 ON T1.supplier_id = T2.supplier_id JOIN addresses AS T3 ON T2.address_id = T3.address_id ORDER BY T3.address_details
department_store
[ "Show all the customers.", "What are the phone numbers of all customers?", "What are the phone numbers of all customers and suppliers?" ]
[ "SELECT * FROM customers", "SELECT customer_phone FROM customers", "SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers" ]
What are the phone numbers of all customers and suppliers?
SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers
department_store
[ "Which products were ordered more than three times?", "Which products were purchased for a total amount of more than 80000?", "Find the ids of all products that were ordered more than three times or purchased for a total amount of more than 80000." ]
[ "SELECT * FROM Order_Items GROUP BY product_id HAVING count(*) > 3", "SELECT * FROM Product_Suppliers GROUP BY product_id HAVING sum(total_amount_purchased) > 80000", "SELECT product_id FROM Order_Items GROUP BY product_id HAVING count(*) > 3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING sum(total_amount_purchased) > 80000" ]
Return the ids of all products that were ordered more than three times or supplied more than 80000.
SELECT product_id FROM Order_Items GROUP BY product_id HAVING count(*) > 3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING sum(total_amount_purchased) > 80000
department_store
[ "What are the ids and names of all products?", "How about those with a price lower than 600?", "How about those with price above 600 or below 900?" ]
[ "SELECT product_id , product_name FROM products", "SELECT product_id , product_name FROM products WHERE product_price < 600", "SELECT product_id , product_name FROM products WHERE product_price < 600 OR product_price > 900" ]
What are id and name of the products whose price is lower than 600 or higher than 900?
SELECT product_id , product_name FROM products WHERE product_price < 600 OR product_price > 900
department_store
[ "What are the ids of all suppliers?", "What is the average of total amount purchased?", "Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000." ]
[ "SELECT supplier_id FROM Product_Suppliers", "SELECT avg(total_amount_purchased) FROM Product_Suppliers", "SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING avg(total_amount_purchased) > 50000 OR avg(total_amount_purchased) < 30000" ]
Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000.
SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING avg(total_amount_purchased) > 50000 OR avg(total_amount_purchased) < 30000
department_store
[ "How many products does each suppler supply?", "Which suppler supplies the most products? Give me the supplier id.", "What are the average amount purchased and value purchased for this supplier." ]
[ "SELECT count(*) FROM Product_Suppliers GROUP BY supplier_id", "SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY count(*) DESC LIMIT 1", "SELECT avg(total_amount_purchased) , avg(total_value_purchased) FROM Product_Suppliers WHERE supplier_id = (SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY count(*) DESC LIMIT 1)" ]
What are the average amount purchased and value purchased for the supplier who supplies the most products.
SELECT avg(total_amount_purchased) , avg(total_value_purchased) FROM Product_Suppliers WHERE supplier_id = (SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY count(*) DESC LIMIT 1)
department_store
[ "Show all the customer codes.", "What is the largest code among those?", "Show me both the largest and smallest codes." ]
[ "SELECT customer_code FROM Customers", "SELECT max(customer_code) FROM Customers", "SELECT max(customer_code) , min(customer_code) FROM Customers" ]
What is the largest and smallest customer codes?
SELECT max(customer_code) , min(customer_code) FROM Customers
department_store
[ "Find the information for the product \"keyboard\".", "Return all the distinct customers who bought a keyboard.", "What are their names?" ]
[ "SELECT * FROM products WHERE product_name = \"keyboard\"", "SELECT DISTINCT * FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id JOIN products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = \"keyboard\"", "SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id JOIN products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = \"keyboard\"" ]
List the names of all the distinct customers who bought a keyboard.
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id JOIN products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = "keyboard"
department_store
[ "Show the information for the product \"red jeans\".", "Find all the distinct suppliers who supply red jeans.", "What are their names and phone numbers?" ]
[ "SELECT * FROM products WHERE product_name = \"red jeans\"", "SELECT DISTINCT * FROM suppliers AS T1 JOIN product_suppliers AS T2 ON T1.supplier_id = T2.supplier_id JOIN products AS T3 ON T2.product_id = T3.product_id WHERE T3.product_name = \"red jeans\"", "SELECT DISTINCT T1.supplier_name , T1.supplier_phone FROM suppliers AS T1 JOIN product_suppliers AS T2 ON T1.supplier_id = T2.supplier_id JOIN products AS T3 ON T2.product_id = T3.product_id WHERE T3.product_name = \"red jeans\"" ]
List the names and phone numbers of all the distinct suppliers who supply red jeans.
SELECT DISTINCT T1.supplier_name , T1.supplier_phone FROM suppliers AS T1 JOIN product_suppliers AS T2 ON T1.supplier_id = T2.supplier_id JOIN products AS T3 ON T2.product_id = T3.product_id WHERE T3.product_name = "red jeans"
department_store
[ "What are the highest and lowest prices of products?", "What are the highest and lowest prices of products, grouped by product type?", "Sort the results by the product type." ]
[ "SELECT max(product_price) , min(product_price) FROM products", "SELECT max(product_price) , min(product_price) , product_type_code FROM products GROUP BY product_type_code", "SELECT max(product_price) , min(product_price) , product_type_code FROM products GROUP BY product_type_code ORDER BY product_type_code" ]
What are the highest and lowest prices of products, grouped by and alphabetically ordered by product type?
SELECT max(product_price) , min(product_price) , product_type_code FROM products GROUP BY product_type_code ORDER BY product_type_code
department_store
[ "Find customer orders whose status is \"Cancelled\".", "List the order id, customer id for orders in Cancelled status.", "Sort the results by the order date." ]
[ "SELECT * FROM customer_orders WHERE order_status_code = \"Cancelled\"", "SELECT order_id , customer_id FROM customer_orders WHERE order_status_code = \"Cancelled\"", "SELECT order_id , customer_id FROM customer_orders WHERE order_status_code = \"Cancelled\" ORDER BY order_date" ]
List the order id, customer id for orders in Cancelled status, ordered by their order dates.
SELECT order_id , customer_id FROM customer_orders WHERE order_status_code = "Cancelled" ORDER BY order_date
department_store
[ "How many customers bought each product?", "Which products were bought by at least two distinct customers?", "What are the product names?" ]
[ "SELECT COUNT (DISTINCT T1.customer_id) FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id JOIN products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id", "SELECT * FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id JOIN products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id HAVING COUNT (DISTINCT T1.customer_id) >= 2", "SELECT DISTINCT T3.product_name FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id JOIN products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id HAVING COUNT (DISTINCT T1.customer_id) >= 2" ]
Find the names of products that were bought by at least two distinct customers.
SELECT DISTINCT T3.product_name FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id JOIN products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id HAVING COUNT (DISTINCT T1.customer_id) >= 2
department_store
[ "Count the number of distinct products each customer ordered.", "Find customers who have bought at least three distinct products.", "What are their names?" ]
[ "SELECT COUNT (T3.product_id) FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id", "SELECT DISTINCT * FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id HAVING COUNT (DISTINCT T3.product_id) >= 3", "SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id HAVING COUNT (DISTINCT T3.product_id) >= 3" ]
Find the names of customers who have bought at least three distinct products.
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id HAVING COUNT (DISTINCT T3.product_id) >= 3
department_store
[ "What are the name and gender of each staff?", "What about the staff that has been assigned the job of Sales Person?", "What about the staff who has been assigned the job of Sales Person but never Clerical Staff?" ]
[ "SELECT staff_name , staff_gender FROM staff", "SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = \"Sales Person\"", "SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = \"Sales Person\" EXCEPT SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = \"Clerical Staff\"" ]
Find the name and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff.
SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Sales Person" EXCEPT SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Clerical Staff"
department_store
[ "What are the id and name of each customer?", "Only return those for customers whose address contains WY.", "Find the ids and names of customers whose address contains WY state and do not use credit cards for payment." ]
[ "SELECT customer_id , customer_name FROM customers", "SELECT customer_id , customer_name FROM customers WHERE customer_address LIKE \"%WY%\"", "SELECT customer_id , customer_name FROM customers WHERE customer_address LIKE \"%WY%\" AND payment_method_code != \"Credit Card\"" ]
Find the id and name of customers whose address contains WY state and do not use credit card for payment.
SELECT customer_id , customer_name FROM customers WHERE customer_address LIKE "%WY%" AND payment_method_code != "Credit Card"
department_store
[ "Show me all the products.", "What is the average price of all products?", "What is the average price of all products whose type is Clothes." ]
[ "SELECT * FROM products", "SELECT avg(product_price) FROM products", "SELECT avg(product_price) FROM products WHERE product_type_code = 'Clothes'" ]
Find the average price of all product clothes.
SELECT avg(product_price) FROM products WHERE product_type_code = 'Clothes'
department_store
[ "Find camera lens whose focal length is longer than 15 mm.", "How many are there?" ]
[ "SELECT * FROM camera_lens WHERE focal_length_mm > 15", "SELECT count(*) FROM camera_lens WHERE focal_length_mm > 15" ]
How many camera lenses have a focal length longer than 15 mm?
SELECT count(*) FROM camera_lens WHERE focal_length_mm > 15
mountain_photos
[ "What are the brand and name of each camera lens?", "Sort the results in descending order of the lens' maximum aperture." ]
[ "SELECT brand , name FROM camera_lens", "SELECT brand , name FROM camera_lens ORDER BY max_aperture DESC" ]
Find the brand and name for each camera lens, and sort in descending order of maximum aperture.
SELECT brand , name FROM camera_lens ORDER BY max_aperture DESC
mountain_photos
[ "Give me the information for all photos.", "List the id, color scheme, and name for each." ]
[ "SELECT * FROM photos", "SELECT id , color , name FROM photos" ]
List the id, color scheme, and name for all the photos.
SELECT id , color , name FROM photos
mountain_photos
[ "What is the height of each mountain?", "What is the maximum height?", "Also show the average height." ]
[ "SELECT max(height) , avg(height) FROM mountain", "SELECT max(height) FROM mountain", "SELECT max(height) , avg(height) FROM mountain" ]
What are the maximum and average height of the mountains?
SELECT height FROM mountain
mountain_photos
[ "What is the prominence of each mountain?", "What is the prominence of mountains in country 'Morocco'?", "What is the average of them?" ]
[ "SELECT prominence FROM mountain", "SELECT prominence FROM mountain WHERE country = 'Morocco'", "SELECT avg(prominence) FROM mountain WHERE country = 'Morocco'" ]
What are the average prominence of the mountains in country 'Morocco'?
SELECT avg(prominence) FROM mountain WHERE country = 'Morocco'
mountain_photos
[ "Show all the mountains.", "Which mountains do not belong to the range 'Aberdare Range'?", "What are those mountains' name, height and prominence?" ]
[ "SELECT * FROM mountain", "SELECT * FROM mountain WHERE range != 'Aberdare Range'", "SELECT name , height , prominence FROM mountain WHERE range != 'Aberdare Range'" ]
What are the name, height and prominence of mountains which do not belong to the range 'Aberdare Range'?
SELECT name , height , prominence FROM mountain WHERE range != 'Aberdare Range'
mountain_photos
[ "Show the id and name of all mountains.", "Show the id and name of all the mountains that have photos.", "What are the id and name of mountains that have photos and heights above 4000?" ]
[ "SELECT id , name FROM mountain", "SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id", "SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.height > 4000" ]
What are the id and name of mountains that have photos and height above 4000?
SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.height > 4000
mountain_photos
[ "Show the ids and names of all mountains.", "Show the ids and names of those that have photos.", "Which ones have at least 2 photos?" ]
[ "SELECT id , name FROM mountain", "SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id", "SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id GROUP BY T1.id HAVING count(*) >= 2" ]
What are the id and name of the mountains that have at least 2 photos?
SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id GROUP BY T1.id HAVING count(*) >= 2
mountain_photos
[ "Show the id of the camera lens that has taken picture of each mountain.", "Which one has taken pictures of the most mountains.", "What is the name of this camera?" ]
[ "SELECT camera_lens_id FROM photos", "SELECT camera_lens_id FROM photos GROUP BY camera_lens_id ORDER BY count(*) DESC LIMIT 1", "SELECT T2.name FROM photos AS T1 JOIN camera_lens AS T2 ON T1.camera_lens_id = T2.id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1" ]
What are the names of the cameras that have taken picture of the most mountains?
SELECT T2.name FROM photos AS T1 JOIN camera_lens AS T2 ON T1.camera_lens_id = T2.id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
mountain_photos
[ "For each photo, show the id of the camera lens that has taken it.", "Which photos were taken with the lens brand 'Sigma' or 'Olympus'?", "Give me the photo names." ]
[ "SELECT camera_lens_id FROM photos", "SELECT * FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id = T1.id WHERE T1.brand = 'Sigma' OR T1.brand = 'Olympus'", "SELECT T2.name FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id = T1.id WHERE T1.brand = 'Sigma' OR T1.brand = 'Olympus'" ]
What are the names of photos taken with the lens brand 'Sigma' or 'Olympus'?
SELECT T2.name FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id = T1.id WHERE T1.brand = 'Sigma' OR T1.brand = 'Olympus'
mountain_photos
[ "What is the brand of each camera lens?", "How many different kinds are there?" ]
[ "SELECT brand FROM camera_lens", "SELECT count(DISTINCT brand) FROM camera_lens" ]
How many different kinds of lens brands are there?
SELECT count(DISTINCT brand) FROM camera_lens
mountain_photos
[ "Show the id of all the camera lenses used for taking photos.", "Which camera lenses were not used for taking any photos?", "How many are there?" ]
[ "SELECT camera_lens_id FROM photos", "SELECT * FROM camera_lens WHERE id NOT IN ( SELECT camera_lens_id FROM photos )", "SELECT count(*) FROM camera_lens WHERE id NOT IN ( SELECT camera_lens_id FROM photos )" ]
How many camera lenses are not used in taking any photos?
SELECT count(*) FROM camera_lens WHERE id NOT IN ( SELECT camera_lens_id FROM photos )
mountain_photos
[ "Which mountains are in the country 'Ethiopia'?", "Which camera lenses are used to take photos of these mountains? Return the camera lens ids.", "How many distinct kinds of camera lenses are there, among these?" ]
[ "SELECT * FROM mountain WHERE country = 'Ethiopia'", "SELECT T2.camera_lens_id FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.country = 'Ethiopia'", "SELECT count(DISTINCT T2.camera_lens_id) FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.country = 'Ethiopia'" ]
How many distinct kinds of camera lenses are used to take photos of mountains in the country 'Ethiopia'?
SELECT count(DISTINCT T2.camera_lens_id) FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.country = 'Ethiopia'
mountain_photos
[ "Which mountains are in the range 'Toubkal Atlas'?", "Find the brands of lenses that took a picture of mountains with range 'Toubkal Atlas'", "Of these, which ones have also taken a picture of mountains with range 'Lasta Massif'" ]
[ "SELECT * FROM mountain WHERE range = 'Toubkal Atlas'", "SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Toubkal Atlas'", "SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Toubkal Atlas' INTERSECT SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Lasta Massif'" ]
List the brands of lenses that took both a picture of mountains with range 'Toubkal Atlas' and a picture of mountains with range 'Lasta Massif'
SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Toubkal Atlas' INTERSECT SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Lasta Massif'
mountain_photos
[ "Which pictures are taken by a lens of brand 'Sigma'?", "Show the name and prominence of the mountains whose picture is not taken by a lens of brand 'Sigma'." ]
[ "SELECT * FROM photos AS T2 JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T3.brand = 'Sigma'", "SELECT name , prominence FROM mountain EXCEPT SELECT T1.name , T1.prominence FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T3.brand = 'Sigma'" ]
Show the name and prominence of the mountains whose picture is not taken by a lens of brand 'Sigma'.
SELECT name , prominence FROM mountain EXCEPT SELECT T1.name , T1.prominence FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T3.brand = 'Sigma'
mountain_photos
[ "Show the name of each camera lens.", "Find the camera lens names containing substring \"Digital\"." ]
[ "SELECT name FROM camera_lens", "SELECT name FROM camera_lens WHERE name LIKE \"%Digital%\"" ]
List the camera lens names containing substring "Digital".
SELECT name FROM camera_lens WHERE name LIKE "%Digital%"
mountain_photos
[ "Tell me claim 143's settled amount.", "Tell me its number of settlements.", "Which claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id." ]
[ "SELECT Amount_Settled FROM Claims WHERE Claim_ID = 143", "SELECT COUNT(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID WHERE T1.Claim_ID = 143", "SELECT T1.Date_Claim_Made , T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.Claim_id HAVING count(*) > 2 UNION SELECT T1.Date_Claim_Made , T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id WHERE T1.Amount_Claimed = ( SELECT max(Amount_Claimed) FROM Claims )" ]
Which claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id.
SELECT T1.Date_Claim_Made , T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.Claim_id HAVING count(*) > 2 UNION SELECT T1.Date_Claim_Made , T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id WHERE T1.Amount_Claimed = ( SELECT max(Amount_Claimed) FROM Claims )
insurance_policies
[ "Tell me the claims id of the customer named Ellsworth Paucek.", "Tell me the number of policies of the customer named Ellsworth Paucek.", "Which customer had at least 2 policies but did not file any claims? List the customer details and id." ]
[ "SELECT T3.Claim_ID FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id JOIN Claims AS T3 ON T2.policy_id = T3.policy_id WHERE T1.customer_details = \"Ellsworth Paucek\"", "SELECT COUNT(*) FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id WHERE T1.customer_details = \"Ellsworth Paucek\"", "SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2 EXCEPT SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id JOIN Claims AS T3 ON T2.policy_id = T3.policy_id" ]
Which customer had at least 2 policies but did not file any claims? List the customer details and id.
SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2 EXCEPT SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id JOIN Claims AS T3 ON T2.policy_id = T3.policy_id
insurance_policies
[ "What is the claim settled date of the claim with id 571.", "What is its settlement amount?", "Among all the claims, what is the settlement amount of the claim with the largest claim amount? List both the settlement amount and claim amount" ]
[ "SELECT Date_Claim_Settled FROM Claims WHERE Claim_ID = 571", "SELECT Amount_Settled FROM Claims WHERE Claim_ID = 571", "SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1" ]
Among all the claims, what is the settlement amount of the claim with the largest claim amount? List both the settlement amount and claim amount.
SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1
insurance_policies
[ "Tell me the claims id of the customer named Dr. Diana Rathk.", "What was their claim amount?", "Among all the claims, what is the amount claimed in the claim with the least amount settled? List both the settlement amount and claim amount" ]
[ "SELECT T3.Claim_ID FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id JOIN Claims AS T3 ON T2.policy_id = T3.policy_id WHERE T1.customer_details = \"Dr. Diana Rathk\"", "SELECT T3.Amount_Claimed FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id JOIN Claims AS T3 ON T2.policy_id = T3.policy_id WHERE T1.customer_details = \"Dr. Diana Rathk\"", "SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC LIMIT 1" ]
Among all the claims, what is the amount claimed in the claim with the least amount settled? List both the settlement amount and claim amount.
SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC LIMIT 1
insurance_policies
[ "Among all the claims, which one has the largest claim amount?", "Which one has the least claim amount?", "Which claims have a claimed amount larger than the average? Tell me the date the claim was made and the date it was settled." ]
[ "SELECT Claim_ID FROM Claims ORDER BY Amount_Settled ASC LIMIT 1", "SELECT Claim_ID FROM Claims ORDER BY Amount_Settled DESC LIMIT 1", "SELECT Date_Claim_Made , Date_Claim_Settled FROM Claims WHERE Amount_Claimed > ( SELECT avg(Amount_Claimed) FROM Claims )" ]
Among all the claims, which claims have a claimed amount larger than the average? List the date the claim was made and the date it was settled.
SELECT Date_Claim_Made , Date_Claim_Settled FROM Claims WHERE Amount_Claimed > ( SELECT avg(Amount_Claimed) FROM Claims )
insurance_policies
[ "Tell me claim 563's claim amount.", "How about that of claim 621?", "Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date." ]
[ "SELECT Amount_Claimed FROM Claims WHERE Claim_ID = 563", "SELECT Amount_Claimed FROM Claims WHERE Claim_ID = 621", "SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= ( SELECT avg(Amount_Settled) FROM Claims )" ]
Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date.
SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= ( SELECT avg(Amount_Settled) FROM Claims )
insurance_policies
[ "Tell me claim 621's claim amount.", "How about its settlement claim amount?", "How many settlements does each claim correspond to? List the claim id and the number of settlements." ]
[ "SELECT Amount_Claimed FROM Claims WHERE Claim_ID = 621", "SELECT T2.Amount_Claimed FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID WHERE T1.Claim_ID = 621", "SELECT T1.Claim_id , count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id" ]
How many settlements does each claim correspond to? List the claim id and the number of settlements.
SELECT T1.Claim_id , count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id
insurance_policies
[ "Tell me the number of settlements of claim 957", "How about the settlement claim amount?", "Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number" ]
[ "SELECT COUNT(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID WHERE T1.Claim_ID = 957", "SELECT T2.Amount_Claimed FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID WHERE T1.Claim_ID = 957", "SELECT T1.claim_id , T1.date_claim_made , count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY count(*) DESC LIMIT 1" ]
Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number.
SELECT T1.claim_id , T1.date_claim_made , count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY count(*) DESC LIMIT 1
insurance_policies
[ "Tell me the settlement amount of settlement 564.", "What is the date on which the claim was made?", "How many settlements were made on the claim with the most recent claim settlement date? Tell me the number and the claim id." ]
[ "SELECT Amount_Settled FROM Settlements WHERE Settlement_ID = 564", "SELECT Date_Claim_Made FROM Settlements WHERE Settlement_ID = 564", "SELECT count(*) , T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1" ]
How many settlements were made on the claim with the most recent claim settlement date? List the number and the claim id.
SELECT count(*) , T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1
insurance_policies
[ "Tell me which claim has the largest claim amount.", "How about the latest one?", "How about the earliest one?" ]
[ "SELECT Claim_ID FROM Claims ORDER BY Amount_Settled ASC LIMIT 1", "SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made DESC LIMIT 1", "SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1" ]
Of all the claims, what was the earliest date when any claim was made?
SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1
insurance_policies
[ "Tell me the policy types of the customer named Augustine Kerluke", "How many are there?", "Who are the customers that have had more than 1 policy?" ]
[ "SELECT T2.Policy_Type_Code FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id WHERE Customer_Details = \"Augustine Kerluke\"", "SELECT COUNT(T2.Policy_Type_Code) FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id WHERE Customer_Details = \"Augustine Kerluke\"", "SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id GROUP BY T1.customer_id HAVING count(*) > 1" ]
Who are the customers that had more than 1 policy? List the customer details and id.
SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id GROUP BY T1.customer_id HAVING count(*) > 1
insurance_policies
[ "Tell me payment method code of the most recent payment.", "Tell me the amount of the most recent payment.", "What is the most popular payment method?" ]
[ "SELECT Payment_Method_Code FROM Payments ORDER BY Date_Payment_Made DESC LIMIT 1", "SELECT Amount_Payment FROM Payments ORDER BY Date_Payment_Made DESC LIMIT 1", "SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) DESC LIMIT 1" ]
What is the most popular payment method?
SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) DESC LIMIT 1
insurance_policies
[ "Tell me how many payments are processed by MasterCard?", "How about that of Discover Card?", "With which kind of payment method were the least number of payments processed?" ]
[ "SELECT COUNT(*) FROM Payments WHERE Payment_Method_Code = \"MasterCard\"", "SELECT COUNT(*) FROM Payments WHERE Payment_Method_Code = \"Discover Card\"", "SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) ASC LIMIT 1" ]
With which kind of payment method were the least number of payments processed?
SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) ASC LIMIT 1
insurance_policies
[ "Tell me the policy types of the customer named Augustine Kerluke.", "How many are there?", "Which kind of policy type was chosen by the most customers?" ]
[ "SELECT T2.Policy_Type_Code FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id WHERE Customer_Details = \"Augustine Kerluke\"", "SELECT COUNT(T2.Policy_Type_Code) FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id WHERE Customer_Details = \"Augustine Kerluke\"", "SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY count(*) DESC LIMIT 1" ]
Which kind of policy type was chosen by the most customers?
SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY count(*) DESC LIMIT 1
insurance_policies
[ "Tell me the policy types of the customer named Selena Gerhold.", "How about that of the customer named Sydnie Friesen?", "Tell me the details of the customers who do not have any policies." ]
[ "SELECT * FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id WHERE Customer_Details = \"Selena Gerhold\"", "SELECT * FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id WHERE Customer_Details = \"Sydnie Friesen\"", "SELECT customer_details FROM Customers EXCEPT SELECT T1.customer_details FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.customer_id = T2.customer_id" ]
List the details of the customers who do not have any policies.
SELECT customer_details FROM Customers EXCEPT SELECT T1.customer_details FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.customer_id = T2.customer_id
insurance_policies
[ "Show information for all train stations.", "How many are there?" ]
[ "SELECT * FROM station", "SELECT count(*) FROM station" ]
How many train stations are there?
SELECT count(*) FROM station
train_station
[ "Show the name for all stations.", "Also show the location for them.", "Also add the number of platforms for each." ]
[ "SELECT name FROM station", "SELECT name , LOCATION FROM station", "SELECT name , LOCATION , number_of_platforms FROM station" ]
Show the name, location, and number of platforms for all stations.
SELECT name , LOCATION , number_of_platforms FROM station
train_station
[ "Show the location for each train station.", "Show only distinct results." ]
[ "SELECT LOCATION FROM station", "SELECT DISTINCT LOCATION FROM station" ]
What are all locations of train stations?
SELECT DISTINCT LOCATION FROM station
train_station
[ "Show the name for all train stations.", "Also show the total passenger for them.", "How about the results for those stations not in London?" ]
[ "SELECT name FROM station", "SELECT name , total_passengers FROM station", "SELECT name , total_passengers FROM station WHERE LOCATION != 'London'" ]
Show the names and total passengers for all train stations not in London.
SELECT name , total_passengers FROM station WHERE LOCATION != 'London'
train_station
[ "Show the names of the stations.", "Also show the main services for them.", "Order the results by the total number of passengers, descending.", "Only show the top three." ]
[ "SELECT name FROM station", "SELECT name , main_services FROM station", "SELECT name , main_services FROM station ORDER BY total_passengers DESC", "SELECT name , main_services FROM station ORDER BY total_passengers DESC LIMIT 3" ]
Show the names and main services for train stations that have the top three total number of passengers.
SELECT name , main_services FROM station ORDER BY total_passengers DESC LIMIT 3
train_station
[ "Show the total passengers for all train stations.", "Show the total passengers for those in either London or Glasgow.", "What is the average?", "Also show the maximum." ]
[ "SELECT total_passengers FROM station", "SELECT total_passengers FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow'", "SELECT avg(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow'", "SELECT avg(total_passengers) , max(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow'" ]
What is the average and maximum number of total passengers for train stations in London or Glasgow?
SELECT avg(total_passengers) , max(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow'
train_station
[ "Show the location for train stations.", "For each location of them, show the total number of platforms.", "For each of them, also show the total number of passengers." ]
[ "SELECT LOCATION FROM station", "SELECT LOCATION , sum(number_of_platforms) FROM station GROUP BY LOCATION", "SELECT LOCATION , sum(number_of_platforms) , sum(total_passengers) FROM station GROUP BY LOCATION" ]
Show all locations and the total number of platforms and passengers for all train stations in each location.
SELECT LOCATION , sum(number_of_platforms) , sum(total_passengers) FROM station GROUP BY LOCATION
train_station
[ "Show locations for stations.", "Show locations for stations with at least 15 platforms.", "Among those, which locations also have stations with more than 25 total passengers?", "Show distinct locations of them." ]
[ "select LOCATION FROM station", "SELECT LOCATION FROM station WHERE number_of_platforms >= 15", "SELECT LOCATION FROM station WHERE number_of_platforms >= 15 AND total_passengers > 25", "SELECT DISTINCT LOCATION FROM station WHERE number_of_platforms >= 15 AND total_passengers > 25" ]
Show all locations that have train stations with at least 15 platforms and train stations with more than 25 total passengers.
SELECT DISTINCT LOCATION FROM station WHERE number_of_platforms >= 15 AND total_passengers > 25
train_station
[ "Show all locations of train stations.", "Show locations with a station having at least 15 platforms.", "Show all locations that don't." ]
[ "SELECT LOCATION FROM station", "SELECT LOCATION FROM station WHERE number_of_platforms >= 15", "SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms >= 15" ]
Show all locations which don't have a train station with at least 15 platforms.
SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms >= 15
train_station
[ "Show the location for all train stations.", "Show them in descending order of the number of train stations.", "Which one has the most?" ]
[ "SELECT LOCATION FROM station", "SELECT LOCATION FROM station GROUP BY LOCATION ORDER BY count(*) DESC", "SELECT LOCATION FROM station GROUP BY LOCATION ORDER BY count(*) DESC LIMIT 1" ]
Show the location with most number of train stations.
SELECT LOCATION FROM station GROUP BY LOCATION ORDER BY count(*) DESC LIMIT 1
train_station