index
int32
0
1.03k
db_id
stringclasses
20 values
question
stringlengths
18
174
db_info
stringlengths
1
1.79k
ground_truth
stringlengths
20
474
900
network_1
Show name of all students who have some friends and also are liked by someone else.
| highschooler: id, name | friend: friend_id, student_id | likes: student_id, liked_id |
select highschooler.name from friend join highschooler on likes.student_id = highschooler.id intersect select highschooler.name from likes join highschooler on likes.liked_id = highschooler.id
901
network_1
What are the names of high schoolers who both have friends and are liked?
| highschooler: id, name, grade | friend: student_id, friend_id | likes: student_id, liked_id | friend.friend_id = highschooler.id | friend.student_id = highschooler.id | likes.student_id = highschooler.id | likes.liked_id = highschooler.id |
select highschooler.name from friend join highschooler on likes.student_id = highschooler.id intersect select highschooler.name from likes join highschooler on likes.liked_id = highschooler.id
902
network_1
Count the number of likes for each student id.
| likes : student_id, liked_id | highschooler : id, name, grade | friend : student_id, friend_id |
select student_id , count ( * ) from likes group by student_id
903
network_1
How many likes correspond to each student id?
| highschooler: id, name, grade | friend: student_id, friend_id | likes: student_id, liked_id |
select student_id , count ( * ) from likes group by student_id
904
network_1
Show the names of high schoolers who have likes, and numbers of likes for each.
| highschooler: name, id, grade | likes: student_id, liked_id |
select highschooler.name , count ( * ) from likes join highschooler on likes.student_id = highschooler.id group by likes.student_id
905
network_1
What are the names of high schoolers who have likes, and how many likes does each have?
| highschooler: name, id, grade | likes: student_id, liked_id | friend: student_id, friend_id | friend.friend_id = highschooler.id | friend.student_id = highschooler.id | likes.student_id = highschooler.id | likes.liked_id = highschooler.id |
select highschooler.name , count ( * ) from likes join highschooler on likes.student_id = highschooler.id group by likes.student_id
906
network_1
What is the name of the high schooler who has the greatest number of likes?
| highschooler: name, id, grade | likes: student_id, liked_id | friend: student_id, friend_id | likes.student_id = highschooler.id |
select highschooler.name from likes join highschooler on likes.student_id = highschooler.id group by likes.student_id order by count ( * ) desc limit 1
907
network_1
Give the name of the student with the most likes.
| highschooler: name, id, grade | likes: liked_id, student_id | friend: friend_id, student_id | friend.friend_id = highschooler.id | friend.student_id = highschooler.id | likes.student_id = highschooler.id | likes.liked_id = highschooler.id |
select highschooler.name from likes join highschooler on likes.student_id = highschooler.id group by likes.student_id order by count ( * ) desc limit 1
908
network_1
Show the names of students who have at least 2 likes.
| highschooler: name, id, grade | friend: student_id, friend_id | likes: student_id, liked_id |
select highschooler.name from likes join highschooler on likes.student_id = highschooler.id group by likes.student_id having count ( * ) >= 2
909
network_1
What are the names of students who have 2 or more likes?
| highschooler: id, name, grade | likes: student_id, liked_id | friend: student_id, friend_id | likes.student_id = highschooler.id | likes.liked_id = highschooler.id | friend.friend_id = highschooler.id | friend.student_id = highschooler.id |
select highschooler.name from likes join highschooler on likes.student_id = highschooler.id group by likes.student_id having count ( * ) >= 2
910
network_1
Show the names of students who have a grade higher than 5 and have at least 2 friends.
| highschooler: grade, name, id | friend: friend_id, student_id |
select highschooler.name from friend join highschooler on friend.student_id = highschooler.id where highschooler.grade > 5 group by friend.student_id having count ( * ) >= 2
911
network_1
What are the names of high schoolers who have a grade of over 5 and have 2 or more friends?
| highschooler: id, name, grade | friend: student_id, friend_id | likes: student_id, liked_id | friend.friend_id = highschooler.id | friend.student_id = highschooler.id | likes.student_id = highschooler.id | likes.liked_id = highschooler.id |
select highschooler.name from friend join highschooler on friend.student_id = highschooler.id where highschooler.grade > 5 group by friend.student_id having count ( * ) >= 2
912
network_1
How many likes does Kyle have?
| highschooler: name, id | likes: student_id | friend: ... | highschooler.id = likes.student_id | highschooler.friend_id = friend.student_id |
select count ( * ) from likes join highschooler on likes.student_id = highschooler.id where highschooler.name = 'Kyle'
913
network_1
Return the number of likes that the high schooler named Kyle has.
| highschooler: name, id, grade | friend: friend_id, student_id | likes: student_id, liked_id | friend.friend_id = highschooler.id | friend.student_id = highschooler.id | likes.student_id = highschooler.id | likes.liked_id = highschooler.id |
select count ( * ) from likes join highschooler on likes.student_id = highschooler.id where highschooler.name = 'Kyle'
914
network_1
Find the average grade of all students who have some friends.
| highschooler: id, grade, name | friend: student_id, friend_id | likes: none |
select avg ( grade ) from highschooler where id in ( select friend.student_id from friend join highschooler on friend.student_id = highschooler.id )
915
network_1
What is the average grade of students who have friends?
| highschooler: grade, id, name | friend: student_id, friend_id | likes: student_id, liked_id |
select avg ( grade ) from highschooler where id in ( select friend.student_id from friend join highschooler on friend.student_id = highschooler.id )
916
network_1
Find the minimum grade of students who have no friends.
| highschooler: grade, id, name | friend: student_id, friend_id | likes: student_id, liked_id |
select min ( grade ) from highschooler where id not in ( select friend.student_id from friend join highschooler on friend.student_id = highschooler.id )
917
network_1
What is the lowest grade of students who do not have any friends?
| highschooler: grade, id, name | friend: student_id, friend_id | likes: student_id, liked_id | friend.friend_id = highschooler.id | friend.student_id = highschooler.id | likes.student_id = highschooler.id | likes.liked_id = highschooler.id |
select min ( grade ) from highschooler where id not in ( select friend.student_id from friend join highschooler on friend.student_id = highschooler.id )
918
dog_kennels
Which states have both owners and professionals living there?
| owners: state, city, owner_id, first_name, last_name, street, zip_code, email_address, home_phone, cell_number | professionals: state, city, professional_id, role_code, first_name, street, zip_code, last_name, email_address, home_phone, cell_number | dogs: owner_id, dog_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | breeds: breed_code, breed_name | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | charges: charge_id, charge_type, charge_amount | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | treatments.professional_id = professionals.professional_id |
select state from owners intersect select state from professionals
919
dog_kennels
Find the states where both owners and professionals live.
| owners: state, owner_id | professionals: state, professional_id | dogs: owner_id | treatments: professional_id | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | dogs.owner_id = owners.owner_id | treatments.professional_id = professionals.professional_id | treatments.dog_id = dogs.dog_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code |
select state from owners intersect select state from professionals
920
dog_kennels
What is the average age of the dogs who have gone through any treatments?
| treatments: dog_id, treatment_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs: dog_id, age, owner_id, abandoned_yn, breed_code, size_code, name, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | sizes: size_code, size_description | breeds: breed_code, breed_name | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatment_types: treatment_type_code , treatment_type_description | charges: charge_id , charge_type , charge_amount | treatments.dog_id = dogs.dog_id | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select avg ( age ) from dogs where dog_id in ( select dog_id from treatments )
921
dog_kennels
Find the average age of the dogs who went through treatments.
| dogs: dog_id, age | treatments: treatment_id, dog_id | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: abandoned_yn, breed_code, size_code, name, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | dogs.owner_id = owners.owner_id |
select avg ( age ) from dogs where dog_id in ( select dog_id from treatments )
922
dog_kennels
Which professionals live in the state of Indiana or have done treatment on more than 2 treatments? List his or her id, last name and cell phone.
| professionals: professional_id, state, last_name, cell_number, role_code, first_name, street, city, zip_code, email_address, home_phone | treatments: professional_id, treatment_type_code, date_of_treatment, treatment_id, dog_id, cost_of_treatment | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | dogs.owner_id = owners.owner_id | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select professional_id , last_name , cell_number from professionals where state = 'Indiana' union select professionals.professional_id , professionals.last_name , professionals.cell_number from professionals join treatments on professionals.professional_id = treatments.professional_id group by professionals.professional_id having count ( * ) > 2
923
dog_kennels
Find the id, last name and cell phone of the professionals who live in the state of Indiana or have performed more than two treatments.
| professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | dogs.owner_id = owners.owner_id | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select professional_id , last_name , cell_number from professionals where state = 'Indiana' union select professionals.professional_id , professionals.last_name , professionals.cell_number from professionals join treatments on professionals.professional_id = treatments.professional_id group by professionals.professional_id having count ( * ) > 2
924
dog_kennels
Which dogs have not cost their owner more than 1000 for treatment ? List the dog names .
| treatments: cost_of_treatment, dog_id | dogs: name, dog_id | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments.dog_id = dogs.dog_id | dogs.breed_code = breeds.breed_code | dogs.size_code = sizes.size_code | treatments.treatment_type_code = treatment_types.treatment_type_code |
select name from dogs where dog_id not in ( select dog_id from treatments group by dog_id having sum ( cost_of_treatment ) > 1000 )
925
dog_kennels
What are the names of the dogs for which the owner has not spend more than 1000 for treatment ?
| dogs: dog_id, owner_id, name | owners: owner_id | treatments: treatment_id, dog_id, cost_of_treatment | breeds: breed_code | sizes: size_code | treatment_types: treatment_type_code | charges: charge_id, charge_amount | professionals: professional_id | treatments.dog_id = dogs.dog_id | dogs.owner_id = owners.owner_id | treatsments.treatment_type_code = treatment_types.treatment_type_code | dogs.breed_code = breeds.breed_code | dogs.size_code = sizes.size_code | treatments.professional_id = professionals.professional_id |
select name from dogs where dog_id not in ( select dog_id from treatments group by dog_id having sum ( cost_of_treatment ) > 1000 )
926
dog_kennels
Which first names are used for professionals or owners but are not used as dog names?
| owners: first_name, owner_id | professionals: first_name, professional_id | dogs: name, dog_id, owner_id, breed_code, size_code | treatments: dog_id, professional_id | breeds: breed_code, breed_name | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | charges: charge_id, charge_type, charge_amount | dogs.owner_id=owners.owner_id | treatments.dog_id=dogs.dog_id | treatments.professional_id=professionals.professional_id | dogs.size_code=sizes.size_code | dogs.breed_code=breeds.breed_code | treatments.treatment_type_code=treatment_types.treatment_type_code |
select first_name from professionals union select first_name from owners except select name from dogs
927
dog_kennels
Find the first names that are used for professionals or owners but are not used as dog names.
| owners: first_name, owner_id | professionals: first_name, professional_id | dogs: name, owner_id, breed_code, size_code | treatments: dog_id, professional_id, treatment_type_code | breeds: breed_code, breed_name | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | charges: charge_id, charge_type, charge_amount | dogs.owner_id = owners.owner_id | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.treatment_type_code = treatment_types.treatment_type_code |
select first_name from professionals union select first_name from owners except select name from dogs
928
dog_kennels
Which professional did not operate any treatment on dogs? List the professional's id, role and email.
| treatments: professional_id, dog_id, treatment_id, treatment_type_code, date_of_treatment, cost_of_treatment | professionals: professional_id, role_code, email_address, first_name, last_name, street, city, state, zip_code, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id |
select professional_id , role_code , email_address from professionals except select professionals.professional_id , professionals.role_code , professionals.email_address from professionals join treatments on professionals.professional_id = treatments.professional_id
929
dog_kennels
Give me the id, role and email of the professionals who did not perform any treatment on dogs.
| professionals: professional_id, role_code, email_address | treatments: professional_id, dog_id | dogs: dog_id | owners: owner_id, email_address | treatment_types: treatment_type_code, treatment_type_description | sizes: size_code, size_description | charges: charge_id, charge_type, charge_amount | breeds: breed_code, breed_name | dogs.owner_id = owners.owner_id | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.breed_code = breeds.breed_code | dogs.size_code = sizes.size_code |
select professional_id , role_code , email_address from professionals except select professionals.professional_id , professionals.role_code , professionals.email_address from professionals join treatments on professionals.professional_id = treatments.professional_id
930
dog_kennels
Which owner owns the most dogs? List the owner id, first name and last name.
| owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | dogs.owner_id = owners.owner_id |
select dogs.owner_id , owners.first_name , owners.last_name from dogs join owners on dogs.owner_id = owners.owner_id group by dogs.owner_id order by count ( * ) desc limit 1
931
dog_kennels
Return the owner id, first name and last name of the owner who has the most dogs.
| dogs: owner_id, dog_id | owners: owner_id, first_name, last_name | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id=owners.owner_id |
select dogs.owner_id , owners.first_name , owners.last_name from dogs join owners on dogs.owner_id = owners.owner_id group by dogs.owner_id order by count ( * ) desc limit 1
932
dog_kennels
Which professionals have done at least two treatments? List the professional's id, role, and first name.
| professionals: professional_id, role_code, first_name | treatments: professional_id, treatment_id | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code |
select professionals.professional_id , professionals.role_code , professionals.first_name from professionals join treatments on professionals.professional_id = treatments.professional_id group by professionals.professional_id having count ( * ) >= 2
933
dog_kennels
What are the id, role, and first name of the professionals who have performed two or more treatments?
| professionals: professional_id, first_name, role_code, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: professional_id, dog_id, treatment_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | breeds: breed_code, breed_name | sizes: size_code, size_description | charges: charge_id, charge_type, charge_amount | treatments.professional_id = professionals.professional_id | treatments.dog_id = dogs.dog_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code |
select professionals.professional_id , professionals.role_code , professionals.first_name from professionals join treatments on professionals.professional_id = treatments.professional_id group by professionals.professional_id having count ( * ) >= 2
934
dog_kennels
What is the name of the breed with the most dogs?
| dogs: breed_code, dog_id | breeds: breed_name, breed_code | owners: owner_id | sizes: size_code | charges: charge_id | treatment_types: treatment_type_code | professionals: professional_id | treatments: treatment_id | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select breeds.breed_name from breeds join dogs on breeds.breed_code = dogs.breed_code group by breeds.breed_name order by count ( * ) desc limit 1
935
dog_kennels
Which breed do the most dogs have? Give me the breed name.
| breeds: breed_code, breed_name | dogs: dog_id, breed_code | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select breeds.breed_name from breeds join dogs on breeds.breed_code = dogs.breed_code group by breeds.breed_name order by count ( * ) desc limit 1
936
dog_kennels
Which owner has paid for the most treatments on his or her dogs? List the owner id and last name.
| treatments: cost_of_treatment, dog_id, treatment_id, professional_id, treatment_type_code, date_of_treatment | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | owners: owner_id, last_name, first_name, street, city, state, zip_code, email_address, home_phone, cell_number | breeds: breed_code, breed_name | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs.owner_id = owners.owner_id | treatments.dog_id = dogs.dog_id |
select owners.owner_id , owners.last_name from owners join dogs on owners.owner_id = dogs.owner_id join treatments on dogs.dog_id = treatments.dog_id group by owners.owner_id order by count ( * ) desc limit 1
937
dog_kennels
Tell me the owner id and last name of the owner who spent the most on treatments of his or her dogs.
| treatments: cost_of_treatment, dog_id | dogs: owner_id, dog_id | owners: owner_id, last_name | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments.dog_id = dogs.dog_id | dogs.owner_id = owners.owner_id |
select owners.owner_id , owners.last_name from owners join dogs on owners.owner_id = dogs.owner_id join treatments on dogs.dog_id = treatments.dog_id group by owners.owner_id order by count ( * ) desc limit 1
938
dog_kennels
What is the description of the treatment type that costs the least money in total?
| treatments: cost_of_treatment, treatment_type_code, treatment_id, dog_id, professional_id, date_of_treatment | treatment_types: treatment_type_description, treatment_type_code | dogs: dog_id | professionals: professional_id | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | breeds: breed_code, breed_name | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select treatment_types.treatment_type_description from treatment_types join treatments on treatment_types.treatment_type_code = treatments.treatment_type_code group by treatment_types.treatment_type_code order by sum ( cost_of_treatment ) asc limit 1
939
dog_kennels
Give me the description of the treatment type whose total cost is the lowest.
| treatments: cost_of_treatment, treatment_type_code | treatment_types: treatment_type_code, treatment_type_description |
select treatment_types.treatment_type_description from treatment_types join treatments on treatment_types.treatment_type_code = treatments.treatment_type_code group by treatment_types.treatment_type_code order by sum ( cost_of_treatment ) asc limit 1
940
dog_kennels
Which owner has paid the largest amount of money in total for their dogs? Show the owner id and zip code.
| owners: owner_id, zip_code | dogs: owner_id, dog_id | treatments: dog_id, cost_of_treatment | charges: charge_amount |
select owners.owner_id , owners.zip_code from owners join dogs on owners.owner_id = dogs.owner_id join treatments on dogs.dog_id = treatments.dog_id group by owners.owner_id order by sum ( treatments.cost_of_treatment ) desc limit 1
941
dog_kennels
Find the owner id and zip code of the owner who spent the most money in total for his or her dogs.
| treatments: cost_of_treatment, dog_id | dogs: dog_id, owner_id | owners: owner_id, zip_code | treatments.dog_id = dogs.dog_id | dogs.owner_id = owners.owner_id |
select owners.owner_id , owners.zip_code from owners join dogs on owners.owner_id = dogs.owner_id join treatments on dogs.dog_id = treatments.dog_id group by owners.owner_id order by sum ( treatments.cost_of_treatment ) desc limit 1
942
dog_kennels
Which professionals have done at least two types of treatments? List the professional id and cell phone.
| professionals: professional_id, cell_number | treatments: professional_id, treatment_type_code | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code |
select professionals.professional_id , professionals.cell_number from professionals join treatments on professionals.professional_id = treatments.professional_id group by professionals.professional_id having count ( * ) >= 2
943
dog_kennels
Find the id and cell phone of the professionals who operate two or more types of treatments.
| treatments: professional_id, treatment_type_code | professionals: professional_id, cell_number | dogs: dog_id | treatment_types: treatment_type_code | owners: owner_id | sizes: size_code | breeds: breed_code | charges: charge_id | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select professionals.professional_id , professionals.cell_number from professionals join treatments on professionals.professional_id = treatments.professional_id group by professionals.professional_id having count ( * ) >= 2
944
dog_kennels
What are the first name and last name of the professionals who have done treatment with cost below average?
| professionals: professional_id, first_name, last_name, role_code, street, city, state, zip_code, email_address, home_phone, cell_number | treatments: treatment_id, professional_id, dog_id, treatment_type_code, date_of_treatment, cost_of_treatment | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | breeds: breed_code, breed_name | sizes: size_code, size_description | charges: charge_id, charge_type, charge_amount | treatment_types: treatment_type_code, treatment_type_description | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.owner_id = owners.owner_id | dogs.breed_code = breeds.breed_code | dogs.size_code = sizes.size_code |
select distinct professionals.first_name , professionals.last_name from professionals join treatments where cost_of_treatment < ( select avg ( cost_of_treatment ) from treatments )
945
dog_kennels
Which professionals have operated a treatment that costs less than the average? Give me theor first names and last names.
| treatments: treatment_id, dog_id, professional_id, cost_of_treatment | professionals: professional_id, first_name, last_name | treatments.professional_id = professionals.professional_id |
select distinct professionals.first_name , professionals.last_name from professionals join treatments where cost_of_treatment < ( select avg ( cost_of_treatment ) from treatments )
946
dog_kennels
List the date of each treatment, together with the first name of the professional who operated it.
| treatments: date_of_treatment, professional_id, treatment_id, cost_of_treatment, treatment_type_code | professionals: first_name, professional_id, role_code, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code |
select treatments.date_of_treatment , professionals.first_name from treatments join professionals on treatments.professional_id = professionals.professional_id
947
dog_kennels
What are the date and the operating professional's first name of each treatment?
| treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | breeds: breed_code, breed_name | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | charges: charge_id, charge_type, charge_amount | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | dogs.owner_id = owners.owner_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select treatments.date_of_treatment , professionals.first_name from treatments join professionals on treatments.professional_id = professionals.professional_id
948
dog_kennels
List the cost of each treatment and the corresponding treatment type description.
| treatments: cost_of_treatment, treatment_type_code | treatment_types: treatment_type_code, treatment_type_description | breeds: breed_code, breed_name | sizes: size_code, size_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | charges: charge_id, charge_type, charge_amount | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code |
select treatments.cost_of_treatment , treatment_types.treatment_type_description from treatments join treatment_types on treatments.treatment_type_code = treatment_types.treatment_type_code
949
dog_kennels
What are the cost and treatment type description of each treatment?
| treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | treatment_types: treatment_type_code, treatment_type_description | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | breeds: breed_code, breed_name | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code |
select treatments.cost_of_treatment , treatment_types.treatment_type_description from treatments join treatment_types on treatments.treatment_type_code = treatment_types.treatment_type_code
950
dog_kennels
List each owner's first name, last name, and the size of his for her dog.
| owners: first_name, last_name, owner_id | dogs: owner_id, size_code | sizes: size_code, size_description |
select owners.first_name , owners.last_name , dogs.size_code from owners join dogs on owners.owner_id = dogs.owner_id
951
dog_kennels
What are each owner's first name, last name, and the size of their dog?
| owners: first_name, last_name, owner_id, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: owner_id, size_code, dog_id, abandoned_yn, breed_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | sizes: size_description, size_code | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select owners.first_name , owners.last_name , dogs.size_code from owners join dogs on owners.owner_id = dogs.owner_id
952
dog_kennels
List pairs of the owner's first name and the dogs's name.
| owners: first_name, owner_id | dogs: name, owner_id | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id=owners.owner_id |
select owners.first_name , dogs.name from owners join dogs on owners.owner_id = dogs.owner_id
953
dog_kennels
What are each owner's first name and their dogs's name?
| owners: first_name, owner_id | dogs: name, owner_id | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, abandoned_yn, breed_code, size_code, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select owners.first_name , dogs.name from owners join dogs on owners.owner_id = dogs.owner_id
954
dog_kennels
List the names of the dogs of the rarest breed and the treatment dates of them.
| dogs: name, breed_code | breeds: breed_code, breed_name | treatments: dog_id, date_of_treatment |
select dogs.name , treatments.date_of_treatment from dogs join treatments on dogs.dog_id = treatments.dog_id where dogs.breed_code = ( select breed_code from dogs group by breed_code order by count ( * ) asc limit 1 )
955
dog_kennels
Which dogs are of the rarest breed? Show their names and treatment dates.
| breeds: breed_code, breed_name | dogs: dog_id, breed_code, name, date_arrived, date_adopted, date_departed | treatments: dog_id, date_of_treatment | owners: owner_id | sizes: size_code | charges: charge_id | professionals: professional_id | treatment_types: treatment_type_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select dogs.name , treatments.date_of_treatment from dogs join treatments on dogs.dog_id = treatments.dog_id where dogs.breed_code = ( select breed_code from dogs group by breed_code order by count ( * ) asc limit 1 )
956
dog_kennels
Which dogs are owned by someone who lives in Virginia? List the owner's first name and the dog's name.
| owners: state, first_name, owner_id | dogs: name, owner_id | breeds: breed_code , breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id , professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.breed_code = breeds.breed_code | dogs.size_code = sizes.size_code |
select owners.first_name , dogs.name from owners join dogs on owners.owner_id = dogs.owner_id where owners.state = 'Virginia'
957
dog_kennels
Find the first names of owners living in Virginia and the names of dogs they own.
| owners: state, owner_id, first_name | dogs: owner_id, name, breed_code | breeds: breed_code, breed_name | sizes: size_code, size_description | charges: charge_id, charge_type, charge_amount | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | dogs.breed_code = breeds.breed_code |
select owners.first_name , dogs.name from owners join dogs on owners.owner_id = dogs.owner_id where owners.state = 'Virginia'
958
dog_kennels
What are the arriving date and the departing date of the dogs who have gone through a treatment?
| dogs: date_arrived, date_departed, dog_id | treatments: treatment_id, dog_id | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id | professionals: professional_id | sizes: size_code, size_description | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | dogs.dog_id = treatments.dog_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select distinct dogs.date_arrived , dogs.date_departed from dogs join treatments on dogs.dog_id = treatments.dog_id
959
dog_kennels
Find the arriving date and the departing date of the dogs that received a treatment.
| treatments: dog_id, date_of_treatment, treatment_id, professional_id, treatment_type_code, cost_of_treatment | dogs: dog_id, date_arrived, date_departed, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_adopted | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | sizes: size_code, size_description | breeds: breed_code, breed_name | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatment_types: treatment_type_code, treatment_type_description | charges: charge_id, charge_type, charge_amount | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select distinct dogs.date_arrived , dogs.date_departed from dogs join treatments on dogs.dog_id = treatments.dog_id
960
dog_kennels
List the last name of the owner owning the youngest dog.
| dogs: dog_id, owner_id, age, date_of_birth, breed_code, size_code, name, gender, weight, date_arrived, date_adopted, date_departed, abandoned_yn | owners: owner_id, last_name, first_name, street, city, state, zip_code, email_address, home_phone, cell_number | breeds: breed_code, breed_name | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | charges: charge_id, charge_type, charge_amount | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select owners.last_name from owners join dogs on owners.owner_id = dogs.owner_id where dogs.age = ( select max ( age ) from dogs )
961
dog_kennels
Who owns the youngest dog? Give me his or her last name.
| dogs: age, owner_id, dog_id, abandoned_yn, breed_code, size_code, name, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | owners: owner_id, last_name, first_name, street, city, state, zip_code, email_address, home_phone, cell_number | breeds: breed_code, breed_name | sizes: size_code, size_description | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | charges: charge_id, charge_type, charge_amount | treatment_types: treatment_type_code, treatment_type_description | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id |
select owners.last_name from owners join dogs on owners.owner_id = dogs.owner_id where dogs.age = ( select max ( age ) from dogs )
962
dog_kennels
List the emails of the professionals who live in the state of Hawaii or the state of Wisconsin.
| professionals: state, email_address, professional_id, role_code, first_name, street, city, zip_code, last_name, home_phone, cell_number |
select email_address from professionals where state = 'Hawaii' or state = 'Wisconsin'
963
dog_kennels
What are the emails of the professionals living in either the state of Hawaii or the state of Wisconsin?
| professionals: email_address, state, professional_id, first_name, last_name, street, city, zip_code, home_phone, cell_number, role_code | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code |
select email_address from professionals where state = 'Hawaii' or state = 'Wisconsin'
964
dog_kennels
What are the arriving date and the departing date of all the dogs?
| dogs: `date_arrived`, `date_departed`, `dog_id`, `owner_id`, `breed_code`, `size_code`, `abandoned_yn`, `name`, `age`, `date_of_birth`, `gender`, `weight`, `date_adopted` | owners: `owner_id`, `first_name`, `last_name`, `street`, `city`, `state`, `zip_code`, `email_address`, `home_phone`, `cell_number` | breeds: `breed_code`, `breed_name` | sizes: `size_code`, `size_description` | treatments: `dog_id`, `professional_id`, `treatment_type_code`, `date_of_treatment`, `cost_of_treatment` | professionals: `professional_id`, `role_code`, `first_name`, `street`, `city`, `state`, `zip_code`, `last_name`, `email_address`, `home_phone`, `cell_number` | treatment_types: `treatment_type_code`, `treatment_type_description` | charges: `charge_id`, `charge_type`, `charge_amount` | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select date_arrived , date_departed from dogs
965
dog_kennels
List the arrival date and the departure date for all the dogs.
| dogs: date_arrived, date_departed, dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_adopted | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select date_arrived , date_departed from dogs
966
dog_kennels
How many dogs went through any treatments?
| dogs: dog_id | treatments: dog_id, treatment_id |
select count ( distinct dog_id ) from treatments
967
dog_kennels
Count the number of dogs that went through a treatment.
| dogs: dog_id | treatments: treatment_id, dog_id | breeds: breed_code | sizes: size_code | owners: owner_id | professionals: professional_id | treatment_types: treatment_type_code | charges: charge_id | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select count ( distinct dog_id ) from treatments
968
dog_kennels
How many professionals have performed any treatment to dogs?
| professionals: professional_id | treatments: professional_id, dog_id, treatment_id | dogs: dog_id | breeds: | charges: | sizes: | treatment_types: | owners: | treatments.professional_id = professionals.professional_id | treatments.dog_id = dogs.dog_id |
select count ( distinct professional_id ) from treatments
969
dog_kennels
Find the number of professionals who have ever treated dogs.
| professionals: professional_id, first_name, last_name | treatments: treatment_id, dog_id, professional_id | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select count ( distinct professional_id ) from treatments
970
dog_kennels
Which professionals live in a city containing the substring 'West'? List his or her role, street, city and state.
| professionals: city, role_code, first_name, street, state, professional_id, last_name, zip_code, email_address, home_phone, cell_number |
select role_code , street , city , state from professionals where city like '%West%'
971
dog_kennels
Find the role, street, city and state of the professionals living in a city that contains the substring 'West'.
| professionals: role_code, street, city, state, professional_id | owners: city, owner_id | treatments: dog_id, professional_id | dogs: dog_id, owner_id |
select role_code , street , city , state from professionals where city like '%West%'
972
dog_kennels
Which owners live in the state whose name contains the substring 'North'? List his first name, last name and email.
| owners: state, first_name, last_name, email_address, owner_id | dogs: owner_id | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code |
select first_name , last_name , email_address from owners where state like '%North%'
973
dog_kennels
Return the first name, last name and email of the owners living in a state whose name contains the substring 'North'.
| owners: first_name, last_name, email_address, state, owner_id, street, city, zip_code, home_phone, cell_number | dogs: owner_id, dog_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment |
select first_name , last_name , email_address from owners where state like '%North%'
974
dog_kennels
How many dogs have an age below the average?
| dogs: age, dog_id |
select count ( * ) from dogs where age < ( select avg ( age ) from dogs )
975
dog_kennels
Count the number of dogs of an age below the average.
| dogs: age, dog_id |
select count ( * ) from dogs where age < ( select avg ( age ) from dogs )
976
dog_kennels
How much does the most recent treatment cost?
| treatments: treatment_id, date_of_treatment, cost_of_treatment, dog_id, professional_id, treatment_type_code | dogs: dog_id, owner_id, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | breeds: breed_code, breed_name | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | dogs.owner_id = owners.owner_id | dogs.breed_code = breeds.breed_code | dogs.size_code = sizes.size_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select cost_of_treatment from treatments order by date_of_treatment desc limit 1
977
dog_kennels
Show me the cost of the most recently performed treatment.
| treatments: cost_of_treatment, date_of_treatment, treatment_id, dog_id, professional_id, treatment_type_code | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code |
select cost_of_treatment from treatments order by date_of_treatment desc limit 1
978
dog_kennels
How many dogs have not gone through any treatment?
| dogs: dog_id, treatment_type_code, abandoned_yn | treatments: dog_id, treatment_id | breeds: breed_code | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select count ( * ) from dogs where dog_id not in ( select dog_id from treatments )
979
dog_kennels
Tell me the number of dogs that have not received any treatment .
| dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | breeds: breed_code, breed_name | sizes: size_code, size_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | charges: charge_id, charge_type, charge_amount | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select count ( * ) from dogs where dog_id not in ( select dog_id from treatments )
980
dog_kennels
How many owners temporarily do not have any dogs?
| dogs: owner_id, dog_id, abandoned_yn, date_adopted, date_departed | owners: owner_id | dogs.owner_id = owners.owner_id |
select count ( * ) from owners where owner_id not in ( select owner_id from dogs )
981
dog_kennels
Find the number of owners who do not own any dogs at this moment.
| dogs: owner_id | owners: owner_id |
select count ( * ) from owners where owner_id not in ( select owner_id from dogs )
982
dog_kennels
How many professionals did not operate any treatment on dogs?
| professionals: professional_id, role_code, first_name, last_name | treatments: treatment_id, dog_id, professional_id | dogs: dog_id | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | sizes: size_code, size_description | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | treatment_types: treatment_type_code, treatment_type_description | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.treatment_type_code = treatment_types.treatment_type_code |
select count ( * ) from professionals where professional_id not in ( select professional_id from treatments )
983
dog_kennels
Find the number of professionals who have not treated any dogs.
| treatments: professional_id, dog_id | professionals: professional_id | dogs: dog_id, breed_code, size_code | breeds: breed_code | sizes: size_code | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | charges: charge_id, charge_type, charge_amount | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code |
select count ( * ) from professionals where professional_id not in ( select professional_id from treatments )
984
dog_kennels
List the dog name, age and weight of the dogs who have been abandoned? 1 stands for yes, and 0 stands for no.
| dogs: abandoned_yn, name, age, weight | owners: owner_id | sizes: size_code | breeds: breed_code | treatments: dog_id, professional_id, treatment_type_code | professionals: professional_id | charges: charge_id | treatment_types: treatment_type_code | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select name , age , weight from dogs where abandoned_yn = 1
985
dog_kennels
What are the dog name, age and weight of the dogs that were abandoned? Note that 1 stands for yes, and 0 stands for no in the tables.
| dogs: abandoned_yn, name, age, weight, dog_id, owner_id, breed_code, size_code, date_of_birth, gender, date_arrived, date_adopted, date_departed | breeds : breed_code , breed_name | charges : charge_id , charge_type , charge_amount | sizes : size_code , size_description | treatment_types : treatment_type_code , treatment_type_description | owners : owner_id , first_name , last_name , street , city , state , zip_code , email_address , home_phone , cell_number | professionals : professional_id , role_code , first_name , street , city , state , zip_code , last_name , email_address , home_phone , cell_number | treatments : treatment_id , dog_id , professional_id , treatment_type_code , date_of_treatment , cost_of_treatment | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select name , age , weight from dogs where abandoned_yn = 1
986
dog_kennels
What is the average age of all the dogs?
| dogs: age, dog_id, owner_id, abandoned_yn, breed_code, size_code, name, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | sizes: size_code, size_description | breeds: breed_code, breed_name | professionals: professional_id, role_code, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | treatment_types: treatment_type_code, treatment_type_description | charges: charge_id, charge_type, charge_amount |
select avg ( age ) from dogs
987
dog_kennels
Compute the average age of all the dogs.
| dogs: age, dog_id | breeds: breed_code | sizes: size_code | owners: owner_id | charges: charge_id, charge_type, charge_amount | treatment_types: treatment_type_code, treatment_type_description | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select avg ( age ) from dogs
988
dog_kennels
What is the age of the oldest dog?
| dogs: age, dog_id, owner_id, breed_code, size_code, name, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed, abandoned_yn | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | sizes: size_code, size_description | breeds: breed_code, breed_name | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatment_types: treatment_type_code, treatment_type_description | charges: charge_id, charge_type, charge_amount | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select max ( age ) from dogs
989
dog_kennels
Tell me the age of the oldest dog.
| dogs: age, dog_id, owner_id, breed_code, size_code, name, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed, abandoned_yn | owners: owner_id | sizes: size_code | breeds: breed_code | treatments: dog_id | professionals: professional_id | treatment_types: treatment_type_code | charges: charge_id | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select max ( age ) from dogs
990
dog_kennels
How much does each charge type costs? List both charge type and amount.
| charges: charge_type, charge_amount, charge_id | breeds: breed_code, breed_name | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select charge_type , charge_amount from charges
991
dog_kennels
List each charge type and its amount.
| charges: charge_type, charge_amount | breeds: breed_code, breed_name | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.breed_code = breeds.breed_code | dogs.size_code = sizes.size_code | dogs.owner_id = owners.owner_id | treatments.dog_id = dogs.dog_id | treatments.treatment_type_code = treatment_types.treatment_type_code | treatments.professional_id = professionals.professional_id |
select charge_type , charge_amount from charges
992
dog_kennels
How much does the most expensive charge type costs?
| charges: charge_amount, charge_type, charge_id | breeds: breed_name, breed_code | dogs: name, dog_id, owner_id, abandoned_yn, breed_code, size_code, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | owners: first_name, owner_id, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | sizes: size_description, size_code | treatment_types: treatment_type_description, treatment_type_code | professionals: professional_id, role_code, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | treatments: cost_of_treatment, treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id |
select max ( charge_amount ) from charges
993
dog_kennels
What is the charge amount of the most expensive charge type?
| charges: charge_id, charge_type, charge_amount | breeds: breed_code, breed_name | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select max ( charge_amount ) from charges
994
dog_kennels
List the email, cell phone and home phone of all the professionals.
| professionals: professional_id, email_address, cell_number, home_phone, role_code, first_name, last_name, street, city, state, zip_code | breeds: breed_code, breed_name | charges: charge_id, charge_type, charge_amount | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select email_address , cell_number , home_phone from professionals
995
dog_kennels
What are the email, cell phone and home phone of each professional?
| professionals: email_address, home_phone, cell_number, professional_id, role_code, first_name, last_name, street, city, state, zip_code | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | dogs: dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | breeds: breed_code, breed_name | sizes: size_code, size_description | treatment_types: treatment_type_code, treatment_type_description | charges: charge_id, charge_type, charge_amount | treatments.dog_id = dogs.dog_id | dogs.owner_id = owners.owner_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.breed_code = breeds.breed_code | dogs.size_code = sizes.size_code |
select email_address , cell_number , home_phone from professionals
996
dog_kennels
What are all the possible breed type and size type combinations?
| breeds: breed_code, breed_name | sizes: size_code, size_description | dogs: breed_code, size_code, dog_id, owner_id, abandoned_yn, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed | owners: owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number | professionals: professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number | charges: charge_id, charge_type, charge_amount | treatment_types: treatment_type_code, treatment_type_description | treatments: treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code |
select distinct breed_code , size_code from dogs
997
dog_kennels
Find the distinct breed type and size type combinations for dogs.
| dogs: breed_code, size_code | breeds: breed_code, breed_name | sizes: size_code, size_description |
select distinct breed_code , size_code from dogs
998
dog_kennels
List the first name of all the professionals along with the description of the treatment they have done.
| professionals: first_name, professional_id | treatments: professional_id, treatment_type_code | treatment_types: treatment_type_description, treatment_type_code | owners: owner_id | dogs: dog_id, owner_id, breed_code, size_code | breeds: breed_code | sizes: size_code | charges: charge_id | treatments.professional_id = professionals.professional_id | treatments.treatment_type_code = treatment_types.treatment_type_code | dogs.owner_id = owners.owner_id | dogs.size_code = sizes.size_code | dogs.breed_code = breeds.breed_code | treatments.dog_id = dogs.dog_id |
select distinct professionals.first_name , treatment_types.treatment_type_description from professionals join treatments on professionals.professional_id = treatments.professional_id join treatment_types on treatments.treatment_type_code = treatment_types.treatment_type_code
999
dog_kennels
What are each professional's first name and description of the treatment they have performed?
| professionals: professional_id, first_name | treatments: professional_id, treatment_type_code | treatment_types: treatment_type_code, treatment_type_description |
select distinct professionals.first_name , treatment_types.treatment_type_description from professionals join treatments on professionals.professional_id = treatments.professional_id join treatment_types on treatments.treatment_type_code = treatment_types.treatment_type_code