Question:
What are the names of all employees who can fly both the Boeing 737-800 and the Airbus A340-300?
Additional table information: table: flight_1

Answer: SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Boeing 737-800' INTERSECT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Airbus A340-300'


Question:
Show names for all employees who do not have certificate of Boeing 737-800.
Additional table information: table: flight_1

Answer: SELECT name FROM Employee EXCEPT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Boeing 737-800'


Question:
What are the names of all employees who are not certified to fly Boeing 737-800s?
Additional table information: table: flight_1

Answer: SELECT name FROM Employee EXCEPT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Boeing 737-800'


Question:
Show the name of aircraft which fewest people have its certificate.
Additional table information: table: flight_1

Answer: SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid GROUP BY T1.aid ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of the aircraft that the least people are certified to fly?
Additional table information: table: flight_1

Answer: SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid GROUP BY T1.aid ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people have its certificate.
Additional table information: table: flight_1

Answer: SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid WHERE T2.distance > 5000 GROUP BY T1.aid ORDER BY COUNT(*) >= 5 NULLS FIRST


Question:
What is the name and distance of every aircraft that can cover a distance of more than 5000 and which at least 5 people can fly?
Additional table information: table: flight_1

Answer: SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid WHERE T2.distance > 5000 GROUP BY T1.aid ORDER BY COUNT(*) >= 5 NULLS FIRST


Question:
what is the salary and name of the employee who has the most number of aircraft certificates?
Additional table information: table: flight_1

Answer: SELECT T1.name, T1.salary FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the salaray and name of the employee that is certified to fly the most planes?
Additional table information: table: flight_1

Answer: SELECT T1.name, T1.salary FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000?
Additional table information: table: flight_1

Answer: SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the salaray and name of the employee with the most certificates to fly planes more than 5000?
Additional table information: table: flight_1

Answer: SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many allergies are there?
Additional table information: table: allergy_1

Answer: SELECT COUNT(DISTINCT allergy) FROM Allergy_type


Question:
How many allergy entries are there?
Additional table information: table: allergy_1

Answer: SELECT COUNT(DISTINCT allergy) FROM Allergy_type


Question:
How many different allergy types exist?
Additional table information: table: allergy_1

Answer: SELECT COUNT(DISTINCT allergytype) FROM Allergy_type


Question:
How many distinct allergies are there?
Additional table information: table: allergy_1

Answer: SELECT COUNT(DISTINCT allergytype) FROM Allergy_type


Question:
Show all allergy types.
Additional table information: table: allergy_1

Answer: SELECT DISTINCT allergytype FROM Allergy_type


Question:
What are the different allergy types?
Additional table information: table: allergy_1

Answer: SELECT DISTINCT allergytype FROM Allergy_type


Question:
Show all allergies and their types.
Additional table information: table: allergy_1

Answer: SELECT allergy, allergytype FROM Allergy_type


Question:
What are the allergies and their types?
Additional table information: table: allergy_1

Answer: SELECT allergy, allergytype FROM Allergy_type


Question:
Show all allergies with type food.
Additional table information: table: allergy_1

Answer: SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = 'food'


Question:
What are all the different food allergies?
Additional table information: table: allergy_1

Answer: SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = 'food'


Question:
What is the type of allergy Cat?
Additional table information: table: allergy_1

Answer: SELECT allergytype FROM Allergy_type WHERE allergy = 'Cat'


Question:
What is allergy type of a cat allergy?
Additional table information: table: allergy_1

Answer: SELECT allergytype FROM Allergy_type WHERE allergy = 'Cat'


Question:
How many allergies have type animal?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Allergy_type WHERE allergytype = 'animal'


Question:
How many animal type allergies exist?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Allergy_type WHERE allergytype = 'animal'


Question:
Show all allergy types and the number of allergies in each type.
Additional table information: table: allergy_1

Answer: SELECT allergytype, COUNT(*) FROM Allergy_type GROUP BY allergytype


Question:
What are the allergy types and how many allergies correspond to each one?
Additional table information: table: allergy_1

Answer: SELECT allergytype, COUNT(*) FROM Allergy_type GROUP BY allergytype


Question:
Which allergy type has most number of allergies?
Additional table information: table: allergy_1

Answer: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which allergy type is most common?
Additional table information: table: allergy_1

Answer: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which allergy type has least number of allergies?
Additional table information: table: allergy_1

Answer: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Which allergy type is the least common?
Additional table information: table: allergy_1

Answer: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
How many students are there?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student


Question:
What is the total number of students?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student


Question:
Show first name and last name for all students.
Additional table information: table: allergy_1

Answer: SELECT Fname, Lname FROM Student


Question:
What are the full names of all students
Additional table information: table: allergy_1

Answer: SELECT Fname, Lname FROM Student


Question:
How many different advisors are listed?
Additional table information: table: allergy_1

Answer: SELECT COUNT(DISTINCT advisor) FROM Student


Question:
How many advisors are there?
Additional table information: table: allergy_1

Answer: SELECT COUNT(DISTINCT advisor) FROM Student


Question:
Show all majors.
Additional table information: table: allergy_1

Answer: SELECT DISTINCT Major FROM Student


Question:
What are the different majors?
Additional table information: table: allergy_1

Answer: SELECT DISTINCT Major FROM Student


Question:
Show all cities where students live.
Additional table information: table: allergy_1

Answer: SELECT DISTINCT city_code FROM Student


Question:
What cities do students live in?
Additional table information: table: allergy_1

Answer: SELECT DISTINCT city_code FROM Student


Question:
Show first name, last name, age for all female students. Their sex is F.
Additional table information: table: allergy_1

Answer: SELECT Fname, Lname, Age FROM Student WHERE Sex = 'F'


Question:
What are the full names and ages for all female students whose sex is F?
Additional table information: table: allergy_1

Answer: SELECT Fname, Lname, Age FROM Student WHERE Sex = 'F'


Question:
Show student ids for all male students.
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE Sex = 'M'


Question:
What are the student ids for all male students?
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE Sex = 'M'


Question:
How many students are age 18?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student WHERE age = 18


Question:
How many students are 18 years old?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student WHERE age = 18


Question:
Show all student ids who are older than 20.
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE age > 20


Question:
What are the student ids for students over 20 years old?
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE age > 20


Question:
Which city does the student whose last name is 'Kim' live in?
Additional table information: table: allergy_1

Answer: SELECT city_code FROM Student WHERE LName = 'Kim'


Question:
Give the city that the student whose family name is Kim lives in.
Additional table information: table: allergy_1

Answer: SELECT city_code FROM Student WHERE LName = 'Kim'


Question:
Who is the advisor of student with ID 1004?
Additional table information: table: allergy_1

Answer: SELECT Advisor FROM Student WHERE StuID = 1004


Question:
Who advises student 1004?
Additional table information: table: allergy_1

Answer: SELECT Advisor FROM Student WHERE StuID = 1004


Question:
How many students live in HKG or CHI?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student WHERE city_code = 'HKG' OR city_code = 'CHI'


Question:
Give the number of students living in either HKG or CHI.
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student WHERE city_code = 'HKG' OR city_code = 'CHI'


Question:
Show the minimum, average, and maximum age of all students.
Additional table information: table: allergy_1

Answer: SELECT MIN(age), AVG(age), MAX(age) FROM Student


Question:
What is the minimum, mean, and maximum age across all students?
Additional table information: table: allergy_1

Answer: SELECT MIN(age), AVG(age), MAX(age) FROM Student


Question:
What is the last name of the youngest student?
Additional table information: table: allergy_1

