nl
stringlengths
18
174
sql
stringlengths
20
422
db_id
stringclasses
20 values
table_schema
stringclasses
90 values
Show name of all students who have some friends and also are liked by someone else.
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id INTERSECT SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.liked_id = T2.id
network_1
[{'table_name': 'friend', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'friend id'}], 'foreign_key_columns': ['friend id', 'student id'], 'primary_keys': ['student id']}, {'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'l...
What are the names of high schoolers who both have friends and are liked?
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id INTERSECT SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.liked_id = T2.id
network_1
[{'table_name': 'friend', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'friend id'}], 'foreign_key_columns': ['friend id', 'student id'], 'primary_keys': ['student id']}, {'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'l...
Count the number of likes for each student id.
SELECT student_id , count(*) FROM Likes GROUP BY student_id
network_1
[{'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'liked id'], 'primary_keys': ['student id']}]
How many likes correspond to each student id?
SELECT student_id , count(*) FROM Likes GROUP BY student_id
network_1
[{'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'liked id'], 'primary_keys': ['student id']}]
Show the names of high schoolers who have likes, and numbers of likes for each.
SELECT T2.name , count(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id
network_1
[{'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'liked id'], 'primary_keys': ['student id']}]
What are the names of high schoolers who have likes, and how many likes does each have?
SELECT T2.name , count(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id
network_1
[{'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'liked id'], 'primary_keys': ['student id']}]
What is the name of the high schooler who has the greatest number of likes?
SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
network_1
[{'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'liked id'], 'primary_keys': ['student id']}]
Give the name of the student with the most likes.
SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
network_1
[{'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'liked id'], 'primary_keys': ['student id']}]
Show the names of students who have at least 2 likes.
SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id HAVING count(*) >= 2
network_1
[{'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'liked id'], 'primary_keys': ['student id']}]
What are the names of students who have 2 or more likes?
SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id HAVING count(*) >= 2
network_1
[{'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'liked id'], 'primary_keys': ['student id']}]
Show the names of students who have a grade higher than 5 and have at least 2 friends.
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.grade > 5 GROUP BY T1.student_id HAVING count(*) >= 2
network_1
[{'table_name': 'friend', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'friend id'}], 'foreign_key_columns': ['friend id', 'student id'], 'primary_keys': ['student id']}]
What are the names of high schoolers who have a grade of over 5 and have 2 or more friends?
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.grade > 5 GROUP BY T1.student_id HAVING count(*) >= 2
network_1
[{'table_name': 'friend', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'friend id'}], 'foreign_key_columns': ['friend id', 'student id'], 'primary_keys': ['student id']}]
How many likes does Kyle have?
SELECT count(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.name = "Kyle"
network_1
[{'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'liked id'], 'primary_keys': ['student id']}]
Return the number of likes that the high schooler named Kyle has.
SELECT count(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.name = "Kyle"
network_1
[{'table_name': 'likes', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'liked id'}], 'foreign_key_columns': ['student id', 'liked id'], 'primary_keys': ['student id']}]
Find the average grade of all students who have some friends.
SELECT avg(grade) FROM Highschooler WHERE id IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id)
network_1
[{'table_name': 'friend', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'friend id'}], 'foreign_key_columns': ['friend id', 'student id'], 'primary_keys': ['student id']}]
What is the average grade of students who have friends?
SELECT avg(grade) FROM Highschooler WHERE id IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id)
network_1
[{'table_name': 'friend', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'friend id'}], 'foreign_key_columns': ['friend id', 'student id'], 'primary_keys': ['student id']}]
Find the minimum grade of students who have no friends.
SELECT min(grade) FROM Highschooler WHERE id NOT IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id)
network_1
[{'table_name': 'friend', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'friend id'}], 'foreign_key_columns': ['friend id', 'student id'], 'primary_keys': ['student id']}]
What is the lowest grade of students who do not have any friends?
SELECT min(grade) FROM Highschooler WHERE id NOT IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id)
network_1
[{'table_name': 'friend', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'friend id'}], 'foreign_key_columns': ['friend id', 'student id'], 'primary_keys': ['student id']}]
Which states have both owners and professionals living there?
SELECT state FROM Owners INTERSECT SELECT state FROM Professionals
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Find the states where both owners and professionals live.
SELECT state FROM Owners INTERSECT SELECT state FROM Professionals
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
What is the average age of the dogs who have gone through any treatments?
SELECT avg(age) FROM Dogs WHERE dog_id IN ( SELECT dog_id FROM Treatments )
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
Find the average age of the dogs who went through treatments.
SELECT avg(age) FROM Dogs WHERE dog_id IN ( SELECT dog_id FROM Treatments )
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
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.
SELECT professional_id , last_name , cell_number FROM Professionals WHERE state = 'Indiana' UNION SELECT T1.professional_id , T1.last_name , T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id HAVING count(*) > 2
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
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.
SELECT professional_id , last_name , cell_number FROM Professionals WHERE state = 'Indiana' UNION SELECT T1.professional_id , T1.last_name , T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id HAVING count(*) > 2
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
Which dogs have not cost their owner more than 1000 for treatment ? List the dog names .
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
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
What are the names of the dogs for which the owner has not spend more than 1000 for treatment ?
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
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
Which first names are used for professionals or owners but are not used as dog names?
SELECT first_name FROM Professionals UNION SELECT first_name FROM Owners EXCEPT SELECT name FROM Dogs
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Find the first names that are used for professionals or owners but are not used as dog names.
SELECT first_name FROM Professionals UNION SELECT first_name FROM Owners EXCEPT SELECT name FROM Dogs
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Which professional did not operate any treatment on dogs? List the professional's id, role and email.
SELECT professional_id , role_code , email_address FROM Professionals EXCEPT SELECT T1.professional_id , T1.role_code , T1.email_address FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
Give me the id, role and email of the professionals who did not perform any treatment on dogs.
SELECT professional_id , role_code , email_address FROM Professionals EXCEPT SELECT T1.professional_id , T1.role_code , T1.email_address FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
Which owner owns the most dogs? List the owner id, first name and last name.
SELECT T1.owner_id , T2.first_name , T2.last_name FROM Dogs AS T1 JOIN Owners AS T2 ON T1.owner_id = T2.owner_id GROUP BY T1.owner_id ORDER BY count(*) DESC LIMIT 1
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Return the owner id, first name and last name of the owner who has the most dogs.
SELECT T1.owner_id , T2.first_name , T2.last_name FROM Dogs AS T1 JOIN Owners AS T2 ON T1.owner_id = T2.owner_id GROUP BY T1.owner_id ORDER BY count(*) DESC LIMIT 1
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Which professionals have done at least two treatments? List the professional's id, role, and first name.
SELECT T1.professional_id , T1.role_code , T1.first_name FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id HAVING count(*) >= 2
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
What are the id, role, and first name of the professionals who have performed two or more treatments?
SELECT T1.professional_id , T1.role_code , T1.first_name FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id HAVING count(*) >= 2
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
What is the name of the breed with the most dogs?
SELECT T1.breed_name FROM Breeds AS T1 JOIN Dogs AS T2 ON T1.breed_code = T2.breed_code GROUP BY T1.breed_name ORDER BY count(*) DESC LIMIT 1
dog_kennels
[{'table_name': 'breeds', 'table_schema': [{'col_name': 'breed code'}, {'col_name': 'breed name'}], 'foreign_key_columns': [], 'primary_keys': ['breed code']}, {'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col...
Which breed do the most dogs have? Give me the breed name.
SELECT T1.breed_name FROM Breeds AS T1 JOIN Dogs AS T2 ON T1.breed_code = T2.breed_code GROUP BY T1.breed_name ORDER BY count(*) DESC LIMIT 1
dog_kennels
[{'table_name': 'breeds', 'table_schema': [{'col_name': 'breed code'}, {'col_name': 'breed name'}], 'foreign_key_columns': [], 'primary_keys': ['breed code']}, {'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col...
Which owner has paid for the most treatments on his or her dogs? List the owner id and last name.
SELECT T1.owner_id , T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id JOIN Treatments AS T3 ON T2.dog_id = T3.dog_id GROUP BY T1.owner_id ORDER BY count(*) DESC LIMIT 1
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Tell me the owner id and last name of the owner who spent the most on treatments of his or her dogs.
SELECT T1.owner_id , T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id JOIN Treatments AS T3 ON T2.dog_id = T3.dog_id GROUP BY T1.owner_id ORDER BY count(*) DESC LIMIT 1
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
What is the description of the treatment type that costs the least money in total?
SELECT T1.treatment_type_description FROM Treatment_types AS T1 JOIN Treatments AS T2 ON T1.treatment_type_code = T2.treatment_type_code GROUP BY T1.treatment_type_code ORDER BY sum(cost_of_treatment) ASC LIMIT 1
dog_kennels
[{'table_name': 'treatments', 'table_schema': [{'col_name': 'treatment id'}, {'col_name': 'dog id'}, {'col_name': 'professional id'}, {'col_name': 'treatment type code'}, {'col_name': 'date of treatment'}, {'col_name': 'cost of treatment'}], 'foreign_key_columns': ['dog id', 'professional id', 'treatment type code'], '...
Give me the description of the treatment type whose total cost is the lowest.
SELECT T1.treatment_type_description FROM Treatment_types AS T1 JOIN Treatments AS T2 ON T1.treatment_type_code = T2.treatment_type_code GROUP BY T1.treatment_type_code ORDER BY sum(cost_of_treatment) ASC LIMIT 1
dog_kennels
[{'table_name': 'treatments', 'table_schema': [{'col_name': 'treatment id'}, {'col_name': 'dog id'}, {'col_name': 'professional id'}, {'col_name': 'treatment type code'}, {'col_name': 'date of treatment'}, {'col_name': 'cost of treatment'}], 'foreign_key_columns': ['dog id', 'professional id', 'treatment type code'], '...
Which owner has paid the largest amount of money in total for their dogs? Show the owner id and zip code.
SELECT T1.owner_id , T1.zip_code FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id JOIN Treatments AS T3 ON T2.dog_id = T3.dog_id GROUP BY T1.owner_id ORDER BY sum(T3.cost_of_treatment) DESC LIMIT 1
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Find the owner id and zip code of the owner who spent the most money in total for his or her dogs.
SELECT T1.owner_id , T1.zip_code FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id JOIN Treatments AS T3 ON T2.dog_id = T3.dog_id GROUP BY T1.owner_id ORDER BY sum(T3.cost_of_treatment) DESC LIMIT 1
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Which professionals have done at least two types of treatments? List the professional id and cell phone.
SELECT T1.professional_id , T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id HAVING count(*) >= 2
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
Find the id and cell phone of the professionals who operate two or more types of treatments.
SELECT T1.professional_id , T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id HAVING count(*) >= 2
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
What are the first name and last name of the professionals who have done treatment with cost below average?
SELECT DISTINCT T1.first_name , T1.last_name FROM Professionals AS T1 JOIN Treatments AS T2 WHERE cost_of_treatment < ( SELECT avg(cost_of_treatment) FROM Treatments )
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
Which professionals have operated a treatment that costs less than the average? Give me theor first names and last names.
SELECT DISTINCT T1.first_name , T1.last_name FROM Professionals AS T1 JOIN Treatments AS T2 WHERE cost_of_treatment < ( SELECT avg(cost_of_treatment) FROM Treatments )
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
List the date of each treatment, together with the first name of the professional who operated it.
SELECT T1.date_of_treatment , T2.first_name FROM Treatments AS T1 JOIN Professionals AS T2 ON T1.professional_id = T2.professional_id
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
What are the date and the operating professional's first name of each treatment?
SELECT T1.date_of_treatment , T2.first_name FROM Treatments AS T1 JOIN Professionals AS T2 ON T1.professional_id = T2.professional_id
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
List the cost of each treatment and the corresponding treatment type description.
SELECT T1.cost_of_treatment , T2.treatment_type_description FROM Treatments AS T1 JOIN treatment_types AS T2 ON T1.treatment_type_code = T2.treatment_type_code
dog_kennels
[{'table_name': 'treatments', 'table_schema': [{'col_name': 'treatment id'}, {'col_name': 'dog id'}, {'col_name': 'professional id'}, {'col_name': 'treatment type code'}, {'col_name': 'date of treatment'}, {'col_name': 'cost of treatment'}], 'foreign_key_columns': ['dog id', 'professional id', 'treatment type code'], '...
What are the cost and treatment type description of each treatment?
SELECT T1.cost_of_treatment , T2.treatment_type_description FROM Treatments AS T1 JOIN treatment_types AS T2 ON T1.treatment_type_code = T2.treatment_type_code
dog_kennels
[{'table_name': 'treatments', 'table_schema': [{'col_name': 'treatment id'}, {'col_name': 'dog id'}, {'col_name': 'professional id'}, {'col_name': 'treatment type code'}, {'col_name': 'date of treatment'}, {'col_name': 'cost of treatment'}], 'foreign_key_columns': ['dog id', 'professional id', 'treatment type code'], '...
List each owner's first name, last name, and the size of his for her dog.
SELECT T1.first_name , T1.last_name , T2.size_code FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
What are each owner's first name, last name, and the size of their dog?
SELECT T1.first_name , T1.last_name , T2.size_code FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
List pairs of the owner's first name and the dogs's name.
SELECT T1.first_name , T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
What are each owner's first name and their dogs's name?
SELECT T1.first_name , T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
List the names of the dogs of the rarest breed and the treatment dates of them.
SELECT T1.name , T2.date_of_treatment FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id = T2.dog_id WHERE T1.breed_code = ( SELECT breed_code FROM Dogs GROUP BY breed_code ORDER BY count(*) ASC LIMIT 1 )
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
Which dogs are of the rarest breed? Show their names and treatment dates.
SELECT T1.name , T2.date_of_treatment FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id = T2.dog_id WHERE T1.breed_code = ( SELECT breed_code FROM Dogs GROUP BY breed_code ORDER BY count(*) ASC LIMIT 1 )
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
Which dogs are owned by someone who lives in Virginia? List the owner's first name and the dog's name.
SELECT T1.first_name , T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T1.state = 'Virginia'
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Find the first names of owners living in Virginia and the names of dogs they own.
SELECT T1.first_name , T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T1.state = 'Virginia'
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
What are the arriving date and the departing date of the dogs who have gone through a treatment?
SELECT DISTINCT T1.date_arrived , T1.date_departed FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id = T2.dog_id
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
Find the arriving date and the departing date of the dogs that received a treatment.
SELECT DISTINCT T1.date_arrived , T1.date_departed FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id = T2.dog_id
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
List the last name of the owner owning the youngest dog.
SELECT T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T2.age = ( SELECT max(age) FROM Dogs )
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Who owns the youngest dog? Give me his or her last name.
SELECT T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T2.age = ( SELECT max(age) FROM Dogs )
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
List the emails of the professionals who live in the state of Hawaii or the state of Wisconsin.
SELECT email_address FROM Professionals WHERE state = 'Hawaii' OR state = 'Wisconsin'
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
What are the emails of the professionals living in either the state of Hawaii or the state of Wisconsin?
SELECT email_address FROM Professionals WHERE state = 'Hawaii' OR state = 'Wisconsin'
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
What are the arriving date and the departing date of all the dogs?
SELECT date_arrived , date_departed FROM Dogs
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
List the arrival date and the departure date for all the dogs.
SELECT date_arrived , date_departed FROM Dogs
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
How many dogs went through any treatments?
SELECT count(DISTINCT dog_id) FROM Treatments
dog_kennels
[{'table_name': 'treatments', 'table_schema': [{'col_name': 'treatment id'}, {'col_name': 'dog id'}, {'col_name': 'professional id'}, {'col_name': 'treatment type code'}, {'col_name': 'date of treatment'}, {'col_name': 'cost of treatment'}], 'foreign_key_columns': ['dog id', 'professional id', 'treatment type code'], '...
Count the number of dogs that went through a treatment.
SELECT count(DISTINCT dog_id) FROM Treatments
dog_kennels
[{'table_name': 'treatments', 'table_schema': [{'col_name': 'treatment id'}, {'col_name': 'dog id'}, {'col_name': 'professional id'}, {'col_name': 'treatment type code'}, {'col_name': 'date of treatment'}, {'col_name': 'cost of treatment'}], 'foreign_key_columns': ['dog id', 'professional id', 'treatment type code'], '...
How many professionals have performed any treatment to dogs?
SELECT count(DISTINCT professional_id) FROM Treatments
dog_kennels
[{'table_name': 'treatments', 'table_schema': [{'col_name': 'treatment id'}, {'col_name': 'dog id'}, {'col_name': 'professional id'}, {'col_name': 'treatment type code'}, {'col_name': 'date of treatment'}, {'col_name': 'cost of treatment'}], 'foreign_key_columns': ['dog id', 'professional id', 'treatment type code'], '...
Find the number of professionals who have ever treated dogs.
SELECT count(DISTINCT professional_id) FROM Treatments
dog_kennels
[{'table_name': 'treatments', 'table_schema': [{'col_name': 'treatment id'}, {'col_name': 'dog id'}, {'col_name': 'professional id'}, {'col_name': 'treatment type code'}, {'col_name': 'date of treatment'}, {'col_name': 'cost of treatment'}], 'foreign_key_columns': ['dog id', 'professional id', 'treatment type code'], '...
Which professionals live in a city containing the substring 'West'? List his or her role, street, city and state.
SELECT role_code , street , city , state FROM professionals WHERE city LIKE '%West%'
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
Find the role, street, city and state of the professionals living in a city that contains the substring 'West'.
SELECT role_code , street , city , state FROM professionals WHERE city LIKE '%West%'
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
Which owners live in the state whose name contains the substring 'North'? List his first name, last name and email.
SELECT first_name , last_name , email_address FROM Owners WHERE state LIKE '%North%'
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Return the first name, last name and email of the owners living in a state whose name contains the substring 'North'.
SELECT first_name , last_name , email_address FROM Owners WHERE state LIKE '%North%'
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
How many dogs have an age below the average?
SELECT count(*) FROM Dogs WHERE age < ( SELECT avg(age) FROM Dogs )
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
Count the number of dogs of an age below the average.
SELECT count(*) FROM Dogs WHERE age < ( SELECT avg(age) FROM Dogs )
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
How much does the most recent treatment cost?
SELECT cost_of_treatment FROM Treatments ORDER BY date_of_treatment DESC LIMIT 1
dog_kennels
[{'table_name': 'treatments', 'table_schema': [{'col_name': 'treatment id'}, {'col_name': 'dog id'}, {'col_name': 'professional id'}, {'col_name': 'treatment type code'}, {'col_name': 'date of treatment'}, {'col_name': 'cost of treatment'}], 'foreign_key_columns': ['dog id', 'professional id', 'treatment type code'], '...
Show me the cost of the most recently performed treatment.
SELECT cost_of_treatment FROM Treatments ORDER BY date_of_treatment DESC LIMIT 1
dog_kennels
[{'table_name': 'treatments', 'table_schema': [{'col_name': 'treatment id'}, {'col_name': 'dog id'}, {'col_name': 'professional id'}, {'col_name': 'treatment type code'}, {'col_name': 'date of treatment'}, {'col_name': 'cost of treatment'}], 'foreign_key_columns': ['dog id', 'professional id', 'treatment type code'], '...
How many dogs have not gone through any treatment?
SELECT count(*) FROM Dogs WHERE dog_id NOT IN ( SELECT dog_id FROM Treatments )
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
Tell me the number of dogs that have not received any treatment .
select count(*) from dogs where dog_id not in ( select dog_id from treatments )
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
How many owners temporarily do not have any dogs?
SELECT count(*) FROM Owners WHERE owner_id NOT IN ( SELECT owner_id FROM Dogs )
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
Find the number of owners who do not own any dogs at this moment.
SELECT count(*) FROM Owners WHERE owner_id NOT IN ( SELECT owner_id FROM Dogs )
dog_kennels
[{'table_name': 'owners', 'table_schema': [{'col_name': 'owner id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {'col_name': 'cell number'}], 'foreign_key...
How many professionals did not operate any treatment on dogs?
SELECT count(*) FROM Professionals WHERE professional_id NOT IN ( SELECT professional_id FROM Treatments )
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
Find the number of professionals who have not treated any dogs.
SELECT count(*) FROM Professionals WHERE professional_id NOT IN ( SELECT professional_id FROM Treatments )
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
List the dog name, age and weight of the dogs who have been abandoned? 1 stands for yes, and 0 stands for no.
SELECT name , age , weight FROM Dogs WHERE abandoned_yn = 1
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
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.
SELECT name , age , weight FROM Dogs WHERE abandoned_yn = 1
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
What is the average age of all the dogs?
SELECT avg(age) FROM Dogs
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
Compute the average age of all the dogs.
SELECT avg(age) FROM Dogs
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
What is the age of the oldest dog?
SELECT max(age) FROM Dogs
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
Tell me the age of the oldest dog.
SELECT max(age) FROM Dogs
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
How much does each charge type costs? List both charge type and amount.
SELECT charge_type , charge_amount FROM Charges
dog_kennels
[{'table_name': 'charges', 'table_schema': [{'col_name': 'charge id'}, {'col_name': 'charge type'}, {'col_name': 'charge amount'}], 'foreign_key_columns': [], 'primary_keys': ['charge id']}]
List each charge type and its amount.
SELECT charge_type , charge_amount FROM Charges
dog_kennels
[{'table_name': 'charges', 'table_schema': [{'col_name': 'charge id'}, {'col_name': 'charge type'}, {'col_name': 'charge amount'}], 'foreign_key_columns': [], 'primary_keys': ['charge id']}]
How much does the most expensive charge type costs?
SELECT max(charge_amount) FROM Charges
dog_kennels
[{'table_name': 'charges', 'table_schema': [{'col_name': 'charge id'}, {'col_name': 'charge type'}, {'col_name': 'charge amount'}], 'foreign_key_columns': [], 'primary_keys': ['charge id']}]
What is the charge amount of the most expensive charge type?
SELECT max(charge_amount) FROM Charges
dog_kennels
[{'table_name': 'charges', 'table_schema': [{'col_name': 'charge id'}, {'col_name': 'charge type'}, {'col_name': 'charge amount'}], 'foreign_key_columns': [], 'primary_keys': ['charge id']}]
List the email, cell phone and home phone of all the professionals.
SELECT email_address , cell_number , home_phone FROM professionals
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
What are the email, cell phone and home phone of each professional?
SELECT email_address , cell_number , home_phone FROM professionals
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
What are all the possible breed type and size type combinations?
SELECT DISTINCT breed_code , size_code FROM dogs
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
Find the distinct breed type and size type combinations for dogs.
SELECT DISTINCT breed_code , size_code FROM dogs
dog_kennels
[{'table_name': 'dogs', 'table_schema': [{'col_name': 'dog id'}, {'col_name': 'owner id'}, {'col_name': 'abandoned yes or no'}, {'col_name': 'breed code'}, {'col_name': 'size code'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'date of birth'}, {'col_name': 'gender'}, {'col_name': 'weight'}, {'col_name': 'd...
List the first name of all the professionals along with the description of the treatment they have done.
SELECT DISTINCT T1.first_name , T3.treatment_type_description FROM professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id JOIN Treatment_types AS T3 ON T2.treatment_type_code = T3.treatment_type_code
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...
What are each professional's first name and description of the treatment they have performed?
SELECT DISTINCT T1.first_name , T3.treatment_type_description FROM professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id JOIN Treatment_types AS T3 ON T2.treatment_type_code = T3.treatment_type_code
dog_kennels
[{'table_name': 'professionals', 'table_schema': [{'col_name': 'professional id'}, {'col_name': 'role code'}, {'col_name': 'first name'}, {'col_name': 'street'}, {'col_name': 'city'}, {'col_name': 'state'}, {'col_name': 'zip code'}, {'col_name': 'last name'}, {'col_name': 'email address'}, {'col_name': 'home phone'}, {...