db_id
stringclasses
20 values
question
stringlengths
18
174
db_info
stringclasses
20 values
ground_truth
stringlengths
20
474
network_1
Show name of all students who have some friends and also are liked by someone else.
# 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
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
network_1
Count the number of likes for each student id.
# 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 student_id , count ( * ) from likes group by student_id
network_1
How many likes correspond to each student id?
# 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 student_id , count ( * ) from likes group by student_id
network_1
Show the names of high schoolers who have likes, and numbers of likes for each.
# 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 , count ( * ) from likes join highschooler on likes.student_id = highschooler.id group by likes.student_id
network_1
What are the names of high schoolers who have likes, and how many likes does each have?
# 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 , count ( * ) from likes join highschooler on likes.student_id = highschooler.id group by likes.student_id
network_1
What is the name of the high schooler who has the greatest number of likes?
# 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 likes join highschooler on likes.student_id = highschooler.id group by likes.student_id order by count ( * ) desc limit 1
network_1
Give the name of the student with the most likes.
# 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 likes join highschooler on likes.student_id = highschooler.id group by likes.student_id order by count ( * ) desc limit 1
network_1
Show the names of students who have at least 2 likes.
# 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 likes join highschooler on likes.student_id = highschooler.id group by likes.student_id having count ( * ) >= 2
network_1
What are the names of students who have 2 or more likes?
# 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 likes join highschooler on likes.student_id = highschooler.id group by likes.student_id having count ( * ) >= 2
network_1
Show the names of students who have a grade higher than 5 and have at least 2 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
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
network_1
How many likes does Kyle have?
# 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 count ( * ) from likes join highschooler on likes.student_id = highschooler.id where highschooler.name = 'Kyle'
network_1
Return the number of likes that the high schooler named Kyle has.
# 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 count ( * ) from likes join highschooler on likes.student_id = highschooler.id where highschooler.name = 'Kyle'
network_1
Find the average grade of all students who have some 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 avg ( grade ) from highschooler where id in ( select friend.student_id from friend join highschooler on friend.student_id = highschooler.id )
network_1
What is the average grade of students who have 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 avg ( grade ) from highschooler where id in ( select friend.student_id from friend join highschooler on friend.student_id = highschooler.id )
network_1
Find the minimum grade of students who have no 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 min ( grade ) from highschooler where id not in ( select friend.student_id from friend join highschooler on friend.student_id = highschooler.id )
network_1
What is the lowest grade of students who do not have any 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 min ( grade ) from highschooler where id not in ( select friend.student_id from friend join highschooler on friend.student_id = highschooler.id )
dog_kennels
Which states have both owners and professionals living there?
# 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 ) # 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.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 state from owners intersect select state from professionals
dog_kennels
Find the states where both owners and professionals live.
# 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 ) # 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.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 state from owners intersect select state from professionals
dog_kennels
What is the average age of the dogs who have gone through any treatments?
# 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 ) # 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.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 where dog_id in ( select dog_id from treatments )
dog_kennels
Find the average age of the dogs who went through treatments.
# 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 ) # 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.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 where dog_id in ( select dog_id from treatments )
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.
# 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 ) # 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.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
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.
# 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 ) # 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.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
dog_kennels
Which dogs have not cost their owner more than 1000 for treatment ? List the dog names .
# 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 ) # 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.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 from dogs where dog_id not in ( select dog_id from treatments group by dog_id having sum ( cost_of_treatment ) > 1000 )
dog_kennels
What are the names of the dogs for which the owner has not spend more than 1000 for 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 ) # 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.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 from dogs where dog_id not in ( select dog_id from treatments group by dog_id having sum ( cost_of_treatment ) > 1000 )
dog_kennels
Which first names are used for professionals or owners but are not used as dog names?
# 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 ) # 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.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 first_name from professionals union select first_name from owners except select name from dogs
dog_kennels
Find the first names that are used for professionals or owners but are not used as dog names.
# 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 ) # 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.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 first_name from professionals union select first_name from owners except select name from dogs
dog_kennels
Which professional did not operate any treatment on dogs? List the professional's id, role and email.
# 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 ) # 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.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 , 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
dog_kennels
Give me the id, role and email of the professionals who did not perform any treatment on dogs.
# 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 ) # 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.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 , 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
dog_kennels
Which owner owns the most dogs? List the owner id, first name and 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 ) # 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.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 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
dog_kennels
Return the owner id, first name and last name of the owner who has the most dogs.
# 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 ) # 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.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 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
dog_kennels
Which professionals have done at least two treatments? List the professional's id, role, and first 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 ) # 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.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.role_code , professionals.first_name from professionals join treatments on professionals.professional_id = treatments.professional_id group by professionals.professional_id having count ( * ) >= 2
dog_kennels
What are the id, role, and first name of the professionals who have performed two or more treatments?
# 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 ) # 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.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.role_code , professionals.first_name from professionals join treatments on professionals.professional_id = treatments.professional_id group by professionals.professional_id having count ( * ) >= 2
dog_kennels
What is the name of the breed with the most dogs?
# 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 ) # 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.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
dog_kennels
Which breed do the most dogs have? Give me the breed 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 ) # 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.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
dog_kennels
Which owner has paid for the most treatments on his or her dogs? List the owner id and 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 ) # 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.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.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
dog_kennels
Tell me the owner id and last name of the owner who spent the most on treatments of his or her dogs.
# 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 ) # 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.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.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
dog_kennels
What is the description of the treatment type that costs the least money in total?
# 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 ) # 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.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
dog_kennels
Give me the description of the treatment type whose total cost is the lowest.
# 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 ) # 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.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
dog_kennels
Which owner has paid the largest amount of money in total for their dogs? Show the owner id and 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 ) # 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.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.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
dog_kennels
Find the owner id and zip code of the owner who spent the most money in total for his or her dogs.
# 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 ) # 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.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.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
dog_kennels
Which professionals have done at least two types of treatments? List the professional id and cell phone.
# 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 ) # 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.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
dog_kennels
Find the id and cell phone of the professionals who operate two or more types of treatments.
# 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 ) # 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.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
dog_kennels
What are the first name and last name of the professionals who have done treatment with cost below average?
# 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 ) # 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.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 professionals.first_name , professionals.last_name from professionals join treatments where cost_of_treatment < ( select avg ( cost_of_treatment ) from treatments )
dog_kennels
Which professionals have operated a treatment that costs less than the average? Give me theor first names and last names.
# 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 ) # 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.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 professionals.first_name , professionals.last_name from professionals join treatments where cost_of_treatment < ( select avg ( cost_of_treatment ) from treatments )
dog_kennels
List the date of each treatment, together with the first name of the professional who operated it.
# 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 ) # 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.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 treatments.date_of_treatment , professionals.first_name from treatments join professionals on treatments.professional_id = professionals.professional_id
dog_kennels
What are the date and the operating professional's first name of each 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 ) # 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.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 treatments.date_of_treatment , professionals.first_name from treatments join professionals on treatments.professional_id = professionals.professional_id
dog_kennels
List the cost of each treatment and the corresponding treatment type description.
# 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 ) # 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.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 treatments.cost_of_treatment , treatment_types.treatment_type_description from treatments join treatment_types on treatments.treatment_type_code = treatment_types.treatment_type_code
dog_kennels
What are the cost and treatment type description of each 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 ) # 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.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 treatments.cost_of_treatment , treatment_types.treatment_type_description from treatments join treatment_types on treatments.treatment_type_code = treatment_types.treatment_type_code
dog_kennels
List each owner's first name, last name, and the size of his for her dog.
# 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 ) # 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.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 , owners.last_name , dogs.size_code from owners join dogs on owners.owner_id = dogs.owner_id
dog_kennels
What are each owner's first name, last name, and the size of their dog?
# 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 ) # 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.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 , owners.last_name , dogs.size_code from owners join dogs on owners.owner_id = dogs.owner_id
dog_kennels
List pairs of the owner's first name and the dogs's 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 ) # 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.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
dog_kennels
What are each owner's first name and their dogs's 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 ) # 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.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
dog_kennels
List the names of the dogs of the rarest breed and the treatment dates of them.
# 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 ) # 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.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 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 )
dog_kennels
Which dogs are of the rarest breed? Show their names and treatment dates.
# 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 ) # 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.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 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 )
dog_kennels
Which dogs are owned by someone who lives in Virginia? List the owner's first name and the dog's 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 ) # 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.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 where owners.state = 'Virginia'
dog_kennels
Find the first names of owners living in Virginia and the names of dogs they own.
# 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 ) # 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.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 where owners.state = 'Virginia'
dog_kennels
What are the arriving date and the departing date of the dogs who have gone through a 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 ) # 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.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
dog_kennels
Find the arriving date and the departing date of the dogs that received a 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 ) # 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.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
dog_kennels
List the last name of the owner owning the youngest dog.
# 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 ) # 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.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 )
dog_kennels
Who owns the youngest dog? Give me his or her 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 ) # 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.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 )
dog_kennels
List the emails of the professionals who live in the state of Hawaii or the state of Wisconsin.
# 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 ) # 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.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 from professionals where state = 'Hawaii' or state = 'Wisconsin'
dog_kennels
What are the emails of the professionals living in either the state of Hawaii or the state of Wisconsin?
# 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 ) # 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.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 from professionals where state = 'Hawaii' or state = 'Wisconsin'
dog_kennels
What are the arriving date and the departing date of all the dogs?
# 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 ) # 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.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
dog_kennels
List the arrival date and the departure date for all the dogs.
# 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 ) # 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.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
dog_kennels
How many dogs went through any treatments?
# 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 ) # 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.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
dog_kennels
Count the number of dogs that went through a 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 ) # 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.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
dog_kennels
How many professionals have performed any treatment to dogs?
# 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 ) # 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.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
dog_kennels
Find the number of professionals who have ever treated dogs.
# 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 ) # 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.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
dog_kennels
Which professionals live in a city containing the substring 'West'? List his or her role, street, city and state.
# 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 ) # 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.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 role_code , street , city , state from professionals where city like '%West%'
dog_kennels
Find the role, street, city and state of the professionals living in a city that contains the substring 'West'.
# 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 ) # 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.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 role_code , street , city , state from professionals where city like '%West%'
dog_kennels
Which owners live in the state whose name contains the substring 'North'? List his first name, last name and email.
# 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 ) # 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.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 first_name , last_name , email_address from owners where state like '%North%'
dog_kennels
Return the first name, last name and email of the owners living in a state whose name contains the substring 'North'.
# 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 ) # 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.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 first_name , last_name , email_address from owners where state like '%North%'
dog_kennels
How many dogs have an age below the average?
# 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 ) # 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.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 age < ( select avg ( age ) from dogs )
dog_kennels
Count the number of dogs of an age below the average.
# 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 ) # 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.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 age < ( select avg ( age ) from dogs )
dog_kennels
How much does the most recent treatment cost?
# 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 ) # 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.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 cost_of_treatment from treatments order by date_of_treatment desc limit 1
dog_kennels
Show me the cost of the most recently performed 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 ) # 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.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 cost_of_treatment from treatments order by date_of_treatment desc limit 1
dog_kennels
How many dogs have not gone through any 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 ) # 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.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 )
dog_kennels
Tell me the number of dogs that have not received any 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 ) # 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.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 )
dog_kennels
How many owners temporarily do not have any dogs?
# 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 ) # 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.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 owners where owner_id not in ( select owner_id from dogs )
dog_kennels
Find the number of owners who do not own any dogs at this moment.
# 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 ) # 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.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 owners where owner_id not in ( select owner_id from dogs )
dog_kennels
How many professionals did not operate any treatment on dogs?
# 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 ) # 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.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 professionals where professional_id not in ( select professional_id from treatments )
dog_kennels
Find the number of professionals who have not treated any dogs.
# 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 ) # 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.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 professionals where professional_id not in ( select professional_id from treatments )
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.
# 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 ) # 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.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
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.
# 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 ) # 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.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
dog_kennels
What is the average age of all the dogs?
# 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 ) # 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.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
dog_kennels
Compute the average age of all the dogs.
# 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 ) # 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.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
dog_kennels
What is the age of the oldest dog?
# 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 ) # 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.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
dog_kennels
Tell me the age of the oldest dog.
# 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 ) # 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.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
dog_kennels
How much does each charge type costs? List both charge type and amount.
# 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 ) # 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.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
dog_kennels
List each charge type and its amount.
# 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 ) # 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.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
dog_kennels
How much does the most expensive charge type costs?
# 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 ) # 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.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
dog_kennels
What is the charge amount of the most expensive charge type?
# 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 ) # 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.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
dog_kennels
List the email, cell phone and home phone of all the professionals.
# 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 ) # 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.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
dog_kennels
What are the email, cell phone and home phone of each professional?
# 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 ) # 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.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
dog_kennels
What are all the possible breed type and size type combinations?
# 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 ) # 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.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
dog_kennels
Find the distinct breed type and size type combinations for dogs.
# 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 ) # 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.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
dog_kennels
List the first name of all the professionals along with the description of the treatment they have done.
# 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 ) # 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.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 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
dog_kennels
What are each professional's first name and description of the treatment they have performed?
# 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 ) # 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.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 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