Answer: SELECT LName FROM Student WHERE age = (SELECT MIN(age) FROM Student)


Question:
Provide the last name of the youngest student.
Additional table information: table: allergy_1

Answer: SELECT LName FROM Student WHERE age = (SELECT MIN(age) FROM Student)


Question:
Show the student id of the oldest student.
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE age = (SELECT MAX(age) FROM Student)


Question:
What student id corresponds to the oldest student?
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE age = (SELECT MAX(age) FROM Student)


Question:
Show all majors and corresponding number of students.
Additional table information: table: allergy_1

Answer: SELECT major, COUNT(*) FROM Student GROUP BY major


Question:
How many students are there for each major?
Additional table information: table: allergy_1

Answer: SELECT major, COUNT(*) FROM Student GROUP BY major


Question:
Which major has most number of students?
Additional table information: table: allergy_1

Answer: SELECT major FROM Student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the largest major?
Additional table information: table: allergy_1

Answer: SELECT major FROM Student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show all ages and corresponding number of students.
Additional table information: table: allergy_1

Answer: SELECT age, COUNT(*) FROM Student GROUP BY age


Question:
How old is each student and how many students are each age?
Additional table information: table: allergy_1

Answer: SELECT age, COUNT(*) FROM Student GROUP BY age


Question:
Show the average age for male and female students.
Additional table information: table: allergy_1

Answer: SELECT AVG(age), sex FROM Student GROUP BY sex


Question:
What are the average ages for male and female students?
Additional table information: table: allergy_1

Answer: SELECT AVG(age), sex FROM Student GROUP BY sex


Question:
Show all cities and corresponding number of students.
Additional table information: table: allergy_1

Answer: SELECT city_code, COUNT(*) FROM Student GROUP BY city_code


Question:
How many students live in each city?
Additional table information: table: allergy_1

Answer: SELECT city_code, COUNT(*) FROM Student GROUP BY city_code


Question:
Show all advisors and corresponding number of students.
Additional table information: table: allergy_1

Answer: SELECT advisor, COUNT(*) FROM Student GROUP BY advisor


Question:
How many students does each advisor have?
Additional table information: table: allergy_1

Answer: SELECT advisor, COUNT(*) FROM Student GROUP BY advisor


Question:
Which advisor has most number of students?
Additional table information: table: allergy_1

Answer: SELECT advisor FROM Student GROUP BY advisor ORDER BY COUNT(*) DESC LIMIT 1


Question:
Give the advisor with the most students.
Additional table information: table: allergy_1

Answer: SELECT advisor FROM Student GROUP BY advisor ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many students have cat allergies?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Has_allergy WHERE Allergy = 'Cat'


Question:
How many students are affected by cat allergies?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Has_allergy WHERE Allergy = 'Cat'


Question:
Show all student IDs who have at least two allergies.
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Has_allergy GROUP BY StuID HAVING COUNT(*) >= 2


Question:
What are the students ids of students who have more than one allergy?
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Has_allergy GROUP BY StuID HAVING COUNT(*) >= 2


Question:
What are the student ids of students who don't have any allergies?
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy


Question:
Which students are unaffected by allergies?
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy


Question:
How many female students have milk or egg allergies?
Additional table information: table: allergy_1

Answer: 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'


Question:
How many students who are female are allergic to milk or eggs?
Additional table information: table: allergy_1

Answer: 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'


Question:
How many students have a food allergy?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = 'food'


Question:
How many students are affected by food related allergies?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = 'food'


Question:
Which allergy has most number of students affected?
Additional table information: table: allergy_1

Answer: SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which allergy is the most common?
Additional table information: table: allergy_1

Answer: SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show all allergies with number of students affected.
Additional table information: table: allergy_1

Answer: SELECT Allergy, COUNT(*) FROM Has_allergy GROUP BY Allergy


Question:
How many students have each different allergy?
Additional table information: table: allergy_1

Answer: SELECT Allergy, COUNT(*) FROM Has_allergy GROUP BY Allergy


Question:
Show all allergy type with number of students affected.
Additional table information: table: allergy_1

Answer: SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype


Question:
How many students are affected by each allergy type?
Additional table information: table: allergy_1

Answer: SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype


Question:
Find the last name and age of the student who has allergy to both milk and cat.
Additional table information: table: allergy_1

Answer: 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')


Question:
What are the last names and ages of the students who are allergic to milk and cat?
Additional table information: table: allergy_1

Answer: 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')


Question:
What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies.
Additional table information: table: allergy_1

Answer: 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 NULLS FIRST


Question:
What are the allergies the girl named Lisa has? And what are the types of them? Order the result by allergy names.
Additional table information: table: allergy_1

Answer: 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 NULLS FIRST


Question:
Find the first name and gender of the student who has allergy to milk but not cat.
Additional table information: table: allergy_1

Answer: 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')


Question:
What are the first name and gender of the students who have allergy to milk but can put up with cats?
Additional table information: table: allergy_1

Answer: 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')


Question:
Find the average age of the students who have allergies with food and animal types.
Additional table information: table: allergy_1

Answer: 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')


Question:
How old are the students with allergies to food and animal types on average?
Additional table information: table: allergy_1

Answer: 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')


Question:
List the first and last name of the students who do not have any food type allergy.
Additional table information: table: allergy_1

Answer: SELECT fname, lname FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'food')


Question:
What is the full name of each student who is not allergic to any type of food.
Additional table information: table: allergy_1

Answer: SELECT fname, lname FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'food')


Question:
Find the number of male (sex is 'M') students who have some food type allery.
Additional table information: table: allergy_1

Answer: 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')


Question:
How many male students (sex is 'M') are allergic to any type of food?
Additional table information: table: allergy_1

Answer: 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')


Question:
Find the different first names and cities of the students who have allergy to milk or cat.
Additional table information: table: allergy_1

Answer: 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'


Question:
What are the distinct first names and cities of the students who have allergy either to milk or to cat?
Additional table information: table: allergy_1

Answer: 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'


Question:
Find the number of students who are older than 18 and do not have allergy to either food or animal.
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student WHERE age > 18 AND NOT StuID 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')


Question:
How many students are over 18 and do not have allergy to food type or animal type?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student WHERE age > 18 AND NOT StuID 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')


Question:
Find the first name and major of the students who are not allegry to soy.
Additional table information: table: allergy_1

Answer: SELECT fname, major FROM Student WHERE NOT StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = 'Soy')


Question:
What are the first name and major of the students who are able to consume soy?
Additional table information: table: allergy_1

Answer: SELECT fname, major FROM Student WHERE NOT StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = 'Soy')


Question:
A list of the top 5 countries by number of invoices. List country name and number of invoices.
Additional table information: table: store_1

Answer: SELECT billing_country, COUNT(*) FROM invoices GROUP BY billing_country ORDER BY COUNT(*) DESC LIMIT 5


Question:
What are the top 5 countries by number of invoices and how many do they have?
Additional table information: table: store_1

Answer: SELECT billing_country, COUNT(*) FROM invoices GROUP BY billing_country ORDER BY COUNT(*) DESC LIMIT 5


Question:
A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size.
Additional table information: table: store_1

Answer: SELECT billing_country, SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8


Question:
What are the names of the top 8 countries by total invoice size and what are those sizes?
Additional table information: table: store_1

Answer: SELECT billing_country, SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8


Question:
A list of the top 10 countries by average invoice size. List country name and average invoice size.
Additional table information: table: store_1

Answer: SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10


Question:
What are the names of the countries and average invoice size of the top countries by size?
Additional table information: table: store_1

