nl stringlengths 22 185 | sql stringlengths 22 608 | db_id stringclasses 40
values | table_schema stringclasses 305
values |
|---|---|---|---|
Give the country with the fewest students. | SELECT T1.country FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code GROUP BY T1.country ORDER BY count(*) LIMIT 1 | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
Show names for all cities where at least three students live. | SELECT T1.city_name FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code GROUP BY T1.city_code HAVING count(*) >= 3 | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
What are the names of cities with at least three students? | SELECT T1.city_name FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code GROUP BY T1.city_code HAVING count(*) >= 3 | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
Show all states where more than 5 students live. | SELECT T1.state FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code GROUP BY T1.state HAVING count(*) > 5 | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
What are the states with more than 5 students? | SELECT T1.state FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code GROUP BY T1.state HAVING count(*) > 5 | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
Show ids for all students who don't live in USA. | SELECT StuID FROM Student EXCEPT SELECT StuID FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code WHERE country = "USA" | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
What the the student ids for students not living in the USA? | SELECT StuID FROM Student EXCEPT SELECT StuID FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code WHERE country = "USA" | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
Show ids for all female (sex is F) students living in state PA. | SELECT StuID FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code WHERE T1.state = "PA" AND T2.sex = 'F' | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
What are the student ids for female students in the state of PA? | SELECT StuID FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code WHERE T1.state = "PA" AND T2.sex = 'F' | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
Show ids for all male students living outside of USA. | SELECT StuID FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code WHERE T2.sex = 'M' AND T1.country != "USA" | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
What are the ids for male students not in the USA? | SELECT StuID FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code WHERE T2.sex = 'M' AND T1.country != "USA" | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
What is the distance between BAL and CHI? | SELECT distance FROM Direct_distance WHERE city1_code = "BAL" AND city2_code = "CHI" | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
Give the distance between BAL and CHI? | SELECT distance FROM Direct_distance WHERE city1_code = "BAL" AND city2_code = "CHI" | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
Show me the distance between Boston and Newark. | SELECT distance FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code JOIN City AS T3 ON T1.city2_code = T3.city_code WHERE T2.city_name = "Boston" AND T3.city_name = "Newark" | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}, {'table_name': 'city', 'table_schema': [{'col_name': 'city code'}, {'col_name': 'city name'}, {'col_name': 'sta... |
What is the distance between Boston and Newark? | SELECT distance FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code JOIN City AS T3 ON T1.city2_code = T3.city_code WHERE T2.city_name = "Boston" AND T3.city_name = "Newark" | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}, {'table_name': 'city', 'table_schema': [{'col_name': 'city code'}, {'col_name': 'city name'}, {'col_name': 'sta... |
What is the average, minimum, maximum distance between two cities? | SELECT avg(distance) , min(distance) , max(distance) FROM Direct_distance | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
Give the average, minimum, and maximum distances between two cities. | SELECT avg(distance) , min(distance) , max(distance) FROM Direct_distance | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
Show me the city code of two cities with maximum distance. | SELECT city1_code , city2_code FROM Direct_distance ORDER BY distance DESC LIMIT 1 | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
What are the city codes of the cities with the maximum distance? | SELECT city1_code , city2_code FROM Direct_distance ORDER BY distance DESC LIMIT 1 | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
Show me the city code of two cities with a distance greater than the average. | SELECT city1_code , city2_code FROM Direct_distance WHERE distance > (SELECT avg(distance) FROM Direct_distance) | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
What are the city codes of cities with distance greater than average? | SELECT city1_code , city2_code FROM Direct_distance WHERE distance > (SELECT avg(distance) FROM Direct_distance) | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
Show me the city code of two cities with a distance less than 1000. | SELECT city1_code , city2_code FROM Direct_distance WHERE distance < 1000 | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
What are the city codes corresponding to cities with distances less than 1000? | SELECT city1_code , city2_code FROM Direct_distance WHERE distance < 1000 | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
What is the total distance between city BAL and all other cities. | SELECT sum(distance) FROM Direct_distance WHERE city1_code = "BAL" | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
What is the sum of distances between BAL and other cities? | SELECT sum(distance) FROM Direct_distance WHERE city1_code = "BAL" | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
What is the average distance between Boston and all other cities. | SELECT avg(distance) FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code WHERE T2.city_name = "Boston" | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}, {'table_name': 'city', 'table_schema': [{'col_name': 'city code'}, {'col_name': 'city name'}, {'col_name': 'sta... |
Give the average distance between Boston and other cities. | SELECT avg(distance) FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code WHERE T2.city_name = "Boston" | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}, {'table_name': 'city', 'table_schema': [{'col_name': 'city code'}, {'col_name': 'city name'}, {'col_name': 'sta... |
What is the name of the city closest to Chicago? | SELECT T3.city_name FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code JOIN City AS T3 ON T1.city2_code = T3.city_code WHERE T2.city_name = "Chicago" ORDER BY distance LIMIT 1 | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}, {'table_name': 'city', 'table_schema': [{'col_name': 'city code'}, {'col_name': 'city name'}, {'col_name': 'sta... |
Give the name of the nearest city to Chicago. | SELECT T3.city_name FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code JOIN City AS T3 ON T1.city2_code = T3.city_code WHERE T2.city_name = "Chicago" ORDER BY distance LIMIT 1 | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}, {'table_name': 'city', 'table_schema': [{'col_name': 'city code'}, {'col_name': 'city name'}, {'col_name': 'sta... |
What is the name of the city furthest to Boston? | SELECT T3.city_name FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code JOIN City AS T3 ON T1.city2_code = T3.city_code WHERE T2.city_name = "Boston" ORDER BY distance DESC LIMIT 1 | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}, {'table_name': 'city', 'table_schema': [{'col_name': 'city code'}, {'col_name': 'city name'}, {'col_name': 'sta... |
Give the city name of the city with greatest distance from Boston. | SELECT T3.city_name FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code JOIN City AS T3 ON T1.city2_code = T3.city_code WHERE T2.city_name = "Boston" ORDER BY distance DESC LIMIT 1 | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}, {'table_name': 'city', 'table_schema': [{'col_name': 'city code'}, {'col_name': 'city name'}, {'col_name': 'sta... |
Show all city codes and the total distance to all other cities. | SELECT city1_code , sum(distance) FROM Direct_distance GROUP BY city1_code | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
For each city, what is the the city code and sum of distances from each? | SELECT city1_code , sum(distance) FROM Direct_distance GROUP BY city1_code | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}] |
Show all city names and the average distance to all other cities. | SELECT T2.city_name , avg(distance) FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code GROUP BY T1.city1_code | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}, {'table_name': 'city', 'table_schema': [{'col_name': 'city code'}, {'col_name': 'city name'}, {'col_name': 'sta... |
What are the city name and average distances from each city? | SELECT T2.city_name , avg(distance) FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code GROUP BY T1.city1_code | address_1 | [{'table_name': 'direct distance', 'table_schema': [{'col_name': 'city1 code'}, {'col_name': 'city2 code'}, {'col_name': 'distance'}], 'foreign_key_columns': ['city2 code', 'city1 code'], 'primary_keys': []}, {'table_name': 'city', 'table_schema': [{'col_name': 'city code'}, {'col_name': 'city name'}, {'col_name': 'sta... |
How far do Linda (first name) Smith (last name) and Tracy (first name) Kim (last name) live? | SELECT distance FROM Direct_distance AS T1 JOIN Student AS T2 ON T1.city1_code = T2.city_code JOIN Student AS T3 ON T1.city2_code = T3.city_code WHERE T2.Fname = "Linda" AND T2.Lname = "Smith" AND T3.Fname = "Tracy" AND T3.Lname = "Kim" | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
What is the distance between the cities where Linda Smith and Tracy Kim live? | SELECT distance FROM Direct_distance AS T1 JOIN Student AS T2 ON T1.city1_code = T2.city_code JOIN Student AS T3 ON T1.city2_code = T3.city_code WHERE T2.Fname = "Linda" AND T2.Lname = "Smith" AND T3.Fname = "Tracy" AND T3.Lname = "Kim" | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
What is the first name and last name of the student living furthest to Linda Smith? | SELECT T3.Fname , T3.Lname FROM Direct_distance AS T1 JOIN Student AS T2 ON T1.city1_code = T2.city_code JOIN Student AS T3 ON T1.city2_code = T3.city_code WHERE T2.Fname = "Linda" AND T2.Lname = "Smith" ORDER BY distance DESC LIMIT 1 | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
What is the full name of the student who lives furthest from Linda Smith? | SELECT T3.Fname , T3.Lname FROM Direct_distance AS T1 JOIN Student AS T2 ON T1.city1_code = T2.city_code JOIN Student AS T3 ON T1.city2_code = T3.city_code WHERE T2.Fname = "Linda" AND T2.Lname = "Smith" ORDER BY distance DESC LIMIT 1 | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
Which state does the student whose first name is Linda live in? | SELECT state FROM Student AS T1 JOIN City AS T2 ON T1.city_code = T2.city_code WHERE T1.Fname = "Linda" | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
Give the state that the student with first name Linda lives in. | SELECT state FROM Student AS T1 JOIN City AS T2 ON T1.city_code = T2.city_code WHERE T1.Fname = "Linda" | address_1 | [{'table_name': 'student', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'last name'}, {'col_name': 'first name'}, {'col_name': 'age'}, {'col_name': 'sex'}, {'col_name': 'major'}, {'col_name': 'advisor'}, {'col_name': 'city code'}], 'foreign_key_columns': ['city code'], 'primary_keys': ['student id']}, {'ta... |
Return all details of sailors who are older than 30. | SELECT * FROM Sailors WHERE age > 30 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What can you tell me about sailors who are older than age 30? | SELECT * FROM Sailors WHERE age > 30 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
Return name and age for sailors who are younger than 30. | SELECT name , age FROM Sailors WHERE age < 30 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What is the name and age of every sailor who is younger than age 30? | SELECT name , age FROM Sailors WHERE age < 30 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
Find boats reserved by Sailor with id 1. | SELECT DISTINCT bid FROM Reserves WHERE sid = 1 | boat_1 | [{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}] |
What are the different boat ids reserved by the sailor whose id is 1? | SELECT DISTINCT bid FROM Reserves WHERE sid = 1 | boat_1 | [{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}] |
Who reserved boat 102? | SELECT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid WHERE T2.bid = 102 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
What is the name of the sailor who reserved boat 102? | SELECT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid WHERE T2.bid = 102 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
Return the unique boat ids (bid) of all reserved boats. | SELECT DISTINCT bid FROM Reserves | boat_1 | [{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}] |
What are the ids of all boats that are reserved by someone? | SELECT DISTINCT bid FROM Reserves | boat_1 | [{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}] |
What is the name of sailors whose names contain letter e? | SELECT name FROM Sailors WHERE name LIKE '%e%' | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What is the name of every sailor whose name contains the letter e? | SELECT name FROM Sailors WHERE name LIKE '%e%' | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
return the unique ids of sailors who are older than any sailors. | SELECT DISTINCT sid FROM Sailors WHERE age > (SELECT min(age) FROM Sailors); | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What is the different id of every sailor who is not the youngest? | SELECT DISTINCT sid FROM Sailors WHERE age > (SELECT min(age) FROM Sailors); | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
Return the unique names of sailors who are older than any sailors whose rating is larger than 7. | SELECT DISTINCT name FROM Sailors WHERE age > (SELECT min(age) FROM Sailors WHERE rating > 7); | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What are the different names of sailors who are older than some other sailor with a rating larger than 7? | SELECT DISTINCT name FROM Sailors WHERE age > (SELECT min(age) FROM Sailors WHERE rating > 7); | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
Find the name and id of the sailors who reserved at least one boat? | SELECT DISTINCT T1.name , T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
What is the name and id of every sailor who reserved one or more boats? | SELECT DISTINCT T1.name , T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
Find the id and name of the sailors who reserved more than one boat. | SELECT DISTINCT T1.name , T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid GROUP BY T2.sid HAVING COUNT(*) > 1 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
What are the different names of sailors who reserved two or more boats ? | select distinct t1.name , t1.sid from sailors as t1 join reserves as t2 on t1.sid = t2.sid group by t2.sid having count(*) >= 2 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
Find the id of Sailors (sid) that reserved red or blue boat. | SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid WHERE T1.color = 'red' OR T1.color = "blue" | boat_1 | [{'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_key_columns': [], 'primary_keys': ['boat id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id... |
What are the sids for sailors who reserved red or blue boats? | SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid WHERE T1.color = 'red' OR T1.color = "blue" | boat_1 | [{'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_key_columns': [], 'primary_keys': ['boat id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id... |
Find the name and id of Sailors (sid) that reserved red or blue boat. | SELECT DISTINCT T2.sid , T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid JOIN Sailors AS T3 ON T2.sid = T3.sid WHERE T1.color = 'red' OR T1.color = "blue" | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k... |
What are the names and ids of sailors who reserved red or blue boats? | SELECT DISTINCT T2.sid , T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid JOIN Sailors AS T3 ON T2.sid = T3.sid WHERE T1.color = 'red' OR T1.color = "blue" | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k... |
Find the id of Sailors (sid) that reserved red and blue boat. | SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid WHERE T1.color = 'red' INTERSECT SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid WHERE T1.color = "blue" | boat_1 | [{'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_key_columns': [], 'primary_keys': ['boat id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id... |
What are the ids of sailors who reserved red and blue boats? | SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid WHERE T1.color = 'red' INTERSECT SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid WHERE T1.color = "blue" | boat_1 | [{'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_key_columns': [], 'primary_keys': ['boat id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id... |
Find the name and id of Sailors (sid) that reserved red and blue boat. | SELECT DISTINCT T2.sid , T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid JOIN Sailors AS T3 ON T2.sid = T3.sid WHERE T1.color = 'red' INTERSECT SELECT DISTINCT T2.sid , T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid JOIN Sailors AS T3 ON T2.sid = T3.sid WHERE T1.color = ... | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k... |
What are the names and ids of sailors who reserved red and blue boats? | SELECT DISTINCT T2.sid , T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid JOIN Sailors AS T3 ON T2.sid = T3.sid WHERE T1.color = 'red' INTERSECT SELECT DISTINCT T2.sid , T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid JOIN Sailors AS T3 ON T2.sid = T3.sid WHERE T1.color = ... | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k... |
What is the ids of sailors that haven’t reserved a boat? | SELECT sid FROM Sailors EXCEPT SELECT sid FROM Reserves | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
What are the ids of sailors who have not reserved a boat? | SELECT sid FROM Sailors EXCEPT SELECT sid FROM Reserves | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
what is the name and id of sailors who do not have a reservation of a boat? | SELECT sid , name FROM Sailors EXCEPT SELECT T1.sid , T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
What are the names and ids of all sailors who do not have boat reservations? | SELECT sid , name FROM Sailors EXCEPT SELECT T1.sid , T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
Find id for the sailors who do not have a reservation of a boat? | SELECT sid FROM Sailors EXCEPT SELECT T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
What is id about sailors who do not have boat reservations? | SELECT sid FROM Sailors EXCEPT SELECT T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
What is the name of the sailors who reserved boat with id 103? | SELECT DISTINCT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid WHERE T2.bid = 103 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
Find the name of the sailors who reserved boat with id 103. | SELECT DISTINCT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid WHERE T2.bid = 103 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
What is the name of all sailors whose rating is higher than any sailor named Luis? | SELECT name FROM Sailors WHERE rating > (SELECT min(rating) FROM Sailors WHERE name = 'Luis') | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What are the sailors' names, the ones whose rating is higher than any sailor named Luis? | SELECT name FROM Sailors WHERE rating > (SELECT min(rating) FROM Sailors WHERE name = 'Luis') | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What is the name of all sailors whose rating is higher than all sailors named Luis? | SELECT name FROM Sailors WHERE rating > (SELECT max(rating) FROM Sailors WHERE name = 'Luis') | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What are the names of all sailors with a higher rating than every sailor named Luis? | SELECT name FROM Sailors WHERE rating > (SELECT max(rating) FROM Sailors WHERE name = 'Luis') | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
what is the name and id of every sailor who has a rating greater than 2 and reserved a boat. | SELECT DISTINCT T1.name , T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid WHERE T1.rating > 2 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
What are the names and ids of all sailors who have a rating of at least 3 and reserved a boat? | SELECT DISTINCT T1.name , T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid WHERE T1.rating > 2 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'for... |
Find the name and age of the oldest sailor. | SELECT name , age FROM Sailors WHERE age = ( SELECT max(age) FROM Sailors ) | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What is the name and age of the sailor with maximum age? | SELECT name , age FROM Sailors WHERE age = ( SELECT max(age) FROM Sailors ) | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
how many sailors in total? | SELECT COUNT(*) FROM Sailors | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
How many sailors exist? | SELECT COUNT(*) FROM Sailors | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What is the average age of sailors whose rating is 7? | SELECT AVG(age) FROM Sailors WHERE rating = 7 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What is average age of all sailors who have a rating of 7? | SELECT AVG(age) FROM Sailors WHERE rating = 7 | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
How many sailors whose name starts with letter D exist ? | select count(*) from sailors where name like 'd%' | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What is the count of the sailors whose name starts with letter D ? | select count(*) from sailors where name like 'd%' | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
What are the average rating and max age of all sailors? | SELECT AVG(rating) , MAX(age) FROM Sailors | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
Find the average rating and largest age for the sailors | SELECT AVG(rating) , MAX(age) FROM Sailors | boat_1 | [{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}] |
Find the number of reservations for each boat. | SELECT bid , count(*) FROM Reserves GROUP BY bid | boat_1 | [{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}] |
How many reservations exist for each boat? | SELECT bid , count(*) FROM Reserves GROUP BY bid | boat_1 | [{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}] |
Find the number of reservations for each boat with id greater than 50. | SELECT bid , count(*) FROM Reserves GROUP BY bid HAVING bid > 50 | boat_1 | [{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}] |
How many reservations exist for each boat with an id greater than 50? | SELECT bid , count(*) FROM Reserves GROUP BY bid HAVING bid > 50 | boat_1 | [{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}] |
Find the number of reservations for each boat with more than 1 reservation. | SELECT bid , count(*) FROM Reserves GROUP BY bid HAVING count(*) > 1 | boat_1 | [{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}] |
How many reservations exist for each boat that has more than 1 reservation already? | SELECT bid , count(*) FROM Reserves GROUP BY bid HAVING count(*) > 1 | boat_1 | [{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}] |
Find the number of reservations by sailors with id greater than 1 for each boat. | SELECT bid , count(*) FROM Reserves WHERE sid > 1 GROUP BY bid | boat_1 | [{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.