db_id
stringlengths
4
31
SQL
stringlengths
18
1.45k
input_sequence
stringlengths
148
11k
question
stringlengths
16
325
dorm_1
select count(distinct major) , count(distinct city_code) from student
Question: find the numbers of different majors and cities. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_amenity...
find the numbers of different majors and cities.
dorm_1
select count(distinct major) , count(distinct city_code) from student
Question: how many different majors are there and how many different city codes are there for each student? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in ->...
how many different majors are there and how many different city codes are there for each student?
dorm_1
select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t3.amenity_name = 'tv lounge' intersect select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.ameni...
Question: find the name of dorms which have both tv lounge and study room as amenities. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room...
find the name of dorms which have both tv lounge and study room as amenities.
dorm_1
select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t3.amenity_name = 'tv lounge' intersect select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.ameni...
Question: what is the name of the dorm with both a tv lounge and study room listed as amenities? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dor...
what is the name of the dorm with both a tv lounge and study room listed as amenities?
dorm_1
select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t3.amenity_name = 'tv lounge' except select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid w...
Question: find the name of dorms which have tv lounge but no study room as amenity. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_num...
find the name of dorms which have tv lounge but no study room as amenity.
dorm_1
select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t3.amenity_name = 'tv lounge' except select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid w...
Question: what is the name of each dorm that has a tv lounge but no study rooms? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number...
what is the name of each dorm that has a tv lounge but no study rooms?
dorm_1
select lname from student where sex = 'f' and city_code = 'bal' union select lname from student where sex = 'm' and age < 20
Question: find the last name of students who is either female (sex is f) and living in the city of code bal or male (sex is m) and in age of below 20. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name....
find the last name of students who is either female (sex is f) and living in the city of code bal or male (sex is m) and in age of below 20.
dorm_1
select lname from student where sex = 'f' and city_code = 'bal' union select lname from student where sex = 'm' and age < 20
Question: what is the last name of every student who is either female or living in a city with the code bal or male and under 20? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormi...
what is the last name of every student who is either female or living in a city with the code bal or male and under 20?
dorm_1
select dorm_name from dorm order by student_capacity desc limit 1
Question: find the name of the dorm with the largest capacity. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_ame...
find the name of the dorm with the largest capacity.
dorm_1
select dorm_name from dorm order by student_capacity desc limit 1
Question: what are the names of the dorm with the largest capacity? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Ha...
what are the names of the dorm with the largest capacity?
dorm_1
select amenity_name from dorm_amenity order by amenity_name
Question: list in alphabetic order all different amenities. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_amenit...
list in alphabetic order all different amenities.
dorm_1
select amenity_name from dorm_amenity order by amenity_name
Question: what are the different dorm amenity names in alphabetical order? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Jo...
what are the different dorm amenity names in alphabetical order?
dorm_1
select city_code from student group by city_code order by count(*) desc limit 1
Question: find the code of city where most of students are living in. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: ...
find the code of city where most of students are living in.
dorm_1
select city_code from student group by city_code order by count(*) desc limit 1
Question: what is the code of the city with the most students? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_ame...
what is the code of the city with the most students?
dorm_1
select fname , lname from student where age < (select avg(age) from student)
Question: find the first and last name of students whose age is younger than the average age. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid...
find the first and last name of students whose age is younger than the average age.
dorm_1
select fname , lname from student where age < (select avg(age) from student)
Question: what is the first and last name of all students who are younger than average? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room...
what is the first and last name of all students who are younger than average?
dorm_1
select fname , lname from student where city_code != 'hkg' order by age
Question: list the first and last name of students who are not living in the city with code hkg, and sorted the results by their ages. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> ...
list the first and last name of students who are not living in the city with code hkg, and sorted the results by their ages.
dorm_1
select fname , lname from student where city_code != 'hkg' order by age
Question: what are the first and last names of all students who are not living in the city hkg and order the results by age? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, am...
what are the first and last names of all students who are not living in the city hkg and order the results by age?
dorm_1
select t1.amenity_name from dorm_amenity as t1 join has_amenity as t2 on t2.amenid = t1.amenid join dorm as t3 on t2.dormid = t3.dormid where t3.dorm_name = 'anonymous donor hall' order by t1.amenity_name
Question: list name of all amenities which anonymous donor hall has, and sort the results in alphabetic order. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in...
list name of all amenities which anonymous donor hall has, and sort the results in alphabetic order.
dorm_1
select t1.amenity_name from dorm_amenity as t1 join has_amenity as t2 on t2.amenid = t1.amenid join dorm as t3 on t2.dormid = t3.dormid where t3.dorm_name = 'anonymous donor hall' order by t1.amenity_name
Question: what are the amenities in alphabetical order that anonymous donor hall has? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_n...
what are the amenities in alphabetical order that anonymous donor hall has?
dorm_1
select count(*) , sum(student_capacity) , gender from dorm group by gender
Question: find the number of dorms and total capacity for each gender. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins:...
find the number of dorms and total capacity for each gender.
dorm_1
select count(*) , sum(student_capacity) , gender from dorm group by gender
Question: how many dorms are there and what is the total capacity for each gender? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_numb...
how many dorms are there and what is the total capacity for each gender?
dorm_1
select avg(age) , max(age) , sex from student group by sex
Question: find the average and oldest age for students with different sex. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Jo...
find the average and oldest age for students with different sex.
dorm_1
select avg(age) , max(age) , sex from student group by sex
Question: what is the average and oldest age for each gender of student? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Join...
what is the average and oldest age for each gender of student?
dorm_1
select count(*) , major from student group by major
Question: find the number of students in each major. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_amenity.ameni...
find the number of students in each major.
dorm_1
select count(*) , major from student group by major
Question: how many students are there in each major? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_amenity.ameni...
how many students are there in each major?
dorm_1
select count(*) , avg(age) , city_code from student group by city_code
Question: find the number and average age of students living in each city. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Jo...
find the number and average age of students living in each city.
dorm_1
select count(*) , avg(age) , city_code from student group by city_code
Question: how many students live in each city and what are their average ages? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. ...
how many students live in each city and what are their average ages?
dorm_1
select count(*) , avg(age) , city_code from student where sex = 'm' group by city_code
Question: find the average age and number of male students (with sex m) from each city. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room...
find the average age and number of male students (with sex m) from each city.
dorm_1
select count(*) , avg(age) , city_code from student where sex = 'm' group by city_code
Question: what is the average age and how many male students are there in each city? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_nu...
what is the average age and how many male students are there in each city?
dorm_1
select count(*) , city_code from student group by city_code having count(*) > 1
Question: find the number of students for the cities where have more than one student. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_...
find the number of students for the cities where have more than one student.
dorm_1
select count(*) , city_code from student group by city_code having count(*) > 1
Question: how many students are from each city, and which cities have more than one cities? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, ...
how many students are from each city, and which cities have more than one cities?
dorm_1
select fname , lname from student where major != (select major from student group by major order by count(*) desc limit 1)
Question: find the first and last name of students who are not in the largest major. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_nu...
find the first and last name of students who are not in the largest major.
dorm_1
select fname , lname from student where major != (select major from student group by major order by count(*) desc limit 1)
Question: what is the first and last name of the students who are not in the largest major? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, ...
what is the first and last name of the students who are not in the largest major?
dorm_1
select count(*) , sex from student where age > (select avg(age) from student) group by sex
Question: find the number of students whose age is older than the average age for each gender. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormi...
find the number of students whose age is older than the average age for each gender.
dorm_1
select count(*) , sex from student where age > (select avg(age) from student) group by sex
Question: how many students are older than average for each gender? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Ha...
how many students are older than average for each gender?
dorm_1
select avg(t1.age) , t3.dorm_name from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid group by t3.dorm_name
Question: find the average age of students living in each dorm and the name of dorm. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_nu...
find the average age of students living in each dorm and the name of dorm.
dorm_1
select avg(t1.age) , t3.dorm_name from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid group by t3.dorm_name
Question: what is the average age for each dorm and what are the names of each dorm? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_nu...
what is the average age for each dorm and what are the names of each dorm?
dorm_1
select count(*) , t1.dormid from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid where t1.student_capacity > 100 group by t1.dormid
Question: find the number of amenities for each of the dorms that can accommodate more than 100 students. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> s...
find the number of amenities for each of the dorms that can accommodate more than 100 students.
dorm_1
select count(*) , t1.dormid from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid where t1.student_capacity > 100 group by t1.dormid
Question: for each dorm, how many amenities does it have? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_amenity....
for each dorm, how many amenities does it have?
dorm_1
select count(*) , t3.dorm_name from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid where t1.age > 20 group by t3.dorm_name
Question: find the number of students who is older than 20 in each dorm. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Join...
find the number of students who is older than 20 in each dorm.
dorm_1
select count(*) , t3.dorm_name from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid where t1.age > 20 group by t3.dorm_name
Question: how many students are older than 20 in each dorm? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_amenit...
how many students are older than 20 in each dorm?
dorm_1
select t1.fname from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid where t3.dorm_name = 'smith hall'
Question: find the first name of students who are living in the smith hall. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | J...
find the first name of students who are living in the smith hall.
dorm_1
select t1.fname from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid where t3.dorm_name = 'smith hall'
Question: what are the first names of all students in smith hall? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_...
what are the first names of all students in smith hall?
dorm_1
select avg(t1.age) from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid where t3.student_capacity = (select max(student_capacity) from dorm)
Question: find the average age of students who are living in the dorm with the largest capacity. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dor...
find the average age of students who are living in the dorm with the largest capacity.
dorm_1
select avg(t1.age) from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid where t3.student_capacity = (select max(student_capacity) from dorm)
Question: what is the average age of students who are living in the dorm with the largest capacity? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, ...
what is the average age of students who are living in the dorm with the largest capacity?
dorm_1
select count(*) from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid where t3.gender = 'm'
Question: find the total number of students living in the male dorm (with gender m). | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_nu...
find the total number of students living in the male dorm (with gender m).
dorm_1
select count(*) from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid where t3.gender = 'm'
Question: what are the total number of students who are living in a male dorm? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. ...
what are the total number of students who are living in a male dorm?
dorm_1
select count(*) from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid where t3.dorm_name = 'smith hall' and t1.sex = 'f'
Question: find the number of female students (with f sex) living in smith hall | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. ...
find the number of female students (with f sex) living in smith hall
dorm_1
select count(*) from student as t1 join lives_in as t2 on t1.stuid = t2.stuid join dorm as t3 on t3.dormid = t2.dormid where t3.dorm_name = 'smith hall' and t1.sex = 'f'
Question: how many female students live in smith hall? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_amenity.ame...
how many female students live in smith hall?
dorm_1
select t3.amenity_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t1.dorm_name = 'smith hall'
Question: find the name of amenities smith hall dorm have. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_amenity...
find the name of amenities smith hall dorm have.
dorm_1
select t3.amenity_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t1.dorm_name = 'smith hall'
Question: what are the names of the amenities that smith hall has? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has...
what are the names of the amenities that smith hall has?
dorm_1
select t3.amenity_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t1.dorm_name = 'smith hall' order by t3.amenity_name
Question: find the name of amenities smith hall dorm have. ordered the results by amenity names. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dor...
find the name of amenities smith hall dorm have. ordered the results by amenity names.
dorm_1
select t3.amenity_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t1.dorm_name = 'smith hall' order by t3.amenity_name
Question: what amenities does smith hall have in alphabetical order? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: H...
what amenities does smith hall have in alphabetical order?
dorm_1
select t1.amenity_name from dorm_amenity as t1 join has_amenity as t2 on t1.amenid = t2.amenid group by t2.amenid order by count(*) desc limit 1
Question: find the name of amenity that is most common in all dorms. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: H...
find the name of amenity that is most common in all dorms.
dorm_1
select t1.amenity_name from dorm_amenity as t1 join has_amenity as t2 on t1.amenid = t2.amenid group by t2.amenid order by count(*) desc limit 1
Question: what is the most common amenity in the dorms? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: Has_amenity.am...
what is the most common amenity in the dorms?
dorm_1
select t1.fname from student as t1 join lives_in as t2 on t1.stuid = t2.stuid where t2.dormid in (select t2.dormid from dorm as t3 join has_amenity as t4 on t3.dormid = t4.dormid join dorm_amenity as t5 on t4.amenid = t5.amenid group by t3.dormid order by count(*) desc limit 1)
Question: find the first name of students who are living in the dorm that has most number of amenities. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stu...
find the first name of students who are living in the dorm that has most number of amenities.
dorm_1
select t1.fname from student as t1 join lives_in as t2 on t1.stuid = t2.stuid where t2.dormid in (select t2.dormid from dorm as t3 join has_amenity as t4 on t3.dormid = t4.dormid join dorm_amenity as t5 on t4.amenid = t5.amenid group by t3.dormid order by count(*) desc limit 1)
Question: what are the first names of all students who live in the dorm with the most amenities? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dor...
what are the first names of all students who live in the dorm with the most amenities?
dorm_1
select t1.dorm_name , t1.student_capacity from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid group by t2.dormid order by count(*) limit 1
Question: find the name and capacity of the dorm with least number of amenities. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number...
find the name and capacity of the dorm with least number of amenities.
dorm_1
select t1.dorm_name , t1.student_capacity from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid group by t2.dormid order by count(*) limit 1
Question: what is the name and capacity of the dorm with the fewest amount of amenities? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, roo...
what is the name and capacity of the dorm with the fewest amount of amenities?
dorm_1
select dorm_name from dorm except select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t3.amenity_name = 'tv lounge'
Question: find the name of dorms that do not have amenity tv lounge. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Joins: H...
find the name of dorms that do not have amenity tv lounge.
dorm_1
select dorm_name from dorm except select t1.dorm_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t3.amenity_name = 'tv lounge'
Question: what are the names of the dorm that does not have a tv lounge? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dormid, room_number. | Join...
what are the names of the dorm that does not have a tv lounge?
dorm_1
select t1.fname , t1.lname from student as t1 join lives_in as t2 on t1.stuid = t2.stuid where t2.dormid in (select t3.dormid from has_amenity as t3 join dorm_amenity as t4 on t3.amenid = t4.amenid where t4.amenity_name = 'tv lounge')
Question: find the first and last name of students who are living in the dorms that have amenity tv lounge. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in ->...
find the first and last name of students who are living in the dorms that have amenity tv lounge.
dorm_1
select t1.fname , t1.lname from student as t1 join lives_in as t2 on t1.stuid = t2.stuid where t2.dormid in (select t3.dormid from has_amenity as t3 join dorm_amenity as t4 on t3.amenid = t4.amenid where t4.amenity_name = 'tv lounge')
Question: what are the first and last names of all students who are living in a dorm with a tv lounge? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stui...
what are the first and last names of all students who are living in a dorm with a tv lounge?
dorm_1
select t1.fname , t1.age from student as t1 join lives_in as t2 on t1.stuid = t2.stuid where t2.dormid not in (select t3.dormid from has_amenity as t3 join dorm_amenity as t4 on t3.amenid = t4.amenid where t4.amenity_name = 'tv lounge')
Question: find the first name and age of students who are living in the dorms that do not have amenity tv lounge. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives...
find the first name and age of students who are living in the dorms that do not have amenity tv lounge.
dorm_1
select t1.fname , t1.age from student as t1 join lives_in as t2 on t1.stuid = t2.stuid where t2.dormid not in (select t3.dormid from has_amenity as t3 join dorm_amenity as t4 on t3.amenid = t4.amenid where t4.amenity_name = 'tv lounge')
Question: what is the first name and age of every student who lives in a dorm with a tv lounge? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid, dorm...
what is the first name and age of every student who lives in a dorm with a tv lounge?
dorm_1
select t3.amenity_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid join lives_in as t4 on t4.dormid = t1.dormid join student as t5 on t5.stuid = t4.stuid where t5.lname = 'smith'
Question: find the name of amenities of the dorm where the student with last name smith is living in. | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid...
find the name of amenities of the dorm where the student with last name smith is living in.
dorm_1
select t3.amenity_name from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid join lives_in as t4 on t4.dormid = t1.dormid join student as t5 on t5.stuid = t4.stuid where t5.lname = 'smith'
Question: what are the amenities in the dorm that a student who has the last name of smith lives in? | Tables: Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Dorm -> dormid, dorm_name, student_capacity, gender. Dorm_amenity -> amenid, amenity_name. Has_amenity -> dormid, amenid. Lives_in -> stuid,...
what are the amenities in the dorm that a student who has the last name of smith lives in?
customer_complaints
select count(*) from customers
Question: how many customers are there? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, parent_product_id, product_category_code, ...
how many customers are there?
customer_complaints
select count(*) from customers
Question: count the number of customers. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, parent_product_id, product_category_code,...
count the number of customers.
customer_complaints
select email_address , phone_number from customers order by email_address , phone_number
Question: find the emails and phone numbers of all the customers, ordered by email address and phone number. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_numbe...
find the emails and phone numbers of all the customers, ordered by email address and phone number.
customer_complaints
select email_address , phone_number from customers order by email_address , phone_number
Question: what are the emails and phone numbers of all customers, sorted by email address and phone number? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number...
what are the emails and phone numbers of all customers, sorted by email address and phone number?
customer_complaints
select town_city from customers where customer_type_code = 'good credit rating' group by town_city order by count(*) limit 1
Question: which city has the least number of customers whose type code is 'good credit rating'? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -...
which city has the least number of customers whose type code is 'good credit rating'?
customer_complaints
select town_city from customers where customer_type_code = 'good credit rating' group by town_city order by count(*) limit 1
Question: return the city with the customer type code 'good credit rating' that had the fewest customers. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. ...
return the city with the customer type code 'good credit rating' that had the fewest customers.
customer_complaints
select t1.product_name , count(*) from products as t1 join complaints as t2 on t1.product_id = t2.product_id group by t1.product_name
Question: list the name of all products along with the number of complaints that they have received. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Produ...
list the name of all products along with the number of complaints that they have received.
customer_complaints
select t1.product_name , count(*) from products as t1 join complaints as t2 on t1.product_id = t2.product_id group by t1.product_name
Question: what are all the different product names, and how many complains has each received? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> ...
what are all the different product names, and how many complains has each received?
customer_complaints
select t1.email_address from customers as t1 join complaints as t2 on t1.customer_id = t2.customer_id group by t1.customer_id order by count(*) limit 1
Question: find the emails of customers who has filed a complaints of the product with the most complaints. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number....
find the emails of customers who has filed a complaints of the product with the most complaints.
customer_complaints
select t1.email_address from customers as t1 join complaints as t2 on t1.customer_id = t2.customer_id group by t1.customer_id order by count(*) limit 1
Question: what are the emails of customers who have filed complaints on the product which has had the greatest number of complaints? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, em...
what are the emails of customers who have filed complaints on the product which has had the greatest number of complaints?
customer_complaints
select distinct t1.product_name from products as t1 join complaints as t2 on t1.product_id = t2.product_id join customers as t3 group by t3.customer_id order by count(*) limit 1
Question: which products has been complained by the customer who has filed least amount of complaints? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Pro...
which products has been complained by the customer who has filed least amount of complaints?
customer_complaints
select distinct t1.product_name from products as t1 join complaints as t2 on t1.product_id = t2.product_id join customers as t3 group by t3.customer_id order by count(*) limit 1
Question: return the names of products that have had complaints filed by the customer who has filed the fewest complaints. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_addres...
return the names of products that have had complaints filed by the customer who has filed the fewest complaints.
customer_complaints
select t1.phone_number from customers as t1 join complaints as t2 on t1.customer_id = t2.customer_id order by t2.date_complaint_raised desc limit 1
Question: what is the phone number of the customer who has filed the most recent complaint? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> pr...
what is the phone number of the customer who has filed the most recent complaint?
customer_complaints
select t1.phone_number from customers as t1 join complaints as t2 on t1.customer_id = t2.customer_id order by t2.date_complaint_raised desc limit 1
Question: return the phone number of the customer who filed the complaint that was raised most recently. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. P...
return the phone number of the customer who filed the complaint that was raised most recently.
customer_complaints
select email_address , phone_number from customers where customer_id not in (select customer_id from complaints)
Question: find the email and phone number of the customers who have never filed a complaint before. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Produc...
find the email and phone number of the customers who have never filed a complaint before.
customer_complaints
select email_address , phone_number from customers where customer_id not in (select customer_id from complaints)
Question: what are the emails and phone numbers of custoemrs who have never filed a complaint? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products ->...
what are the emails and phone numbers of custoemrs who have never filed a complaint?
customer_complaints
select phone_number from customers union select phone_number from staff
Question: find the phone number of all the customers and staff. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, parent_product_id,...
find the phone number of all the customers and staff.
customer_complaints
select phone_number from customers union select phone_number from staff
Question: what are the phone numbers of all customers and all staff members? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, paren...
what are the phone numbers of all customers and all staff members?
customer_complaints
select product_description from products where product_name = 'chocolate'
Question: what is the description of the product named 'chocolate'? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, parent_product...
what is the description of the product named 'chocolate'?
customer_complaints
select product_description from products where product_name = 'chocolate'
Question: return the description of the product called 'chocolate'. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, parent_product...
return the description of the product called 'chocolate'.
customer_complaints
select product_name , product_category_code from products order by product_price desc limit 1
Question: find the name and category of the most expensive product. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, parent_product...
find the name and category of the most expensive product.
customer_complaints
select product_name , product_category_code from products order by product_price desc limit 1
Question: what is the name and category code of the product with the highest price? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id...
what is the name and category code of the product with the highest price?
customer_complaints
select product_price from products where product_id not in (select product_id from complaints)
Question: find the prices of products which has never received a single complaint. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id,...
find the prices of products which has never received a single complaint.
customer_complaints
select product_price from products where product_id not in (select product_id from complaints)
Question: what are the prices of products that have never gotten a complaint? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, pare...
what are the prices of products that have never gotten a complaint?
customer_complaints
select avg(product_price) , product_category_code from products group by product_category_code
Question: what is the average price of the products for each category? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, parent_prod...
what is the average price of the products for each category?
customer_complaints
select avg(product_price) , product_category_code from products group by product_category_code
Question: return the average price of products that have each category code. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, paren...
return the average price of products that have each category code.
customer_complaints
select t1.last_name from staff as t1 join complaints as t2 on t1.staff_id = t2.staff_id join products as t3 on t2.product_id = t3.product_id order by t3.product_price limit 1
Question: find the last name of the staff member who processed the complaint of the cheapest product. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Prod...
find the last name of the staff member who processed the complaint of the cheapest product.
customer_complaints
select t1.last_name from staff as t1 join complaints as t2 on t1.staff_id = t2.staff_id join products as t3 on t2.product_id = t3.product_id order by t3.product_price limit 1
Question: what is the last name of the staff member in charge of the complaint on the product with the lowest price? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, pho...
what is the last name of the staff member in charge of the complaint on the product with the lowest price?
customer_complaints
select complaint_status_code from complaints group by complaint_status_code having count(*) > 3
Question: which complaint status has more than 3 records on file? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, parent_product_i...
which complaint status has more than 3 records on file?
customer_complaints
select complaint_status_code from complaints group by complaint_status_code having count(*) > 3
Question: return complaint status codes have more than 3 corresponding complaints? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id,...
return complaint status codes have more than 3 corresponding complaints?
customer_complaints
select last_name from staff where email_address like '%wrau%'
Question: find the last name of the staff whose email address contains 'wrau'. | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products -> product_id, par...
find the last name of the staff whose email address contains 'wrau'.
customer_complaints
select last_name from staff where email_address like '%wrau%'
Question: what are the last names of staff with email addressed containing the substring 'wrau'? | Tables: Staff -> staff_id, gender, first_name, last_name, email_address, phone_number. Customers -> customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number. Products ...
what are the last names of staff with email addressed containing the substring 'wrau'?