Answer: SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10


Question:
Find out 5 customers who most recently purchased something. List customers' first and last name.
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY T2.invoice_date DESC LIMIT 5


Question:
What are the first and last names of the 5 customers who purchased something most recently?
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY T2.invoice_date DESC LIMIT 5


Question:
Find out the top 10 customers by total number of orders. List customers' first and last name and the number of total orders.
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name, COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10


Question:
What are the top 10 customers' first and last names by total number of orders and how many orders did they make?
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name, COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10


Question:
List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name, SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10


Question:
What are the top 10 customers' first and last names with the highest gross sales, and also what are the sales?
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name, SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10


Question:
List the top 5 genres by number of tracks. List genres name and total tracks.
Additional table information: table: store_1

Answer: SELECT T1.name, COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 5


Question:
How many tracks does each genre have and what are the names of the top 5?
Additional table information: table: store_1

Answer: SELECT T1.name, COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 5


Question:
List every album's title.
Additional table information: table: store_1

Answer: SELECT title FROM albums


Question:
What are the titles of all the albums?
Additional table information: table: store_1

Answer: SELECT title FROM albums


Question:
List every album ordered by album title in ascending order.
Additional table information: table: store_1

Answer: SELECT title FROM albums ORDER BY title NULLS FIRST


Question:
What are the titles of all the albums alphabetically ascending?
Additional table information: table: store_1

Answer: SELECT title FROM albums ORDER BY title NULLS FIRST


Question:
List every album whose title starts with A in alphabetical order.
Additional table information: table: store_1

Answer: SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title NULLS FIRST


Question:
What are the titles of all albums that start with A in alphabetical order?
Additional table information: table: store_1

Answer: SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title NULLS FIRST


Question:
List the customers first and last name of 10 least expensive invoices.
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total NULLS FIRST LIMIT 10


Question:
What are the first and last names of the customers with the 10 cheapest invoices?
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total NULLS FIRST LIMIT 10


Question:
List total amount of  invoice from Chicago, IL.
Additional table information: table: store_1

Answer: SELECT SUM(total) FROM invoices WHERE billing_city = 'Chicago' AND billing_state = 'IL'


Question:
What are the total amount of money in the invoices billed from Chicago, Illinois?
Additional table information: table: store_1

Answer: SELECT SUM(total) FROM invoices WHERE billing_city = 'Chicago' AND billing_state = 'IL'


Question:
List the number of invoices from Chicago, IL.
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM invoices WHERE billing_city = 'Chicago' AND billing_state = 'IL'


Question:
How many invoices were billed from Chicago, IL?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM invoices WHERE billing_city = 'Chicago' AND billing_state = 'IL'


Question:
List the number of invoices from the US, grouped by state.
Additional table information: table: store_1

Answer: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = 'USA' GROUP BY billing_state


Question:
How many invoices were billed from each state?
Additional table information: table: store_1

Answer: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = 'USA' GROUP BY billing_state


Question:
List the state in the US with the most invoices.
Additional table information: table: store_1

Answer: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = 'USA' GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the states with the most invoices?
Additional table information: table: store_1

Answer: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = 'USA' GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the number of invoices and the invoice total from California.
Additional table information: table: store_1

Answer: SELECT billing_state, COUNT(*), SUM(total) FROM invoices WHERE billing_state = 'CA'


Question:
What is the number of invoices and total money billed in them from CA?
Additional table information: table: store_1

Answer: SELECT billing_state, COUNT(*), SUM(total) FROM invoices WHERE billing_state = 'CA'


Question:
List Aerosmith's albums.
Additional table information: table: store_1

Answer: SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = 'Aerosmith'


Question:
What are the titles of all the Aerosmith albums?
Additional table information: table: store_1

Answer: SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = 'Aerosmith'


Question:
How many albums does Billy Cobham has?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = 'Billy Cobham'


Question:
How many albums has Billy Cobam released?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = 'Billy Cobham'


Question:
Eduardo Martins is a customer at which company?
Additional table information: table: store_1

Answer: SELECT company FROM customers WHERE first_name = 'Eduardo' AND last_name = 'Martins'


Question:
What is the company where Eduardo Martins is a customer?
Additional table information: table: store_1

Answer: SELECT company FROM customers WHERE first_name = 'Eduardo' AND last_name = 'Martins'


Question:
What is Astrid Gruber's email and phone number?
Additional table information: table: store_1

Answer: SELECT email, phone FROM customers WHERE first_name = 'Astrid' AND last_name = 'Gruber'


Question:
What is the email and phone number of Astrid Gruber the customer?
Additional table information: table: store_1

Answer: SELECT email, phone FROM customers WHERE first_name = 'Astrid' AND last_name = 'Gruber'


Question:
How many customers live in Prague city?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM customers WHERE city = 'Prague'


Question:
How many customers live in the city of Prague?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM customers WHERE city = 'Prague'


Question:
How many customers in state of CA?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM customers WHERE state = 'CA'


Question:
How many customers are from California?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM customers WHERE state = 'CA'


Question:
What country does Roberto Almeida live?
Additional table information: table: store_1

Answer: SELECT country FROM customers WHERE first_name = 'Roberto' AND last_name = 'Almeida'


Question:
In which country does Roberto Almeida?
Additional table information: table: store_1

Answer: SELECT country FROM customers WHERE first_name = 'Roberto' AND last_name = 'Almeida'


Question:
List the name of albums that are released by aritist whose name has 'Led'
Additional table information: table: store_1

Answer: SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'


Question:
What is the title of the album that was released by the artist whose name has the phrase 'Led'?
Additional table information: table: store_1

Answer: SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'


Question:
How many customers does Steve Johnson support?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = 'Steve' AND T1.last_name = 'Johnson'


Question:
What is the count of customers that Steve Johnson supports?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = 'Steve' AND T1.last_name = 'Johnson'


Question:
What is the title, phone and hire date of Nancy Edwards?
Additional table information: table: store_1

Answer: SELECT title, phone, hire_date FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'


Question:
What is the title, phone number and hire date for the employee named Nancy Edwards?
Additional table information: table: store_1

Answer: SELECT title, phone, hire_date FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'


Question:
find the full name of employees who report to Nancy Edwards?
Additional table information: table: store_1

Answer: SELECT T2.first_name, T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = 'Nancy' AND T1.last_name = 'Edwards'


Question:
What is the first and last name of the employee who reports to Nancy Edwards?
Additional table information: table: store_1

Answer: SELECT T2.first_name, T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = 'Nancy' AND T1.last_name = 'Edwards'


Question:
What is the address of employee Nancy Edwards?
Additional table information: table: store_1

Answer: SELECT address FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'


Question:
What is Nancy Edwards's address?
Additional table information: table: store_1

Answer: SELECT address FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'


Question:
Find the full name of employee who supported the most number of customers.
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the full name of the employee who has the most customers?
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many employees are living in Canada?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM employees WHERE country = 'Canada'


Question:
How many employees live in Canada?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM employees WHERE country = 'Canada'


Question:
What is employee Nancy Edwards's phone number?
Additional table information: table: store_1

Answer: SELECT phone FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'


Question:
What is the the phone number of Nancy Edwards?
Additional table information: table: store_1

Answer: SELECT phone FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'


Question:
Who is the youngest employee in the company? List employee's first and last name.
Additional table information: table: store_1

Answer: SELECT first_name, last_name FROM employees ORDER BY birth_date DESC LIMIT 1


Question:
What si the youngest employee's first and last name?
Additional table information: table: store_1

