niryuu/sni-each-converted huggingface dataset:
find the number of different Continent in country table
Output: SELECT Count ( DISTINCT Continent ) FROM country
find the summation of Population and the average Continent in country table whose SurfaceArea greater than 3000
Output: SELECT Sum ( Population ) , Avg ( Continent ) FROM country WHERE SurfaceArea > 3000
find the Continent of country table for which LocalName equals Anguilla
Output: SELECT Continent FROM country WHERE LocalName = "Anguilla"
find the number of rows in airports table whose Country equals Aberdeen and City equals United Airlines
Output: SELECT Count ( * ) FROM airports WHERE Country = "Aberdeen" AND City = "United Airlines"
Step 1: find the number of rows of each value of transcript_id in Transcript_Contents table.
Step 2: find transcript_id, transcript_id of Transcript_Contents table with smallest value in the results of step 1
Output: SELECT transcript_id , transcript_id FROM Transcript_Contents GROUP BY transcript_id ORDER BY Count ( * ) Asc LIMIT 1
Step 1: For each row in orchestra table, find the corresponding rows in performance table.
Step 2: find each value of performance's Orchestra_ID in the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT Count ( * ) , T1.Record_Company FROM orchestra AS T1 JOIN performance AS T2 ON T1.Orchestra_ID = T2.Orchestra_ID GROUP BY T2.Orchestra_ID
find the feature_type_name of Ref_Feature_Types table
Output: SELECT feature_type_name FROM Ref_Feature_Types
Step 1: For each row in car_names table, find corresponding rows in model_list table and in cars_data table.
Step 2: find model_list's Model of the results of step 1 with largest value of Accelerate
Output: SELECT T1.Model 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 ORDER BY T3.Accelerate Desc LIMIT 1
Step 1: For each row in airlines table, find the corresponding rows in airports table.
Step 2: find the number of rows in the results of step 1 whose airports's Country equals Aberdeen and airlines's Country equals United Airlines
Output: SELECT Count ( * ) FROM airlines AS T1 JOIN airports AS T2 WHERE T2.Country = "Aberdeen" AND T1.Country = "United Airlines"
find each value of Name in teacher table along with the number of the corresponding rows to each value
Output: SELECT Name , Count ( * ) FROM teacher GROUP BY Name
Step 1: find the name of Highschooler table for which grade equals 9.
Step 2: find the name of Highschooler table for which grade equals 9.
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 WHERE grade = 9 INTERSECT SELECT name FROM Highschooler WHERE grade = 9
Step 1: For each row in players table, find the corresponding rows in matches table.
Step 2: find first_name, country_code of the results of step 1 whose loser_ioc equals WTA Championships.
Step 3: find first_name, country_code 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.first_name , T1.country_code FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.loser_id WHERE T2.loser_ioc = "WTA Championships" INTERSECT SELECT T1.first_name , T1.country_code FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.loser_id WHERE T2.loser_ioc = "Australian Open"
find the number of different Code2 in country table
Output: SELECT Count ( DISTINCT Code2 ) FROM country
Step 1: For each row in car_names table, find corresponding rows in model_list table and in cars_data table.
Step 2: find without repetition model_list's Model of the results of step 1 whose Horsepower greater than General Motors or Horsepower equals 3500
Output: SELECT DISTINCT T1.Model 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 T3.Horsepower > 3500 OR T3.Horsepower = "General Motors"
find the Code2 of country table with largest value of Continent
Output: SELECT Code2 FROM country ORDER BY Continent Desc LIMIT 1
Step 1: find the Population of country table for which Continent equals Africa.
Step 2: find the GovernmentForm of country table whose Population less than the results of step 1
Output: SELECT GovernmentForm FROM country WHERE Population < ( SELECT Population FROM country WHERE Continent = "Africa" )
Step 1: For each row in TV_Channel table, find the corresponding rows in Cartoon table.
Step 2: find series_name, Country of the results of step 1 whose Written_by equals Ben Jones and Written_by equals Michael Chang
Output: SELECT T1.series_name , T1.Country FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Written_by = "Michael Chang" AND T2.Written_by = "Ben Jones"
Step 1: find the number of rows of each value of Rating in TV_series table.
Step 2: find Rating, Rating of TV_series table ordered descending by the results of step 1.
Step 3: For each row in TV_Channel table, find the corresponding rows in TV_series table.
Step 4: find the number of rows of each value of Hight_definition_TV in the results of step 3.
Step 5: find Rating of step 3 results ordered descending by the results of step 4.
Step 6: only keep the first row of the results of step 5.
Step 7: show the rows that are in both the results of step 2 and the results of step 6.
Step 8: only show the first 3 rows of the results
Output: SELECT T1.Rating , T1.Rating FROM TV_series AS T1 GROUP BY T1.Rating ORDER BY Count ( * ) Desc LIMIT 1 INTERSECT SELECT T1.Rating FROM TV_Channel AS T2 JOIN TV_series AS T1 ON T2.id = T1.Channel GROUP BY T2.Hight_definition_TV ORDER BY Count ( * ) Desc LIMIT 3
find the number of rows in airports table whose AirportName equals Ashley and City equals Aberdeen
Output: SELECT Count ( * ) FROM airports WHERE AirportName = "Ashley" AND City = "Aberdeen"
find each value of Name in singer table along with the number of the corresponding rows to each value
Output: SELECT Name , Count ( * ) FROM singer GROUP BY Name
Step 1: For each row in car_makers table, find the corresponding rows in model_list table.
Step 2: find the number of rows of each value of ModelId in the results of step 1.
Step 3: find FullName, ModelId in the results of step 1 whose corresponding value in step 2 is greater than 3
Output: SELECT T1.FullName , T2.ModelId FROM car_makers AS T1 JOIN model_list AS T2 ON T1.Id = T2.Maker GROUP BY T2.ModelId HAVING Count ( * ) > 3
Step 1: For each row in TV_Channel table, find the corresponding rows in TV_series table.
Step 2: find the number of rows of each value of Channel in the results of step 1.
Step 3: find Content in the results of step 1 whose corresponding value in step 2 is greater than 2
Output: SELECT T1.Content FROM TV_Channel AS T1 JOIN TV_series AS T2 ON T1.id = T2.Channel GROUP BY T2.Channel HAVING Count ( * ) > 2
Step 1: For each row in TV_Channel table, find corresponding rows in TV_series table and in Cartoon table.
Step 2: find Episode of the results of step 1 whose Title equals A Love of a Lifetime
Output: SELECT T2.Episode FROM TV_Channel AS T1 JOIN TV_series AS T2 ON T2.Channel = T1.id JOIN Cartoon AS T3 ON T1.id = T3.Channel WHERE T3.Title = "A Love of a Lifetime"
Step 1: For each row in Templates table, find the corresponding rows in Documents table.
Step 2: find the number of rows of each value of Documents's Template_ID in the results of step 1.
Step 3: find Version_Number, Template_Type_Code in the results of step 1 whose corresponding value in step 2 is greater than 5
Output: SELECT T1.Version_Number , T1.Template_Type_Code FROM Templates AS T1 JOIN Documents AS T2 ON T1.Template_ID = T2.Template_ID GROUP BY T2.Template_ID HAVING Count ( * ) > 5
Step 1: For each row in airlines table, find the corresponding rows in airports table.
Step 2: find the number of rows in the results of step 1 whose airports's Country equals United Airlines and Airline equals AHD
Output: SELECT Count ( * ) FROM airlines AS T1 JOIN airports AS T2 WHERE T2.Country = "United Airlines" AND T1.Airline = "AHD"
Step 1: For each row in Has_Pet table, find corresponding rows in Student table and in Pets table.
Step 2: find Major, Age of the results of step 1 whose weight less than or equals cat
Output: SELECT T1.Major , T1.Age FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID JOIN Pets AS T3 ON T2.PetID = T3.PetID WHERE T3.weight < = "cat"
find the summation of LifeExpectancy in country table whose Name not equals English
Output: SELECT Sum ( LifeExpectancy ) FROM country WHERE Name ! = "English"
find the first_name, last_name of players table for which first_name contains L ordered ascending by birth_date
Output: SELECT first_name , last_name FROM players WHERE first_name LIKE "L" ORDER BY birth_date Asc
find the number of rows in Pets table whose pet_age greater than 10
Output: SELECT Count ( * ) FROM Pets WHERE pet_age > 10
find the number of rows in airlines table whose Airline equals APG
Output: SELECT Count ( * ) FROM airlines WHERE Airline = "APG"
find the Region, Population of country table
Output: SELECT Region , Population FROM country
find GovernmentForm of country table whose Continent equals Asia and Population greater than 103000
Output: SELECT GovernmentForm FROM country WHERE Continent = "Asia" AND Population > 103000
find without repetition the Document_Description of Documents table
Output: SELECT DISTINCT Document_Description FROM Documents
find grade of Highschooler table whose grade equals 4 or grade equals 9
Output: SELECT grade FROM Highschooler WHERE grade = 9 OR grade = 4
find the date_departed, date_of_birth of Dogs table
Output: SELECT date_departed , date_of_birth FROM Dogs
find the winner_name of matches table for which loser_ioc equals Australian Open with smallest value of winner_rank
Output: SELECT winner_name FROM matches WHERE loser_ioc = "Australian Open" ORDER BY winner_rank Asc LIMIT 1
Step 1: For each row in TV_Channel table, find corresponding rows in TV_series table and in Cartoon table.
Step 2: find Weekly_Rank of the results of step 1 whose Title equals A Love of a Lifetime
Output: SELECT T2.Weekly_Rank FROM TV_Channel AS T1 JOIN TV_series AS T2 ON T2.Channel = T1.id JOIN Cartoon AS T3 ON T1.id = T3.Channel WHERE T3.Title = "A Love of a Lifetime"
Step 1: For each row in conductor table, find the corresponding rows in orchestra table.
Step 2: find the  Name in the results of step 1 whose Year_of_Founded greater than 2003 ordered descending by Year_of_Founded.
Step 3: only show the first 2008 rows of the results
Output: SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID WHERE T2.Year_of_Founded > 2003 ORDER BY T2.Year_of_Founded Desc LIMIT 2008
Step 1: For each row in visit table, find corresponding rows in museum table and in visitor table.
Step 2: find the summation of Total_spent of each value of visit's Museum_ID in the results of step 1.
Step 3: find visitor_ID, visitor's Name, Num_of_Staff of the results of step 1 with largest value in the results of step 2
Output: SELECT T3.visitor_ID , T2.Name , T1.Num_of_Staff FROM museum AS T1 JOIN visitor AS T2 JOIN visit AS T3 ON T1.Museum_ID = T3.Museum_ID AND T3.visitor_ID = T2.ID AND T1.Museum_ID = T3.Museum_ID GROUP BY T3.Museum_ID ORDER BY Sum ( T3.Total_spent ) Desc LIMIT 1
find the Code of country table for which Population greater than English
Output: SELECT Code FROM country WHERE Population > "English"
Step 1: find the tourney_name, winner_rank of matches table ordered ascending by loser_age.
Step 2: only show the first 3 rows of the results
Output: SELECT tourney_name , winner_rank FROM matches ORDER BY loser_age Asc LIMIT 3
find the number of rows in Student table
Output: SELECT Count ( * ) FROM Student
find each value of StuID in Student table along with the number of the corresponding rows to each value
Output: SELECT StuID , Count ( * ) FROM Student GROUP BY StuID
Step 1: find the tourney_name, loser_rank of matches table ordered ascending by loser_age.
Step 2: only show the first 3 rows of the results
Output: SELECT tourney_name , loser_rank FROM matches ORDER BY loser_age Asc LIMIT 3
Step 1: find the professional_id, role_code, email_address of Professionals table.
Step 2: find the professional_id, role_code, email_address of Professionals table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT professional_id , role_code , email_address FROM Professionals EXCEPT SELECT professional_id , role_code , email_address FROM Professionals
Step 1: find the number of rows of each value of breed_name in Breeds table.
Step 2: find breed_name of Breeds table with largest value in the results of step 1
Output: SELECT breed_name FROM Breeds GROUP BY breed_name ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in visit table, find corresponding rows in museum table and in visitor table.
Step 2: find visitor's Name of the results of step 1 whose Open_Year greater than 2009.
Step 3: find visitor's Name of the results of step 1 whose Open_Year less than 2011.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T2.Name FROM museum AS T1 JOIN visitor AS T2 JOIN visit AS T3 ON T1.Museum_ID = T3.Museum_ID AND T3.visitor_ID = T2.ID WHERE T1.Open_Year > 2009 INTERSECT SELECT T2.Name FROM museum AS T1 JOIN visitor AS T2 JOIN visit AS T3 ON T1.Museum_ID = T3.Museum_ID AND T3.visitor_ID = T2.ID WHERE T1.Open_Year < 2011
find the number of rows in cars_data table whose Accelerate greater than 150
Output: SELECT Count ( * ) FROM cars_data WHERE Accelerate > 150
Step 1: For each row in Has_Allergy table, find corresponding rows in Allergy_Type table and in Student table.
Step 2: find the number of rows in the results of step 1 whose Sex equals M and AllergyType equals food
Output: SELECT Count ( * ) FROM Allergy_Type AS T1 JOIN Has_Allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T2.StuID = T3.StuID WHERE T3.Sex = "M" AND T1.AllergyType = "food"
find the number of different Location_Description in Ref_Locations table
Output: SELECT Count ( DISTINCT Location_Description ) FROM Ref_Locations
find the JOB_TITLE of jobs table for which MAX_SALARY greater than 9000
Output: SELECT JOB_TITLE FROM jobs WHERE MAX_SALARY > 9000
find the SALARY, MANAGER_ID of employees table
Output: SELECT SALARY , MANAGER_ID FROM employees
find the Studio of film table for which Director not equals Walter Hill
Output: SELECT Studio FROM film WHERE Director ! = "Walter Hill"
find the Headquarters of company table for which Main_Industry not equals Banking
Output: SELECT Headquarters FROM company WHERE Main_Industry ! = "Banking"
Step 1: find the summation of total of each value of billing_country in invoices table.
Step 2: find billing_country of invoices table ordered descending by the results of step 1.
Step 3: only show the first 8 rows of the results
Output: SELECT billing_country FROM invoices GROUP BY billing_country ORDER BY Sum ( total ) Desc LIMIT 8
find the EMPLOYEE_ID, SALARY of employees table for which FIRST_NAME equals Payam
Output: SELECT EMPLOYEE_ID , SALARY FROM employees WHERE FIRST_NAME = "Payam"
Step 1: For each row in Staff table, find the corresponding rows in Problem_Log table.
Step 2: find problem_log_id of the results of step 1 whose staff_first_name equals Jolie or staff_first_name equals Weber
Output: SELECT T1.problem_log_id FROM Problem_Log AS T1 JOIN Staff AS T2 ON T1.assigned_to_staff_id = T2.staff_id WHERE T2.staff_first_name = "Weber" OR T2.staff_first_name = "Jolie"
find the problem_id of Problem_Log table for which log_entry_date less than 1978-06-26
Output: SELECT problem_id FROM Problem_Log WHERE log_entry_date < "1978-06-26"
find the number of rows in film_market_estimation table whose Low_Estimate less than 300
Output: SELECT Count ( * ) FROM film_market_estimation WHERE Low_Estimate < 300
Step 1: For each row in customers table, find the corresponding rows in invoices table.
Step 2: find the summation of total of each value of first_name in the results of step 1.
Step 3: find first_name, last_name of step 1 results ordered descending by the results of step 2.
Step 4: only show the first 10 rows of the results
Output: SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id GROUP BY T1.first_name ORDER BY Sum ( T2.total ) Desc LIMIT 10
Step 1: find the Consider_rate of candidate table ordered descending by Consider_rate.
Step 2: only show the first 3 rows of the results
Output: SELECT Consider_rate FROM candidate ORDER BY Consider_rate Desc LIMIT 3
find the name of tracks table
Output: SELECT name FROM tracks
Step 1: For each row in ACCOUNTS table, find the corresponding rows in SAVINGS table.
Step 2: find name, name of the results of step 1 whose balance less than 200000
Output: SELECT T1.name , T1.name FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid WHERE T2.balance < 200000
find the name of PersonFriend table for which friend equals Bob
Output: SELECT name FROM PersonFriend WHERE friend = "Bob"
find the Date, Venue of workshop table ordered ascending by Date
Output: SELECT Date , Venue FROM workshop ORDER BY Date Asc
Step 1: For each row in Customers table, find the corresponding rows in Policies table.
Step 2: find Customer_Details of the results of step 1 with largest value of Start_Date
Output: SELECT T1.Customer_Details FROM Customers AS T1 JOIN Policies AS T2 ON T1.Customer_ID = T2.Customer_ID ORDER BY T2.Start_Date Desc LIMIT 1
Step 1: find the CName of Course table for which Days equals 4.
Step 2: find the CName of Course table for which Days equals 1.
Step 3: show the rows that are in any of the results of step 1 or the results of step 2
Output: SELECT CName FROM Course WHERE Days = 4 UNION SELECT CName FROM Course WHERE Days = 1
find the Advisor of Student table for which Major equals 1004
Output: SELECT Advisor FROM Student WHERE Major = 1004
find the Poll_Source of candidate table for which Unsure_rate equals 1
Output: SELECT Poll_Source FROM candidate WHERE Unsure_rate = 1
find the Title, Studio of film table for which Title contains Universal
Output: SELECT Title , Studio FROM film WHERE Title LIKE "Universal"
Step 1: find the number of rows of each value of id in customers table.
Step 2: find first_name, last_name of customers table ordered descending by the results of step 1.
Step 3: only show the first 10 rows of the results
Output: SELECT first_name , last_name FROM customers GROUP BY id ORDER BY Count ( * ) Desc LIMIT 10
find the name, Industry of Companies table ordered ascending by name
Output: SELECT name , Industry FROM Companies ORDER BY name Asc
find the decor of Rooms table with largest value of basePrice
Output: SELECT decor FROM Rooms ORDER BY basePrice Desc LIMIT 1
find the number of rows in Ref_Document_Types table
Output: SELECT Count ( * ) FROM Ref_Document_Types
Step 1: find the company_id of flight table.
Step 2: find the name, Type of operate_company table whose operate_company's id one of the results of step 1
Output: SELECT T1.name , T1.Type FROM operate_company AS T1 WHERE T1.id IN ( SELECT T2.company_id FROM flight AS T2 )
Step 1: find the average age in Person table.
Step 2: find without repetition the name of Person table whose age less than the results of step 1
Output: SELECT DISTINCT name FROM Person WHERE age < ( SELECT Avg ( age ) FROM Person )
find the problem_id of Problem_Log table for which log_entry_date greater than 1978-06-26
Output: SELECT problem_id FROM Problem_Log WHERE log_entry_date > "1978-06-26"
Step 1: find the number of rows of each value of Lastname in Band table.
Step 2: find Lastname of Band table with largest value in the results of step 1
Output: SELECT Lastname FROM Band GROUP BY Lastname ORDER BY Count ( * ) Desc LIMIT 1
find the first_name, last_name of employees table with smallest value of birth_date
Output: SELECT first_name , last_name FROM employees ORDER BY birth_date Asc LIMIT 1
Step 1: For each row in ACCOUNTS table, find the corresponding rows in SAVINGS table.
Step 2: find name, name, balance of the results of step 1 ordered descending by balance
Output: SELECT T1.name , T1.name , T2.balance FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid ORDER BY T2.balance Desc
Step 1: For each row in departments table, find the corresponding rows in employees table.
Step 2: find the  FIRST_NAME in the results of step 1 whose DEPARTMENT_NAME not equals M ordered ascending by SALARY
Output: SELECT T2.FIRST_NAME , T2.HIRE_DATE , T2.SALARY FROM departments AS T1 JOIN employees AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T1.DEPARTMENT_NAME ! = "M" ORDER BY T2.SALARY Asc
Step 1: find the number of rows of each value of Pilot_name in pilot table.
Step 2: find Pilot_name in pilot table whose corresponding value in step 1 is greater than 1
Output: SELECT Pilot_name FROM pilot GROUP BY Pilot_name HAVING Count ( * ) > 1
Step 1: find the number of rows of each value of Building in Faculty table.
Step 2: find Building of Faculty table with largest value in the results of step 1
Output: SELECT Building FROM Faculty GROUP BY Building ORDER BY Count ( * ) Desc LIMIT 1
find the Document_Type_Code, Document_Description, Document_ID of Documents table
Output: SELECT Document_Type_Code , Document_Description , Document_ID FROM Documents
Step 1: For each row in Staff table, find the corresponding rows in Engineer_Visits table.
Step 2: find each value of contact_staff_id in the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT T1.staff_name , Count ( * ) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id GROUP BY T2.contact_staff_id
find the number of different Claim_Status_Code in Claim_Headers table
Output: SELECT Count ( DISTINCT Claim_Status_Code ) FROM Claim_Headers
find the number of rows in Vocals table whose Type equals lead
Output: SELECT Count ( * ) FROM Vocals WHERE Type = "lead"
find the name of Person table with largest value of age
Output: SELECT name FROM Person ORDER BY age Desc LIMIT 1
Step 1: find the average age in Person table.
Step 2: find the name of Person table whose age less than the results of step 1
Output: SELECT name FROM Person WHERE age < ( SELECT Avg ( age ) FROM Person )
Step 1: For each row in employees table, find the corresponding rows in locations table.
Step 2: find FIRST_NAME, LAST_NAME of the results of step 1 whose CITY equals London
Output: SELECT T1.FIRST_NAME , T1.LAST_NAME FROM employees AS T1 JOIN locations AS T2 WHERE T2.CITY = "London"
Step 1: find the number of rows of each value of Location_Code in Ref_Locations table.
Step 2: find Location_Description of Ref_Locations table with largest value in the results of step 1
Output: SELECT Location_Description FROM Ref_Locations GROUP BY Location_Code ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in trip table, find the corresponding rows in weather table.
Step 2: find the average duration in the results of step 1 whose min_visibility_miles greater than 50
Output: SELECT Avg ( T1.duration ) FROM trip AS T1 JOIN weather AS T2 WHERE T2.min_visibility_miles > 50
find the number of rows in invoices table whose billing_city equals Chicago
Output: SELECT Count ( * ) FROM invoices WHERE billing_city = "Chicago"
Step 1: For each row in departments table, find the corresponding rows in employees table.
Step 2: find FIRST_NAME, DEPARTMENT_NAME of the results of step 1 whose LAST_NAME equals McEwen
Output: SELECT T2.FIRST_NAME , T1.DEPARTMENT_NAME FROM departments AS T1 JOIN employees AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T2.LAST_NAME = "McEwen"
Step 1: For each row in station table, find the corresponding rows in trip table.
Step 2: find the number of rows in the results of step 1 whose city equals Mountain View and end_date equals Palo Alto
Output: SELECT Count ( * ) FROM station AS T1 JOIN trip AS T2 WHERE T1.city = "Mountain View" AND T2.end_date = "Palo Alto"
Step 1: For each row in Rooms table, find the corresponding rows in Reservations table.
Step 2: find the summation of Adults in the results of step 1 whose bedType equals modern
Output: SELECT Sum ( T2.Adults ) FROM Rooms AS T1 JOIN Reservations AS T2 ON T1.RoomId = T2.Room WHERE T1.bedType = "modern"
find the number of rows in Scientists table
Output: SELECT Count ( * ) FROM Scientists
Step 1: find the SongId of Tracklists table.
Step 2: find the Title of Songs table whose Songs's SongId not one of the results of step 1
Output: SELECT T1.Title FROM Songs AS T1 WHERE T1.SongId NOT IN ( SELECT T2.SongId FROM Tracklists AS T2 )
Step 1: For each row in Tracklists table, find corresponding rows in Songs table and in Albums table.
Step 2: find the number of rows of each value of Label in the results of step 1.
Step 3: find Songs's Title of the results of step 1 with largest value in the results of step 2
Output: SELECT T1.Title FROM Songs AS T1 JOIN Albums AS T2 JOIN Tracklists AS T3 ON T1.SongId = T3.SongId AND T3.AlbumId = T2.AId GROUP BY T2.Label ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in Product table, find the corresponding rows in Problems table.
Step 2: find problem_id of the results of step 1 whose product_name equals voluptatem and date_problem_closed greater than 1995
Output: SELECT T2.problem_id FROM Product AS T1 JOIN Problems AS T2 ON T1.product_id = T2.product_id WHERE T1.product_name = "voluptatem" AND T2.date_problem_closed > 1995
Step 1: find the average min_humidity of each value of zip_code in weather table.
Step 2: find zip_code in weather table whose corresponding value in step 1 is greater than or equals 100
Output: SELECT zip_code FROM weather GROUP BY zip_code HAVING Avg ( min_humidity ) > = 100
Step 1: find the Theme of farm_competition table.
Step 2: find the Theme of farm_competition table whose Competition_ID not one of the results of step 1
Output: SELECT Theme FROM farm_competition WHERE Competition_ID NOT IN ( SELECT Theme FROM farm_competition )
Step 1: find the average Height of each value of Sex in people table.
Step 2: find Sex of people table with largest value in the results of step 1
Output: SELECT Sex FROM people GROUP BY Sex ORDER BY Avg ( Height ) Desc LIMIT 1
find the average Age in Student table whose Sex equals F
Output: SELECT Avg ( Age ) FROM Student WHERE Sex = "F"
Step 1: For each row in Staff table, find the corresponding rows in Problems table.
Step 2: find problem_id, reported_by_staff_id of the results of step 1 whose staff_first_name equals Rylan
Output: SELECT T2.problem_id , T2.reported_by_staff_id FROM Staff AS T1 JOIN Problems AS T2 ON T1.staff_id = T2.closure_authorised_by_staff_id WHERE T1.staff_first_name = "Rylan"
Step 1: find the state_province_county of Addresses table.
Step 2: find the state_province_county of Addresses table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT state_province_county FROM Addresses EXCEPT SELECT state_province_county FROM Addresses
Step 1: For each row in Tracklists table, find corresponding rows in Songs table and in Albums table.
Step 2: find Songs's Title of the results of step 1 whose Year equals 2012
Output: SELECT T1.Title FROM Songs AS T1 JOIN Albums AS T2 JOIN Tracklists AS T3 ON T1.SongId = T3.SongId AND T3.AlbumId = T2.AId WHERE T2.Year = 2012
Step 1: find the friend of PersonFriend table.
Step 2: find the Person's name of Person table whose Person's name not one of the results of step 1
Output: SELECT T1.name FROM Person AS T1 WHERE T1.name NOT IN ( SELECT T2.friend FROM PersonFriend AS T2 )
find the name of Person table with smallest value of age
Output: SELECT name FROM Person ORDER BY age Asc LIMIT 1
find id of station table whose city equals San Francisco and long greater than 10 and long greater than -121.90178200000001
Output: SELECT id FROM station WHERE city = "San Francisco" AND long > -121.90178200000001 AND long > 10
Step 1: For each row in station table, find the corresponding rows in trip table.
Step 2: find long, city, start_station_name of the results of step 1 with smallest value of duration
Output: SELECT T1.long , T1.city , T2.start_station_name FROM station AS T1 JOIN trip AS T2 ORDER BY T2.duration Asc LIMIT 1
find the number of rows in Person table whose age greater than engineer
Output: SELECT Count ( * ) FROM Person WHERE age > "engineer"
Step 1: find the number of rows of each value of Id in Band table.
Step 2: find Firstname of Band table with largest value in the results of step 1
Output: SELECT Firstname FROM Band GROUP BY Id ORDER BY Count ( * ) Desc LIMIT 1
find the number of rows in All_Documents table whose Document_Type_Code equals CV
Output: SELECT Count ( * ) FROM All_Documents WHERE Document_Type_Code = "CV"
find the number of rows in Songs table whose Title equals Badlands
Output: SELECT Count ( * ) FROM Songs WHERE Title = "Badlands"
Step 1: For each row in ACCOUNTS table, find the corresponding rows in SAVINGS table.
Step 2: find name, balance, balance of the results of step 1
Output: SELECT T1.name , T2.balance , T2.balance FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid
find the problem_log_id, problem_id of Problem_Log table
Output: SELECT problem_log_id , problem_id FROM Problem_Log
find the Music_Festival, Result of music_festival table
Output: SELECT Music_Festival , Result FROM music_festival
Step 1: For each row in city table, find the corresponding rows in hosting_city table.
Step 2: find City of the results of step 1 whose Year equals 1
Output: SELECT T1.City FROM city AS T1 JOIN hosting_city AS T2 ON T1.City_ID = T2.Host_City WHERE T2.Year = 1
find the email, phone of customers table for which last_name equals Astrid
Output: SELECT email , phone FROM customers WHERE last_name = "Astrid"
Step 1: For each row in station table, find the corresponding rows in weather table.
Step 2: find zip_code of the results of step 1 whose long greater than 80 or min_sea_level_pressure_inches greater than 29.97
Output: SELECT T2.zip_code FROM station AS T1 JOIN weather AS T2 WHERE T1.long > 80 OR T2.min_sea_level_pressure_inches > 29.97
Step 1: For each row in ACCOUNTS table, find the corresponding rows in CHECKING table.
Step 2: find name of the results of step 1 whose balance greater than 10000
Output: SELECT T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid WHERE T2.balance > 10000
Step 1: find the average balance in SAVINGS table.
Step 2: For each row in ACCOUNTS table, find the corresponding rows in SAVINGS table.
Step 3: find name in the results of step 2 whose balance less than the results of step 1
Output: SELECT T1.name FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid WHERE T2.balance < ( SELECT Avg ( T2.balance ) FROM SAVINGS AS T2 )
Step 1: For each row in Rooms table, find the corresponding rows in Reservations table.
Step 2: find roomName, bedType, Room of the results of step 1 with largest value of Rate
Output: SELECT T1.roomName , T1.bedType , T2.Room FROM Rooms AS T1 JOIN Reservations AS T2 ON T1.RoomId = T2.Room ORDER BY T2.Rate Desc LIMIT 1
find the Type, High_Estimate of film_market_estimation table
Output: SELECT Type , High_Estimate FROM film_market_estimation
find the Fname, LName of Student table
Output: SELECT Fname , LName FROM Student
find each value of Employee_ID in Employees table along with the number of the corresponding rows to each value
Output: SELECT Employee_ID , Count ( * ) FROM Employees GROUP BY Employee_ID
find the number of rows in buildings table
Output: SELECT Count ( * ) FROM buildings
find the Name of people table for which Sex equals F ordered ascending by Name
Output: SELECT Name FROM people WHERE Sex = "F" ORDER BY Name Asc
find the number of rows in Vocals table whose Type equals Demon Kitty Rag
Output: SELECT Count ( * ) FROM Vocals WHERE Type = "Demon Kitty Rag"
Step 1: For each row in jobs table, find the corresponding rows in employees table.
Step 2: find EMPLOYEE_ID, LAST_NAME, MAX_SALARY of the results of step 1 whose SALARY less than J
Output: SELECT T2.EMPLOYEE_ID , T2.LAST_NAME , T1.MAX_SALARY FROM jobs AS T1 JOIN employees AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T2.SALARY < "J"
Step 1: find the id, end_date of trip table ordered descending by duration.
Step 2: only show the first 3 rows of the results
Output: SELECT id , end_date FROM trip ORDER BY duration Desc LIMIT 3
Step 1: find the number of rows of each value of Song in volume table.
Step 2: find Song in volume table whose corresponding value in step 1 is greater than 1
Output: SELECT Song FROM volume GROUP BY Song HAVING Count ( * ) > 1
find the average Sheep_and_Goats in farm table whose Sheep_and_Goats greater than 5000
Output: SELECT Avg ( Sheep_and_Goats ) FROM farm WHERE Sheep_and_Goats > 5000
find each value of bedType in Rooms table along with the number of the corresponding rows to each value
Output: SELECT bedType , Count ( * ) FROM Rooms GROUP BY bedType
Step 1: For each row in employees table, find the corresponding rows in locations table.
Step 2: find FIRST_NAME, LAST_NAME, STATE_PROVINCE of the results of step 1
Output: SELECT T1.FIRST_NAME , T1.LAST_NAME , T2.STATE_PROVINCE FROM employees AS T1 JOIN locations AS T2
Step 1: find the maximum balance in CHECKING table.
Step 2: find the name, ACCOUNTS's custid of ACCOUNTS table whose ACCOUNTS's custid less than the results of step 1
Output: SELECT T1.name , T1.custid FROM ACCOUNTS AS T1 WHERE T1.custid < ( SELECT Max ( T2.balance ) FROM CHECKING AS T2 )
find rows of Albums table whose Year greater than or equals 2010 and Year less than or equals 0
Output: SELECT * FROM Albums WHERE Year > = 0 AND Year < = 2010
Step 1: For each row in invoices table, find corresponding rows in customers table and in invoice_lines table.
Step 2: find first_name, last_name of the results of step 1 ordered ascending by unit_price.
Step 3: only show the first 10 rows of the results
Output: SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id JOIN invoice_lines AS T3 ON T2.id = T3.invoice_id ORDER BY T3.unit_price Asc LIMIT 10
Step 1: find the Fname of Student table.
Step 2: find the Fname of Student table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT Fname FROM Student EXCEPT SELECT Fname FROM Student
find each value of JOB_TITLE in jobs table along with the average MAX_SALARY of the corresponding rows to each value
Output: SELECT JOB_TITLE , Avg ( MAX_SALARY ) FROM jobs GROUP BY JOB_TITLE
Step 1: For each row in ACCOUNTS table, find the corresponding rows in SAVINGS table.
Step 2: find name of the results of step 1 with smallest value of balance
Output: SELECT T1.name FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid ORDER BY T2.balance Asc LIMIT 1
Step 1: find the average duration in trip table whose subscription_type equals 94103.
Step 2: find the id of trip table whose duration greater than the results of step 1
Output: SELECT id FROM trip WHERE duration > ( SELECT Avg ( duration ) FROM trip WHERE subscription_type = 94103 )
find the number of rows in station table
Output: SELECT Count ( * ) FROM station
Step 1: For each row in Member_of_club table, find corresponding rows in Student table and in Club table.
Step 2: find Fname, LName of the results of step 1 whose ClubName equals Hopkins Student Enterprises
Output: SELECT T1.Fname , T1.LName FROM Student AS T1 JOIN Club AS T2 JOIN Member_of_club AS T3 ON T1.StuID = T3.StuID AND T3.ClubID = T2.ClubID WHERE T2.ClubName = "Hopkins Student Enterprises"
Step 1: find rows in Person table whose gender equals male.
Step 2: find each value of city the results of step 1 along with the average age of the corresponding rows to each value
Output: SELECT Avg ( age ) , city FROM Person WHERE gender = "male" GROUP BY city
find the name of Person table for which city equals new york city
Output: SELECT name FROM Person WHERE city = "new york city"
Step 1: find the AllergyType of Allergy_Type table.
Step 2: find the average Age in Student table whose Sex one of the results of step 1
Output: SELECT Avg ( T1.Age ) FROM Student AS T1 WHERE T1.Sex IN ( SELECT T2.AllergyType FROM Allergy_Type AS T2 )
find the rows of employees table for which SALARY less than 2500
Output: SELECT * FROM employees WHERE SALARY < 2500
find the Document_Type_Name of Ref_Document_Types table for which Document_Type_Code equals Paper
Output: SELECT Document_Type_Name FROM Ref_Document_Types WHERE Document_Type_Code = "Paper"
find the number of rows in Reservations table whose CheckIn equals King
Output: SELECT Count ( * ) FROM Reservations WHERE CheckIn = "King"
Step 1: find the customer_name of Customers table ordered ascending by customer_name.
Step 2: only show the first 5 rows of the results
Output: SELECT customer_name FROM Customers ORDER BY customer_name Asc LIMIT 5
Step 1: find the number of rows in weather table whose min_humidity greater than 8.
Step 2: find the max_sea_level_pressure_inches of weather table for which max_sea_level_pressure_inches less than 50.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT Count ( * ) FROM weather WHERE min_humidity > 8 INTERSECT SELECT max_sea_level_pressure_inches FROM weather WHERE max_sea_level_pressure_inches < 50
Step 1: For each row in city table, find the corresponding rows in hosting_city table.
Step 2: find City of the results of step 1 whose Year equals 2008.
Step 3: find City of the results of step 1 whose Year equals 2008.
Step 4: show the rows that are in the results of step 2 but not in the results of step 3
Output: SELECT T1.City FROM city AS T1 JOIN hosting_city AS T2 ON T1.City_ID = T2.Host_City WHERE T2.Year = 2008 EXCEPT SELECT T1.City FROM city AS T1 JOIN hosting_city AS T2 ON T1.City_ID = T2.Host_City WHERE T2.Year = 2008
Step 1: For each row in Problems table, find the corresponding rows in Problem_Log table.
Step 2: find Problem_Log's problem_id, date_problem_reported of the results of step 1 whose problem_log_id equals 10
Output: SELECT T1.problem_id , T2.date_problem_reported FROM Problem_Log AS T1 JOIN Problems AS T2 ON T1.problem_id = T2.problem_id WHERE T1.problem_log_id = 10
find the average Sales_billion in Companies table
Output: SELECT Avg ( Sales_billion ) FROM Companies
find the friend of PersonFriend table for which friend equals Bob
Output: SELECT friend FROM PersonFriend WHERE friend = "Bob"
Step 1: find the Company_ID of station_company table.
Step 2: find the Main_Industry of company table whose company's Company_ID not one of the results of step 1
Output: SELECT T1.Main_Industry FROM company AS T1 WHERE T1.Company_ID NOT IN ( SELECT T2.Company_ID FROM station_company AS T2 )
find without repetition name of airport table whose Country equals United States or Country equals Billund Airport
Output: SELECT DISTINCT name FROM airport WHERE Country = "Billund Airport" OR Country = "United States"
find the JOB_TITLE, MAX_SALARY of jobs table for which MIN_SALARY equals or between 12000 and 18000
Output: SELECT JOB_TITLE , MAX_SALARY FROM jobs WHERE MIN_SALARY BETWEEN 18000 AND 12000
find the number of different Competition in match table
Output: SELECT Count ( DISTINCT Competition ) FROM match
Step 1: For each row in trip table, find the corresponding rows in weather table.
Step 2: find start_date, duration of the results of step 1 with smallest value of min_humidity
Output: SELECT T1.start_date , T1.duration FROM trip AS T1 JOIN weather AS T2 ORDER BY T2.min_humidity Asc LIMIT 1
Step 1: For each row in Employees table, find the corresponding rows in Documents_to_be_Destroyed table.
Step 2: find the number of rows of each value of Destroyed_by_Employee_ID in the results of step 1.
Step 3: find Employee_ID in the results of step 1 whose corresponding value in step 2 is greater than or equals 1
Output: SELECT T1.Employee_ID FROM Employees AS T1 JOIN Documents_to_be_Destroyed AS T2 ON T1.Employee_ID = T2.Destroyed_by_Employee_ID GROUP BY T2.Destroyed_by_Employee_ID HAVING Count ( * ) > = 1
Step 1: For each row in Statements table, find corresponding rows in Documents table and in Accounts table.
Step 2: find the number of rows of each value of Document_ID in the results of step 1.
Step 3: find Accounts's Statement_ID, Statement_Details of the results of step 1 with largest value in the results of step 2
Output: SELECT T3.Statement_ID , T2.Statement_Details FROM Documents AS T1 JOIN Statements AS T2 ON T1.Document_ID = T2.Statement_ID AND T1.Document_ID = T2.Statement_ID JOIN Accounts AS T3 ON T2.Statement_ID = T3.Statement_ID GROUP BY T1.Document_ID ORDER BY Count ( * ) Desc LIMIT 1
find the name of PersonFriend table with smallest value of year
Output: SELECT name FROM PersonFriend ORDER BY year Asc LIMIT 1
Step 1: For each row in ACCOUNTS table, find the corresponding rows in SAVINGS table.
Step 2: find balance of the results of step 1 whose name contains ee
Output: SELECT T2.balance FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid WHERE T1.name LIKE "ee"
find the number of rows in tracks table whose name equals Billy Cobham
Output: SELECT Count ( * ) FROM tracks WHERE name = "Billy Cobham"
Step 1: find the number of rows of each value of City in city table.
Step 2: find City, Regional_Population in city table whose corresponding value in step 1 is greater than 1
Output: SELECT City , Regional_Population FROM city GROUP BY City HAVING Count ( * ) > 1
find the number of rows in Songs table
Output: SELECT Count ( * ) FROM Songs
find without repetition the Fname, city_code of Student table for which Sex greater than or equals Milk
Output: SELECT DISTINCT Fname , city_code FROM Student WHERE Sex > = "Milk"
find the minimum duration and the minimum duration in trip table whose start_station_name equals Howard at 2nd
Output: SELECT Min ( duration ) , Min ( duration ) FROM trip WHERE start_station_name = "Howard at 2nd"
Step 1: For each row in ACCOUNTS table, find the corresponding rows in SAVINGS table.
Step 2: find balance, balance of the results of step 1 whose name equals Brown
Output: SELECT T2.balance , T2.balance FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid WHERE T1.name = "Brown"
Step 1: For each row in Ref_Locations table, find the corresponding rows in Document_Locations table.
Step 2: find Date_in_Location_From, Date_in_Locaton_To of the results of step 1 whose Location_Name equals Robin CV
Output: SELECT T2.Date_in_Location_From , T2.Date_in_Locaton_To FROM Ref_Locations AS T1 JOIN Document_Locations AS T2 ON T1.Location_Code = T2.Location_Code WHERE T1.Location_Name = "Robin CV"
Step 1: find the number of rows of each value of skill_id in Skills table.
Step 2: find skill_id, skill_description of Skills table with largest value in the results of step 1
Output: SELECT skill_id , skill_description FROM Skills GROUP BY skill_id ORDER BY Count ( * ) Desc LIMIT 1
find the maximum Consider_rate, the minimum Oppose_rate and the maximum Oppose_rate in candidate table
Output: SELECT Max ( Consider_rate ) , Min ( Oppose_rate ) , Max ( Oppose_rate ) FROM candidate
find phone of customers table whose first_name equals Nancy and last_name equals Edwards
Output: SELECT phone FROM customers WHERE first_name = "Nancy" AND last_name = "Edwards"
Step 1: For each row in city table, find the corresponding rows in hosting_city table.
Step 2: find City, City of the results of step 1 whose Year equals 1
Output: SELECT T1.City , T1.City FROM city AS T1 JOIN hosting_city AS T2 ON T1.City_ID = T2.Host_City WHERE T2.Year = 1
Step 1: For each row in representative table, find the corresponding rows in election table.
Step 2: find the average Vote_Percent in the results of step 1 whose Party equals Republican
Output: SELECT Avg ( T1.Vote_Percent ) FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE T2.Party = "Republican"
Step 1: For each row in customers table, find the corresponding rows in invoices table.
Step 2: find first_name, last_name of the results of step 1 ordered descending by total.
Step 3: only show the first 10 rows of the results
Output: SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id ORDER BY T2.total Desc LIMIT 10
Step 1: For each row in Tracklists table, find corresponding rows in Songs table and in Albums table.
Step 2: find Songs's Title of the results of step 1 whose Year equals 2010
Output: SELECT T1.Title FROM Songs AS T1 JOIN Albums AS T2 JOIN Tracklists AS T3 ON T1.SongId = T3.SongId AND T3.AlbumId = T2.AId WHERE T2.Year = 2010
Step 1: For each row in Projects table, find the corresponding rows in AssignedTo table.
Step 2: find each value of Project in the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT T1.Name , Count ( * ) FROM Projects AS T1 JOIN AssignedTo AS T2 ON T1.Code = T2.Project GROUP BY T2.Project
Step 1: For each row in Documents table, find the corresponding rows in Documents_with_Expenses table.
Step 2: find Document_Type_Code, Document_Details, Documents's Document_ID of the results of step 1
Output: SELECT T1.Document_Type_Code , T2.Document_Details , T1.Document_ID FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.Document_ID = T2.Document_ID
Step 1: For each row in jobs table, find the corresponding rows in employees table.
Step 2: find EMPLOYEE_ID, MIN_SALARY of the results of step 1 whose FIRST_NAME equals 2007-11-05 and LAST_NAME greater than 2009-07-05 and LAST_NAME less than King
Output: SELECT T2.EMPLOYEE_ID , T1.MIN_SALARY FROM jobs AS T1 JOIN employees AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T2.FIRST_NAME = "2007-11-05" AND T2.LAST_NAME > "King" AND T2.LAST_NAME < "2009-07-05"
find the name of Person table with largest value of gender
Output: SELECT name FROM Person ORDER BY gender Desc LIMIT 1
Step 1: For each row in employees table, find the corresponding rows in customers table.
Step 2: find employees's first_name, employees's last_name of the results of step 1 whose customers's first_name equals Nancy and customers's last_name equals Edwards
Output: SELECT T1.first_name , T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id WHERE T2.first_name = "Nancy" AND T2.last_name = "Edwards"
Step 1: For each row in people table, find the corresponding rows in candidate table.
Step 2: find each value of Sex in the results of step 1 along with the minimum Unsure_rate of the corresponding rows to each value
Output: SELECT T2.Name , Min ( T1.Unsure_rate ) FROM candidate AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID GROUP BY T2.Sex
Step 1: For each row in jobs table, find the corresponding rows in employees table.
Step 2: find each value of DEPARTMENT_ID in the results of step 1 along with the average MAX_SALARY of the corresponding rows to each value
Output: SELECT T1.JOB_TITLE , Avg ( T1.MAX_SALARY ) FROM jobs AS T1 JOIN employees AS T2 ON T1.JOB_ID = T2.JOB_ID GROUP BY T2.DEPARTMENT_ID
Step 1: find the number of rows of each value of EMPLOYEE_ID in employees table.
Step 2: find MANAGER_ID in employees table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT MANAGER_ID FROM employees GROUP BY EMPLOYEE_ID HAVING Count ( * ) > = 2
Step 1: find the number of rows of each value of name in buildings table.
Step 2: find name in buildings table whose corresponding value in step 1 is greater than 1
Output: SELECT name FROM buildings GROUP BY name HAVING Count ( * ) > 1
find the minimum Support_rate, the maximum Consider_rate and the average Oppose_rate in candidate table
Output: SELECT Min ( Support_rate ) , Max ( Consider_rate ) , Avg ( Oppose_rate ) FROM candidate
find each value of COUNTRY_ID in countries table along with the number of the corresponding rows to each value
Output: SELECT COUNTRY_ID , Count ( * ) FROM countries GROUP BY COUNTRY_ID
Step 1: find the number of rows of each value of skill_id in Skills table.
Step 2: find skill_id, skill_code of Skills table with largest value in the results of step 1
Output: SELECT skill_id , skill_code FROM Skills GROUP BY skill_id ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the EMPLOYEE_ID of employees table.
Step 2: For each row in departments table, find the corresponding rows in job_history table.
Step 3: find job_history's EMPLOYEE_ID of the results of step 2 whose LOCATION_ID equals 100.
Step 4: show the rows that are in the results of step 1 but not in the results of step 3
Output: SELECT T1.EMPLOYEE_ID FROM employees AS T1 EXCEPT SELECT T3.EMPLOYEE_ID FROM departments AS T2 JOIN job_history AS T3 ON T2.DEPARTMENT_ID = T3.DEPARTMENT_ID WHERE T2.LOCATION_ID = 100