database_id stringlengths 4 31 | query stringlengths 22 577 | question stringlengths 19 224 |
|---|---|---|
school_player | SELECT LOCATION FROM school ORDER BY Founded DESC; | List the locations of schools in descending order of founded year. |
school_player | SELECT Enrollment FROM school WHERE Denomination != "Catholic"; | What are the enrollments of schools whose denomination is not "Catholic"? |
school_player | SELECT avg(Enrollment) FROM school; | What is the average enrollment of schools? |
school_player | SELECT Team FROM player ORDER BY Team ASC; | What are the teams of the players, sorted in ascending alphabetical order? |
school_player | SELECT Team FROM player ORDER BY Age DESC LIMIT 1; | Find the team of the player of the highest age. |
school_player | SELECT Team FROM player ORDER BY Age DESC LIMIT 5; | List the teams of the players with the top 5 largest ages. |
school_player | SELECT T1.Team , T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID; | For each player, show the team and the location of school they belong to. |
school_player | SELECT T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID HAVING COUNT(*) > 1; | Show the locations of schools that have more than 1 player. |
school_player | SELECT T2.Denomination FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID ORDER BY COUNT(*) DESC LIMIT 1; | Show the denomination of the school that has the most players. |
school_player | SELECT T1.Location , T2.Nickname FROM school AS T1 JOIN school_details AS T2 ON T1.School_ID = T2.School_ID; | Show locations and nicknames of schools. |
school_player | SELECT Denomination , COUNT(*) FROM school GROUP BY Denomination | Please show different denominations and the corresponding number of schools. |
school_player | SELECT Denomination , COUNT(*) FROM school GROUP BY Denomination ORDER BY COUNT(*) DESC | Please show different denominations and the corresponding number of schools in descending order. |
school_player | SELECT School_Colors FROM school ORDER BY Enrollment DESC LIMIT 1 | List the school color of the school that has the largest enrollment. |
school_player | SELECT LOCATION FROM school WHERE School_ID NOT IN (SELECT School_ID FROM Player) | List the locations of schools that do not have any player. |
school_player | SELECT Denomination FROM school WHERE Founded < 1890 INTERSECT SELECT Denomination FROM school WHERE Founded > 1900; | Show the denomination shared by schools founded before 1890 and schools founded after 1900 |
school_player | SELECT Nickname FROM school_details WHERE Division != "Division 1"; | Show the nicknames of schools that are not in division 1. |
store_product | SELECT max_page_size FROM product GROUP BY max_page_size HAVING count(*) > 3 | Find the list of page size which have more than 3 product listed |
store_product | SELECT district_name FROM district WHERE city_area > 10 OR City_Population > 100000 | Find the name all districts with city area greater than 10 or population larger than 100000 |
store_product | SELECT district_name FROM district ORDER BY city_population DESC LIMIT 1 | Which district has the largest population? |
store_product | SELECT district_name FROM district ORDER BY city_area ASC LIMIT 1 | Which district has the least area? |
store_product | SELECT t1.store_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t3.district_name = "Khanewal District" | Find the names of all stores in Khanewal District. |
store_product | SELECT t1.store_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id WHERE district_id = (SELECT district_id FROM district ORDER BY city_population DESC LIMIT 1) | Find all the stores in the district with the most population. |
store_product | SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t1.store_name = "Blackville" | Which city is the headquarter of the store named "Blackville" in? |
store_product | SELECT t3.headquartered_city , count(*) FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city | Find the number of stores in each city. |
store_product | SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city ORDER BY count(*) DESC LIMIT 1 | Find the city with the most number of stores. |
store_product | SELECT t1.product FROM product AS t1 JOIN store_product AS t2 ON t1.product_id = t2.product_id JOIN store AS t3 ON t2.store_id = t3.store_id WHERE t3.store_name = "Miramichi" | What products are available at store named "Miramichi"? |
store_product | SELECT product FROM product WHERE max_page_size = "A4" AND pages_per_minute_color < 5 | Find products with max page size as "A4" and pages per minute color smaller than 5. |
store_product | SELECT product FROM product WHERE max_page_size = "A4" OR pages_per_minute_color < 5 | Find products with max page size as "A4" or pages per minute color smaller than 5. |
store_product | SELECT product FROM product WHERE product LIKE "%Scanner%" | Find all the product whose name contains the word "Scanner". |
store_product | SELECT max_page_size FROM product GROUP BY max_page_size ORDER BY count(*) DESC LIMIT 1 | Find the most prominent max page size among all the products. |
store_product | SELECT product FROM product WHERE max_page_size != (SELECT max_page_size FROM product GROUP BY max_page_size ORDER BY count(*) DESC LIMIT 1) | Find the name of the products that are not using the most frequently-used max page size. |
store_product | SELECT sum(city_population) FROM district WHERE city_area > (SELECT avg(city_area) FROM district) | Find the total population of the districts where the area is bigger than the average city area. |
network_2 | SELECT count(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan' | How many friends does Dan have? |
network_2 | SELECT name FROM Person WHERE age = (SELECT max(age) FROM person) | Who is the oldest person? |
network_2 | SELECT name FROM Person WHERE job = 'student' AND age = (SELECT max(age) FROM person WHERE job = 'student' ) | Who is the oldest person whose job is student? |
network_2 | SELECT name FROM Person WHERE gender = 'male' AND age = (SELECT min(age) FROM person WHERE gender = 'male' ) | Who is the youngest male? |
network_2 | SELECT age FROM Person WHERE job = 'doctor' AND name = 'Zach' | How old is the doctor named Zach? |
network_2 | SELECT count(*) FROM Person WHERE age > 30 AND job = 'engineer' | How many people whose age is greater 30 and job is engineer? |
network_2 | SELECT avg(age) , job FROM Person WHERE gender = 'male' GROUP BY job | What is average age of male for different job title? |
network_2 | SELECT count(*) , gender FROM Person WHERE age < 40 GROUP BY gender | Find the number of people who is under 40 for each gender. |
network_2 | SELECT name FROM Person WHERE age > (SELECT min(age) FROM person WHERE job = 'engineer') ORDER BY age | Find the name of people whose age is greater than any engineer sorted by their age. |
network_2 | SELECT count(*) FROM Person WHERE age > (SELECT max(age) FROM person WHERE job = 'engineer') | Find the number of people whose age is greater than all engineers. |
network_2 | SELECT name, age FROM Person WHERE gender = 'male' ORDER BY age | Find the name and age of all males in order of their age. |
network_2 | SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' INTERSECT SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' | Find the name and age of the person who is a friend of both Dan and Alice. |
network_2 | SELECT DISTINCT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' OR T2.friend = 'Alice' | Find the name and age of the person who is a friend of Dan or Alice. |
network_2 | SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) INTERSECT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30) | Find the name of the person who has friends with age above 40 and under age 30? |
network_2 | SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) EXCEPT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30) | Find the name of the person who has friends with age above 40 but not under age 30? |
network_2 | SELECT name FROM person EXCEPT SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.job = 'student' | Find the name of the person who has no student friends. |
network_2 | SELECT name FROM PersonFriend GROUP BY name HAVING count(*) = 1 | Find the person who has exactly one friend. |
network_2 | SELECT friend FROM PersonFriend WHERE name = 'Bob' | Who are the friends of Bob? |
network_2 | SELECT name FROM PersonFriend WHERE friend = 'Bob' | Find the name of persons who are friends with Bob. |
network_2 | SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Zach' AND T1.gender = 'female' | Find the names of females who are friends with Zach |
network_2 | SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'female' | Find the female friends of Alice. |
network_2 | SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'male' AND T1.job = 'doctor' | Find the male friend of Alice whose job is a doctor? |
network_2 | SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.city = 'new york city' | Who has a friend that is from new york city? |
network_2 | SELECT DISTINCT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age < (SELECT avg(age) FROM person) | Who has friends that are younger than the average age? |
network_2 | SELECT DISTINCT T2.name , T2.friend , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT avg(age) FROM person) | Who has friends that are older than the average age? Print their friends and their ages as well |
network_2 | SELECT friend FROM PersonFriend WHERE name = 'Zach' AND YEAR = (SELECT max(YEAR) FROM PersonFriend WHERE name = 'Zach') | Who is the friend of Zach with longest year relationship? |
network_2 | SELECT T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Zach' AND T2.year = (SELECT max(YEAR) FROM PersonFriend WHERE name = 'Zach') | What is the age of the friend of Zach with longest year relationship? |
network_2 | SELECT name FROM PersonFriend WHERE friend = 'Alice' AND YEAR = (SELECT min(YEAR) FROM PersonFriend WHERE friend = 'Alice') | Find the name of persons who are friends with Alice for the shortest years. |
network_2 | SELECT T1.name , T1.age , T1.job FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' AND T2.year = (SELECT max(YEAR) FROM PersonFriend WHERE friend = 'Alice') | Find the name, age, and job title of persons who are friends with Alice for the longest years. |
network_2 | SELECT name FROM person EXCEPT SELECT name FROM PersonFriend | Who is the person that has no friend? |
network_2 | SELECT T2.name , avg(T1.age) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend GROUP BY T2.name ORDER BY avg(T1.age) DESC LIMIT 1 | Which person whose friends have the oldest average age? |
network_2 | SELECT count(DISTINCT name) FROM PersonFriend WHERE friend NOT IN (SELECT name FROM person WHERE city = 'Austin') | What is the total number of people who has no friend living in the city of Austin. |
browser_web | SELECT max(market_share) , min(market_share) , avg(market_share) FROM browser | What is the maximum, minimum and average market share of the listed browsers? |
browser_web | SELECT T1.name FROM browser AS T1 JOIN accelerator_compatible_browser AS T2 ON T1.id = T2.browser_id JOIN web_client_accelerator AS T3 ON T2.accelerator_id = T3.id WHERE T3.name = 'CProxy' AND T2.compatible_since_year > 1998 | What is the name of the browser that became compatible with the accelerator 'CProxy' after year 1998 ? |
browser_web | SELECT T1.id , T1.Name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id GROUP BY T1.id HAVING count(*) >= 2 | What are the ids and names of the web accelerators that are compatible with two or more browsers? |
browser_web | SELECT T1.id , T1.name FROM browser AS T1 JOIN accelerator_compatible_browser AS T2 ON T1.id = T2.browser_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1 | What is the id and name of the browser that is compatible with the most web accelerators? |
browser_web | SELECT T1.compatible_since_year FROM accelerator_compatible_browser AS T1 JOIN browser AS T2 ON T1.browser_id = T2.id JOIN web_client_accelerator AS T3 ON T1.accelerator_id = T3.id WHERE T3.name = 'CACHEbox' AND T2.name = 'Internet Explorer' | When did the web accelerator 'CACHEbox' and browser 'Internet Explorer' become compatible? |
browser_web | SELECT count(*) FROM web_client_accelerator WHERE id NOT IN ( SELECT accelerator_id FROM accelerator_compatible_browser ); | How many accelerators are not compatible with the browsers listed ? |
browser_web | SELECT DISTINCT T1.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T3.market_share > 15; | What distinct accelerator names are compatible with the browswers that have market share higher than 15? |
browser_web | SELECT T3.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T1.name = 'CACHEbox' INTERSECT SELECT T3.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id ... | List the names of the browser that are compatible with both 'CACHEbox' and 'Fasterfox'. |
browser_web | SELECT name , operating_system FROM web_client_accelerator EXCEPT SELECT T1.name , T1.operating_system FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T3.name = 'Opera' | Show the accelerator names and supporting operating systems that are not compatible with the browser named 'Opera'. |
browser_web | SELECT name FROM web_client_accelerator WHERE name LIKE "%Opera%" | Which accelerator name contains substring "Opera"? |
roller_coaster | SELECT Status FROM roller_coaster WHERE LENGTH > 3300 OR Height > 100 | Show the statuses of roller coasters longer than 3300 or higher than 100. |
roller_coaster | SELECT Speed FROM roller_coaster ORDER BY LENGTH DESC LIMIT 1 | What is the speed of the longest roller coaster? |
roller_coaster | SELECT Status FROM roller_coaster GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1 | Please show the most common status of roller coasters. |
roller_coaster | SELECT Status FROM roller_coaster GROUP BY Status HAVING COUNT(*) > 2 | List the status shared by more than two roller coasters. |
roller_coaster | SELECT Park FROM roller_coaster ORDER BY Speed DESC LIMIT 1 | Show the park of the roller coaster with the highest speed. |
roller_coaster | SELECT T1.Name FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name HAVING COUNT(*) > 1 | Show the names of countries that have more than one roller coaster. |
roller_coaster | SELECT T1.Name , T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID ORDER BY T2.Height DESC LIMIT 1 | Show the name and population of the country that has the highest roller coaster. |
roller_coaster | SELECT T1.Name , avg(T2.Speed) FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name | Show the names of countries and the average speed of roller coasters from each country. |
roller_coaster | SELECT count(*) FROM country WHERE country_id NOT IN ( SELECT country_id FROM roller_coaster WHERE LENGTH > 3000 ) | How many countries do not have an roller coaster longer than 3000? |
dorm_1 | SELECT count(*) FROM student WHERE sex = 'F' AND age < 25 | How many female students (sex is F) whose age is below 25? |
dorm_1 | SELECT fname FROM student WHERE city_code = 'PHL' AND age BETWEEN 20 AND 25 | Find the first name of students living in city PHL whose age is between 20 and 25. |
dorm_1 | SELECT avg(student_capacity) , sum(student_capacity) FROM dorm WHERE gender = 'X' | Find the average and total capacity of dorms for the students with gender X. |
dorm_1 | SELECT dorm_name FROM dorm WHERE dormid NOT IN (SELECT dormid FROM has_amenity) | Find the name of dorms that do not have any amenity. |
dorm_1 | SELECT student_capacity, gender FROM dorm WHERE dorm_name LIKE '%Donor%' | Find the capacity and gender type of the dorm whose name has substring ‘Donor’. |
dorm_1 | SELECT dorm_name, gender FROM dorm WHERE student_capacity > 300 OR student_capacity < 100 | Find the name and gender type of the dorms whose capacity is greater than 300 or less than 100. |
dorm_1 | SELECT count(DISTINCT major), count(DISTINCT city_code) FROM student | Find the numbers of different majors and cities. |
dorm_1 | SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' INTERSECT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.ameni... | Find the name of dorms which have both TV Lounge and Study Room as amenities. |
dorm_1 | SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid W... | Find the name of dorms which have TV Lounge but no Study Room as amenity. |
dorm_1 | SELECT lname FROM student WHERE sex = 'F' AND city_code = 'BAL' UNION SELECT lname FROM student WHERE sex = 'M' AND age < 20 | Find the last name of students who is either female (sex is F) and living in the city of code BAL or male (sex is M) and in age of below 20. |
dorm_1 | SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1 | Find the name of the dorm with the largest capacity. |
dorm_1 | SELECT city_code FROM student GROUP BY city_code ORDER BY count(*) DESC LIMIT 1 | Find the code of city where most of students are living in. |
dorm_1 | SELECT fname , lname FROM student WHERE age < (SELECT avg(age) FROM student) | Find the first and last name of students whose age is younger than the average age. |
dorm_1 | SELECT fname, lname FROM student WHERE city_code != 'HKG' ORDER BY age | List the first and last name of students who are not living in the city with code HKG, and sorted the results by their ages. |
dorm_1 | SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T2.amenid = T1.amenid JOIN dorm AS T3 ON T2.dormid = T3.dormid WHERE T3.dorm_name = 'Anonymous Donor Hall' ORDER BY T1.amenity_name | List name of all amenities which Anonymous Donor Hall has, and sort the results in alphabetic order. |
dorm_1 | SELECT count(*) , sum(student_capacity) , gender FROM dorm GROUP BY gender | Find the number of dorms and total capacity for each gender. |
dorm_1 | SELECT avg(age) , max(age) , sex FROM student GROUP BY sex | Find the average and oldest age for students with different sex. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.