Answer: SELECT first_name, last_name FROM employees ORDER BY birth_date DESC LIMIT 1


Question:
List top 10 employee work longest in the company. List employee's first and last name.
Additional table information: table: store_1

Answer: SELECT first_name, last_name FROM employees ORDER BY hire_date ASC NULLS FIRST LIMIT 10


Question:
What are the first and last names of the top 10 longest-serving employees?
Additional table information: table: store_1

Answer: SELECT first_name, last_name FROM employees ORDER BY hire_date ASC NULLS FIRST LIMIT 10


Question:
Find the number of employees whose title is IT Staff from each city?
Additional table information: table: store_1

Answer: SELECT COUNT(*), city FROM employees WHERE title = 'IT Staff' GROUP BY city


Question:
How many employees who are IT staff are from each city?
Additional table information: table: store_1

Answer: SELECT COUNT(*), city FROM employees WHERE title = 'IT Staff' GROUP BY city


Question:
Which employee manage most number of peoples? List employee's first and last name, and number of people report to that employee.
Additional table information: table: store_1

Answer: SELECT T2.first_name, T2.last_name, COUNT(T1.reports_to) FROM employees AS T1 JOIN employees AS T2 ON T1.reports_to = T2.id GROUP BY T1.reports_to ORDER BY COUNT(T1.reports_to) DESC LIMIT 1


Question:
What are the first and last names of all the employees and how many people report to them?
Additional table information: table: store_1

Answer: SELECT T2.first_name, T2.last_name, COUNT(T1.reports_to) FROM employees AS T1 JOIN employees AS T2 ON T1.reports_to = T2.id GROUP BY T1.reports_to ORDER BY COUNT(T1.reports_to) DESC LIMIT 1


Question:
How many orders does Lucas Mancini has?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = 'Lucas' AND T1.last_name = 'Mancini'


Question:
How many orders does Luca Mancini have in his invoices?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = 'Lucas' AND T1.last_name = 'Mancini'


Question:
What is the total amount of money spent by Lucas Mancini?
Additional table information: table: store_1

Answer: SELECT SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = 'Lucas' AND T1.last_name = 'Mancini'


Question:
How much money did Lucas Mancini spend?
Additional table information: table: store_1

Answer: SELECT SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = 'Lucas' AND T1.last_name = 'Mancini'


Question:
List all media types.
Additional table information: table: store_1

Answer: SELECT name FROM media_types


Question:
What are the names of all the media types?
Additional table information: table: store_1

Answer: SELECT name FROM media_types


Question:
List all different genre types.
Additional table information: table: store_1

Answer: SELECT DISTINCT name FROM genres


Question:
What are the different names of the genres?
Additional table information: table: store_1

Answer: SELECT DISTINCT name FROM genres


Question:
List the name of all playlist.
Additional table information: table: store_1

Answer: SELECT name FROM playlists


Question:
What are the names of all the playlists?
Additional table information: table: store_1

Answer: SELECT name FROM playlists


Question:
Who is the composer of track Fast As a Shark?
Additional table information: table: store_1

Answer: SELECT composer FROM tracks WHERE name = 'Fast As a Shark'


Question:
What is the composer who created the track 'Fast As a Shark'?
Additional table information: table: store_1

Answer: SELECT composer FROM tracks WHERE name = 'Fast As a Shark'


Question:
How long does track Fast As a Shark has?
Additional table information: table: store_1

Answer: SELECT milliseconds FROM tracks WHERE name = 'Fast As a Shark'


Question:
How many milliseconds long is Fast As a Shark?
Additional table information: table: store_1

Answer: SELECT milliseconds FROM tracks WHERE name = 'Fast As a Shark'


Question:
What is the name of tracks whose genre is Rock?
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = 'Rock'


Question:
What is the name of all tracks in the Rock genre?
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = 'Rock'


Question:
What is title of album which track Balls to the Wall belongs to?
Additional table information: table: store_1

Answer: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T2.name = 'Balls to the Wall'


Question:
What is the name of the album that has the track Ball to the Wall?
Additional table information: table: store_1

Answer: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T2.name = 'Balls to the Wall'


Question:
List name of all tracks in Balls to the Wall.
Additional table information: table: store_1

Answer: SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = 'Balls to the Wall'


Question:
What is the name of all tracks in the album named Balls to the Wall?
Additional table information: table: store_1

Answer: SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = 'Balls to the Wall'


Question:
List title of albums have the number of tracks greater than 10.
Additional table information: table: store_1

Answer: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id HAVING COUNT(T1.id) > 10


Question:
What are the names of the albums that have more than 10 tracks?
Additional table information: table: store_1

Answer: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id HAVING COUNT(T1.id) > 10


Question:
List the name of tracks belongs to genre Rock and whose media type is MPEG audio file.
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = 'Rock' AND T3.name = 'MPEG audio file'


Question:
What are the names of all Rock tracks that are stored on MPEG audio files?
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = 'Rock' AND T3.name = 'MPEG audio file'


Question:
List the name of tracks belongs to genre Rock or media type is MPEG audio file.
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = 'Rock' OR T3.name = 'MPEG audio file'


Question:
What are the names of all tracks that belong to the Rock genre and whose media type is MPEG?
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = 'Rock' OR T3.name = 'MPEG audio file'


Question:
List the name of tracks belongs to genre Rock or genre Jazz.
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = 'Rock' OR T1.name = 'Jazz'


Question:
What are the names of the tracks that are Rock or Jazz songs?
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = 'Rock' OR T1.name = 'Jazz'


Question:
List the name of all tracks in the playlists of Movies.
Additional table information: table: store_1

Answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T3.id = T2.playlist_id WHERE T3.name = 'Movies'


Question:
What are the names of all tracks that are on playlists titled Movies?
Additional table information: table: store_1

Answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T3.id = T2.playlist_id WHERE T3.name = 'Movies'


Question:
List the name of playlist which has number of tracks greater than 100.
Additional table information: table: store_1

Answer: SELECT T2.name FROM playlist_tracks AS T1 JOIN playlists AS T2 ON T2.id = T1.playlist_id GROUP BY T1.playlist_id HAVING COUNT(T1.track_id) > 100


Question:
What are the names of all playlists that have more than 100 tracks?
Additional table information: table: store_1

Answer: SELECT T2.name FROM playlist_tracks AS T1 JOIN playlists AS T2 ON T2.id = T1.playlist_id GROUP BY T1.playlist_id HAVING COUNT(T1.track_id) > 100


Question:
List all tracks bought by customer Daan Peeters.
Additional table information: table: store_1

Answer: SELECT T1.name FROM tracks AS T1 JOIN invoice_lines AS T2 ON T1.id = T2.track_id JOIN invoices AS T3 ON T3.id = T2.invoice_id JOIN customers AS T4 ON T4.id = T3.customer_id WHERE T4.first_name = 'Daan' AND T4.last_name = 'Peeters'


Question:
What are the tracks that Dean Peeters bought?
Additional table information: table: store_1

Answer: SELECT T1.name FROM tracks AS T1 JOIN invoice_lines AS T2 ON T1.id = T2.track_id JOIN invoices AS T3 ON T3.id = T2.invoice_id JOIN customers AS T4 ON T4.id = T3.customer_id WHERE T4.first_name = 'Daan' AND T4.last_name = 'Peeters'


Question:
How much is the track Fast As a Shark?
Additional table information: table: store_1

Answer: SELECT unit_price FROM tracks WHERE name = 'Fast As a Shark'


