query_id
int64 0
2.15k
| database_id
stringclasses 40
values | table_id
listlengths 1
4
| query
stringlengths 22
185
| answer
stringlengths 22
608
| difficulty
stringclasses 4
values |
---|---|---|---|---|---|
800 |
address_1
|
[
"city",
"student"
] |
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
|
extra
|
801 |
address_1
|
[
"city",
"student"
] |
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
|
medium
|
802 |
address_1
|
[
"city",
"student"
] |
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
|
medium
|
803 |
address_1
|
[
"city",
"student"
] |
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
|
medium
|
804 |
address_1
|
[
"city",
"student"
] |
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
|
medium
|
805 |
address_1
|
[
"city",
"student"
] |
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"
|
hard
|
806 |
address_1
|
[
"city",
"student"
] |
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"
|
hard
|
807 |
address_1
|
[
"city",
"student"
] |
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'
|
medium
|
808 |
address_1
|
[
"city",
"student"
] |
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'
|
medium
|
809 |
address_1
|
[
"city",
"student"
] |
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"
|
medium
|
810 |
address_1
|
[
"city",
"student"
] |
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"
|
medium
|
811 |
address_1
|
[
"direct_distance"
] |
What is the distance between BAL and CHI?
|
SELECT distance FROM Direct_distance WHERE city1_code = "BAL" AND city2_code = "CHI"
|
medium
|
812 |
address_1
|
[
"direct_distance"
] |
Give the distance between BAL and CHI?
|
SELECT distance FROM Direct_distance WHERE city1_code = "BAL" AND city2_code = "CHI"
|
medium
|
813 |
address_1
|
[
"city",
"direct_distance"
] |
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"
|
hard
|
814 |
address_1
|
[
"city",
"direct_distance"
] |
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"
|
hard
|
815 |
address_1
|
[
"direct_distance"
] |
What is the average, minimum, maximum distance between two cities?
|
SELECT avg(distance) , min(distance) , max(distance) FROM Direct_distance
|
medium
|
816 |
address_1
|
[
"direct_distance"
] |
Give the average, minimum, and maximum distances between two cities.
|
SELECT avg(distance) , min(distance) , max(distance) FROM Direct_distance
|
medium
|
817 |
address_1
|
[
"direct_distance"
] |
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
|
medium
|
818 |
address_1
|
[
"direct_distance"
] |
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
|
medium
|
819 |
address_1
|
[
"direct_distance"
] |
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)
|
extra
|
820 |
address_1
|
[
"direct_distance"
] |
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)
|
extra
|
821 |
address_1
|
[
"direct_distance"
] |
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
|
medium
|
822 |
address_1
|
[
"direct_distance"
] |
What are the city codes corresponding to cities with distances less than 1000?
|
SELECT city1_code , city2_code FROM Direct_distance WHERE distance < 1000
|
medium
|
823 |
address_1
|
[
"direct_distance"
] |
What is the total distance between city BAL and all other cities.
|
SELECT sum(distance) FROM Direct_distance WHERE city1_code = "BAL"
|
easy
|
824 |
address_1
|
[
"direct_distance"
] |
What is the sum of distances between BAL and other cities?
|
SELECT sum(distance) FROM Direct_distance WHERE city1_code = "BAL"
|
easy
|
825 |
address_1
|
[
"city",
"direct_distance"
] |
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"
|
medium
|
826 |
address_1
|
[
"city",
"direct_distance"
] |
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"
|
medium
|
827 |
address_1
|
[
"city",
"direct_distance"
] |
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
|
extra
|
828 |
address_1
|
[
"city",
"direct_distance"
] |
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
|
extra
|
829 |
address_1
|
[
"city",
"direct_distance"
] |
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
|
extra
|
830 |
address_1
|
[
"city",
"direct_distance"
] |
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
|
extra
|
831 |
address_1
|
[
"direct_distance"
] |
Show all city codes and the total distance to all other cities.
|
SELECT city1_code , sum(distance) FROM Direct_distance GROUP BY city1_code
|
medium
|
832 |
address_1
|
[
"direct_distance"
] |
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
|
medium
|
833 |
address_1
|
[
"city",
"direct_distance"
] |
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
|
medium
|
834 |
address_1
|
[
"city",
"direct_distance"
] |
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
|
medium
|
835 |
address_1
|
[
"student",
"direct_distance"
] |
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"
|
hard
|
836 |
address_1
|
[
"student",
"direct_distance"
] |
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"
|
hard
|
837 |
address_1
|
[
"student",
"direct_distance"
] |
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
|
extra
|
838 |
address_1
|
[
"student",
"direct_distance"
] |
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
|
extra
|
839 |
address_1
|
[
"city",
"student"
] |
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"
|
medium
|
840 |
address_1
|
[
"city",
"student"
] |
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"
|
medium
|
841 |
boat_1
|
[
"sailors"
] |
Return all details of sailors who are older than 30.
|
SELECT * FROM Sailors WHERE age > 30
|
easy
|
842 |
boat_1
|
[
"sailors"
] |
What can you tell me about sailors who are older than age 30?
|
SELECT * FROM Sailors WHERE age > 30
|
easy
|
843 |
boat_1
|
[
"sailors"
] |
Return name and age for sailors who are younger than 30.
|
SELECT name , age FROM Sailors WHERE age < 30
|
medium
|
844 |
boat_1
|
[
"sailors"
] |
What is the name and age of every sailor who is younger than age 30?
|
SELECT name , age FROM Sailors WHERE age < 30
|
medium
|
845 |
boat_1
|
[
"reserves"
] |
Find boats reserved by Sailor with id 1.
|
SELECT DISTINCT bid FROM Reserves WHERE sid = 1
|
easy
|
846 |
boat_1
|
[
"reserves"
] |
What are the different boat ids reserved by the sailor whose id is 1?
|
SELECT DISTINCT bid FROM Reserves WHERE sid = 1
|
easy
|
847 |
boat_1
|
[
"reserves",
"sailors"
] |
Who reserved boat 102?
|
SELECT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid WHERE T2.bid = 102
|
medium
|
848 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
medium
|
849 |
boat_1
|
[
"reserves"
] |
Return the unique boat ids (bid) of all reserved boats.
|
SELECT DISTINCT bid FROM Reserves
|
easy
|
850 |
boat_1
|
[
"reserves"
] |
What are the ids of all boats that are reserved by someone?
|
SELECT DISTINCT bid FROM Reserves
|
easy
|
851 |
boat_1
|
[
"sailors"
] |
What is the name of sailors whose names contain letter e?
|
SELECT name FROM Sailors WHERE name LIKE '%e%'
|
medium
|
852 |
boat_1
|
[
"sailors"
] |
What is the name of every sailor whose name contains the letter e?
|
SELECT name FROM Sailors WHERE name LIKE '%e%'
|
medium
|
853 |
boat_1
|
[
"sailors"
] |
return the unique ids of sailors who are older than any sailors.
|
SELECT DISTINCT sid FROM Sailors WHERE age > (SELECT min(age) FROM Sailors);
|
hard
|
854 |
boat_1
|
[
"sailors"
] |
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);
|
hard
|
855 |
boat_1
|
[
"sailors"
] |
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);
|
hard
|
856 |
boat_1
|
[
"sailors"
] |
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);
|
hard
|
857 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
medium
|
858 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
medium
|
859 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
medium
|
860 |
boat_1
|
[
"sailors",
"reserves"
] |
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
|
medium
|
861 |
boat_1
|
[
"reserves",
"boats"
] |
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"
|
hard
|
862 |
boat_1
|
[
"reserves",
"boats"
] |
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"
|
hard
|
863 |
boat_1
|
[
"reserves",
"sailors",
"boats"
] |
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"
|
extra
|
864 |
boat_1
|
[
"reserves",
"sailors",
"boats"
] |
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"
|
extra
|
865 |
boat_1
|
[
"reserves",
"boats"
] |
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"
|
extra
|
866 |
boat_1
|
[
"reserves",
"boats"
] |
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"
|
extra
|
867 |
boat_1
|
[
"reserves",
"sailors",
"boats"
] |
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 = "blue"
|
extra
|
868 |
boat_1
|
[
"reserves",
"sailors",
"boats"
] |
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 = "blue"
|
extra
|
869 |
boat_1
|
[
"reserves",
"sailors"
] |
What is the ids of sailors that haven’t reserved a boat?
|
SELECT sid FROM Sailors EXCEPT SELECT sid FROM Reserves
|
hard
|
870 |
boat_1
|
[
"reserves",
"sailors"
] |
What are the ids of sailors who have not reserved a boat?
|
SELECT sid FROM Sailors EXCEPT SELECT sid FROM Reserves
|
hard
|
871 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
extra
|
872 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
extra
|
873 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
hard
|
874 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
hard
|
875 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
medium
|
876 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
medium
|
877 |
boat_1
|
[
"sailors"
] |
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')
|
hard
|
878 |
boat_1
|
[
"sailors"
] |
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')
|
hard
|
879 |
boat_1
|
[
"sailors"
] |
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')
|
hard
|
880 |
boat_1
|
[
"sailors"
] |
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')
|
hard
|
881 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
medium
|
882 |
boat_1
|
[
"reserves",
"sailors"
] |
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
|
medium
|
883 |
boat_1
|
[
"sailors"
] |
Find the name and age of the oldest sailor.
|
SELECT name , age FROM Sailors WHERE age = ( SELECT max(age) FROM Sailors )
|
extra
|
884 |
boat_1
|
[
"sailors"
] |
What is the name and age of the sailor with maximum age?
|
SELECT name , age FROM Sailors WHERE age = ( SELECT max(age) FROM Sailors )
|
extra
|
885 |
boat_1
|
[
"sailors"
] |
how many sailors in total?
|
SELECT COUNT(*) FROM Sailors
|
easy
|
886 |
boat_1
|
[
"sailors"
] |
How many sailors exist?
|
SELECT COUNT(*) FROM Sailors
|
easy
|
887 |
boat_1
|
[
"sailors"
] |
What is the average age of sailors whose rating is 7?
|
SELECT AVG(age) FROM Sailors WHERE rating = 7
|
easy
|
888 |
boat_1
|
[
"sailors"
] |
What is average age of all sailors who have a rating of 7?
|
SELECT AVG(age) FROM Sailors WHERE rating = 7
|
easy
|
889 |
boat_1
|
[
"sailors"
] |
How many sailors whose name starts with letter D exist ?
|
select count(*) from sailors where name like 'd%'
|
medium
|
890 |
boat_1
|
[
"sailors"
] |
What is the count of the sailors whose name starts with letter D ?
|
select count(*) from sailors where name like 'd%'
|
medium
|
891 |
boat_1
|
[
"sailors"
] |
What are the average rating and max age of all sailors?
|
SELECT AVG(rating) , MAX(age) FROM Sailors
|
medium
|
892 |
boat_1
|
[
"sailors"
] |
Find the average rating and largest age for the sailors
|
SELECT AVG(rating) , MAX(age) FROM Sailors
|
medium
|
893 |
boat_1
|
[
"reserves"
] |
Find the number of reservations for each boat.
|
SELECT bid , count(*) FROM Reserves GROUP BY bid
|
medium
|
894 |
boat_1
|
[
"reserves"
] |
How many reservations exist for each boat?
|
SELECT bid , count(*) FROM Reserves GROUP BY bid
|
medium
|
895 |
boat_1
|
[
"reserves"
] |
Find the number of reservations for each boat with id greater than 50.
|
SELECT bid , count(*) FROM Reserves GROUP BY bid HAVING bid > 50
|
medium
|
896 |
boat_1
|
[
"reserves"
] |
How many reservations exist for each boat with an id greater than 50?
|
SELECT bid , count(*) FROM Reserves GROUP BY bid HAVING bid > 50
|
medium
|
897 |
boat_1
|
[
"reserves"
] |
Find the number of reservations for each boat with more than 1 reservation.
|
SELECT bid , count(*) FROM Reserves GROUP BY bid HAVING count(*) > 1
|
medium
|
898 |
boat_1
|
[
"reserves"
] |
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
|
medium
|
899 |
boat_1
|
[
"reserves"
] |
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
|
medium
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.