cnatale/presto-athena-txt-2-sql huggingface dataset:
How many allergies have type animal?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Allergy_type WHERE allergytype = 'animal'
How many animal type allergies exist?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Allergy_type WHERE allergytype = 'animal'
Show all allergy types and the number of allergies in each type.
Additional table information: table: allergy_1
SQL: SELECT allergytype, COUNT(*) FROM Allergy_type GROUP BY allergytype
What are the allergy types and how many allergies correspond to each one?
Additional table information: table: allergy_1
SQL: SELECT allergytype, COUNT(*) FROM Allergy_type GROUP BY allergytype
Which allergy type has most number of allergies?
Additional table information: table: allergy_1
SQL: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) DESC LIMIT 1
Which allergy type is most common?
Additional table information: table: allergy_1
SQL: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) DESC LIMIT 1
Which allergy type has least number of allergies?
Additional table information: table: allergy_1
SQL: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
Which allergy type is the least common?
Additional table information: table: allergy_1
SQL: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
How many students are there?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Student
What is the total number of students?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Student
Show first name and last name for all students.
Additional table information: table: allergy_1
SQL: SELECT Fname, Lname FROM Student
What are the full names of all students
Additional table information: table: allergy_1
SQL: SELECT Fname, Lname FROM Student
How many different advisors are listed?
Additional table information: table: allergy_1
SQL: SELECT COUNT(DISTINCT advisor) FROM Student
How many advisors are there?
Additional table information: table: allergy_1
SQL: SELECT COUNT(DISTINCT advisor) FROM Student
Show all majors.
Additional table information: table: allergy_1
SQL: SELECT DISTINCT Major FROM Student
What are the different majors?
Additional table information: table: allergy_1
SQL: SELECT DISTINCT Major FROM Student
Show all cities where students live.
Additional table information: table: allergy_1
SQL: SELECT DISTINCT city_code FROM Student
What cities do students live in?
Additional table information: table: allergy_1
SQL: SELECT DISTINCT city_code FROM Student
Show first name, last name, age for all female students. Their sex is F.
Additional table information: table: allergy_1
SQL: SELECT Fname, Lname, Age FROM Student WHERE Sex = 'F'
What are the full names and ages for all female students whose sex is F?
Additional table information: table: allergy_1
SQL: SELECT Fname, Lname, Age FROM Student WHERE Sex = 'F'
Show student ids for all male students.
Additional table information: table: allergy_1
SQL: SELECT StuID FROM Student WHERE Sex = 'M'
What are the student ids for all male students?
Additional table information: table: allergy_1
SQL: SELECT StuID FROM Student WHERE Sex = 'M'
How many students are age 18?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Student WHERE age = 18
How many students are 18 years old?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Student WHERE age = 18
Show all student ids who are older than 20.
Additional table information: table: allergy_1
SQL: SELECT StuID FROM Student WHERE age > 20
What are the student ids for students over 20 years old?
Additional table information: table: allergy_1
SQL: SELECT StuID FROM Student WHERE age > 20
Which city does the student whose last name is 'Kim' live in?
Additional table information: table: allergy_1
SQL: SELECT city_code FROM Student WHERE LName = 'Kim'
Give the city that the student whose family name is Kim lives in.
Additional table information: table: allergy_1
SQL: SELECT city_code FROM Student WHERE LName = 'Kim'
Who is the advisor of student with ID 1004?
Additional table information: table: allergy_1
SQL: SELECT Advisor FROM Student WHERE StuID = 1004
Who advises student 1004?
Additional table information: table: allergy_1
SQL: SELECT Advisor FROM Student WHERE StuID = 1004
How many students live in HKG or CHI?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Student WHERE city_code = 'HKG' OR city_code = 'CHI'
Give the number of students living in either HKG or CHI.
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Student WHERE city_code = 'HKG' OR city_code = 'CHI'
Show the minimum, average, and maximum age of all students.
Additional table information: table: allergy_1
SQL: SELECT MIN(age), AVG(age), MAX(age) FROM Student
What is the minimum, mean, and maximum age across all students?
Additional table information: table: allergy_1
SQL: SELECT MIN(age), AVG(age), MAX(age) FROM Student
What is the last name of the youngest student?
Additional table information: table: allergy_1
SQL: SELECT LName FROM Student WHERE age = (SELECT MIN(age) FROM Student)
Provide the last name of the youngest student.
Additional table information: table: allergy_1
SQL: SELECT LName FROM Student WHERE age = (SELECT MIN(age) FROM Student)
Show the student id of the oldest student.
Additional table information: table: allergy_1
SQL: SELECT StuID FROM Student WHERE age = (SELECT MAX(age) FROM Student)
What student id corresponds to the oldest student?
Additional table information: table: allergy_1
SQL: SELECT StuID FROM Student WHERE age = (SELECT MAX(age) FROM Student)
Show all majors and corresponding number of students.
Additional table information: table: allergy_1
SQL: SELECT major, COUNT(*) FROM Student GROUP BY major
How many students are there for each major?
Additional table information: table: allergy_1
SQL: SELECT major, COUNT(*) FROM Student GROUP BY major
Which major has most number of students?
Additional table information: table: allergy_1
SQL: SELECT major FROM Student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1
What is the largest major?
Additional table information: table: allergy_1
SQL: SELECT major FROM Student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1
Show all ages and corresponding number of students.
Additional table information: table: allergy_1
SQL: SELECT age, COUNT(*) FROM Student GROUP BY age
How old is each student and how many students are each age?
Additional table information: table: allergy_1
SQL: SELECT age, COUNT(*) FROM Student GROUP BY age
Show the average age for male and female students.
Additional table information: table: allergy_1
SQL: SELECT AVG(age), sex FROM Student GROUP BY sex
What are the average ages for male and female students?
Additional table information: table: allergy_1
SQL: SELECT AVG(age), sex FROM Student GROUP BY sex
Show all cities and corresponding number of students.
Additional table information: table: allergy_1
SQL: SELECT city_code, COUNT(*) FROM Student GROUP BY city_code
How many students live in each city?
Additional table information: table: allergy_1
SQL: SELECT city_code, COUNT(*) FROM Student GROUP BY city_code
Show all advisors and corresponding number of students.
Additional table information: table: allergy_1
SQL: SELECT advisor, COUNT(*) FROM Student GROUP BY advisor
How many students does each advisor have?
Additional table information: table: allergy_1
SQL: SELECT advisor, COUNT(*) FROM Student GROUP BY advisor
Which advisor has most number of students?
Additional table information: table: allergy_1
SQL: SELECT advisor FROM Student GROUP BY advisor ORDER BY COUNT(*) DESC LIMIT 1
Give the advisor with the most students.
Additional table information: table: allergy_1
SQL: SELECT advisor FROM Student GROUP BY advisor ORDER BY COUNT(*) DESC LIMIT 1
How many students have cat allergies?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Has_allergy WHERE Allergy = 'Cat'
How many students are affected by cat allergies?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Has_allergy WHERE Allergy = 'Cat'
Show all student IDs who have at least two allergies.
Additional table information: table: allergy_1
SQL: SELECT StuID FROM Has_allergy GROUP BY StuID HAVING COUNT(*) >= 2
What are the students ids of students who have more than one allergy?
Additional table information: table: allergy_1
SQL: SELECT StuID FROM Has_allergy GROUP BY StuID HAVING COUNT(*) >= 2
What are the student ids of students who don't have any allergies?
Additional table information: table: allergy_1
SQL: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy
Which students are unaffected by allergies?
Additional table information: table: allergy_1
SQL: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy
How many female students have milk or egg allergies?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = 'F' AND T1.allergy = 'Milk' OR T1.allergy = 'Eggs'
How many students who are female are allergic to milk or eggs?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = 'F' AND T1.allergy = 'Milk' OR T1.allergy = 'Eggs'
How many students have a food allergy?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = 'food'
How many students are affected by food related allergies?
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = 'food'
Which allergy has most number of students affected?
Additional table information: table: allergy_1
SQL: SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY COUNT(*) DESC LIMIT 1
Which allergy is the most common?
Additional table information: table: allergy_1
SQL: SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY COUNT(*) DESC LIMIT 1
Show all allergies with number of students affected.
Additional table information: table: allergy_1
SQL: SELECT Allergy, COUNT(*) FROM Has_allergy GROUP BY Allergy
How many students have each different allergy?
Additional table information: table: allergy_1
SQL: SELECT Allergy, COUNT(*) FROM Has_allergy GROUP BY Allergy
Show all allergy type with number of students affected.
Additional table information: table: allergy_1
SQL: SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype
How many students are affected by each allergy type?
Additional table information: table: allergy_1
SQL: SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype
Find the last name and age of the student who has allergy to both milk and cat.
Additional table information: table: allergy_1
SQL: SELECT lname, age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = 'Milk' INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = 'Cat')
What are the last names and ages of the students who are allergic to milk and cat?
Additional table information: table: allergy_1
SQL: SELECT lname, age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = 'Milk' INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = 'Cat')
What are the 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
SQL: 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
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
SQL: 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
Find the first name and gender of the student who has allergy to milk but not cat.
Additional table information: table: allergy_1
SQL: SELECT fname, sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = 'Milk' EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = 'Cat')
What are the first name and gender of the students who have allergy to milk but can put up with cats?
Additional table information: table: allergy_1
SQL: 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')
Find the average age of the students who have allergies with food and animal types.
Additional table information: table: allergy_1
SQL: SELECT AVG(age) FROM Student WHERE StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'food' INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'animal')
How old are the students with allergies to food and animal types on average?
Additional table information: table: allergy_1
SQL: 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')
List the first and last name of the students who do not have any food type allergy.
Additional table information: table: allergy_1
SQL: 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')
What is the full name of each student who is not allergic to any type of food.
Additional table information: table: allergy_1
SQL: 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')
Find the number of male (sex is 'M') students who have some food type allery.
Additional table information: table: allergy_1
SQL: SELECT COUNT(*) FROM Student WHERE sex = 'M' AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'food')
How many male students (sex is 'M') are allergic to any type of food?
Additional table information: table: allergy_1
SQL: 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')
Find the different first names and cities of the students who have allergy to milk or cat.
Additional table information: table: allergy_1
SQL: SELECT DISTINCT T1.fname, T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = 'Milk' OR T2.Allergy = 'Cat'
What are the distinct first names and cities of the students who have allergy either to milk or to cat?
Additional table information: table: allergy_1
SQL: 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'
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
SQL: 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')
How many students are over 18 and do not have allergy to food type or animal type?
Additional table information: table: allergy_1
SQL: 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')
Find the first name and major of the students who are not allegry to soy.
Additional table information: table: allergy_1
SQL: SELECT fname, major FROM Student WHERE NOT StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = 'Soy')
What are the first name and major of the students who are able to consume soy?
Additional table information: table: allergy_1
SQL: SELECT fname, major FROM Student WHERE NOT StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = 'Soy')
A list of the top 5 countries by number of invoices. List country name and number of invoices.
Additional table information: table: store_1
SQL: SELECT billing_country, COUNT(*) FROM invoices GROUP BY billing_country ORDER BY COUNT(*) DESC LIMIT 5
What are the top 5 countries by number of invoices and how many do they have?
Additional table information: table: store_1
SQL: SELECT billing_country, COUNT(*) FROM invoices GROUP BY billing_country ORDER BY COUNT(*) DESC LIMIT 5
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
SQL: SELECT billing_country, SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8
What are the names of the top 8 countries by total invoice size and what are those sizes?
Additional table information: table: store_1
SQL: SELECT billing_country, SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8
A list of the top 10 countries by average invoice size. List country name and average invoice size.
Additional table information: table: store_1
SQL: SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10
What are the names of the countries and average invoice size of the top countries by size?
Additional table information: table: store_1
SQL: SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10
Find out 5 customers who most recently purchased something. List customers' first and last name.
Additional table information: table: store_1
SQL: 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
What are the first and last names of the 5 customers who purchased something most recently?
Additional table information: table: store_1
SQL: 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
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
SQL: 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
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
SQL: 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
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
SQL: 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
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
SQL: 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
List the top 5 genres by number of tracks. List genres name and total tracks.
Additional table information: table: store_1
SQL: 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
How many tracks does each genre have and what are the names of the top 5?
Additional table information: table: store_1
SQL: 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
List every album's title.
Additional table information: table: store_1
SQL: SELECT title FROM albums
What are the titles of all the albums?
Additional table information: table: store_1
SQL: SELECT title FROM albums
List every album ordered by album title in ascending order.
Additional table information: table: store_1
SQL: SELECT title FROM albums ORDER BY title NULLS FIRST
What are the titles of all the albums alphabetically ascending?
Additional table information: table: store_1
SQL: SELECT title FROM albums ORDER BY title NULLS FIRST
List every album whose title starts with A in alphabetical order.
Additional table information: table: store_1
SQL: SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title NULLS FIRST
What are the titles of all albums that start with A in alphabetical order?
Additional table information: table: store_1
SQL: SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title NULLS FIRST
List the customers first and last name of 10 least expensive invoices.
Additional table information: table: store_1
SQL: 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
What are the first and last names of the customers with the 10 cheapest invoices?
Additional table information: table: store_1
SQL: 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
List total amount of  invoice from Chicago, IL.
Additional table information: table: store_1
SQL: SELECT SUM(total) FROM invoices WHERE billing_city = 'Chicago' AND billing_state = 'IL'
What are the total amount of money in the invoices billed from Chicago, Illinois?
Additional table information: table: store_1
SQL: SELECT SUM(total) FROM invoices WHERE billing_city = 'Chicago' AND billing_state = 'IL'
List the number of invoices from Chicago, IL.
Additional table information: table: store_1
SQL: SELECT COUNT(*) FROM invoices WHERE billing_city = 'Chicago' AND billing_state = 'IL'
How many invoices were billed from Chicago, IL?
Additional table information: table: store_1
SQL: SELECT COUNT(*) FROM invoices WHERE billing_city = 'Chicago' AND billing_state = 'IL'
List the number of invoices from the US, grouped by state.
Additional table information: table: store_1
SQL: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = 'USA' GROUP BY billing_state
How many invoices were billed from each state?
Additional table information: table: store_1
SQL: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = 'USA' GROUP BY billing_state
List the state in the US with the most invoices.
Additional table information: table: store_1
SQL: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = 'USA' GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1
What are the states with the most invoices?
Additional table information: table: store_1
SQL: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = 'USA' GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1
List the number of invoices and the invoice total from California.
Additional table information: table: store_1
SQL: SELECT billing_state, COUNT(*), SUM(total) FROM invoices WHERE billing_state = 'CA'
What is the number of invoices and total money billed in them from CA?
Additional table information: table: store_1
SQL: SELECT billing_state, COUNT(*), SUM(total) FROM invoices WHERE billing_state = 'CA'
List Aerosmith's albums.
Additional table information: table: store_1
SQL: SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = 'Aerosmith'
What are the titles of all the Aerosmith albums?
Additional table information: table: store_1
SQL: SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = 'Aerosmith'
How many albums does Billy Cobham has?
Additional table information: table: store_1
SQL: SELECT COUNT(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = 'Billy Cobham'
How many albums has Billy Cobam released?
Additional table information: table: store_1
SQL: SELECT COUNT(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = 'Billy Cobham'
Eduardo Martins is a customer at which company?
Additional table information: table: store_1
SQL: SELECT company FROM customers WHERE first_name = 'Eduardo' AND last_name = 'Martins'
What is the company where Eduardo Martins is a customer?
Additional table information: table: store_1
SQL: SELECT company FROM customers WHERE first_name = 'Eduardo' AND last_name = 'Martins'
What is Astrid Gruber's email and phone number?
Additional table information: table: store_1
SQL: SELECT email, phone FROM customers WHERE first_name = 'Astrid' AND last_name = 'Gruber'
What is the email and phone number of Astrid Gruber the customer?
Additional table information: table: store_1
SQL: SELECT email, phone FROM customers WHERE first_name = 'Astrid' AND last_name = 'Gruber'
How many customers live in Prague city?
Additional table information: table: store_1
SQL: SELECT COUNT(*) FROM customers WHERE city = 'Prague'
How many customers live in the city of Prague?
Additional table information: table: store_1
SQL: SELECT COUNT(*) FROM customers WHERE city = 'Prague'
How many customers in state of CA?
Additional table information: table: store_1
SQL: SELECT COUNT(*) FROM customers WHERE state = 'CA'
How many customers are from California?
Additional table information: table: store_1
SQL: SELECT COUNT(*) FROM customers WHERE state = 'CA'
What country does Roberto Almeida live?
Additional table information: table: store_1
SQL: SELECT country FROM customers WHERE first_name = 'Roberto' AND last_name = 'Almeida'
In which country does Roberto Almeida?
Additional table information: table: store_1
SQL: SELECT country FROM customers WHERE first_name = 'Roberto' AND last_name = 'Almeida'
List the name of albums that are released by aritist whose name has 'Led'
Additional table information: table: store_1
SQL: SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'
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
SQL: SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'
How many customers does Steve Johnson support?
Additional table information: table: store_1
SQL: 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'
What is the count of customers that Steve Johnson supports?
Additional table information: table: store_1
SQL: 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'
What is the title, phone and hire date of Nancy Edwards?
Additional table information: table: store_1
SQL: SELECT title, phone, hire_date FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'
What is the title, phone number and hire date for the employee named Nancy Edwards?
Additional table information: table: store_1
SQL: SELECT title, phone, hire_date FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'
find the full name of employees who report to Nancy Edwards?
Additional table information: table: store_1
SQL: 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'
What is the first and last name of the employee who reports to Nancy Edwards?
Additional table information: table: store_1
SQL: 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'
What is the address of employee Nancy Edwards?
Additional table information: table: store_1
SQL: SELECT address FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'
What is Nancy Edwards's address?
Additional table information: table: store_1
SQL: SELECT address FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'
Find the full name of employee who supported the most number of customers.
Additional table information: table: store_1
SQL: 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
What is the full name of the employee who has the most customers?
Additional table information: table: store_1
SQL: 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
How many employees are living in Canada?
Additional table information: table: store_1
SQL: SELECT COUNT(*) FROM employees WHERE country = 'Canada'
How many employees live in Canada?
Additional table information: table: store_1
SQL: SELECT COUNT(*) FROM employees WHERE country = 'Canada'
What is employee Nancy Edwards's phone number?
Additional table information: table: store_1
SQL: SELECT phone FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'
What is the the phone number of Nancy Edwards?
Additional table information: table: store_1
SQL: SELECT phone FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'
Who is the youngest employee in the company? List employee's first and last name.
Additional table information: table: store_1
SQL: SELECT first_name, last_name FROM employees ORDER BY birth_date DESC LIMIT 1
What si the youngest employee's first and last name?
Additional table information: table: store_1
SQL: SELECT first_name, last_name FROM employees ORDER BY birth_date DESC LIMIT 1
List top 10 employee work longest in the company. List employee's first and last name.
Additional table information: table: store_1
SQL: SELECT first_name, last_name FROM employees ORDER BY hire_date ASC NULLS FIRST LIMIT 10
What are the first and last names of the top 10 longest-serving employees?
Additional table information: table: store_1
SQL: SELECT first_name, last_name FROM employees ORDER BY hire_date ASC NULLS FIRST LIMIT 10
Find the number of employees whose title is IT Staff from each city?
Additional table information: table: store_1
SQL: SELECT COUNT(*), city FROM employees WHERE title = 'IT Staff' GROUP BY city
How many employees who are IT staff are from each city?
Additional table information: table: store_1
SQL: SELECT COUNT(*), city FROM employees WHERE title = 'IT Staff' GROUP BY city
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
SQL: 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
What are the first and last names of all the employees and how many people report to them?
Additional table information: table: store_1
SQL: 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
How many orders does Lucas Mancini has?
Additional table information: table: store_1
SQL: 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'
How many orders does Luca Mancini have in his invoices?
Additional table information: table: store_1
SQL: 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'
What is the total amount of money spent by Lucas Mancini?
Additional table information: table: store_1
SQL: 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'
How much money did Lucas Mancini spend?
Additional table information: table: store_1
SQL: 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'
List all media types.
Additional table information: table: store_1
SQL: SELECT name FROM media_types
What are the names of all the media types?
Additional table information: table: store_1
SQL: SELECT name FROM media_types
List all different genre types.
Additional table information: table: store_1
SQL: SELECT DISTINCT name FROM genres
What are the different names of the genres?
Additional table information: table: store_1
SQL: SELECT DISTINCT name FROM genres
List the name of all playlist.
Additional table information: table: store_1
SQL: SELECT name FROM playlists
What are the names of all the playlists?
Additional table information: table: store_1
SQL: SELECT name FROM playlists
Who is the composer of track Fast As a Shark?
Additional table information: table: store_1
SQL: SELECT composer FROM tracks WHERE name = 'Fast As a Shark'
What is the composer who created the track 'Fast As a Shark'?
Additional table information: table: store_1
SQL: SELECT composer FROM tracks WHERE name = 'Fast As a Shark'
How long does track Fast As a Shark has?
Additional table information: table: store_1
SQL: SELECT milliseconds FROM tracks WHERE name = 'Fast As a Shark'
How many milliseconds long is Fast As a Shark?
Additional table information: table: store_1
SQL: SELECT milliseconds FROM tracks WHERE name = 'Fast As a Shark'
What is the name of tracks whose genre is Rock?
Additional table information: table: store_1
SQL: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = 'Rock'
What is the name of all tracks in the Rock genre?
Additional table information: table: store_1
SQL: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = 'Rock'
What is title of album which track Balls to the Wall belongs to?
Additional table information: table: store_1
SQL: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T2.name = 'Balls to the Wall'
What is the name of the album that has the track Ball to the Wall?
Additional table information: table: store_1
SQL: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T2.name = 'Balls to the Wall'
List name of all tracks in Balls to the Wall.
Additional table information: table: store_1
SQL: SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = 'Balls to the Wall'
What is the name of all tracks in the album named Balls to the Wall?
Additional table information: table: store_1
SQL: SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = 'Balls to the Wall'
List title of albums have the number of tracks greater than 10.
Additional table information: table: store_1
SQL: 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
What are the names of the albums that have more than 10 tracks?
Additional table information: table: store_1
SQL: 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
List the name of tracks belongs to genre Rock and whose media type is MPEG audio file.
Additional table information: table: store_1
SQL: 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'
What are the names of all Rock tracks that are stored on MPEG audio files?
Additional table information: table: store_1
SQL: 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'
List the name of tracks belongs to genre Rock or media type is MPEG audio file.
Additional table information: table: store_1
SQL: 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'
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
SQL: 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'
List the name of tracks belongs to genre Rock or genre Jazz.
Additional table information: table: store_1
SQL: 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'
What are the names of the tracks that are Rock or Jazz songs?
Additional table information: table: store_1
SQL: 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'
List the name of all tracks in the playlists of Movies.
Additional table information: table: store_1
SQL: 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'
What are the names of all tracks that are on playlists titled Movies?
Additional table information: table: store_1
SQL: 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'
List the name of playlist which has number of tracks greater than 100.
Additional table information: table: store_1
SQL: 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
What are the names of all playlists that have more than 100 tracks?
Additional table information: table: store_1
SQL: 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
List all tracks bought by customer Daan Peeters.
Additional table information: table: store_1
SQL: 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'
What are the tracks that Dean Peeters bought?
Additional table information: table: store_1
SQL: 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'
How much is the track Fast As a Shark?
Additional table information: table: store_1
SQL: SELECT unit_price FROM tracks WHERE name = 'Fast As a Shark'
What is the unit price of the tune 'Fast As a Shark'?
Additional table information: table: store_1
SQL: SELECT unit_price FROM tracks WHERE name = 'Fast As a Shark'
Find the name of tracks which are in Movies playlist but not in music playlist.
Additional table information: table: store_1
SQL: 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'
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
SQL: 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'
Find the name of tracks which are in both Movies and music playlists.
Additional table information: table: store_1
SQL: 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'
What are the names of all the tracks that are in both the Movies and music playlists?
Additional table information: table: store_1
SQL: 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'
Find number of tracks in each genre?
Additional table information: table: store_1
SQL: SELECT COUNT(*), T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name
How many tracks are in each genre?
Additional table information: table: store_1
SQL: SELECT COUNT(*), T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name
How many editors are there?
Additional table information: table: journal_committee
SQL: SELECT COUNT(*) FROM editor
List the names of editors in ascending order of age.
Additional table information: table: journal_committee
SQL: SELECT Name FROM editor ORDER BY Age ASC NULLS FIRST
What are the names and ages of editors?
Additional table information: table: journal_committee
SQL: SELECT Name, Age FROM editor
List the names of editors who are older than 25.
Additional table information: table: journal_committee
SQL: SELECT Name FROM editor WHERE Age > 25
Show the names of editors of age either 24 or 25.
Additional table information: table: journal_committee
SQL: SELECT Name FROM editor WHERE Age = 24 OR Age = 25
What is the name of the youngest editor?
Additional table information: table: journal_committee
SQL: SELECT Name FROM editor ORDER BY Age ASC NULLS FIRST LIMIT 1
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
SQL: SELECT Age, COUNT(*) FROM editor GROUP BY Age
Please show the most common age of editors.
Additional table information: table: journal_committee
SQL: SELECT Age FROM editor GROUP BY Age ORDER BY COUNT(*) DESC LIMIT 1
Show the distinct themes of journals.
Additional table information: table: journal_committee
SQL: SELECT DISTINCT Theme FROM journal
Show the names of editors and the theme of journals for which they serve on committees.
Additional table information: table: journal_committee
SQL: 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
For each journal_committee, find the editor name and the journal theme.
Additional table information: table: journal_committee
SQL: SELECT T2.Name, T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID
Show the names 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
SQL: 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
Show the names of editors that are on the committee of journals with sales bigger than 3000.
Additional table information: table: journal_committee
SQL: SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Sales > 3000
Show the id, name of each editor and the number of journal committees they are on.
Additional table information: table: journal_committee
SQL: SELECT T1.editor_id, T1.Name, COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.editor_id
Show the names of editors that are on at least two journal committees.
Additional table information: table: journal_committee
SQL: 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
List the names of editors that are not on any journal committee.
Additional table information: table: journal_committee
SQL: SELECT Name FROM editor WHERE NOT editor_id IN (SELECT editor_id FROM journal_committee)
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
SQL: 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
What is the average sales of the journals that have an editor whose work type is 'Photo'?
Additional table information: table: journal_committee
SQL: 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'
How many accounts do we have?
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Accounts
Count the number of accounts.
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Accounts
Show ids, customer ids, names for all accounts.
Additional table information: table: customers_card_transactions
SQL: SELECT account_id, customer_id, account_name FROM Accounts
What are the account ids, customer ids, and account names for all the accounts?
Additional table information: table: customers_card_transactions
SQL: SELECT account_id, customer_id, account_name FROM Accounts
Show other account details for account with name 338.
Additional table information: table: customers_card_transactions
SQL: SELECT other_account_details FROM Accounts WHERE account_name = '338'
What are the other account details for the account with the name 338?
Additional table information: table: customers_card_transactions
SQL: SELECT other_account_details FROM Accounts WHERE account_name = '338'
What is the first name, last name, and phone of the customer with account name 162?
Additional table information: table: customers_card_transactions
SQL: 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'
Give the full name and phone of the customer who has the account name 162.
Additional table information: table: customers_card_transactions
SQL: 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'
How many accounts does the customer with first name Art and last name Turcotte have?
Additional table information: table: customers_card_transactions
SQL: 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'
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
SQL: 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'
Show all customer ids and the number of accounts for each customer.
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id
How many accounts are there for each customer id?
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id