Question:
What is the unit price of the tune 'Fast As a Shark'?
Additional table information: table: store_1

Answer: SELECT unit_price FROM tracks WHERE name = 'Fast As a Shark'


Question:
Find the name of tracks which are in Movies playlist but not in music playlist.
Additional table information: table: store_1

Answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' EXCEPT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music'


Question:
What are the names of all tracks that are on the Movies playlist but not in the music playlist?
Additional table information: table: store_1

Answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' EXCEPT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music'


Question:
Find the name of tracks which are in both Movies and music playlists.
Additional table information: table: store_1

Answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' INTERSECT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music'


Question:
What are the names of all the tracks that are in both the Movies and music playlists?
Additional table information: table: store_1

Answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' INTERSECT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music'


Question:
Find number of tracks in each genre?
Additional table information: table: store_1

Answer: SELECT COUNT(*), T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name


Question:
How many tracks are in each genre?
Additional table information: table: store_1

Answer: SELECT COUNT(*), T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name


Question:
How many editors are there?
Additional table information: table: journal_committee

Answer: SELECT COUNT(*) FROM editor


Question:
List the names of editors in ascending order of age.
Additional table information: table: journal_committee

Answer: SELECT Name FROM editor ORDER BY Age ASC NULLS FIRST


Question:
What are the names and ages of editors?
Additional table information: table: journal_committee

Answer: SELECT Name, Age FROM editor


Question:
List the names of editors who are older than 25.
Additional table information: table: journal_committee

Answer: SELECT Name FROM editor WHERE Age > 25


Question:
Show the names of editors of age either 24 or 25.
Additional table information: table: journal_committee

Answer: SELECT Name FROM editor WHERE Age = 24 OR Age = 25


Question:
What is the name of the youngest editor?
Additional table information: table: journal_committee

Answer: SELECT Name FROM editor ORDER BY Age ASC NULLS FIRST LIMIT 1


Question:
What are the different ages of editors? Show each age along with the number of editors of that age.
Additional table information: table: journal_committee

Answer: SELECT Age, COUNT(*) FROM editor GROUP BY Age


Question:
Please show the most common age of editors.
Additional table information: table: journal_committee

Answer: SELECT Age FROM editor GROUP BY Age ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the distinct themes of journals.
Additional table information: table: journal_committee

Answer: SELECT DISTINCT Theme FROM journal


Question:
Show the names of editors and the theme of journals for which they serve on committees.
Additional table information: table: journal_committee

Answer: 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


Question:
For each journal_committee, find the editor name and the journal theme.
Additional table information: table: journal_committee

Answer: 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


Question:
Show the names and ages of editors and the theme of journals for which they serve on committees, in ascending alphabetical order of theme.
Additional table information: table: journal_committee

Answer: 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 NULLS FIRST


Question:
Show the names of editors that are on the committee of journals with sales bigger than 3000.
Additional table information: table: journal_committee

Answer: 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


Question:
Show the id, name of each editor and the number of journal committees they are on.
Additional table information: table: journal_committee

Answer: 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


Question:
Show the names of editors that are on at least two journal committees.
Additional table information: table: journal_committee

Answer: 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


Question:
List the names of editors that are not on any journal committee.
Additional table information: table: journal_committee

Answer: SELECT Name FROM editor WHERE NOT editor_id IN (SELECT editor_id FROM journal_committee)


Question:
List the date, theme and sales of the journal which did not have any of the listed editors serving on committee.
Additional table information: table: journal_committee

Answer: 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


Question:
What is the average sales of the journals that have an editor whose work type is 'Photo'?
Additional table information: table: journal_committee

Answer: SELECT AVG(T1.sales) FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID WHERE T2.work_type = 'Photo'


Question:
How many accounts do we have?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Accounts


Question:
Count the number of accounts.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Accounts


Question:
Show ids, customer ids, names for all accounts.
Additional table information: table: customers_card_transactions

Answer: SELECT account_id, customer_id, account_name FROM Accounts


Question:
What are the account ids, customer ids, and account names for all the accounts?
Additional table information: table: customers_card_transactions

Answer: SELECT account_id, customer_id, account_name FROM Accounts


Question:
Show other account details for account with name 338.
Additional table information: table: customers_card_transactions

Answer: SELECT other_account_details FROM Accounts WHERE account_name = '338'


Question:
What are the other account details for the account with the name 338?
Additional table information: table: customers_card_transactions

Answer: SELECT other_account_details FROM Accounts WHERE account_name = '338'


Question:
What is the first name, last name, and phone of the customer with account name 162?
Additional table information: table: customers_card_transactions

Answer: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = '162'


Question:
Give the full name and phone of the customer who has the account name 162.
Additional table information: table: customers_card_transactions

Answer: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = '162'


Question:
How many accounts does the customer with first name Art and last name Turcotte have?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Art' AND T2.customer_last_name = 'Turcotte'


Question:
Return the number of accounts that the customer with the first name Art and last name Turcotte has.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Art' AND T2.customer_last_name = 'Turcotte'


Question:
Show all customer ids and the number of accounts for each customer.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id


Question:
How many accounts are there for each customer id?
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id


Question:
Show the customer id and number of accounts with most accounts.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the customer id of the customer with the most accounts, and how many accounts does this person have?
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the customer first, last name and id with least number of accounts.
Additional table information: table: customers_card_transactions

Answer: SELECT T2.customer_first_name, T2.customer_last_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Give the full name and customer id of the customer with the fewest accounts.
Additional table information: table: customers_card_transactions

Answer: SELECT T2.customer_first_name, T2.customer_last_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Show the number of all customers without an account.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Accounts)


Question:
How many customers do not have an account?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Accounts)


Question:
Show the first names and last names of customers without any account.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_first_name, customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id


Question:
What are the full names of customers who do not have any accounts?
Additional table information: table: customers_card_transactions

Answer: SELECT customer_first_name, customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id


Question:
Show distinct first and last names for all customers with an account.
Additional table information: table: customers_card_transactions

Answer: SELECT DISTINCT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id


Question:
What are the full names of customers who have accounts?
Additional table information: table: customers_card_transactions

Answer: SELECT DISTINCT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id


Question:
How many customers have an account?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(DISTINCT customer_id) FROM Accounts


Question:
Count the number of customers who hold an account.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(DISTINCT customer_id) FROM Accounts


Question:
How many customers do we have?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers


Question:
Count the number of customers.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers


Question:
Show ids, first names, last names, and phones for all customers.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, customer_first_name, customer_last_name, customer_phone FROM Customers


Question:
What are the ids, full names, and phones of each customer?
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, customer_first_name, customer_last_name, customer_phone FROM Customers


Question:
What is the phone and email for customer with first name Aniyah and last name Feest?
Additional table information: table: customers_card_transactions

Answer: SELECT customer_phone, customer_email FROM Customers WHERE customer_first_name = 'Aniyah' AND customer_last_name = 'Feest'


Question:
Return the phone and email of the customer with the first name Aniyah and last name Feest.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_phone, customer_email FROM Customers WHERE customer_first_name = 'Aniyah' AND customer_last_name = 'Feest'


Question:
Show the number of customer cards.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards


Question:
How many customer cards are there?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards


Question:
Show ids, customer ids, card type codes, card numbers for all cards.
Additional table information: table: customers_card_transactions

Answer: SELECT card_id, customer_id, card_type_code, card_number FROM Customers_cards


Question:
What are card ids, customer ids, card types, and card numbers for each customer card?
Additional table information: table: customers_card_transactions

