db_id
stringlengths
4
31
SQL
stringlengths
18
1.45k
input_sequence
stringlengths
148
11k
question
stringlengths
16
325
allergy_1
select advisor , count(*) from student group by advisor
Question: how many students does each advisor have? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
how many students does each advisor have?
allergy_1
select advisor from student group by advisor order by count(*) desc limit 1
Question: which advisor has most number of students? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
which advisor has most number of students?
allergy_1
select advisor from student group by advisor order by count(*) desc limit 1
Question: give the advisor with the most students. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
give the advisor with the most students.
allergy_1
select count(*) from has_allergy where allergy = 'cat'
Question: how many students have cat allergies? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
how many students have cat allergies?
allergy_1
select count(*) from has_allergy where allergy = 'cat'
Question: how many students are affected by cat allergies? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
how many students are affected by cat allergies?
allergy_1
select stuid from has_allergy group by stuid having count(*) >= 2
Question: show all student ids who have at least two allergies. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
show all student ids who have at least two allergies.
allergy_1
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? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
what are the students ids of students who have more than one allergy?
allergy_1
select stuid from student except select stuid from has_allergy
Question: what are the student ids of students who don't have any allergies? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
what are the student ids of students who don't have any allergies?
allergy_1
select stuid from student except select stuid from has_allergy
Question: which students are unaffected by allergies? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
which students are unaffected by allergies?
allergy_1
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 female students have milk or egg allergies? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
how many female students have milk or egg allergies?
allergy_1
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? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
how many students who are female are allergic to milk or eggs?
allergy_1
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 have a food allergy? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
how many students have a food allergy?
allergy_1
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? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
how many students are affected by food related allergies?
allergy_1
select allergy from has_allergy group by allergy order by count(*) desc limit 1
Question: which allergy has most number of students affected? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
which allergy has most number of students affected?
allergy_1
select allergy from has_allergy group by allergy order by count(*) desc limit 1
Question: which allergy is the most common? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
which allergy is the most common?
allergy_1
select allergy , count(*) from has_allergy group by allergy
Question: show all allergies with number of students affected. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
show all allergies with number of students affected.
allergy_1
select allergy , count(*) from has_allergy group by allergy
Question: how many students have each different allergy? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
how many students have each different allergy?
allergy_1
select t2.allergytype , count(*) from has_allergy as t1 join allergy_type as t2 on t1.allergy = t2.allergy group by t2.allergytype
Question: show all allergy type with number of students affected. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
show all allergy type with number of students affected.
allergy_1
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? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
how many students are affected by each allergy type?
allergy_1
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: find the last name and age of the student who has allergy to both milk and cat. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.S...
find the last name and age of the student who has allergy to both milk and cat.
allergy_1
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? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Studen...
what are the last names and ages of the students who are allergic to milk and cat?
allergy_1
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
Question: what are the allergies and their types that the student with first name lisa has? and order the result by name of allergies. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allerg...
what are the allergies and their types that the student with first name lisa has? and order the result by name of allergies.
allergy_1
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
Question: what are the allergies the girl named lisa has? and what are the types of them? order the result by allergy names. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.All...
what are the allergies the girl named lisa has? and what are the types of them? order the result by allergy names.
allergy_1
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 first name and gender of the student who has allergy to milk but not cat. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Studen...
find the first name and gender of the student who has allergy to milk but not cat.
allergy_1
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? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_All...
what are the first name and gender of the students who have allergy to milk but can put up with cats?
allergy_1
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: find the average age of the students who have allergies with food and animal types. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Stude...
find the average age of the students who have allergies with food and animal types.
allergy_1
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? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuI...
how old are the students with allergies to food and animal types on average?
allergy_1
select fname , lname from student where stuid not in (select t1.stuid from has_allergy as t1 join allergy_type as t2 on t1.allergy = t2.allergy where t2.allergytype = 'food')
Question: list the first and last name of the students who do not have any food type allergy. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Stude...
list the first and last name of the students who do not have any food type allergy.
allergy_1
select fname , lname from student where stuid not in (select t1.stuid from has_allergy as t1 join allergy_type as t2 on t1.allergy = t2.allergy where t2.allergytype = 'food')
Question: what is the full name of each student who is not allergic to any type of food. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.St...
what is the full name of each student who is not allergic to any type of food.
allergy_1
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 number of male (sex is 'm') students who have some food type allery. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.Stu...
find the number of male (sex is 'm') students who have some food type allery.
allergy_1
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? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
how many male students (sex is 'm') are allergic to any type of food?
allergy_1
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 different first names and cities of the students who have allergy to milk or cat. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID ...
find the different first names and cities of the students who have allergy to milk or cat.
allergy_1
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? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_A...
what are the distinct first names and cities of the students who have allergy either to milk or to cat?
allergy_1
select count(*) from student where age > 18 and stuid not in ( select stuid from has_allergy as t1 join allergy_type as t2 on t1.allergy = t2.allergy where t2.allergytype = 'food' or t2.allergytype = 'animal')
Question: find the number of students who are older than 18 and do not have allergy to either food or animal. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Aller...
find the number of students who are older than 18 and do not have allergy to either food or animal.
allergy_1
select count(*) from student where age > 18 and stuid not in ( select stuid from has_allergy as t1 join allergy_type as t2 on t1.allergy = t2.allergy where t2.allergytype = 'food' or t2.allergytype = 'animal')
Question: how many students are over 18 and do not have allergy to food type or animal type? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Studen...
how many students are over 18 and do not have allergy to food type or animal type?
allergy_1
select fname , major from student where stuid not in (select stuid from has_allergy where allergy = 'soy')
Question: find the first name and major of the students who are not allegry to soy. | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.StuID,
find the first name and major of the students who are not allegry to soy.
allergy_1
select fname , major from student where stuid not 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? | Tables: Allergy_Type -> Allergy, AllergyType. Has_Allergy -> StuID, Allergy. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. | Joins: Has_Allergy.Allergy = Allergy_Type.Allergy, Has_Allergy.StuID = Student.St...
what are the first name and major of the students who are able to consume soy?
store_1
select billing_country , count(*) from invoices group by billing_country order by count(*) desc limit 5;
Question: a list of the top 5 countries by number of invoices. list country name and number of invoices. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_co...
a list of the top 5 countries by number of invoices. list country name and number of invoices.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, e...
what are the top 5 countries by number of invoices and how many do they have?
store_1
select billing_country , sum(total) from invoices group by billing_country order by sum(total) desc limit 8;
Question: a list of the top 8 countries by gross/total invoice size. list country name and gross invoice size. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, pos...
a list of the top 8 countries by gross/total invoice size. list country name and gross invoice size.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, p...
what are the names of the top 8 countries by total invoice size and what are those sizes?
store_1
select billing_country , avg(total) from invoices group by billing_country order by avg(total) desc limit 10;
Question: a list of the top 10 countries by average invoice size. list country name and average invoice size. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, post...
a list of the top 10 countries by average invoice size. list country name and average invoice size.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, ...
what are the names of the countries and average invoice size of the top countries by size?
store_1
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 5 customers who most recently purchased something. list customers' first and last name. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_...
find out 5 customers who most recently purchased something. list customers' first and last name.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code,...
what are the first and last names of the 5 customers who purchased something most recently?
store_1
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: find out the top 10 customers by total number of orders. list customers' first and last name and the number of total orders. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, c...
find out the top 10 customers by total number of orders. list customers' first and last name and the number of total orders.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, ...
what are the top 10 customers' first and last names by total number of orders and how many orders did they make?
store_1
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 10 customers by total gross sales. list customers' first and last name and total gross sales. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, countr...
list the top 10 customers by total gross sales. list customers' first and last name and total gross sales.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, co...
what are the top 10 customers' first and last names with the highest gross sales, and also what are the sales?
store_1
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 the top 5 genres by number of tracks. list genres name and total tracks. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, e...
list the top 5 genres by number of tracks. list genres name and total tracks.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email...
how many tracks does each genre have and what are the names of the top 5?
store_1
select title from albums;
Question: list every album's title. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, last_name, compan...
list every album's title.
store_1
select title from albums;
Question: what are the titles of all the albums? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, last...
what are the titles of all the albums?
store_1
select title from albums order by title;
Question: list every album ordered by album title in ascending order. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers ->...
list every album ordered by album title in ascending order.
store_1
select title from albums order by title;
Question: what are the titles of all the albums alphabetically ascending? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customer...
what are the titles of all the albums alphabetically ascending?
store_1
select title from albums where title like 'a%' order by title;
Question: list every album whose title starts with a in alphabetical order. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. custom...
list every album whose title starts with a in alphabetical order.
store_1
select title from albums where title like 'a%' order by title;
Question: what are the titles of all albums that start with a in alphabetical order? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, emai...
what are the titles of all albums that start with a in alphabetical order?
store_1
select t1.first_name , t1.last_name from customers as t1 join invoices as t2 on t2.customer_id = t1.id order by total limit 10;
Question: list the customers first and last name of 10 least expensive invoices. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. c...
list the customers first and last name of 10 least expensive invoices.
store_1
select t1.first_name , t1.last_name from customers as t1 join invoices as t2 on t2.customer_id = t1.id order by total limit 10;
Question: what are the first and last names of the customers with the 10 cheapest invoices? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fa...
what are the first and last names of the customers with the 10 cheapest invoices?
store_1
select sum(total) from invoices where billing_city = 'chicago' and billing_state = 'il';
Question: list total amount of invoice from chicago, il. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_n...
list total amount of invoice from chicago, il.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fa...
what are the total amount of money in the invoices billed from chicago, illinois?
store_1
select count(*) from invoices where billing_city = 'chicago' and billing_state = 'il';
Question: list the number of invoices from chicago, il. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_nam...
list the number of invoices from chicago, il.
store_1
select count(*) from invoices where billing_city = 'chicago' and billing_state = 'il';
Question: how many invoices were billed from chicago, il? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_n...
how many invoices were billed from chicago, il?
store_1
select billing_state , count(*) from invoices where billing_country = 'usa' group by billing_state;
Question: list the number of invoices from the us, grouped by state. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> ...
list the number of invoices from the us, grouped by state.
store_1
select billing_state , count(*) from invoices where billing_country = 'usa' group by billing_state;
Question: how many invoices were billed from each state? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_na...
how many invoices were billed from each state?
store_1
select billing_state , count(*) from invoices where billing_country = 'usa' group by billing_state order by count(*) desc limit 1;
Question: list the state in the us with the most invoices. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_...
list the state in the us with the most invoices.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name,...
what are the states with the most invoices?
store_1
select billing_state , count(*) , sum(total) from invoices where billing_state = 'ca';
Question: list the number of invoices and the invoice total from california. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. custo...
list the number of invoices and the invoice total from california.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. c...
what is the number of invoices and total money billed in them from ca?
store_1
select t1.title from albums as t1 join artists as t2 on t1.artist_id = t2.id where t2.name = 'aerosmith';
Question: list aerosmith's albums. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, last_name, company...
list aerosmith's albums.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_...
what are the titles of all the aerosmith albums?
store_1
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 does billy cobham has? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, last...
how many albums does billy cobham has?
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, l...
how many albums has billy cobam released?
store_1
select company from customers where first_name = 'eduardo' and last_name = 'martins';
Question: eduardo martins is a customer at which company? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_n...
eduardo martins is a customer at which company?
store_1
select company from customers where first_name = 'eduardo' and last_name = 'martins';
Question: what is the company where eduardo martins is a customer? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id...
what is the company where eduardo martins is a customer?
store_1
select email , phone from customers where first_name = 'astrid' and last_name = 'gruber';
Question: what is astrid gruber's email and phone number? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_n...
what is astrid gruber's email and phone number?
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. custom...
what is the email and phone number of astrid gruber the customer?
store_1
select count(*) from customers where city = 'prague';
Question: how many customers live in prague city? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, las...
how many customers live in prague city?
store_1
select count(*) from customers where city = 'prague';
Question: how many customers live in the city of prague? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_na...
how many customers live in the city of prague?
store_1
select count(*) from customers where state = 'ca';
Question: how many customers in state of ca? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, last_nam...
how many customers in state of ca?
store_1
select count(*) from customers where state = 'ca';
Question: how many customers are from california? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, las...
how many customers are from california?
store_1
select country from customers where first_name = 'roberto' and last_name = 'almeida';
Question: what country does roberto almeida live? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, las...
what country does roberto almeida live?
store_1
select country from customers where first_name = 'roberto' and last_name = 'almeida';
Question: in which country does roberto almeida? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, last...
in which country does roberto almeida?
store_1
select t2.title from artists as t1 join albums as t2 on t1.id = t2.artist_id where t1.name like '%led%'
Question: list the name of albums that are released by aritist whose name has 'led' | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email...
list the name of albums that are released by aritist whose name has 'led'
store_1
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'? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_c...
what is the title of the album that was released by the artist whose name has the phrase 'led'?
store_1
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: how many customers does steve johnson support? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_na...
how many customers does steve johnson support?
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers ->...
what is the count of customers that steve johnson supports?
store_1
select title , phone , hire_date from employees where first_name = 'nancy' and last_name = 'edwards';
Question: what is the title, phone and hire date of nancy edwards? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id...
what is the title, phone and hire date of nancy edwards?
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, ...
what is the title, phone number and hire date for the employee named nancy edwards?
store_1
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: find the full name of employees who report to nancy edwards? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -...
find the full name of employees who report to nancy edwards?
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, e...
what is the first and last name of the employee who reports to nancy edwards?
store_1
select address from employees where first_name = 'nancy' and last_name = 'edwards';
Question: what is the address of employee nancy edwards? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_na...
what is the address of employee nancy edwards?
store_1
select address from employees where first_name = 'nancy' and last_name = 'edwards';
Question: what is nancy edwards's address? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, last_name,...
what is nancy edwards's address?
store_1
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: find the full name of employee who supported the most number of customers. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, emai...
find the full name of employee who supported the most number of customers.
store_1
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? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. custom...
what is the full name of the employee who has the most customers?
store_1
select count(*) from employees where country = 'canada';
Question: how many employees are living in canada? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, la...
how many employees are living in canada?
store_1
select count(*) from employees where country = 'canada';
Question: how many employees live in canada? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_name, last_nam...
how many employees live in canada?
store_1
select phone from employees where first_name = 'nancy' and last_name = 'edwards';
Question: what is employee nancy edwards's phone number? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_na...
what is employee nancy edwards's phone number?
store_1
select phone from employees where first_name = 'nancy' and last_name = 'edwards';
Question: what is the the phone number of nancy edwards? | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email. customers -> id, first_na...
what is the the phone number of nancy edwards?
store_1
select first_name , last_name from employees order by birth_date desc limit 1;
Question: who is the youngest employee in the company? list employee's first and last name. | Tables: artists -> id, name. sqlite_sequence -> name, seq. albums -> id, title, artist_id. employees -> id, last_name, first_name, title, reports_to, birth_date, hire_date, address, city, state, country, postal_code, phone, fa...
who is the youngest employee in the company? list employee's first and last name.