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 |
---|---|---|---|---|
[
"How old is the youngest student?",
"What about the eldest?",
"What is the average age?"
] | [
"SELECT min(age) FROM Student",
"SELECT max(age) FROM Student",
"SELECT avg(age) FROM Student"
] | What is the minimum, mean, and maximum age across all students? | SELECT min(age) , avg(age) , max(age) FROM Student | allergy_1 |
[
"What is the minimum age of the students?",
"Who is the youngest student?",
"What is his last name?"
] | [
"SELECT min(age) FROM Student",
"SELECT * FROM Student WHERE age = (SELECT min(age) FROM Student)",
"SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student)"
] | Provide the last name of the youngest student. | SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student) | allergy_1 |
[
"Who is the oldest student?",
"What is their id?"
] | [
"SELECT * FROM Student WHERE age = (SELECT max(age) FROM Student)",
"SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student)"
] | What student id corresponds to the oldest student? | SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student) | allergy_1 |
[
"What are the different majors?",
"How many students are studying each subject?"
] | [
"SELECT DISTINCT major FROM Student",
"SELECT major , count(*) FROM Student GROUP BY major"
] | How many students are there for each major? | SELECT major , count(*) FROM Student GROUP BY major | allergy_1 |
[
"What are the different majors?",
"How many students does each major has?",
"Which one has the most students?"
] | [
"SELECT DISTINCT major FROM Student",
"SELECT major , count(*) FROM Student GROUP BY major",
"SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1"
] | What is the largest major? | SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1 | allergy_1 |
[
"What are the different student ages?",
"How many students are each age?"
] | [
"SELECT DISTINCT age FROM Student",
"SELECT age , count(*) FROM Student GROUP BY age"
] | How old is each student and how many students are each age? | SELECT age , count(*) FROM Student GROUP BY age | allergy_1 |
[
"What are the different sex categories for students?",
"How many are there for each category?",
"What is the average age for each category?"
] | [
"SELECT DISTINCT sex FROM Student",
"SELECT count(*) , sex FROM Student GROUP BY sex",
"SELECT avg(age) , sex FROM Student GROUP BY sex"
] | What are the average ages for male and female students? | SELECT avg(age) , sex FROM Student GROUP BY sex | allergy_1 |
[
"What are the different cities that students live in?",
"How many students are from each one?"
] | [
"SELECT DISTINCT city_code FROM Student",
"SELECT city_code , count(*) FROM Student GROUP BY city_code"
] | How many students live in each city? | SELECT city_code , count(*) FROM Student GROUP BY city_code | allergy_1 |
[
"Who are the different advisors?",
"How many students does each one have?"
] | [
"SELECT DISTINCT advisor FROM Student",
"SELECT advisor , count(*) FROM Student GROUP BY advisor"
] | How many students does each advisor have? | SELECT advisor , count(*) FROM Student GROUP BY advisor | allergy_1 |
[
"Who are the advisors of the students?",
"Order the advisors by the number of students they have.",
"Who has the most?"
] | [
"SELECT advisor FROM Student",
"SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*)",
"SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1"
] | Give the advisor with the most students. | SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1 | allergy_1 |
[
"Who have allergies?",
"Who has a cat allergy?",
"How many are there?"
] | [
"SELECT * FROM Has_allergy",
"SELECT * FROM Has_allergy WHERE Allergy = \"Cat\"",
"SELECT count(*) FROM Has_allergy WHERE Allergy = \"Cat\""
] | How many students are affected by cat allergies? | SELECT count(*) FROM Has_allergy WHERE Allergy = "Cat" | allergy_1 |
[
"Who has at least two allergies?",
"What are their ids?"
] | [
"SELECT * FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2",
"SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2"
] | What are the students ids of students who have more than one allergy? | SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2 | allergy_1 |
[
"What are all the student ids?",
"Of these, which students ids correspond to students without allergies?"
] | [
"SELECT StuID FROM Student",
"SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy"
] | Which students are unaffected by allergies? | SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy | allergy_1 |
[
"How many studnets are allergic to milk?",
"How many are allergic to that or to eggs?",
"Of those, how many are female?"
] | [
"SELECT count(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.allergy = \"Milk\"",
"SELECT count(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.allergy = \"Milk\" OR T1.allergy = \"Eggs\"",
"SELECT count(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = \"F\" AND T1.allergy = \"Milk\" OR T1.allergy = \"Eggs\""
] | How many students who are female are allergic to milk or eggs? | SELECT count(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = "F" AND (T1.allergy = "Milk" OR T1.allergy = "Eggs") | allergy_1 |
[
"How many allergy cases are there?",
"Of those, for how many is it a food allergy?"
] | [
"SELECT count(*) FROM Has_allergy",
"SELECT count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = \"food\""
] | How many students are affected by food related allergies? | SELECT count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food" | allergy_1 |
[
"What are the different allergies?",
"Which one has the most students affected?"
] | [
"SELECT DISTINCT Allergy FROM Has_allergy",
"SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY count(*) DESC LIMIT 1"
] | Which allergy is the most common? | SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY count(*) DESC LIMIT 1 | allergy_1 |
[
"What are all the different allergies?",
"How many students does each of them affect?"
] | [
"SELECT DISTINCT Allergy FROM Has_allergy",
"SELECT Allergy , count(*) FROM Has_allergy GROUP BY Allergy"
] | How many students have each different allergy? | SELECT Allergy , count(*) FROM Has_allergy GROUP BY Allergy | allergy_1 |
[
"What are the different allergy types?",
"For each, how many students does it affect?"
] | [
"SELECT DISTINCT allergytype FROM Allergy_type",
"SELECT T2.allergytype , count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype"
] | How many students are affected by each allergy type? | SELECT T2.allergytype , count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype | allergy_1 |
[
"What are student ids who are allergic to milk?",
"Of these, who also have allergy to cat?",
"List their last name and age."
] | [
"SELECT StuID FROM Has_allergy WHERE Allergy = \"Milk\"",
"SELECT StuID FROM Has_allergy WHERE Allergy = \"Milk\" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = \"Cat\"",
"SELECT lname , age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = \"Milk\" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = \"Cat\")"
] | What are the last names and ages of the students who are allergic to milk and cat? | SELECT lname , age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat") | allergy_1 |
[
"What is the girl with first name Lisa allergic to?",
"What type is each allergy?",
"Order them by the name of allergies."
] | [
"SELECT T1.Allergy FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = \"Lisa\"",
"SELECT T1.Allergy , T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = \"Lisa\"",
"SELECT T1.Allergy , T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = \"Lisa\" ORDER BY T1.Allergy"
] | What are the allergies the girl named Lisa has? And what are the types of them? Order the result by allergy names. | SELECT T1.Allergy , T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" ORDER BY T1.Allergy | allergy_1 |
[
"Which students are allergic to cats?",
"Which students are not?",
"Of these, list the first name and sex of students who are allergic to milk."
] | [
"SELECT StuID FROM Has_allergy WHERE Allergy = \"Cat\"",
"SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = \"Cat\"",
"SELECT fname , sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = \"Milk\" EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = \"Cat\")"
] | What are the first name and gender of the students who have allergy to milk but can put up with cats? | SELECT fname , sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat") | allergy_1 |
[
"Which students have allergies to food type?",
"Which of them have also have allergies to animal type?",
"Find the average age of them."
] | [
"SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\"",
"SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"animal\"",
"SELECT avg(age) FROM Student WHERE StuID IN ( SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"animal\")"
] | How old are the students with allergies to food and animal types on average? | SELECT avg(age) FROM Student WHERE StuID IN ( SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "animal") | allergy_1 |
[
"What are the first and last name of all the students?",
"Of them, who are allergic to any type of food?",
"And who are not?"
] | [
"SELECT fname , lname FROM Student",
"SELECT DISTINCT T3.fname , T3.lname FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T1.StuID = T3.StuID WHERE T2.allergytype = \"food\"",
"SELECT fname , lname FROM Student WHERE StuID NOT IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\")"
] | What is the full name of each student who is not allergic to any type of food. | SELECT fname , lname FROM Student WHERE StuID NOT IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food") | allergy_1 |
[
"Who are all the male students?",
"Of these, who have allergies to food type?",
"How many are there?"
] | [
"SELECT * FROM Student WHERE sex = 'M'",
"SELECT * FROM Student WHERE sex = \"M\" AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\")",
"SELECT count(*) FROM Student WHERE sex = \"M\" AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\")"
] | How many male students (sex is 'M') are allergic to any type of food? | SELECT count(*) FROM Student WHERE sex = "M" AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food") | allergy_1 |
[
"What are the ids of the students who have any allergy?",
"Of these, who are allergy to milk or cat?",
"What are the different first names and city codes of them?"
] | [
"SELECT StuID FROM Has_allergy",
"SELECT StuID FROM Has_allergy WHERE Allergy = \"Milk\" OR Allergy = \"Cat\"",
"SELECT DISTINCT T1.fname , T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = \"Milk\" OR T2.Allergy = \"Cat\""
] | What are the distinct first names and cities of the students who have allergy either to milk or to cat? | SELECT DISTINCT T1.fname , T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = "Milk" OR T2.Allergy = "Cat" | allergy_1 |
[
"Which students are over 18?",
"Of them, who are not allergic to food or animal?",
"How many?"
] | [
"SELECT * FROM Student WHERE age > 18",
"SELECT * FROM Student WHERE age > 18 AND StuID NOT IN ( SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\" OR T2.allergytype = \"animal\")",
"SELECT count(*) FROM Student WHERE age > 18 AND StuID NOT IN ( SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\" OR T2.allergytype = \"animal\")"
] | How many students are over 18 and do not have allergy to food type or animal type? | SELECT count(*) FROM Student WHERE age > 18 AND StuID NOT IN ( SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" OR T2.allergytype = "animal") | allergy_1 |
[
"Who have allergy to soy?",
"Who have not?",
"List their first name and major."
] | [
"SELECT * FROM Has_allergy WHERE Allergy = \"Soy\"",
"SELECT * FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = \"Soy\")",
"SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = \"Soy\")"
] | What are the first name and major of the students who are able to consume soy? | SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy") | allergy_1 |
[
"Return the information of all the customers.",
"What are the name of the customers?"
] | [
"SELECT * FROM customers",
"SELECT customer_name FROM customers"
] | What are the names of all the customers? | SELECT customer_name FROM customers | customers_and_addresses |
[
"List all the customers.",
"Count the number of the customers."
] | [
"SELECT * FROM customers",
"SELECT count(*) FROM customers"
] | Return the total number of distinct customers. | SELECT count(*) FROM customers | customers_and_addresses |
[
"Find the order quantity for each order.",
"What is the average order quantity?"
] | [
"SELECT order_quantity FROM order_items",
"SELECT avg(order_quantity) FROM order_items"
] | Find the average order quantity per order. | SELECT avg(order_quantity) FROM order_items | customers_and_addresses |
[
"Which customers' payment method is \"Cash\"?",
"What are the names of those customers?"
] | [
"SELECT * FROM customers WHERE payment_method = \"Cash\"",
"SELECT customer_name FROM customers WHERE payment_method = \"Cash\""
] | Which customers use "Cash" for payment method? Return the customer names. | SELECT customer_name FROM customers WHERE payment_method = "Cash" | customers_and_addresses |
[
"List all the customers.",
"What are the dates they became customers?",
"For customer id between 10 and 20, what are the dates they became customers?"
] | [
"SELECT * FROM customers",
"SELECT date_became_customer FROM customers",
"SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20"
] | What are the dates when customers with ids between 10 and 20 became customers? | SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20 | customers_and_addresses |
[
"What is the payment method each customer uses?",
"Group by the payment method, and return the frequency the method is used.",
"Return the payment method that is used most frequently."
] | [
"SELECT payment_method FROM customers",
"SELECT count(*) FROM customers GROUP BY payment_method",
"SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1"
] | Find the payment method that is used most frequently. | SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1 | customers_and_addresses |
[
"For each payment method, count the number of customers who use it.",
"What is the most frequently used payment method?",
"Return the name of the customers who use this payment method."
] | [
"SELECT count(*) FROM customers GROUP BY payment_method",
"SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1",
"SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1)"
] | Find the name of the customers who use the most frequently used payment method. | SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1) | customers_and_addresses |
[
"What payment method does each customer use?",
"Return all the distinct payment methods used."
] | [
"SELECT payment_method FROM customers",
"SELECT DISTINCT payment_method FROM customers"
] | Return all the distinct payment methods used by customers. | SELECT DISTINCT payment_method FROM customers | customers_and_addresses |
[
"What is the detail of each product?",
"What are the distinct product details?"
] | [
"SELECT product_details FROM products",
"SELECT DISTINCT product_details FROM products"
] | Return the the details of all products. | SELECT DISTINCT product_details FROM products | customers_and_addresses |
[
"Return customers whose name contains \"Alex\".",
"What are the full names of these customers?"
] | [
"SELECT * FROM customers WHERE customer_name LIKE \"%Alex%\"",
"SELECT * FROM customers WHERE customer_name LIKE \"%Alex%\""
] | Which customer's name contains "Alex"? Find the full name. | SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%" | customers_and_addresses |
[
"Return products whose details contain the word \"Latte\" or \"Americano\".",
"What are the full details for these products?"
] | [
"SELECT * FROM products WHERE product_details LIKE \"%Latte%\" OR product_details LIKE \"%Americano%\"",
"SELECT product_details FROM products WHERE product_details LIKE \"%Latte%\" OR product_details LIKE \"%Americano%\""
] | Which product's detail contains the word "Latte" or "Americano"? Return the full detail. | SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%" | customers_and_addresses |
[
"Find the customer who is named \"Maudie Kertzmann\".",
"What is the address id of this customer?",
"What is the address content?"
] | [
"SELECT * FROM customers WHERE customer_name = \"Maudie Kertzmann\"",
"SELECT t2.address_id FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = \"Maudie Kertzmann\"",
"SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = \"Maudie Kertzmann\""
] | Return the address content for the customer whose name is "Maudie Kertzmann". | SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = "Maudie Kertzmann" | customers_and_addresses |
[
"Find all the address ids for the city called Lake Geovannyton.",
"Find all the customers whose address is in this city.",
"How many customers are living there?"
] | [
"SELECT address_id FROM addresses WHERE city = \"Lake Geovannyton\"",
"SELECT * FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = \"Lake Geovannyton\"",
"SELECT count(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = \"Lake Geovannyton\""
] | Find the number of customers who live in the city called Lake Geovannyton. | SELECT count(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = "Lake Geovannyton" | customers_and_addresses |
[
"What are the ids of addresses in Colorado state?",
"Tell me the ids of customers who live there.",
"What are the names of these customers?"
] | [
"SELECT address_id FROM addresses WHERE state_province_county = \"Colorado\"",
"SELECT t2.customer_id FROM customer_addresses AS t2 JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = \"Colorado\"",
"SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = \"Colorado\""
] | What are the names of customers who live in Colorado state? | SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = "Colorado" | customers_and_addresses |
[
"For each customer, find the city he or she lives in.",
"What are all the distinct cities customers live in?",
"What are the cities no customers live in?"
] | [
"SELECT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id",
"SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id",
"SELECT city FROM addresses WHERE city NOT IN ( SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id)"
] | What are the cities no customers live in? | SELECT city FROM addresses WHERE city NOT IN ( SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id) | customers_and_addresses |
[
"List all the cities customers live in.",
"Group by cities and count how many customers live there.",
"Which city has the most customers?"
] | [
"SELECT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id",
"SELECT count(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id GROUP BY t3.city",
"SELECT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id GROUP BY t3.city ORDER BY count(*) DESC LIMIT 1"
] | Find the city where the most customers live. | SELECT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id GROUP BY t3.city ORDER BY count(*) DESC LIMIT 1 | customers_and_addresses |
[
"List all the addresses.",
"What is the list of distinct cities?"
] | [
"SELECT * FROM addresses",
"SELECT DISTINCT city FROM addresses"
] | List all the distinct cities | SELECT DISTINCT city FROM addresses | customers_and_addresses |
[
"Find the address with post code 255.",
"Which city is this address in?"
] | [
"SELECT * FROM addresses WHERE zip_postcode = 255",
"SELECT city FROM addresses WHERE zip_postcode = 255"
] | Which city is post code 255 located in? | SELECT city FROM addresses WHERE zip_postcode = 255 | customers_and_addresses |
[
"Find the address with post code starting with 4.",
"What are the state and country of these addresses?"
] | [
"SELECT * FROM addresses WHERE zip_postcode LIKE \"4%\"",
"SELECT state_province_county , country FROM addresses WHERE zip_postcode LIKE \"4%\""
] | What are the state and country of all the cities that have post codes starting with 4.\ | SELECT state_province_county , country FROM addresses WHERE zip_postcode LIKE "4%" | customers_and_addresses |
[
"Group all the addresses by the country.",
"Which countries have more than four addresses listed?"
] | [
"SELECT * FROM addresses GROUP BY country",
"SELECT country FROM addresses GROUP BY country HAVING count(address_id) > 4"
] | For which countries are there more than four distinct addresses listed? | SELECT country FROM addresses GROUP BY country HAVING count(address_id) > 4 | customers_and_addresses |
[
"List all the contact channel codes.",
"For each contact channel code, return how many times it was used.",
"Which contact channel codes were used less than 5 times?"
] | [
"SELECT channel_code FROM customer_contact_channels",
"SELECT count(customer_id) FROM customer_contact_channels GROUP BY channel_code",
"SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING count(customer_id) < 5"
] | Which contact channel codes were used less than 5 times? | SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING count(customer_id) < 5 | customers_and_addresses |
[
"Find the customer whose name is \"Tillman Ernser\".",
"What are the channel codes used by this person?"
] | [
"SELECT * FROM customers WHERE customer_name = \"Tillman Ernser\"",
"SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = \"Tillman Ernser\""
] | Find the contact channel code that was used by the customer named "Tillman Ernser". | SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser" | customers_and_addresses |
[
"What is the \"active to date\" for each customer?",
"What is the latest \"active to date\" for each customer?",
"Find that information for the customer named \"Tillman Ernser\"."
] | [
"SELECT active_to_date FROM customer_contact_channels",
"SELECT max(active_to_date) FROM customer_contact_channels GROUP BY customer_id",
"SELECT max(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = \"Tillman Ernser\""
] | Return the the "active to date" of the latest contact channel used by the customer named "Tillman Ernser". | SELECT max(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser" | customers_and_addresses |
[
"For each contact channel, find when it started and ended being active.",
"What is the time span between the starting date and ending date?",
"What is the average across all the channels?"
] | [
"SELECT active_to_date , active_from_date FROM customer_contact_channels",
"SELECT active_to_date - active_from_date FROM customer_contact_channels",
"SELECT avg(active_to_date - active_from_date) FROM customer_contact_channels"
] | Compute the average active time span of contact channels. | SELECT avg(active_to_date - active_from_date) FROM customer_contact_channels | customers_and_addresses |
[
"Tell me the active duration for each customer contact channel.",
"Among them, what is the longest active duration?",
"What is the channel code and contact number of the customer contact channel whose active duration was the longest"
] | [
"SELECT active_to_date - active_from_date FROM customer_contact_channels",
"SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1",
"SELECT channel_code , contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1)"
] | Return the channel code and contact number of the customer contact channel whose active duration was the longest. | SELECT channel_code , contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1) | customers_and_addresses |
[
"Which customers use email as the contact channel?",
"What are the dates these customers became active?",
"What are the name and active date of these customers?"
] | [
"SELECT * FROM customer_contact_channels WHERE channel_code = 'Email'",
"SELECT active_from_date FROM customer_contact_channels WHERE channel_code = 'Email'",
"SELECT t1.customer_name , t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email'"
] | What are the name and active date of the customers whose contact channel code is email? | SELECT t1.customer_name , t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email' | customers_and_addresses |
[
"What is the largest order quantity listed in the database?",
"What is the name of the customer who made that order?"
] | [
"SELECT max(order_quantity) FROM order_items",
"SELECT 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 WHERE t3.order_quantity = ( SELECT max(order_quantity) FROM order_items)"
] | Find the name of the customer who made the order of the largest amount of goods. | SELECT 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 WHERE t3.order_quantity = ( SELECT max(order_quantity) FROM order_items) | customers_and_addresses |
[
"Tell me the customer name for each order.",
"What is the total quantity ordered by each customer?",
"Give me the name of the customer who ordered the largest quantity in total."
] | [
"SELECT 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",
"SELECT sum(t3.order_quantity) 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_name",
"SELECT 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_name ORDER BY sum(t3.order_quantity) DESC LIMIT 1"
] | Give me the name of the customer who ordered the most items in total. | SELECT 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_name ORDER BY sum(t3.order_quantity) DESC LIMIT 1 | customers_and_addresses |
[
"What is the total quantity ordered by each customer?",
"Return the customer who ordered the least quantity in total.",
"What is that customer's payment method?"
] | [
"SELECT sum(t3.order_quantity) 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_name",
"SELECT * 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_name ORDER BY sum(t3.order_quantity) LIMIT 1",
"SELECT t1.payment_method 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_name ORDER BY sum(t3.order_quantity) LIMIT 1"
] | Tell me the payment method used by the customer who ordered the least amount of goods in total. | SELECT t1.payment_method 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_name ORDER BY sum(t3.order_quantity) LIMIT 1 | customers_and_addresses |
[
"Find the id of the product ordered in each order.",
"What are the ids of products ordered by the customer named Rodrick Heaney?",
"How many distinct products has he bought?"
] | [
"SELECT product_id FROM order_items",
"SELECT 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 WHERE t1.customer_name = \"Rodrick Heaney\"",
"SELECT count(DISTINCT 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 WHERE t1.customer_name = \"Rodrick Heaney\""
] | Find the number of distinct products Rodrick Heaney has bought so far. | SELECT count(DISTINCT 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 WHERE t1.customer_name = "Rodrick Heaney" | customers_and_addresses |
[
"Find the id of product ordered in each order.",
"What are the ids of products ordered by the customer named Rodrick Heaney?",
"What is the total quantity of products bought by him?"
] | [
"SELECT product_id FROM order_items",
"SELECT 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 WHERE t1.customer_name = \"Rodrick Heaney\"",
"SELECT sum(t3.order_quantity) 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 WHERE t1.customer_name = \"Rodrick Heaney\""
] | Tell me the total quantity of products bought by the customer called "Rodrick Heaney". | SELECT sum(t3.order_quantity) 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 WHERE t1.customer_name = "Rodrick Heaney" | customers_and_addresses |
[
"Which customer order have cancelled status?",
"How many customers have cancelled status?"
] | [
"SELECT * FROM customer_orders WHERE order_status = \"Cancelled\"",
"SELECT count(DISTINCT customer_id) FROM customer_orders WHERE order_status = \"Cancelled\""
] | Return the number of customers who have at least one order with "Cancelled" status. | SELECT count(DISTINCT customer_id) FROM customer_orders WHERE order_status = "Cancelled" | customers_and_addresses |
[
"Which customer orders have \"Second time\" as order detail?",
"How many?"
] | [
"SELECT * FROM customer_orders WHERE order_details = \"Second time\"",
"SELECT count(*) FROM customer_orders WHERE order_details = \"Second time\""
] | Tell me the number of orders with "Second time" as order detail. | SELECT count(*) FROM customer_orders WHERE order_details = "Second time" | customers_and_addresses |
[
"Find all the customer orders whose status is \"Delivered\".",
"What are the customer name and date for those orders?"
] | [
"SELECT * FROM customer_orders WHERE order_status = \"Delivered\"",
"SELECT t1.customer_name , t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = \"Delivered\""
] | What are the customer name and date of the orders whose status is "Delivered". | SELECT t1.customer_name , t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = "Delivered" | customers_and_addresses |
[
"List all the customer orders in the \"Cancelled\" status.",
"Find the order quantity for these orders.",
"Find the total quantity of products associated with those orders."
] | [
"SELECT * FROM customer_orders WHERE order_status = \"Cancelled\"",
"SELECT t2.order_quantity FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_status = \"Cancelled\"",
"SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_status = \"Cancelled\""
] | Find the total quantity of products associated with the orders in the "Cancelled" status. | SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_status = "Cancelled" | customers_and_addresses |
[
"Find all the customer orders that made before 2018-03-17 07:13:53.",
"Compute the total quantity of items purchased in this order."
] | [
"SELECT * FROM customer_orders WHERE order_date < '2018-03-17 07:13:53'",
"SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_date < '2018-03-17 07:13:53'"
] | What is the total amount of products purchased before 2018-03-17 07:13:53? | SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_date < '2018-03-17 07:13:53' | customers_and_addresses |
[
"Order all the customer orders by the descending order date.",
"What is the most recent order?",
"Who made that order?"
] | [
"SELECT * FROM customer_orders ORDER BY order_date DESC",
"SELECT * FROM customer_orders ORDER BY order_date DESC LIMIT 1",
"SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.order_date DESC LIMIT 1"
] | Find the name of the customer who made an order most recently. | SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.order_date DESC LIMIT 1 | customers_and_addresses |
[
"Count the number of times each product is ordered.",
"What is the most frequently ordered product?",
"Tell me the detail of the product."
] | [
"SELECT count(*) FROM order_items GROUP BY product_id",
"SELECT * FROM order_items GROUP BY product_id ORDER BY count(*) DESC LIMIT 1",
"SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY count(*) DESC LIMIT 1"
] | What is the most frequently ordered product? Tell me the detail of the product | SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY count(*) DESC LIMIT 1 | customers_and_addresses |
[
"Find the total quantity order for each product.",
"What is the id of the product whose total order quantity is the largest?",
"What are the name and ID of that product?"
] | [
"SELECT sum(order_quantity) FROM order_items GROUP BY product_id",
"SELECT product_id FROM order_items GROUP BY product_id ORDER BY sum(order_quantity) LIMIT 1",
"SELECT t2.product_details , t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY t1.order_quantity LIMIT 1"
] | What are the name and ID of the product bought the most. | SELECT t2.product_details , t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY sum(t1.order_quantity) LIMIT 1 | customers_and_addresses |
[
"List all addresses in East Julianaside, Texas.",
"List all addresses in Gleasonmouth, Arizona.",
"List all addresses in either of them."
] | [
"SELECT address_content FROM addresses WHERE city = \"East Julianaside\" AND state_province_county = \"Texas\"",
"SELECT address_content FROM addresses WHERE city = \"Gleasonmouth\" AND state_province_county = \"Arizona\"",
"SELECT address_content FROM addresses WHERE city = \"East Julianaside\" AND state_province_county = \"Texas\" UNION SELECT address_content FROM addresses WHERE city = \"Gleasonmouth\" AND state_province_county = \"Arizona\""
] | What are all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona. | SELECT address_content FROM addresses WHERE city = "East Julianaside" AND state_province_county = "Texas" UNION SELECT address_content FROM addresses WHERE city = "Gleasonmouth" AND state_province_county = "Arizona" | customers_and_addresses |
[
"List all the customers' payment method",
"Which customer does not use Cash?",
"What is the name of the customer?"
] | [
"SELECT payment_method FROM customers",
"SELECT * FROM customers WHERE payment_method ! = 'Cash'",
"SELECT customer_name FROM customers WHERE payment_method ! = 'Cash'"
] | What is the name of customers who do not use Cash as payment method. | SELECT customer_name FROM customers WHERE payment_method ! = 'Cash' | customers_and_addresses |
[
"Find the names of all the customers.",
"What are the names of customers who bought the product \"Latte\" before?",
"Which customers never bought Latte\"?"
] | [
"SELECT customer_name FROM customers",
"SELECT 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 product_details = 'Latte'",
"SELECT customer_name FROM customers EXCEPT SELECT 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 product_details = 'Latte'"
] | What are names of customers who never ordered product Latte. | SELECT customer_name FROM customers EXCEPT SELECT 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 product_details = 'Latte' | customers_and_addresses |
[
"List the names of all the customers.",
"What are the names of customers who have made some orders before?",
"Which customers never made an order?"
] | [
"SELECT customer_name FROM customers",
"SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id",
"SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id"
] | What are the names of customers who never made an order. | SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id | customers_and_addresses |
[
"List the names of customers who have purchased Latte.",
"Give me the names of customers who have purchased Americano.",
"Which customers have ordered both?"
] | [
"SELECT 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 product_details = 'Latte'",
"SELECT 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 product_details = 'Americano'",
"SELECT 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 product_details = 'Latte' INTERSECT SELECT 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 product_details = 'Americano'"
] | What are the names of customers who have purchased both products Latte and Americano? | SELECT 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 product_details = 'Latte' INTERSECT SELECT 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 product_details = 'Americano' | customers_and_addresses |
[
"What are the first names of all employees?",
"Also, what are their department names?"
] | [
"SELECT first_name FROM employees",
"SELECT T1.first_name , T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id"
] | What are the first name and department name of all employees? | SELECT T1.first_name , T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id | hr_1 |
[
"Which employees earn less than 6000?",
"What are their full names and salaries?"
] | [
"SELECT * FROM employees WHERE salary < 6000",
"SELECT first_name , last_name , salary FROM employees WHERE salary < 6000"
] | What are the full names and salaries for any employees earning less than 6000? | SELECT first_name , last_name , salary FROM employees WHERE salary < 6000 | hr_1 |
[
"List the first name and department id for all employees?",
"Of these, include the ones for employees with last name McEwen."
] | [
"SELECT first_name , department_id FROM employees",
"SELECT first_name , department_id FROM employees WHERE last_name = 'McEwen'"
] | What are the first names and department numbers for employees with last name McEwen? | SELECT first_name , department_id FROM employees WHERE last_name = 'McEwen' | hr_1 |
[
"What is all the information about all the departments?",
"Of those, what is the information about the Marketing department?"
] | [
"SELECT * FROM departments",
"SELECT * FROM departments WHERE department_name = 'Marketing'"
] | What is all the information about the Marketing department? | SELECT * FROM departments WHERE department_name = 'Marketing' | hr_1 |
[
"What is all the information on employees?",
"Of those, which do not have the letter M in their first names?",
"What were their hire dates?"
] | [
"SELECT * FROM employees",
"SELECT * FROM employees WHERE first_name NOT LIKE '%M%'",
"SELECT hire_date FROM employees WHERE first_name NOT LIKE '%M%'"
] | On what dates were employees without the letter M in their first names hired? | SELECT hire_date FROM employees WHERE first_name NOT LIKE '%M%' | hr_1 |
[
"What is all the information on employees?",
"Of those, which do not have the letter M in their first names?",
"What were their full names, hire dates, salaries, and department numbers?"
] | [
"SELECT * FROM employees",
"SELECT * FROM employees WHERE first_name NOT LIKE '%M%'",
"SELECT first_name , last_name , hire_date , salary , department_id FROM employees WHERE first_name NOT LIKE '%M%'"
] | What are the full name, hire date, salary, and department id for employees without the letter M in their first name? | SELECT first_name , last_name , hire_date , salary , department_id FROM employees WHERE first_name NOT LIKE '%M%' | hr_1 |
[
"Which employees do not have the letter M in their first names?",
"What were their full names, hire dates, salaries, and department numbers?",
"Order these by ascending department number."
] | [
"SELECT * FROM employees WHERE first_name NOT LIKE '%M%'",
"SELECT first_name , last_name , hire_date , salary , department_id FROM employees WHERE first_name NOT LIKE '%M%'",
"SELECT first_name , last_name , hire_date , salary , department_id FROM employees WHERE first_name NOT LIKE '%M%' ORDER BY department_id"
] | What are the full name, hire data, salary and department id for employees without the letter M in their first name, ordered by ascending department id? | SELECT first_name , last_name , hire_date , salary , department_id FROM employees WHERE first_name NOT LIKE '%M%' ORDER BY department_id | hr_1 |
[
"What are all the employees' phone numbers?",
"Return only those for employees with salaries between 8000 and 12000."
] | [
"SELECT phone_number FROM employees",
"SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000"
] | Return the phone numbers of employees with salaries between 8000 and 12000. | SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000 | hr_1 |
[
"What are all the employees with first names that end with m?",
"What are their full names and salaries?"
] | [
"SELECT * FROM employees WHERE first_name LIKE '%m'",
"SELECT first_name , last_name , salary FROM employees WHERE first_name LIKE '%m'"
] | Return the full names and salaries for employees with first names that end with the letter m. | SELECT first_name , last_name , salary FROM employees WHERE first_name LIKE '%m' | hr_1 |
[
"Which employees were hired between November 5th, 2007 and July 5th, 2009?",
"What are their job ids and hire dates?"
] | [
"SELECT * FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05'",
"SELECT job_id , hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05'"
] | What are the job ids and dates of hire for employees hired after November 5th, 2007 and before July 5th, 2009? | SELECT job_id , hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05' | hr_1 |
[
"What are the names of all employees?",
"Of those, who are in department 70 or 90?"
] | [
"SELECT first_name , last_name FROM employees",
"SELECT first_name , last_name FROM employees WHERE department_id = 70 OR department_id = 90"
] | What are the full names of employees who with in department 70 or 90? | SELECT first_name , last_name FROM employees WHERE department_id = 70 OR department_id = 90 | hr_1 |
[
"What is all the information about employees?",
"Of those, which were hired before 2002-06-21?"
] | [
"SELECT * FROM employees",
"SELECT * FROM employees WHERE hire_date < '2002-06-21'"
] | What is all the information about employees hired before June 21, 2002? | SELECT * FROM employees WHERE hire_date < '2002-06-21' | hr_1 |
[
"What is all the information about employees with a D, S or N in their first name?",
"Order those by decreasing salary."
] | [
"SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' OR first_name LIKE '%N%'",
"SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' OR first_name LIKE '%N%' ORDER BY salary DESC"
] | What is all the information about employees with D, S, or N in their first name, ordered by salary descending? | SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' OR first_name LIKE '%N%' ORDER BY salary DESC | hr_1 |
[
"What is all the information about the employees?",
"Of those, who was hired after September 7th, 1987?"
] | [
"SELECT * FROM employees",
"SELECT * FROM employees WHERE hire_date > '1987-09-07'"
] | Which employees were hired after September 7th, 1987? | SELECT * FROM employees WHERE hire_date > '1987-09-07' | hr_1 |
[
"What are all the job titles?",
"Of those, which correspond to jobs with salaries over 9000?"
] | [
"SELECT job_title FROM jobs",
"SELECT job_title FROM jobs WHERE min_salary > 9000"
] | Which job titles correspond to jobs with salaries over 9000? | SELECT job_title FROM jobs WHERE min_salary > 9000 | hr_1 |
[
"What is all the information about jobs with max salary between 12000 and 18000?",
"What are the job titles and differences between max and min salaries for those jobs?"
] | [
"SELECT * FROM jobs WHERE max_salary BETWEEN 12000 AND 18000",
"SELECT job_title , max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000"
] | What are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000? | SELECT job_title , max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000 | hr_1 |
[
"What is all the job history information?",
"What are the unique employee ids?",
"What are the latest end dates corresponding to each one?"
] | [
"SELECT * FROM job_history",
"SELECT employee_id FROM job_history GROUP BY employee_id",
"SELECT employee_id , MAX(end_date) FROM job_history GROUP BY employee_id"
] | What are the employee ids for each employee and final dates of employment at their last job? | SELECT employee_id , MAX(end_date) FROM job_history GROUP BY employee_id | hr_1 |
[
"What are the different department ids?",
"Of these, which had more than 10 employees with commissions?"
] | [
"SELECT department_id FROM employees GROUP BY department_id",
"SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10"
] | What are the department ids for which more than 10 employees had a commission? | SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10 | hr_1 |
[
"What are the manager ids of managers who manage 4 or more employees?",
"What are their department ids?"
] | [
"SELECT manager_id FROM employees GROUP BY manager_id HAVING COUNT(employee_id) >= 4",
"SELECT DISTINCT department_id FROM employees GROUP BY department_id , manager_id HAVING COUNT(employee_id) >= 4"
] | What are department ids for departments with managers managing more than 3 employees? | SELECT DISTINCT department_id FROM employees GROUP BY department_id , manager_id HAVING COUNT(employee_id) >= 4 | hr_1 |
[
"How many cities are there?",
"Count the cities by their country ids."
] | [
"SELECT COUNT(*) FROM locations",
"SELECT country_id , COUNT(*) FROM locations GROUP BY country_id"
] | Give the country id and corresponding count of cities in each country. | SELECT country_id , COUNT(*) FROM locations GROUP BY country_id | hr_1 |
[
"What are job ids for jobs that lasted more than 300 days?",
"Of these, which have been done more than once?"
] | [
"SELECT job_id FROM job_history WHERE end_date - start_date > 300",
"SELECT job_id FROM job_history WHERE end_date - start_date > 300 GROUP BY job_id HAVING COUNT(*) >= 2"
] | What are the job ids for jobs done more than once for a period of more than 300 days? | SELECT job_id FROM job_history WHERE end_date - start_date > 300 GROUP BY job_id HAVING COUNT(*) >= 2 | hr_1 |
[
"What are all the different employee ids in the job history table?",
"Of these, which have had two or more jobs?"
] | [
"SELECT employee_id FROM job_history",
"SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*) >= 2"
] | What are the employee ids for employees who have held two or more jobs? | SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*) >= 2 | hr_1 |
[
"What are all the employee ids?",
"Also, what are the names of the countries that they work in?"
] | [
"SELECT employee_id FROM employees",
"SELECT employee_id , country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id"
] | What are all the employee ids and the names of the countries in which they work? | SELECT employee_id , country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id | hr_1 |
[
"How many employees are there?",
"Group these counts by department name."
] | [
"SELECT COUNT(*) FROM employees",
"SELECT T2.department_name , COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY T2.department_name"
] | Give the name of each department and the number of employees in each. | SELECT T2.department_name , COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY T2.department_name | hr_1 |
[
"What is the average salary for all employees?",
"What are the average salaries by job title?"
] | [
"SELECT AVG(salary) FROM employees",
"SELECT job_title , AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id GROUP BY T2.job_title"
] | What is the average salary for each job title? | SELECT job_title , AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id GROUP BY T2.job_title | hr_1 |
[
"What is the salary of employee with id 163?",
"What is all employee information for employees making more than employee 163?",
"What are the full names of these employees?"
] | [
"SELECT salary FROM employees WHERE employee_id = 163",
"SELECT * FROM employees WHERE salary > (SELECT salary FROM employees WHERE employee_id = 163 )",
"SELECT first_name , last_name FROM employees WHERE salary > (SELECT salary FROM employees WHERE employee_id = 163 )"
] | Provide the full names of employees earning more than the employee with id 163. | SELECT first_name , last_name FROM employees WHERE salary > (SELECT salary FROM employees WHERE employee_id = 163 ) | hr_1 |
[
"What is the lowest salary across all employees?",
"What are these numbers by department id?"
] | [
"SELECT MIN(salary) FROM employees",
"SELECT MIN(salary) , department_id FROM employees GROUP BY department_id"
] | What is the minimum salary in each department? | SELECT MIN(salary) , department_id FROM employees GROUP BY department_id | hr_1 |
[
"What is the lowest salary across all departments?",
"What information is available for employees who make that much?",
"What are their first and last names and department ids?"
] | [
"SELECT MIN(salary) FROM employees GROUP BY department_id",
"SELECT * FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)",
"SELECT first_name , last_name , department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)"
] | What are the full names and department ids for the lowest paid employees across all departments. | SELECT first_name , last_name , department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id) | hr_1 |
[
"What is the average salary across all employees?",
"Which employees make more than that?",
"What are their ids?"
] | [
"SELECT AVG(salary) FROM employees",
"SELECT * FROM employees WHERE salary > (SELECT AVG(salary) FROM employees)",
"SELECT employee_id FROM employees WHERE salary > (SELECT AVG(salary) FROM employees)"
] | What are the employee ids for employees who make more than the average? | SELECT employee_id FROM employees WHERE salary > (SELECT AVG(salary) FROM employees) | hr_1 |