Answer: SELECT card_id, customer_id, card_type_code, card_number FROM Customers_cards


Question:
Show the date valid from and the date valid to for the card with card number '4560596484842'.
Additional table information: table: customers_card_transactions

Answer: SELECT date_valid_from, date_valid_to FROM Customers_cards WHERE card_number = '4560596484842'


Question:
What are the valid from and valid to dates for the card with the number 4560596484842?
Additional table information: table: customers_card_transactions

Answer: SELECT date_valid_from, date_valid_to FROM Customers_cards WHERE card_number = '4560596484842'


Question:
What is the first name, last name, and phone of the customer with card 4560596484842.
Additional table information: table: customers_card_transactions

Answer: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = '4560596484842'


Question:
Return the full name and phone of the customer who has card number 4560596484842.
Additional table information: table: customers_card_transactions

Answer: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = '4560596484842'


Question:
How many cards does customer Art Turcotte have?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Art' AND T2.customer_last_name = 'Turcotte'


Question:
Count the number of cards the customer with the first name Art and last name Turcotte has.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Art' AND T2.customer_last_name = 'Turcotte'


Question:
How many debit cards do we have?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = 'Debit'


Question:
Count the number of customer cards of the type Debit.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = 'Debit'


Question:
How many credit cards does customer Blanche Huels have?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Blanche' AND T2.customer_last_name = 'Huels' AND T1.card_type_code = 'Credit'


Question:
Count the number of credit cards that the customer with first name Blanche and last name Huels has.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Blanche' AND T2.customer_last_name = 'Huels' AND T1.card_type_code = 'Credit'


Question:
Show all customer ids and the number of cards owned by each customer.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id


Question:
What are the different customer ids, and how many cards does each one hold?
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id


Question:
What is the customer id with most number of cards, and how many does he have?
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the id of the customer who has the most cards, as well as the number of cards.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show id, first and last names for all customers with at least two cards.
Additional table information: table: customers_card_transactions

Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2


Question:
What are the ids and full names of customers who hold two or more cards?
Additional table information: table: customers_card_transactions

Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2


Question:
What is the customer id, first and last name with least number of accounts.
Additional table information: table: customers_card_transactions

Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Return the id and full name of the customer who has the fewest accounts.
Additional table information: table: customers_card_transactions

Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Show all card type codes and the number of cards in each type.
Additional table information: table: customers_card_transactions

Answer: SELECT card_type_code, COUNT(*) FROM Customers_cards GROUP BY card_type_code


Question:
What are the different card types, and how many cards are there of each?
Additional table information: table: customers_card_transactions

Answer: SELECT card_type_code, COUNT(*) FROM Customers_cards GROUP BY card_type_code


Question:
What is the card type code with most number of cards?
Additional table information: table: customers_card_transactions

Answer: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the code of the card type that is most common.
Additional table information: table: customers_card_transactions

Answer: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show card type codes with at least 5 cards.
Additional table information: table: customers_card_transactions

Answer: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING COUNT(*) >= 5


Question:
What are the codes of card types that have 5 or more cards?
Additional table information: table: customers_card_transactions

Answer: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING COUNT(*) >= 5


Question:
Show all card type codes and the number of customers holding cards in each type.
Additional table information: table: customers_card_transactions

