niryuu/sni-each-converted huggingface dataset:
Step 1: For each row in model_list table, find the corresponding rows in car_names table.
Step 2: find MakeId, ModelId of the results of step 1 whose model_list's Model greater than or equals 2.
Step 3: find MakeId, ModelId of the results of step 1 whose model_list's Model greater than 3.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T2.MakeId , T1.ModelId FROM model_list AS T1 JOIN car_names AS T2 ON T1.Model = T2.Model WHERE T1.Model > = 2 INTERSECT SELECT T2.MakeId , T1.ModelId FROM model_list AS T1 JOIN car_names AS T2 ON T1.Model = T2.Model WHERE T1.Model > 3
find the Hight_definition_TV, Country of TV_Channel table for which Language not equals English
Output: SELECT Hight_definition_TV , Country FROM TV_Channel WHERE Language ! = "English"
find the average LifeExpectancy in country table whose Continent equals Central Africa
Output: SELECT Avg ( LifeExpectancy ) FROM country WHERE Continent = "Central Africa"
Step 1: find the number of rows in countrylanguage table whose Language equals English.
Step 2: For each row in country table, find the corresponding rows in countrylanguage table.
Step 3: find Continent of the results of step 2 whose Language equals Dutch.
Step 4: show the rows that are in both the results of step 1 and the results of step 3
Output: SELECT Count ( * ) FROM countrylanguage AS T1 WHERE T1.Language = "English" INTERSECT SELECT T2.Continent FROM country AS T2 JOIN countrylanguage AS T1 ON T2.Code = T1.CountryCode WHERE T1.Language = "Dutch"
Step 1: find the number of rows of each value of Model in model_list table.
Step 2: find Model of model_list table with largest value in the results of step 1
Output: SELECT Model FROM model_list GROUP BY Model ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in airports table, find the corresponding rows in flights table.
Step 2: find AirportCode of the results of step 1 with largest value of FlightNo
Output: SELECT T1.AirportCode FROM airports AS T1 JOIN flights AS T2 ON T1.AirportCode = T2.SourceAirport ORDER BY T2.FlightNo Desc LIMIT 1
Step 1: For each row in teacher table, find the corresponding rows in course_arrange table.
Step 2: find each value of course_arrange's Teacher_ID in the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT T1.Name , Count ( * ) FROM teacher AS T1 JOIN course_arrange AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Teacher_ID
find the maximum Weight in cars_data table whose Cylinders equals 1
Output: SELECT Max ( Weight ) FROM cars_data WHERE Cylinders = 1
find the Template_Details, Template_Type_Code of Templates table for which Version_Number greater than 5
Output: SELECT Template_Details , Template_Type_Code FROM Templates WHERE Version_Number > 5
Step 1: For each row in ship table, find the corresponding rows in death table.
Step 2: find the summation of injured of each value of death's id in the results of step 1.
Step 3: find ship's id, name of step 1 results with largest value in the results of step 2
Output: SELECT T1.id , T1.name FROM ship AS T1 JOIN death AS T2 ON T1.id = T2.caused_by_ship_id GROUP BY T2.id ORDER BY Sum ( T2.injured ) Desc LIMIT 1
find the Name of country table with smallest value of LifeExpectancy
Output: SELECT Name FROM country ORDER BY LifeExpectancy Asc LIMIT 1
Step 1: For each row in Addresses table, find the corresponding rows in Students table.
Step 2: find first_name of the results of step 1 whose country equals Iceland or cell_mobile_number equals (096)889-8954x524.
Step 3: find first_name of the results of step 1 whose country equals 09700166582 or cell_mobile_number equals Haiti.
Step 4: show the rows that are in any of the results of step 2 or the results of step 3
Output: SELECT T2.first_name FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.current_address_id WHERE T1.country = "Iceland" OR T2.cell_mobile_number = "(096)889-8954x524" UNION SELECT T2.first_name FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.current_address_id WHERE T1.country = 09700166582 OR T2.cell_mobile_number = "Haiti"
find the number of rows in airports table whose AirportName equals Aberdeen
Output: SELECT Count ( * ) FROM airports WHERE AirportName = "Aberdeen"
Step 1: find the average charge_amount in Charges table.
Step 2: For each row in Charges table, find the corresponding rows in Professionals table.
Step 3: find first_name, last_name in the results of step 2 whose charge_amount less than the results of step 1
Output: SELECT T2.first_name , T2.last_name FROM Charges AS T1 JOIN Professionals AS T2 WHERE T1.charge_amount < ( SELECT Avg ( T1.charge_amount ) FROM Charges AS T1 )
find the first_name, last_name, owner_id of Owners table
Output: SELECT first_name , last_name , owner_id FROM Owners
Step 1: For each row in TV_Channel table, find the corresponding rows in Cartoon table.
Step 2: find Country of the results of step 1 whose Written_by equals Michael Jelenic.
Step 3: find Country of the results of step 1 whose Written_by equals Todd Casey and Directed_by equals Ben Jones.
Step 4: show the rows that are in the results of step 2 but not in the results of step 3
Output: SELECT T1.Country FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Written_by = "Michael Jelenic" EXCEPT SELECT T1.Country FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Written_by = "Todd Casey" AND T2.Directed_by = "Ben Jones"
Step 1: find the StuID of Has_Pet table.
Step 2: find the Fname, Age of Student table whose Student's StuID not one of the results of step 1
Output: SELECT T1.Fname , T1.Age FROM Student AS T1 WHERE T1.StuID NOT IN ( SELECT T2.StuID FROM Has_Pet AS T2 )
Step 1: For each row in people table, find the corresponding rows in poker_player table.
Step 2: find Earnings of the results of step 1 with largest value of Height
Output: SELECT T1.Earnings FROM poker_player AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Height Desc LIMIT 1
Step 1: find the semester_name of Semesters table for which semester_name equals Master.
Step 2: find the semester_name of Semesters table for which semester_description equals Bachelor.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT semester_name FROM Semesters WHERE semester_name = "Master" INTERSECT SELECT semester_name FROM Semesters WHERE semester_description = "Bachelor"
Step 1: For each row in Owners table, find the corresponding rows in Dogs table.
Step 2: find first_name of the results of step 1 whose state equals Virginia and name equals Kacey
Output: SELECT T1.first_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T1.state = "Virginia" AND T2.name = "Kacey"
find the Name, Country, Age of singer table ordered ascending by Age
Output: SELECT Name , Country , Age FROM singer ORDER BY Age Asc
find the number of rows in players table
Output: SELECT Count ( * ) FROM players
Step 1: find the number of rows of each value of CountryId in countries table.
Step 2: find CountryId, CountryName in countries table whose corresponding value in step 1 is greater than fiat.
Step 3: find CountryId, CountryName in countries table whose corresponding value in step 1 is greater than 3.
Step 4: show the rows that are in any of the results of step 2 or the results of step 4
Output: SELECT CountryId , CountryName FROM countries GROUP BY CountryId HAVING Count ( * ) > "fiat" UNION SELECT CountryId , CountryName FROM countries GROUP BY CountryId HAVING Count ( * ) > 3
find the Name of conductor table
Output: SELECT Name FROM conductor
Step 1: find the number of rows of each value of Template_ID in Documents table.
Step 2: find Template_ID in Documents table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT Template_ID FROM Documents GROUP BY Template_ID HAVING Count ( * ) > = 2
Step 1: find the AirportName of airports table.
Step 2: find the AirportName of airports table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT AirportName FROM airports EXCEPT SELECT AirportName FROM airports
find the number of rows in airlines table whose Airline equals JetBlue Airways
Output: SELECT Count ( * ) FROM airlines WHERE Airline = "JetBlue Airways"
find the course_name of Courses table
Output: SELECT course_name FROM Courses
find without repetition the Template_Type_Description of Ref_Template_Types table
Output: SELECT DISTINCT Template_Type_Description FROM Ref_Template_Types
find without repetition the email_address of Students table
Output: SELECT DISTINCT email_address FROM Students
find the Name of country table for which Continent equals Aruba
Output: SELECT Name FROM country WHERE Continent = "Aruba"
find the number of rows in Ref_Feature_Types table
Output: SELECT Count ( * ) FROM Ref_Feature_Types
find the loser_rank of matches table
Output: SELECT loser_rank FROM matches
Step 1: For each row in Documents table, find the corresponding rows in Paragraphs table.
Step 2: find Paragraphs's Other_Details of the results of step 1 whose Document_Name contains Korea
Output: SELECT T2.Other_Details FROM Documents AS T1 JOIN Paragraphs AS T2 ON T1.Document_ID = T2.Document_ID WHERE T1.Document_Name LIKE "Korea"
Step 1: find the number of rows of each value of course_id in Courses table.
Step 2: find course_name, course_id in Courses table whose corresponding value in step 1 is less than or equals 2
Output: SELECT course_name , course_id FROM Courses GROUP BY course_id HAVING Count ( * ) < = 2
Step 1: For each row in Treatment_Types table, find the corresponding rows in Treatments table.
Step 2: find the number of rows of each value of Treatments's treatment_type_code in the results of step 1.
Step 3: find Treatment_Types's treatment_type_code of step 1 results with largest value in the results of step 2
Output: SELECT T1.treatment_type_code FROM Treatment_Types AS T1 JOIN Treatments AS T2 ON T1.treatment_type_code = T2.treatment_type_code GROUP BY T2.treatment_type_code ORDER BY Count ( * ) Desc LIMIT 1
find the maximum Accelerate in cars_data table whose Cylinders equals 1 or Year less than 8
Output: SELECT Max ( Accelerate ) FROM cars_data WHERE Cylinders = 1 OR Year < 8
Step 1: find the name of Highschooler table.
Step 2: find the name of Highschooler table.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT name FROM Highschooler INTERSECT SELECT name FROM Highschooler
find the number of different Episode and the number of rows in TV_series table
Output: SELECT Count ( DISTINCT Episode ) , Count ( * ) FROM TV_series
find the SurfaceArea, Population of country table
Output: SELECT SurfaceArea , Population FROM country
find the number of rows in stadium table
Output: SELECT Count ( * ) FROM stadium
find the summation of Population in country table whose Continent not equals English
Output: SELECT Sum ( Population ) FROM country WHERE Continent ! = "English"
Step 1: For each row in Documents table, find the corresponding rows in Paragraphs table.
Step 2: find Paragraphs's Other_Details of the results of step 1 whose Document_Name equals Korea
Output: SELECT T2.Other_Details FROM Documents AS T1 JOIN Paragraphs AS T2 ON T1.Document_ID = T2.Document_ID WHERE T1.Document_Name = "Korea"
Step 1: find the CountryName of countries table.
Step 2: For each row in car_makers table, find corresponding rows in countries table and in model_list table.
Step 3: find CountryName of the results of step 2 whose Model equals amc.
Step 4: show the rows that are in the results of step 1 but not in the results of step 3
Output: SELECT T1.CountryName FROM countries AS T1 EXCEPT SELECT T1.CountryName FROM countries AS T1 JOIN car_makers AS T2 ON T1.CountryId = T2.Country JOIN model_list AS T3 ON T2.Id = T3.Maker WHERE T3.Model = "amc"
Step 1: find the CountryCode of countrylanguage table for which Language equals English.
Step 2: find the Population of country table whose Continent not one of the results of step 1
Output: SELECT T1.Population FROM country AS T1 WHERE T1.Continent NOT IN ( SELECT T2.CountryCode FROM countrylanguage AS T2 WHERE T2.Language = "English" )
Step 1: find the professional_id, last_name, home_phone of Professionals table for which state equals Indiana.
Step 2: find the number of rows of each value of professional_id in Professionals table.
Step 3: find professional_id, last_name, home_phone in Professionals table whose corresponding value in step 2 is greater than or equals 2.
Step 4: show the rows that are in any of the results of step 1 or the results of step 3
Output: SELECT professional_id , last_name , home_phone FROM Professionals WHERE state = "Indiana" UNION SELECT professional_id , last_name , home_phone FROM Professionals GROUP BY professional_id HAVING Count ( * ) > = 2
Step 1: find the number of rows of each value of professional_id in Professionals table.
Step 2: find professional_id, role_code, first_name in Professionals table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT professional_id , role_code , first_name FROM Professionals GROUP BY professional_id HAVING Count ( * ) > = 2
Step 1: for each value of Document_ID in Paragraphs table, calculate number of rows.
Step 2: show each value of Document_ID in Paragraphs table along with the corresponding number of rows ordered ascending by the results of step 1
Output: SELECT Document_ID , Count ( * ) FROM Paragraphs GROUP BY Document_ID ORDER BY Count ( * ) Asc
Step 1: find the student_id of Likes table.
Step 2: find the name of Highschooler table whose ID not one of the results of step 1
Output: SELECT T1.name FROM Highschooler AS T1 WHERE T1.ID NOT IN ( SELECT T2.student_id FROM Likes AS T2 )
Step 1: For each row in car_names table, find corresponding rows in model_list table and in cars_data table.
Step 2: find the number of rows of each value of model_list's Model in the results of step 1.
Step 3: find Edispl of the results of step 1 with largest value in the results of step 2
Output: SELECT T3.Edispl FROM model_list AS T1 JOIN car_names AS T2 ON T1.Model = T2.Model JOIN cars_data AS T3 ON T2.MakeId = T3.Id GROUP BY T1.Model ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in battle table, find the corresponding rows in ship table.
Step 2: find battle's name, date of the results of step 1 whose ship's name equals HMS Atalanta and ship's name equals Lettice
Output: SELECT T1.name , T1.date FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.name = "Lettice" AND T2.name = "HMS Atalanta"
find the AirportName of airports table for which AirportName equals AKO
Output: SELECT AirportName FROM airports WHERE AirportName = "AKO"
Step 1: find the number of rows of each value of Year_of_Founded in orchestra table.
Step 2: find Year_of_Founded in orchestra table whose corresponding value in step 1 is greater than 1
Output: SELECT Year_of_Founded FROM orchestra GROUP BY Year_of_Founded HAVING Count ( * ) > 1
find the number of rows in car_makers table whose Maker equals American Motor Company
Output: SELECT Count ( * ) FROM car_makers WHERE Maker = "American Motor Company"
Step 1: find the StuID of Has_Pet table.
Step 2: find without repetition the Fname, Age of Student table whose Student's StuID not one of the results of step 1
Output: SELECT DISTINCT T1.Fname , T1.Age FROM Student AS T1 WHERE T1.StuID NOT IN ( SELECT T2.StuID FROM Has_Pet AS T2 )
find the Name of country table for which Continent equals Asia with largest value of Population
Output: SELECT Name FROM country WHERE Continent = "Asia" ORDER BY Population Desc LIMIT 1
Step 1: For each row in stadium table, find the corresponding rows in concert table.
Step 2: only keep the results of step 1 whose Year greater than 2014.
Step 3: find the number of rows of each value of stadium's Stadium_ID in the results of step 2.
Step 4: find Name, Capacity of the results of step 2 with largest value in the results of step 3
Output: SELECT T1.Name , T1.Capacity FROM stadium AS T1 JOIN concert AS T2 ON T1.Stadium_ID = T2.Stadium_ID WHERE T2.Year > 2014 GROUP BY T1.Stadium_ID ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of Continent in country table.
Step 2: find Continent of country table with largest value in the results of step 1
Output: SELECT Continent FROM country GROUP BY Continent ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of Abbreviation in airlines table.
Step 2: find Abbreviation, Country of airlines table with smallest value in the results of step 1
Output: SELECT Abbreviation , Country FROM airlines GROUP BY Abbreviation ORDER BY Count ( * ) Asc LIMIT 1
find the number of rows in battle table whose result equals Captured
Output: SELECT Count ( * ) FROM battle WHERE result = "Captured"
find the number of rows in performance table whose Type greater than or equals CD
Output: SELECT Count ( * ) FROM performance WHERE Type > = "CD"
Step 1: find the loser_name of matches table for which year equals 2013.
Step 2: find the loser_name of matches table for which year equals 2016.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT loser_name FROM matches WHERE year = 2013 INTERSECT SELECT loser_name FROM matches WHERE year = 2016
find the Continent of country table for which IndepYear greater than 1950
Output: SELECT Continent FROM country WHERE IndepYear > 1950
find the rows of employee table
Output: SELECT * FROM employee
Step 1: For each row in country table, find the corresponding rows in city table.
Step 2: find without repetition city's Name of the results of step 1 whose Continent equals T and country's Name equals Chinese
Output: SELECT DISTINCT T1.Name FROM city AS T1 JOIN country AS T2 ON T1.CountryCode = T2.Code WHERE T2.Continent = "T" AND T2.Name = "Chinese"
find the average age in Dogs table whose gender equals 1
Output: SELECT Avg ( age ) FROM Dogs WHERE gender = 1
find the LName of Student table for which Age equals 3
Output: SELECT LName FROM Student WHERE Age = 3
find the Continent of country table
Output: SELECT Continent FROM country
Step 1: find the minimum Num_of_Staff in museum table whose Open_Year less than 2010.
Step 2: find the Name of museum table whose Num_of_Staff greater than the results of step 1
Output: SELECT Name FROM museum WHERE Num_of_Staff > ( SELECT Min ( Num_of_Staff ) FROM museum WHERE Open_Year < 2010 )
find the rows, Template_Type_Code of Templates table with smallest value of Template_Type_Code
Output: SELECT * , Template_Type_Code FROM Templates ORDER BY Template_Type_Code Asc LIMIT 1
Step 1: find rows in country table whose IndepYear less than 1930.
Step 2: find each value of GovernmentForm in the results of step 1 along with the  Code of the corresponding rows to each value
Output: SELECT Code2 , Count ( DISTINCT Code ) FROM country WHERE IndepYear < 1930 GROUP BY GovernmentForm
Step 1: For each row in Treatment_Types table, find the corresponding rows in Treatments table.
Step 2: find the number of rows of each value of Treatments's treatment_type_code in the results of step 1.
Step 3: find treatment_type_description of step 1 results with smallest value in the results of step 2
Output: 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 T2.treatment_type_code ORDER BY Count ( * ) Asc LIMIT 1
Step 1: For each row in Dogs table, find the corresponding rows in Treatments table.
Step 2: find treatment_type_code, weight of the results of step 1
Output: SELECT T2.treatment_type_code , T1.weight FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id = T2.dog_id
find the treatment_type_description, treatment_type_code of Treatment_Types table
Output: SELECT treatment_type_description , treatment_type_code FROM Treatment_Types
find the summation of Population in country table
Output: SELECT Sum ( Population ) FROM country
Step 1: For each row in country table, find corresponding rows in city table and in countrylanguage table.
Step 2: find city's Name of the results of step 1 whose Language equals English
Output: SELECT T1.Name FROM city AS T1 JOIN country AS T2 ON T1.CountryCode = T2.Code JOIN countrylanguage AS T3 ON T2.Code = T3.CountryCode WHERE T3.Language = "English"
find the Population, Continent of country table
Output: SELECT Population , Continent FROM country
find the charge_amount of Charges table with largest value of charge_amount
Output: SELECT charge_amount FROM Charges ORDER BY charge_amount Desc LIMIT 1
Step 1: find the Name, Continent of country table ordered descending by SurfaceArea.
Step 2: only show the first 5 rows of the results
Output: SELECT Name , Continent FROM country ORDER BY SurfaceArea Desc LIMIT 5
find the average Edispl in cars_data table whose Year less than 1980
Output: SELECT Avg ( Edispl ) FROM cars_data WHERE Year < 1980
Step 1: find the number of rows of each value of Airline in airlines table.
Step 2: find Airline in airlines table whose corresponding value in step 1 is less than 200
Output: SELECT Airline FROM airlines GROUP BY Airline HAVING Count ( * ) < 200
Step 1: For each row in country table, find the corresponding rows in countrylanguage table.
Step 2: find the number of different Language in the results of step 1 whose Continent equals Aruba
Output: SELECT Count ( DISTINCT T2.Language ) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Continent = "Aruba"
Step 1: find the StuID of Has_Pet table.
Step 2: find the Fname of Student table whose Student's StuID one of the results of step 1.
Step 3: find the Fname of Student table.
Step 4: show the rows that are in the results of step 2 but not in the results of step 3
Output: SELECT T1.Fname FROM Student AS T1 WHERE T1.StuID IN ( SELECT T2.StuID FROM Has_Pet AS T2 ) EXCEPT SELECT T1.Fname FROM Student AS T1
Step 1: find the semester_name of Semesters table.
Step 2: find the course_name of Courses table whose course_name not one of the results of step 1
Output: SELECT T1.course_name FROM Courses AS T1 WHERE T1.course_name NOT IN ( SELECT T2.semester_name FROM Semesters AS T2 )
Step 1: For each row in Addresses table, find the corresponding rows in Students table.
Step 2: find first_name, line_1 of the results of step 1
Output: SELECT T2.first_name , T1.line_1 FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.current_address_id
find the number of rows in airports table whose AirportName equals Aberdeen or City equals Abilene
Output: SELECT Count ( * ) FROM airports WHERE AirportName = "Aberdeen" OR City = "Abilene"
find the LocalName of country table for which Region equals Kabul
Output: SELECT LocalName FROM country WHERE Region = "Kabul"
find the number of rows in Documents table whose Document_Name equals Summer Show
Output: SELECT Count ( * ) FROM Documents WHERE Document_Name = "Summer Show"
find the first_name, first_name of Professionals table
Output: SELECT first_name , first_name FROM Professionals
find the property_name of Properties table for which room_count greater than 1
Output: SELECT property_name FROM Properties WHERE room_count > 1
Step 1: For each row in airlines table, find the corresponding rows in flights table.
Step 2: find FlightNo of the results of step 1 whose Abbreviation equals APG
Output: SELECT T2.FlightNo FROM airlines AS T1 JOIN flights AS T2 WHERE T1.Abbreviation = "APG"
Step 1: For each row in Breeds table, find the corresponding rows in Dogs table.
Step 2: find breed_name of the results of step 1 with largest value of weight
Output: SELECT T1.breed_name FROM Breeds AS T1 JOIN Dogs AS T2 ON T1.breed_code = T2.breed_code ORDER BY T2.weight Desc LIMIT 1
find without repetition the grade of Highschooler table for which grade equals 9
Output: SELECT DISTINCT grade FROM Highschooler WHERE grade = 9
find the number of rows in car_makers table whose Country equals france
Output: SELECT Count ( * ) FROM car_makers WHERE Country = "france"
Step 1: find the number of rows of each value of Continent in country table.
Step 2: find Name of country table with largest value in the results of step 1
Output: SELECT Name FROM country GROUP BY Continent ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of owner_id in Owners table.
Step 2: find owner_id, last_name of Owners table with largest value in the results of step 1
Output: SELECT owner_id , last_name FROM Owners GROUP BY owner_id ORDER BY Count ( * ) Desc LIMIT 1
find the Code2 of country table for which Continent equals Beatrix
Output: SELECT Code2 FROM country WHERE Continent = "Beatrix"
Step 1: find the number of rows of each value of Abbreviation in airlines table.
Step 2: find Airline of airlines table with largest value in the results of step 1
Output: SELECT Airline FROM airlines GROUP BY Abbreviation ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of grade in Highschooler table.
Step 2: find name in Highschooler table whose corresponding value in step 1 is greater than or equals 3
Output: SELECT name FROM Highschooler GROUP BY grade HAVING Count ( * ) > = 3
find the number of rows in airports table whose City equals Aberdeen or City equals Abilene
Output: SELECT Count ( * ) FROM airports WHERE City = "Abilene" OR City = "Aberdeen"
find the LocalName of country table
Output: SELECT LocalName FROM country
Step 1: find the Airline of airlines table for which airlines's Country equals CVO.
Step 2: For each row in airlines table, find the corresponding rows in airports table.
Step 3: find Airline of the results of step 2 whose airports's Country equals APG.
Step 4: show the rows that are in the results of step 1 but not in the results of step 3
Output: SELECT T1.Airline FROM airlines AS T1 WHERE T1.Country = "CVO" EXCEPT SELECT T1.Airline FROM airlines AS T1 JOIN airports AS T2 WHERE T2.Country = "APG"
Step 1: For each row in ship table, find the corresponding rows in death table.
Step 2: find note, killed of the results of step 1 whose tonnage equals t
Output: SELECT T2.note , T2.killed FROM ship AS T1 JOIN death AS T2 ON T1.id = T2.caused_by_ship_id WHERE T1.tonnage = "t"
Step 1: For each row in TV_Channel table, find the corresponding rows in Cartoon table.
Step 2: find Country of the results of step 1 whose Written_by equals Michael Jelenic.
Step 3: find Country of the results of step 1 whose Written_by equals Todd Casey.
Step 4: show the rows that are in the results of step 2 but not in the results of step 3
Output: SELECT T1.Country FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Written_by = "Michael Jelenic" EXCEPT SELECT T1.Country FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Written_by = "Todd Casey"
find the Name of country table for which Continent equals Beatrix
Output: SELECT Name FROM country WHERE Continent = "Beatrix"
find the average Accelerate in cars_data table whose Cylinders equals 4
Output: SELECT Avg ( Accelerate ) FROM cars_data WHERE Cylinders = 4
find the average age in Dogs table
Output: SELECT Avg ( age ) FROM Dogs
Step 1: For each row in players table, find the corresponding rows in matches table.
Step 2: find first_name, country_code, birth_date of the results of step 1 with smallest value of winner_rank
Output: SELECT T1.first_name , T1.country_code , T1.birth_date FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.loser_id ORDER BY T2.winner_rank Asc LIMIT 1
find the average Horsepower in cars_data table whose Year equals volvo
Output: SELECT Avg ( Horsepower ) FROM cars_data WHERE Year = "volvo"
find the average GNP and the average Population in country table whose Continent equals US Territory
Output: SELECT Avg ( GNP ) , Avg ( Population ) FROM country WHERE Continent = "US Territory"
find the number of different Code in country table whose Continent equals Afghanistan
Output: SELECT Count ( DISTINCT Code ) FROM country WHERE Continent = "Afghanistan"
Step 1: For each row in Templates table, find corresponding rows in Ref_Template_Types table and in Documents table.
Step 2: find Document_ID, Document_Name, Template_Type_Description of the results of step 1
Output: SELECT T3.Document_ID , T3.Document_Name , T1.Template_Type_Description FROM Ref_Template_Types AS T1 JOIN Templates AS T2 ON T1.Template_Type_Code = T2.Template_Type_Code JOIN Documents AS T3 ON T2.Template_ID = T3.Template_ID
Step 1: For each row in Documents table, find the corresponding rows in Paragraphs table.
Step 2: find the number of rows of each value of Paragraphs's Document_ID in the results of step 1.
Step 3: find Documents's Document_ID in the results of step 1 whose corresponding value in step 2 is greater than or equals 2
Output: SELECT T1.Document_ID FROM Documents AS T1 JOIN Paragraphs AS T2 ON T1.Document_ID = T2.Document_ID GROUP BY T2.Document_ID HAVING Count ( * ) > = 2
find the number of rows in country table whose Continent equals Africa
Output: SELECT Count ( * ) FROM country WHERE Continent = "Africa"
Step 1: For each row in Highschooler table, find the corresponding rows in Friend table.
Step 2: find the number of rows of each value of student_id in the results of step 1.
Step 3: find name of step 1 results with largest value in the results of step 2
Output: SELECT T1.name FROM Highschooler AS T1 JOIN Friend AS T2 ON T1.ID = T2.student_id GROUP BY T2.student_id ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in Semesters table, find the corresponding rows in Student_Enrolment table.
Step 2: find Student_Enrolment's semester_id of the results of step 1 whose semester_name equals Master.
Step 3: find Student_Enrolment's semester_id of the results of step 1 whose semester_name equals Bachelor.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T2.semester_id FROM Semesters AS T1 JOIN Student_Enrolment AS T2 ON T1.semester_id = T2.semester_id WHERE T1.semester_name = "Master" INTERSECT SELECT T2.semester_id FROM Semesters AS T1 JOIN Student_Enrolment AS T2 ON T1.semester_id = T2.semester_id WHERE T1.semester_name = "Bachelor"
find the number of different Region in country table whose Continent equals Chinese
Output: SELECT Count ( DISTINCT Region ) FROM country WHERE Continent = "Chinese"
Step 1: find the semester_id of Student_Enrolment table.
Step 2: find the Semesters's semester_id of Semesters table whose Semesters's semester_id not one of the results of step 1
Output: SELECT T1.semester_id FROM Semesters AS T1 WHERE T1.semester_id NOT IN ( SELECT T2.semester_id FROM Student_Enrolment AS T2 )
Step 1: For each row in players table, find the corresponding rows in rankings table.
Step 2: find first_name, ranking of the results of step 1
Output: SELECT T1.first_name , T2.ranking FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id
Step 1: find the number of rows of each value of state in AREA_CODE_STATE table.
Step 2: find area_code of AREA_CODE_STATE table with largest value in the results of step 1
Output: SELECT area_code FROM AREA_CODE_STATE GROUP BY state ORDER BY Count ( * ) Desc LIMIT 1
find the number of rows in Courses table whose course_name equals math
Output: SELECT Count ( * ) FROM Courses WHERE course_name = "math"
Step 1: For each row in Dogs table, find corresponding rows in Breeds table and in Treatments table.
Step 2: find without repetition breed_name, treatment_type_code of the results of step 1
Output: SELECT DISTINCT T1.breed_name , T3.treatment_type_code FROM Breeds AS T1 JOIN Dogs AS T2 ON T1.breed_code = T2.breed_code JOIN Treatments AS T3 ON T2.dog_id = T3.dog_id
find City, Country of airports table whose AirportName equals Alton and CountryAbbrev equals US 
Output: SELECT City , Country FROM airports WHERE AirportName = "Alton" AND CountryAbbrev = "US "
find the number of rows in country table whose Continent equals Chinese
Output: SELECT Count ( * ) FROM country WHERE Continent = "Chinese"
Step 1: For each row in airlines table, find the corresponding rows in flights table.
Step 2: find FlightNo of the results of step 1 whose airlines's Airline equals United Airlines and Country equals USA
Output: SELECT T2.FlightNo FROM airlines AS T1 JOIN flights AS T2 WHERE T1.Airline = "United Airlines" AND T1.Country = "USA"
find the number of rows in cars_data table whose Accelerate greater than 1
Output: SELECT Count ( * ) FROM cars_data WHERE Accelerate > 1
Step 1: find the number of rows of each value of Shop_ID in shop table.
Step 2: find Manager_name, District of shop table with largest value in the results of step 1
Output: SELECT Manager_name , District FROM shop GROUP BY Shop_ID ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the Name of city table ordered descending by Population.
Step 2: only show the first 3 rows of the results
Output: SELECT Name FROM city ORDER BY Population Desc LIMIT 3
find the PetType, pet_age of Pets table with smallest value of pet_age
Output: SELECT PetType , pet_age FROM Pets ORDER BY pet_age Asc LIMIT 1
find the first_name, last_name of players table ordered ascending by birth_date
Output: SELECT first_name , last_name FROM players ORDER BY birth_date Asc
Step 1: For each row in countries table, find the corresponding rows in car_makers table.
Step 2: find the number of rows of each value of Country in the results of step 1.
Step 3: find CountryName in the results of step 1 whose corresponding value in step 2 is greater than or equals 3
Output: SELECT T1.CountryName FROM countries AS T1 JOIN car_makers AS T2 ON T1.CountryId = T2.Country GROUP BY T2.Country HAVING Count ( * ) > = 3
find City, Country of airports table whose AirportName equals Alton and Country equals United States 
Output: SELECT City , Country FROM airports WHERE AirportName = "Alton" AND Country = "United States "
find the summation of Population and the maximum GNP in country table
Output: SELECT Sum ( Population ) , Max ( GNP ) FROM country
Step 1: find the rows of orchestra table for which Year_of_Founded greater than 2003.
Step 2: find the Record_Company of orchestra table for which Year_of_Founded less than 2003.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT * FROM orchestra WHERE Year_of_Founded > 2003 INTERSECT SELECT Record_Company FROM orchestra WHERE Year_of_Founded < 2003
find the name of Dogs table for which weight greater than 1000
Output: SELECT name FROM Dogs WHERE weight > 1000
find the Final_Table_Made, Best_Finish of poker_player table with smallest value of Best_Finish
Output: SELECT Final_Table_Made , Best_Finish FROM poker_player ORDER BY Best_Finish Asc LIMIT 1
Step 1: For each row in players table, find the corresponding rows in matches table.
Step 2: find each value of first_name in the results of step 1 along with the summation of winner_rank of the corresponding rows to each value
Output: SELECT Sum ( T2.winner_rank ) , T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.loser_id GROUP BY T1.first_name
find the number of rows in Highschooler table
Output: SELECT Count ( * ) FROM Highschooler
Step 1: find the number of rows of each value of Channel in Cartoon table.
Step 2: find Production_code, Channel of Cartoon table with largest value in the results of step 1
Output: SELECT Production_code , Channel FROM Cartoon GROUP BY Channel ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in players table, find the corresponding rows in matches table.
Step 2: find country_code, first_name of the results of step 1 whose loser_ioc equals WTA Championships.
Step 3: find country_code, first_name of the results of step 1 whose loser_ioc equals Australian Open.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T1.country_code , T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.loser_id WHERE T2.loser_ioc = "WTA Championships" INTERSECT SELECT T1.country_code , T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.loser_id WHERE T2.loser_ioc = "Australian Open"
Step 1: find the professional_id, last_name, cell_number of Professionals table for which state equals Indiana.
Step 2: find the number of rows of each value of professional_id in Professionals table.
Step 3: find professional_id, last_name, cell_number in Professionals table whose corresponding value in step 2 is greater than 2.
Step 4: show the rows that are in any of the results of step 1 or the results of step 3
Output: SELECT professional_id , last_name , cell_number FROM Professionals WHERE state = "Indiana" UNION SELECT professional_id , last_name , cell_number FROM Professionals GROUP BY professional_id HAVING Count ( * ) > 2
Step 1: find the Code of country table for which Continent equals Republic.
Step 2: For each row in country table, find the corresponding rows in countrylanguage table.
Step 3: find Code of the results of step 2 whose Language equals English.
Step 4: show the rows that are in the results of step 1 but not in the results of step 3
Output: SELECT T1.Code FROM country AS T1 WHERE T1.Continent = "Republic" EXCEPT SELECT T1.Code FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = "English"
find the section_name of Sections table ordered ascending by section_name
Output: SELECT section_name FROM Sections ORDER BY section_name Asc
Step 1: find the number of rows of each value of Employee_ID in employee table.
Step 2: find Name of employee table with largest value in the results of step 1
Output: SELECT Name FROM employee GROUP BY Employee_ID ORDER BY Count ( * ) Desc LIMIT 1
find the number of rows in car_makers table whose FullName equals American Motor Company and FullName equals American Motor Company
Output: SELECT Count ( * ) FROM car_makers WHERE FullName = "American Motor Company" AND FullName = "American Motor Company"
Step 1: find the maximum Population of each value of Continent in country table.
Step 2: find Name, Continent of country table with largest value in the results of step 1
Output: SELECT Name , Continent FROM country GROUP BY Continent ORDER BY Max ( Population ) Desc LIMIT 1
find each value of course_id in Student_Enrolment_Courses table along with the number of the corresponding rows to each value
Output: SELECT Count ( * ) , course_id FROM Student_Enrolment_Courses GROUP BY course_id
Step 1: For each row in car_names table, find corresponding rows in model_list table and in cars_data table.
Step 2: find the average Accelerate in the results of step 1 whose model_list's Model equals 4
Output: SELECT Avg ( T3.Accelerate ) FROM model_list AS T1 JOIN car_names AS T2 ON T1.Model = T2.Model JOIN cars_data AS T3 ON T2.MakeId = T3.Id WHERE T1.Model = 4
Step 1: For each row in airlines table, find the corresponding rows in flights table.
Step 2: find FlightNo of the results of step 1 whose Country equals United Airlines and airlines's Airline equals United Airlines
Output: SELECT T2.FlightNo FROM airlines AS T1 JOIN flights AS T2 WHERE T1.Country = "United Airlines" AND T1.Airline = "United Airlines"
Step 1: find the SurfaceArea of country table for which Region equals Europe.
Step 2: find the Continent of country table whose SurfaceArea greater than the results of step 1
Output: SELECT Continent FROM country WHERE SurfaceArea > ( SELECT SurfaceArea FROM country WHERE Region = "Europe" )
Step 1: find the Airline of airlines table for which airlines's Country equals APG.
Step 2: For each row in airlines table, find the corresponding rows in airports table.
Step 3: find Airline of the results of step 2 whose airports's Country equals CVO.
Step 4: show the rows that are in both the results of step 1 and the results of step 3
Output: SELECT T1.Airline FROM airlines AS T1 WHERE T1.Country = "APG" INTERSECT SELECT T1.Airline FROM airlines AS T1 JOIN airports AS T2 WHERE T2.Country = "CVO"
find the first_name, last_name, email_address of Owners table for which first_name contains North
Output: SELECT first_name , last_name , email_address FROM Owners WHERE first_name LIKE "North"
find the number of rows in matches table whose year greater than or equals 2013
Output: SELECT Count ( * ) FROM matches WHERE year > = 2013
Step 1: find the number of rows of each value of Document_ID in Documents table.
Step 2: find Document_ID, Document_Name of Documents table with largest value in the results of step 1
Output: SELECT Document_ID , Document_Name FROM Documents GROUP BY Document_ID ORDER BY Count ( * ) Desc LIMIT 1
find the average grade in Highschooler table
Output: SELECT Avg ( grade ) FROM Highschooler
Step 1: find the weight of Dogs table.
Step 2: find the name, age, weight of Dogs table whose weight one of the results of step 1
Output: SELECT name , age , weight FROM Dogs WHERE weight IN ( SELECT weight FROM Dogs )
find the number of rows in Documents table whose Document_Name contains Summer Show
Output: SELECT Count ( * ) FROM Documents WHERE Document_Name LIKE "Summer Show"
Step 1: For each row in Departments table, find the corresponding rows in Degree_Programs table.
Step 2: for each value of Degree_Programs's department_id in the results of step 1, calculate number of rows.
Step 3: show each value of Degree_Programs's department_id in the results of step 1 along with the number of rows with largest value in the results of step 2
Output: SELECT T1.department_name , Count ( * ) FROM Departments AS T1 JOIN Degree_Programs AS T2 ON T1.department_id = T2.department_id GROUP BY T2.department_id ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in battle table, find the corresponding rows in ship table.
Step 2: find battle's name, result, bulgarian_commander of the results of step 1 whose ship's name not equals English Channel
Output: SELECT T1.name , T1.result , T1.bulgarian_commander FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.name ! = "English Channel"
find the Edispl of cars_data table with largest value of Weight
Output: SELECT Edispl FROM cars_data ORDER BY Weight Desc LIMIT 1
find the average LifeExpectancy in country table whose Continent equals Africa
Output: SELECT Avg ( LifeExpectancy ) FROM country WHERE Continent = "Africa"
find each value of grade in Highschooler table along with the number of the corresponding rows to each value
Output: SELECT Count ( * ) , grade FROM Highschooler GROUP BY grade
find the ID of Highschooler table for which grade equals Kyle
Output: SELECT ID FROM Highschooler WHERE grade = "Kyle"
Step 1: For each row in country table, find the corresponding rows in countrylanguage table.
Step 2: find Continent of the results of step 1 whose Language equals English.
Step 3: find Continent of the results of step 1 whose Language equals French.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T1.Continent FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = "English" INTERSECT SELECT T1.Continent FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = "French"
find the average GNPOld in country table whose Continent equals Africa
Output: SELECT Avg ( GNPOld ) FROM country WHERE Continent = "Africa"
Step 1: For each row in Charges table, find the corresponding rows in Treatments table.
Step 2: find each value of treatment_type_code in the results of step 1 along with the summation of charge_amount of the corresponding rows to each value
Output: SELECT T2.treatment_type_code , Sum ( T1.charge_amount ) FROM Charges AS T1 JOIN Treatments AS T2 GROUP BY T2.treatment_type_code
Step 1: find the Year of cars_data table for which Weight greater than 4000.
Step 2: find the Year of cars_data table for which Weight less than 3000.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT Year FROM cars_data WHERE Weight > 4000 EXCEPT SELECT Year FROM cars_data WHERE Weight < 3000
Step 1: find the number of rows of each value of contestant_name in CONTESTANTS table.
Step 2: find contestant_number, contestant_name in CONTESTANTS table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT contestant_number , contestant_name FROM CONTESTANTS GROUP BY contestant_name HAVING Count ( * ) > = 2
find the number of rows in Pets table whose PetType equals F and PetType equals dog
Output: SELECT Count ( * ) FROM Pets WHERE PetType = "dog" AND PetType = "F"
Step 1: find the number of rows of each value of DestAirport in flights table.
Step 2: find DestAirport of flights table with largest value in the results of step 1
Output: SELECT DestAirport FROM flights GROUP BY DestAirport ORDER BY Count ( * ) Desc LIMIT 1
find the winner_name, loser_rank of matches table with largest value of winner_rank_points
Output: SELECT winner_name , loser_rank FROM matches ORDER BY winner_rank_points Desc LIMIT 1
Step 1: find the maximum SurfaceArea in country table whose Region equals Europe.
Step 2: find the Continent of country table whose SurfaceArea greater than the results of step 1
Output: SELECT Continent FROM country WHERE SurfaceArea > ( SELECT Max ( SurfaceArea ) FROM country WHERE Region = "Europe" )
Step 1: For each row in Students table, find the corresponding rows in Student_Enrolment table.
Step 2: find the number of rows of each value of Student_Enrolment's student_id in the results of step 1.
Step 3: find first_name, middle_name, last_name in the results of step 1 whose corresponding value in step 2 is equals 2
Output: SELECT T1.first_name , T1.middle_name , T1.last_name FROM Students AS T1 JOIN Student_Enrolment AS T2 ON T1.student_id = T2.student_id GROUP BY T2.student_id HAVING Count ( * ) = 2
Step 1: find the number of rows in players table.
Step 2: find the loser_ioc of matches table.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT Count ( * ) FROM players AS T1 INTERSECT SELECT T2.loser_ioc FROM matches AS T2
Step 1: find the number of rows of each value of course_id in Courses table.
Step 2: find course_name, course_id in Courses table whose corresponding value in step 1 is less than 2
Output: SELECT course_name , course_id FROM Courses GROUP BY course_id HAVING Count ( * ) < 2
find the created of VOTES table for which state equals CA
Output: SELECT created FROM VOTES WHERE state = "CA"
find Name of country table whose Continent equals Asia and Population greater than 103000
Output: SELECT Name FROM country WHERE Continent = "Asia" AND Population > 103000
Step 1: For each row in Highschooler table, find the corresponding rows in Friend table.
Step 2: for each value of student_id in the results of step 1, find the number of rows along with name and grade
Output: SELECT T1.name , T1.grade , Count ( * ) FROM Highschooler AS T1 JOIN Friend AS T2 ON T1.ID = T2.student_id GROUP BY T2.student_id
Step 1: For each row in Treatments table, find corresponding rows in Dogs table and in Professionals table.
Step 2: find date_adopted, first_name of the results of step 1
Output: SELECT T1.date_adopted , T2.first_name FROM Dogs AS T1 JOIN Professionals AS T2 JOIN Treatments AS T3 ON T1.dog_id = T3.dog_id AND T3.professional_id = T2.professional_id
Step 1: For each row in players table, find the corresponding rows in matches table.
Step 2: find each value of first_name in the results of step 1 along with the average winner_rank of the corresponding rows to each value
Output: SELECT Avg ( T2.winner_rank ) , T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.loser_id GROUP BY T1.first_name
Step 1: find the Name of country table for which Continent equals Europe.
Step 2: find the Name of country table for which Population greater than 103000.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT Name FROM country WHERE Continent = "Europe" INTERSECT SELECT Name FROM country WHERE Population > 103000
Step 1: For each row in car_makers table, find the corresponding rows in model_list table.
Step 2: for each value of Id in the results of step 1, find the number of rows along with ModelId and FullName
Output: SELECT T2.ModelId , T1.FullName , Count ( * ) FROM car_makers AS T1 JOIN model_list AS T2 ON T1.Id = T2.Maker GROUP BY T1.Id
find the average Horsepower in cars_data table
Output: SELECT Avg ( Horsepower ) FROM cars_data
find the Title, Directed_by of Cartoon table ordered ascending by Title
Output: SELECT Title , Directed_by FROM Cartoon ORDER BY Title Asc
find the number of rows in country table whose Continent equals Republic
Output: SELECT Count ( * ) FROM country WHERE Continent = "Republic"