db_id
stringlengths 4
31
| text
stringlengths 370
4.84k
|
---|---|
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the numbers of different majors and cities. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( distinct major ) , count ( distinct city_code ) from student |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: How many different majors are there and how many different city codes are there for each student? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( distinct major ) , count ( distinct city_code ) from student |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the name of dorms which have both TV Lounge and Study Room as amenities. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm.dorm_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'TV Lounge' intersect select dorm.dorm_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'Study Room' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the name of the dorm with both a TV Lounge and Study Room listed as amenities? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm.dorm_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'TV Lounge' intersect select dorm.dorm_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'Study Room' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the name of dorms which have TV Lounge but no Study Room as amenity. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm.dorm_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'TV Lounge' except select dorm.dorm_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'Study Room' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the name of each dorm that has a TV Lounge but no study rooms? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm.dorm_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'TV Lounge' except select dorm.dorm_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'Study Room' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: 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. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select lname from student where sex = 'F' and city_code = 'BAL' union select lname from student where sex = 'M' and age < 20 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: 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? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select lname from student where sex = 'F' and city_code = 'BAL' union select lname from student where sex = 'M' and age < 20 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the name of the dorm with the largest capacity. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_name from dorm order by student_capacity desc limit 1 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the names of the dorm with the largest capacity? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_name from dorm order by student_capacity desc limit 1 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: List in alphabetic order all different amenities. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select amenity_name from dorm_amenity order by amenity_name asc |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the different dorm amenity names in alphabetical order? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select amenity_name from dorm_amenity order by amenity_name asc |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the code of city where most of students are living in. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select city_code from student group by city_code order by count ( * ) desc limit 1 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the code of the city with the most students? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select city_code from student group by city_code order by count ( * ) desc limit 1 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the first and last name of students whose age is younger than the average age. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select fname , lname from student where age < ( select avg ( age ) from student ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the first and last name of all students who are younger than average? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select fname , lname from student where age < ( select avg ( age ) from student ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: 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. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select fname , lname from student where city_code != 'HKG' order by age asc |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the first and last names of all students who are not living in the city HKG and order the results by age? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select fname , lname from student where city_code != 'HKG' order by age asc |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: List name of all amenities which Anonymous Donor Hall has, and sort the results in alphabetic order. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_amenity.amenity_name from dorm_amenity join has_amenity on has_amenity.amenid = dorm_amenity.amenid join dorm on has_amenity.dormid = dorm.dormid where dorm.dorm_name = 'Anonymous Donor Hall' order by dorm_amenity.amenity_name asc |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the amenities in alphabetical order that Anonymous Donor Hall has? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_amenity.amenity_name from dorm_amenity join has_amenity on has_amenity.amenid = dorm_amenity.amenid join dorm on has_amenity.dormid = dorm.dormid where dorm.dorm_name = 'Anonymous Donor Hall' order by dorm_amenity.amenity_name asc |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the number of dorms and total capacity for each gender. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , sum ( student_capacity ) , gender from dorm group by gender |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: How many dorms are there and what is the total capacity for each gender? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , sum ( student_capacity ) , gender from dorm group by gender |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the average and oldest age for students with different sex. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select avg ( age ) , max ( age ) , sex from student group by sex |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the average and oldest age for each gender of student? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select avg ( age ) , max ( age ) , sex from student group by sex |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the number of students in each major. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , major from student group by major |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: How many students are there in each major? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , major from student group by major |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the number and average age of students living in each city. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , avg ( age ) , city_code from student group by city_code |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: How many students live in each city and what are their average ages? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , avg ( age ) , city_code from student group by city_code |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the average age and number of male students (with sex M) from each city. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , avg ( age ) , city_code from student where sex = 'M' group by city_code |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the average age and how many male students are there in each city? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , avg ( age ) , city_code from student where sex = 'M' group by city_code |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the number of students for the cities where have more than one student. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , city_code from student group by city_code having count ( * ) > 1 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: How many students are from each city, and which cities have more than one cities? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , city_code from student group by city_code having count ( * ) > 1 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the first and last name of students who are not in the largest major. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select fname , lname from student where major != ( select major from student group by major order by count ( * ) desc limit 1 ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the first and last name of the students who are not in the largest major? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select fname , lname from student where major != ( select major from student group by major order by count ( * ) desc limit 1 ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the number of students whose age is older than the average age for each gender. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , sex from student where age > ( select avg ( age ) from student ) group by sex |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: How many students are older than average for each gender? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , sex from student where age > ( select avg ( age ) from student ) group by sex |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the average age of students living in each dorm and the name of dorm. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select avg ( student.age ) , dorm.dorm_name from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid group by dorm.dorm_name |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the average age for each dorm and what are the names of each dorm? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select avg ( student.age ) , dorm.dorm_name from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid group by dorm.dorm_name |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the number of amenities for each of the dorms that can accommodate more than 100 students. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , dorm.dormid from dorm join has_amenity on dorm.dormid = has_amenity.dormid where dorm.student_capacity > 100 group by dorm.dormid |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: For each dorm, how many amenities does it have? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , dorm.dormid from dorm join has_amenity on dorm.dormid = has_amenity.dormid where dorm.student_capacity > 100 group by dorm.dormid |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the number of students who is older than 20 in each dorm. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , dorm.dorm_name from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where student.age > 20 group by dorm.dorm_name |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: How many students are older than 20 in each dorm? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) , dorm.dorm_name from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where student.age > 20 group by dorm.dorm_name |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the first name of students who are living in the Smith Hall. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select student.fname from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.dorm_name = 'Smith Hall' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the first names of all students in Smith Hall? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select student.fname from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.dorm_name = 'Smith Hall' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the average age of students who are living in the dorm with the largest capacity. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select avg ( student.age ) from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.student_capacity = ( select max ( student_capacity ) from dorm ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the average age of students who are living in the dorm with the largest capacity? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select avg ( student.age ) from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.student_capacity = ( select max ( student_capacity ) from dorm ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the total number of students living in the male dorm (with gender M). | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.gender = 'M' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the total number of students who are living in a male dorm? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.gender = 'M' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the number of female students (with F sex) living in Smith Hall | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.dorm_name = 'Smith Hall' and student.sex = 'F' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: How many female students live in Smith Hall? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select count ( * ) from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.dorm_name = 'Smith Hall' and student.sex = 'F' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the name of amenities Smith Hall dorm have. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_amenity.amenity_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm.dorm_name = 'Smith Hall' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the names of the amenities that Smith Hall has? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_amenity.amenity_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm.dorm_name = 'Smith Hall' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the name of amenities Smith Hall dorm have. ordered the results by amenity names. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_amenity.amenity_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm.dorm_name = 'Smith Hall' order by dorm_amenity.amenity_name asc |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What amenities does Smith Hall have in alphabetical order? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_amenity.amenity_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm.dorm_name = 'Smith Hall' order by dorm_amenity.amenity_name asc |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the name of amenity that is most common in all dorms. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_amenity.amenity_name from dorm_amenity join has_amenity on dorm_amenity.amenid = has_amenity.amenid group by has_amenity.amenid order by count ( * ) desc limit 1 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the most common amenity in the dorms? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_amenity.amenity_name from dorm_amenity join has_amenity on dorm_amenity.amenid = has_amenity.amenid group by has_amenity.amenid order by count ( * ) desc limit 1 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the first name of students who are living in the dorm that has most number of amenities. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select student.fname from student join lives_in on student.stuid = lives_in.stuid where lives_in.dormid in ( select lives_in.dormid from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid group by dorm.dormid order by count ( * ) desc limit 1 ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the first names of all students who live in the dorm with the most amenities? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select student.fname from student join lives_in on student.stuid = lives_in.stuid where lives_in.dormid in ( select lives_in.dormid from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid group by dorm.dormid order by count ( * ) desc limit 1 ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the name and capacity of the dorm with least number of amenities. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm.dorm_name , dorm.student_capacity from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid group by has_amenity.dormid order by count ( * ) asc limit 1 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the name and capacity of the dorm with the fewest amount of amenities? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm.dorm_name , dorm.student_capacity from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid group by has_amenity.dormid order by count ( * ) asc limit 1 |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the name of dorms that do not have amenity TV Lounge. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_name from dorm except select dorm.dorm_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'TV Lounge' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the names of the dorm that does not have a TV Lounge? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_name from dorm except select dorm.dorm_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'TV Lounge' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the first and last name of students who are living in the dorms that have amenity TV Lounge. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select student.fname , student.lname from student join lives_in on student.stuid = lives_in.stuid where lives_in.dormid in ( select has_amenity.dormid from has_amenity join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'TV Lounge' ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the first and last names of all students who are living in a dorm with a TV Lounge? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select student.fname , student.lname from student join lives_in on student.stuid = lives_in.stuid where lives_in.dormid in ( select has_amenity.dormid from has_amenity join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'TV Lounge' ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the first name and age of students who are living in the dorms that do not have amenity TV Lounge. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select student.fname , student.age from student join lives_in on student.stuid = lives_in.stuid where lives_in.dormid not in ( select has_amenity.dormid from has_amenity join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'TV Lounge' ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the first name and age of every student who lives in a dorm with a TV Lounge? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select student.fname , student.age from student join lives_in on student.stuid = lives_in.stuid where lives_in.dormid not in ( select has_amenity.dormid from has_amenity join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm_amenity.amenity_name = 'TV Lounge' ) |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the name of amenities of the dorm where the student with last name Smith is living in. | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_amenity.amenity_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid join lives_in on lives_in.dormid = dorm.dormid join student on student.stuid = lives_in.stuid where student.lname = 'Smith' |
dorm_1 | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the amenities in the dorm that a student who has the last name of Smith lives in? | 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 | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid |
### Response:
select dorm_amenity.amenity_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid join lives_in on lives_in.dormid = dorm.dormid join student on student.stuid = lives_in.stuid where student.lname = 'Smith' |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: How many customers are there? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select count ( * ) from customers |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Count the number of customers. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select count ( * ) from customers |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the emails and phone numbers of all the customers, ordered by email address and phone number. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select email_address , phone_number from customers order by email_address asc , phone_number |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the emails and phone numbers of all customers, sorted by email address and phone number? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select email_address , phone_number from customers order by email_address asc , phone_number |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Which city has the least number of customers whose type code is "Good Credit Rating"? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select town_city from customers where customer_type_code = 'Good Credit Rating' group by town_city order by count ( * ) asc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Return the city with the customer type code "Good Credit Rating" that had the fewest customers. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select town_city from customers where customer_type_code = 'Good Credit Rating' group by town_city order by count ( * ) asc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: List the name of all products along with the number of complaints that they have received. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select products.product_name , count ( * ) from products join complaints on products.product_id = complaints.product_id group by products.product_name |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are all the different product names, and how many complains has each received? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select products.product_name , count ( * ) from products join complaints on products.product_id = complaints.product_id group by products.product_name |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the emails of customers who has filed a complaints of the product with the most complaints. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select customers.email_address from customers join complaints on customers.customer_id = complaints.customer_id group by customers.customer_id order by count ( * ) asc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the emails of customers who have filed complaints on the product which has had the greatest number of complaints? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select customers.email_address from customers join complaints on customers.customer_id = complaints.customer_id group by customers.customer_id order by count ( * ) asc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Which products has been complained by the customer who has filed least amount of complaints? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select distinct products.product_name from products join complaints on products.product_id = complaints.product_id join customers group by customers.customer_id order by count ( * ) asc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Return the names of products that have had complaints filed by the customer who has filed the fewest complaints. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select distinct products.product_name from products join complaints on products.product_id = complaints.product_id join customers group by customers.customer_id order by count ( * ) asc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the phone number of the customer who has filed the most recent complaint? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select customers.phone_number from customers join complaints on customers.customer_id = complaints.customer_id order by complaints.date_complaint_raised desc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Return the phone number of the customer who filed the complaint that was raised most recently. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select customers.phone_number from customers join complaints on customers.customer_id = complaints.customer_id order by complaints.date_complaint_raised desc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the email and phone number of the customers who have never filed a complaint before. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select email_address , phone_number from customers where customer_id not in ( select customer_id from complaints ) |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the emails and phone numbers of custoemrs who have never filed a complaint? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select email_address , phone_number from customers where customer_id not in ( select customer_id from complaints ) |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the phone number of all the customers and staff. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select phone_number from customers union select phone_number from staff |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the phone numbers of all customers and all staff members? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select phone_number from customers union select phone_number from staff |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the description of the product named "Chocolate"? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select product_description from products where product_name = 'Chocolate' |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Return the description of the product called "Chocolate". | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select product_description from products where product_name = 'Chocolate' |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the name and category of the most expensive product. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select product_name , product_category_code from products order by product_price desc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the name and category code of the product with the highest price? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select product_name , product_category_code from products order by product_price desc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the prices of products which has never received a single complaint. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select product_price from products where product_id not in ( select product_id from complaints ) |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the prices of products that have never gotten a complaint? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select product_price from products where product_id not in ( select product_id from complaints ) |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the average price of the products for each category? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select avg ( product_price ) , product_category_code from products group by product_category_code |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Return the average price of products that have each category code. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select avg ( product_price ) , product_category_code from products group by product_category_code |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the last name of the staff member who processed the complaint of the cheapest product. | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select staff.last_name from staff join complaints on staff.staff_id = complaints.staff_id join products on complaints.product_id = products.product_id order by products.product_price asc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What is the last name of the staff member in charge of the complaint on the product with the lowest price? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select staff.last_name from staff join complaints on staff.staff_id = complaints.staff_id join products on complaints.product_id = products.product_id order by products.product_price asc limit 1 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Which complaint status has more than 3 records on file? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select complaint_status_code from complaints group by complaint_status_code having count ( * ) > 3 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Return complaint status codes have more than 3 corresponding complaints? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select complaint_status_code from complaints group by complaint_status_code having count ( * ) > 3 |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: Find the last name of the staff whose email address contains "wrau". | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select last_name from staff where email_address like '%wrau%' |
customer_complaints | Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Convert text to sql: What are the last names of staff with email addressed containing the substring "wrau"? | 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 , date_product_first_available , date_product_discontinued , product_name , product_description , product_price | complaints : complaint_id , product_id , customer_id , complaint_outcome_code , complaint_status_code , complaint_type_code , date_complaint_raised , date_complaint_closed , staff_id | complaints.customer_id = customers.customer_id | complaints.product_id = products.product_id | complaints.staff_id = staff.staff_id |
### Response:
select last_name from staff where email_address like '%wrau%' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.