Answer: SELECT card_type_code, COUNT(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code


Question:
What are the different card type codes, and how many different customers hold each type?
Additional table information: table: customers_card_transactions

Answer: SELECT card_type_code, COUNT(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code


Question:
Show the customer ids and firstname without a credit card.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, customer_first_name FROM Customers EXCEPT SELECT T1.customer_id, T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = 'Credit'


Question:
What are the ids and first names of customers who do not hold a credit card?
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, customer_first_name FROM Customers EXCEPT SELECT T1.customer_id, T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = 'Credit'


Question:
Show all card type codes.
Additional table information: table: customers_card_transactions

Answer: SELECT DISTINCT card_type_code FROM Customers_Cards


Question:
What are the different card type codes?
Additional table information: table: customers_card_transactions

Answer: SELECT DISTINCT card_type_code FROM Customers_Cards


Question:
Show the number of card types.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(DISTINCT card_type_code) FROM Customers_Cards


Question:
How many different card types are there?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(DISTINCT card_type_code) FROM Customers_Cards


Question:
Show all transaction types.
Additional table information: table: customers_card_transactions

Answer: SELECT DISTINCT transaction_type FROM Financial_Transactions


Question:
What are the different types of transactions?
Additional table information: table: customers_card_transactions

Answer: SELECT DISTINCT transaction_type FROM Financial_Transactions


Question:
Show the number of transaction types.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(DISTINCT transaction_type) FROM Financial_Transactions


Question:
How many different types of transactions are there?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(DISTINCT transaction_type) FROM Financial_Transactions


Question:
What is the average and total transaction amount?
Additional table information: table: customers_card_transactions

Answer: SELECT AVG(transaction_amount), SUM(transaction_amount) FROM Financial_transactions


Question:
Return the average transaction amount, as well as the total amount of all transactions.
Additional table information: table: customers_card_transactions

Answer: SELECT AVG(transaction_amount), SUM(transaction_amount) FROM Financial_transactions


Question:
Show the card type codes and the number of transactions.
Additional table information: table: customers_card_transactions

Answer: SELECT T2.card_type_code, COUNT(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code


Question:
What are the different card types, and how many transactions have been made with each?
Additional table information: table: customers_card_transactions

Answer: SELECT T2.card_type_code, COUNT(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code


Question:
Show the transaction type and the number of transactions.
Additional table information: table: customers_card_transactions

Answer: SELECT transaction_type, COUNT(*) FROM Financial_transactions GROUP BY transaction_type


Question:
What are the different transaction types, and how many transactions of each have taken place?
Additional table information: table: customers_card_transactions

Answer: SELECT transaction_type, COUNT(*) FROM Financial_transactions GROUP BY transaction_type


Question:
What is the transaction type that has processed the greatest total amount in transactions?
Additional table information: table: customers_card_transactions

Answer: SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC LIMIT 1


Question:
Return the type of transaction with the highest total amount.
Additional table information: table: customers_card_transactions

Answer: SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC LIMIT 1


Question:
Show the account id and the number of transactions for each account
Additional table information: table: customers_card_transactions

Answer: SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id


Question:
What are the different account ids that have made financial transactions, as well as how many transactions correspond to each?
Additional table information: table: customers_card_transactions

Answer: SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id


Question:
How many tracks do we have?
Additional table information: table: race_track

Answer: SELECT COUNT(*) FROM track


Question:
Count the number of tracks.
Additional table information: table: race_track

Answer: SELECT COUNT(*) FROM track


Question:
Show the name and location for all tracks.
Additional table information: table: race_track

Answer: SELECT name, LOCATION FROM track


Question:
What are the names and locations of all tracks?
Additional table information: table: race_track

Answer: SELECT name, LOCATION FROM track


Question:
Show names and seatings, ordered by seating for all tracks opened after 2000.
Additional table information: table: race_track

Answer: SELECT name, seating FROM track WHERE year_opened > 2000 ORDER BY seating NULLS FIRST


Question:
What are the names and seatings for all tracks opened after 2000, ordered by seating?
Additional table information: table: race_track

Answer: SELECT name, seating FROM track WHERE year_opened > 2000 ORDER BY seating NULLS FIRST


Question:
What is the name, location and seating for the most recently opened track?
Additional table information: table: race_track

Answer: SELECT name, LOCATION, seating FROM track ORDER BY year_opened DESC LIMIT 1


Question:
Return the name, location, and seating of the track that was opened in the most recent year.
Additional table information: table: race_track

Answer: SELECT name, LOCATION, seating FROM track ORDER BY year_opened DESC LIMIT 1


Question:
What is the minimum, maximum, and average seating for all tracks.
Additional table information: table: race_track

Answer: SELECT MIN(seating), MAX(seating), AVG(seating) FROM track


Question:
Return the minimum, maximum, and average seating across all tracks.
Additional table information: table: race_track

Answer: SELECT MIN(seating), MAX(seating), AVG(seating) FROM track


Question:
Show the name, location, open year for all tracks with a seating higher than the average.
Additional table information: table: race_track

Answer: SELECT name, LOCATION, year_opened FROM track WHERE seating > (SELECT AVG(seating) FROM track)


Question:
What are the names, locations, and years of opening for tracks with seating higher than average?
Additional table information: table: race_track

Answer: SELECT name, LOCATION, year_opened FROM track WHERE seating > (SELECT AVG(seating) FROM track)


Question:
What are distinct locations where tracks are located?
Additional table information: table: race_track

Answer: SELECT DISTINCT LOCATION FROM track


Question:
Give the different locations of tracks.
Additional table information: table: race_track

Answer: SELECT DISTINCT LOCATION FROM track


Question:
How many races are there?
Additional table information: table: race_track

Answer: SELECT COUNT(*) FROM race


Question:
Count the number of races.
Additional table information: table: race_track

Answer: SELECT COUNT(*) FROM race


Question:
What are the distinct classes that races can have?
Additional table information: table: race_track

Answer: SELECT DISTINCT CLASS FROM race


Question:
Return the different classes of races.
Additional table information: table: race_track

Answer: SELECT DISTINCT CLASS FROM race


Question:
Show name, class, and date for all races.
Additional table information: table: race_track

Answer: SELECT name, CLASS, date FROM race


Question:
What are the names, classes, and dates for all races?
Additional table information: table: race_track

Answer: SELECT name, CLASS, date FROM race


Question:
Show the race class and number of races in each class.
Additional table information: table: race_track

Answer: SELECT CLASS, COUNT(*) FROM race GROUP BY CLASS


Question:
What are the different classes of races, and how many races correspond to each?
Additional table information: table: race_track

Answer: SELECT CLASS, COUNT(*) FROM race GROUP BY CLASS


Question:
What is the race class with most number of races.
Additional table information: table: race_track

Answer: SELECT CLASS FROM race GROUP BY CLASS ORDER BY COUNT(*) DESC LIMIT 1


Question:
Give the class of races that is most common.
Additional table information: table: race_track

Answer: SELECT CLASS FROM race GROUP BY CLASS ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the race class with at least two races.
Additional table information: table: race_track

Answer: SELECT CLASS FROM race GROUP BY CLASS HAVING COUNT(*) >= 2


Question:
What are the classes of races that have two or more corresponding races?
Additional table information: table: race_track

Answer: SELECT CLASS FROM race GROUP BY CLASS HAVING COUNT(*) >= 2


Question:
What are the names for tracks without a race in class 'GT'.
Additional table information: table: race_track

Answer: SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'


Question:
Give the names of tracks that do not have a race in the class 'GT'.
Additional table information: table: race_track

Answer: SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'


Question:
Show all track names that have had no races.
Additional table information: table: race_track

Answer: SELECT name FROM track WHERE NOT track_id IN (SELECT track_id FROM race)


Question:
Return the names of tracks that have no had any races.
Additional table information: table: race_track

Answer: SELECT name FROM track WHERE NOT track_id IN (SELECT track_id FROM race)


Question:
Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened.
Additional table information: table: race_track

Answer: SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000


Question:
What are the years of opening for tracks with seating between 4000 and 5000?
Additional table information: table: race_track

Answer: SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000


Question:
Show the name of track and the number of races in each track.
Additional table information: table: race_track

Answer: SELECT T2.name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id


Question:
What are the names of different tracks, and how many races has each had?
Additional table information: table: race_track

Answer: SELECT T2.name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id


Question:
Show the name of track with most number of races.
Additional table information: table: race_track

Answer: SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name of the track that has had the greatest number of races?
Additional table information: table: race_track

Answer: SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the name and date for each race and its track name.
Additional table information: table: race_track

Answer: SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id


Question:
What are the names and dates of races, and the names of the tracks where they are held?
Additional table information: table: race_track

Answer: SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id


Question:
Show the name and location of track with 1 race.
Additional table information: table: race_track

Answer: SELECT T2.name, T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING COUNT(*) = 1


Question:
What are the names and locations of tracks that have had exactly 1 race?
Additional table information: table: race_track

Answer: SELECT T2.name, T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING COUNT(*) = 1


Question:
Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats.
Additional table information: table: race_track

Answer: SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000


Question:
What are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats?
Additional table information: table: race_track

Answer: SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000


Question:
How many members have the black membership card?
Additional table information: table: coffee_shop

Answer: SELECT COUNT(*) FROM member WHERE Membership_card = 'Black'


Question:
Find the number of members living in each address.
Additional table information: table: coffee_shop

Answer: SELECT COUNT(*), address FROM member GROUP BY address


Question:
Give me the names of members whose address is in Harford or Waterbury.
Additional table information: table: coffee_shop

Answer: SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury'


Question:
Find the ids and names of members who are under age 30 or with black membership card.
Additional table information: table: coffee_shop

Answer: SELECT name, member_id FROM member WHERE Membership_card = 'Black' OR age < 30


Question:
Find the purchase time, age and address of each member, and show the results in the order of purchase time.
Additional table information: table: coffee_shop

Answer: SELECT Time_of_purchase, age, address FROM member ORDER BY Time_of_purchase NULLS FIRST


Question:
Which membership card has more than 5 members?
Additional table information: table: coffee_shop

Answer: SELECT Membership_card FROM member GROUP BY Membership_card HAVING COUNT(*) > 5


Question:
Which address has both members younger than 30 and members older than 40?
Additional table information: table: coffee_shop

Answer: SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40


Question:
What is the membership card held by both members living in Hartford and ones living in Waterbury address?
Additional table information: table: coffee_shop

Answer: SELECT membership_card FROM member WHERE address = 'Hartford' INTERSECT SELECT membership_card FROM member WHERE address = 'Waterbury'


Question:
How many members are not living in Hartford?
Additional table information: table: coffee_shop

Answer: SELECT COUNT(*) FROM member WHERE address <> 'Hartford'


Question:
Which address do not have any member with the black membership card?
Additional table information: table: coffee_shop

Answer: SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black'


Question:
Show the shop addresses ordered by their opening year.
Additional table information: table: coffee_shop

Answer: SELECT address FROM shop ORDER BY open_year NULLS FIRST


Question:
What are the average score and average staff number of all shops?
Additional table information: table: coffee_shop

Answer: SELECT AVG(num_of_staff), AVG(score) FROM shop


Question:
Find the id and address of the shops whose score is below the average score.
Additional table information: table: coffee_shop

Answer: SELECT shop_id, address FROM shop WHERE score < (SELECT AVG(score) FROM shop)


Question:
Find the address and staff number of the shops that do not have any happy hour.
Additional table information: table: coffee_shop

Answer: SELECT address, num_of_staff FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM happy_hour)


Question:
What are the id and address of the shops which have a happy hour in May?
Additional table information: table: coffee_shop

Answer: SELECT t1.address, t1.shop_id FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id = t2.shop_id WHERE MONTH = 'May'


Question:
which shop has happy hour most frequently? List its id and number of happy hours.
Additional table information: table: coffee_shop

Answer: SELECT shop_id, COUNT(*) FROM happy_hour GROUP BY shop_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which month has the most happy hours?
Additional table information: table: coffee_shop

Answer: SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which months have more than 2 happy hours?
Additional table information: table: coffee_shop

Answer: SELECT MONTH FROM happy_hour GROUP BY MONTH HAVING COUNT(*) > 2


Question:
How many albums are there?
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM ALBUM


Question:
Find the number of albums.
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM ALBUM


Question:
List the names of all music genres.
Additional table information: table: chinook_1

Answer: SELECT Name FROM GENRE


Question:
What are the names of different music genres?
Additional table information: table: chinook_1

Answer: SELECT Name FROM GENRE


Question:
Find all the customer information in state NY.
Additional table information: table: chinook_1

Answer: SELECT * FROM CUSTOMER WHERE State = 'NY'


Question:
What is all the customer information for customers in NY state?
Additional table information: table: chinook_1

Answer: SELECT * FROM CUSTOMER WHERE State = 'NY'


Question:
What are the first names and last names of the employees who live in Calgary city.
Additional table information: table: chinook_1

Answer: SELECT FirstName, LastName FROM EMPLOYEE WHERE City = 'Calgary'


Question:
Find the full names of employees living in the city of Calgary.
Additional table information: table: chinook_1

Answer: SELECT FirstName, LastName FROM EMPLOYEE WHERE City = 'Calgary'


Question:
What are the distinct billing countries of the invoices?
Additional table information: table: chinook_1

Answer: SELECT DISTINCT (BillingCountry) FROM INVOICE


Question:
Find the different billing countries for all invoices.
Additional table information: table: chinook_1

Answer: SELECT DISTINCT (BillingCountry) FROM INVOICE


Question:
Find the names of all artists that have 'a' in their names.
Additional table information: table: chinook_1

Answer: SELECT Name FROM ARTIST WHERE Name LIKE '%a%'


Question:
What are the names of artist who have the letter 'a' in their names?
Additional table information: table: chinook_1

Answer: SELECT Name FROM ARTIST WHERE Name LIKE '%a%'


Question:
Find the title of all the albums of the artist 'AC/DC'.
Additional table information: table: chinook_1

Answer: SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'AC/DC'


Question:
What are the titles of albums by the artist 'AC/DC'?
Additional table information: table: chinook_1

Answer: SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'AC/DC'


Question:
Hom many albums does the artist 'Metallica' have?
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'Metallica'


Question:
Find the number of albums by the artist 'Metallica'.
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'Metallica'


Question:
Which artist does the album 'Balls to the Wall' belong to?
Additional table information: table: chinook_1

Answer: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = 'Balls to the Wall'


Question:
Find the name of the artist who made the album 'Balls to the Wall'.
Additional table information: table: chinook_1

Answer: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = 'Balls to the Wall'


Question:
Which artist has the most albums?
Additional table information: table: chinook_1

Answer: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name of the artist with the greatest number of albums?
Additional table information: table: chinook_1

Answer: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the names of all the tracks that contain the word 'you'.
Additional table information: table: chinook_1

Answer: SELECT Name FROM TRACK WHERE Name LIKE '%you%'


Question:
What are the names of tracks that contain the the word you in them?
Additional table information: table: chinook_1

Answer: SELECT Name FROM TRACK WHERE Name LIKE '%you%'


Question:
What is the average unit price of all the tracks?
Additional table information: table: chinook_1

Answer: SELECT AVG(UnitPrice) FROM TRACK


Question:
Find the average unit price for a track.
Additional table information: table: chinook_1

Answer: SELECT AVG(UnitPrice) FROM TRACK


Question:
What are the durations of the longest and the shortest tracks in milliseconds?
Additional table information: table: chinook_1

Answer: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK


Question:
Find the maximum and minimum durations of tracks in milliseconds.
Additional table information: table: chinook_1

Answer: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK


Question:
Show the album names, ids and the number of tracks for each album.
Additional table information: table: chinook_1

Answer: SELECT T1.Title, T2.AlbumID, COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID


Question:
What are the names and ids of the different albums, and how many tracks are on each?
Additional table information: table: chinook_1

Answer: SELECT T1.Title, T2.AlbumID, COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID


Question:
What is the name of the most common genre in all tracks?
Additional table information: table: chinook_1

Answer: SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the name of the genre that is most frequent across all tracks.
Additional table information: table: chinook_1

Answer: SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the least common media type in all tracks?
Additional table information: table: chinook_1

Answer: SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What is the name of the media type that is least common across all tracks?
Additional table information: table: chinook_1

Answer: SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Show the album names and ids for albums that contain tracks with unit price bigger than 1.
Additional table information: table: chinook_1

Answer: SELECT T1.Title, T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID


Question:
What are the titles and ids for albums containing tracks with unit price greater than 1?
Additional table information: table: chinook_1

Answer: SELECT T1.Title, T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID


Question:
How many tracks belong to rock genre?
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock'


Question:
Count the number of tracks that are part of the rock genre.
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock'


Question:
What is the average unit price of tracks that belong to Jazz genre?
Additional table information: table: chinook_1

Answer: SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Jazz'


Question:
Find the average unit price of jazz tracks.
Additional table information: table: chinook_1

Answer: SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Jazz'


Question:
What is the first name and last name of the customer that has email 'luisg@embraer.com.br'?
Additional table information: table: chinook_1

Answer: SELECT FirstName, LastName FROM CUSTOMER WHERE Email = 'luisg@embraer.com.br'


Question:
Find the full name of the customer with the email 'luisg@embraer.com.br'.
Additional table information: table: chinook_1

Answer: SELECT FirstName, LastName FROM CUSTOMER WHERE Email = 'luisg@embraer.com.br'


Question:
How many customers have email that contains 'gmail.com'?
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE '%gmail.com%'


Question:
Count the number of customers that have an email containing 'gmail.com'.
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE '%gmail.com%'


Question:
What is the first name and last name employee helps the customer with first name Leonie?
Additional table information: table: chinook_1

Answer: SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = 'Leonie'


Question:
Find the full names of employees who help customers with the first name Leonie.
Additional table information: table: chinook_1

Answer: SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = 'Leonie'


Question:
What city does the employee who helps the customer with postal code 70174 live in?
Additional table information: table: chinook_1

Answer: SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = '70174'


Question:
Find the cities corresponding to employees who help customers with the postal code 70174.
Additional table information: table: chinook_1

Answer: SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = '70174'


Question:
How many distinct cities does the employees live in?
Additional table information: table: chinook_1

Answer: SELECT COUNT(DISTINCT city) FROM EMPLOYEE


Question:
Find the number of different cities that employees live in.
Additional table information: table: chinook_1

Answer: SELECT COUNT(DISTINCT city) FROM EMPLOYEE


Question:
Find all invoice dates corresponding to customers with first name Astrid and last name Gruber.
Additional table information: table: chinook_1

Answer: SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = 'Astrid' AND LastName = 'Gruber'


Question:
What are the invoice dates for customers with the first name Astrid and the last name Gruber?
Additional table information: table: chinook_1

Answer: SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = 'Astrid' AND LastName = 'Gruber'


Question:
Find all the customer last names that do not have invoice totals larger than 20.
Additional table information: table: chinook_1

Answer: SELECT LastName FROM CUSTOMER EXCEPT SELECT T1.LastName FROM CUSTOMER AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.total > 20