niryuu/sni-each-converted huggingface dataset:
Step 1: find the Employee_ID of Employees table.
Step 2: find the Destroyed_by_Employee_ID of Documents_to_be_Destroyed table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT T1.Employee_ID FROM Employees AS T1 EXCEPT SELECT T2.Destroyed_by_Employee_ID FROM Documents_to_be_Destroyed AS T2
find the id, City, name of airport table ordered ascending by name
Output: SELECT id , City , name FROM airport ORDER BY name Asc
find the number of rows in station table whose city not equals San Francisco
Output: SELECT Count ( * ) FROM station WHERE city ! = "San Francisco"
find the maximum milliseconds in tracks table
Output: SELECT Max ( milliseconds ) FROM tracks
Step 1: For each row in Instruments table, find corresponding rows in Songs table and in Band table.
Step 2: find Title of the results of step 1 whose Lastname equals Heilo
Output: SELECT T1.Title FROM Songs AS T1 JOIN Band AS T2 JOIN Instruments AS T3 ON T1.SongId = T3.SongId AND T3.BandmateId = T2.Id WHERE T2.Lastname = "Heilo"
find the Event_ID of Events table for which Event_Details not equals Kenyatta Kuhn
Output: SELECT Event_ID FROM Events WHERE Event_Details ! = "Kenyatta Kuhn"
Step 1: For each row in Member_of table, find corresponding rows in Faculty table and in Department table.
Step 2: find Fname, Lname of the results of step 1 whose DName equals 520
Output: SELECT T1.Fname , T1.Lname FROM Faculty AS T1 JOIN Department AS T2 JOIN Member_of AS T3 ON T1.FacID = T3.FacID AND T3.DNO = T2.DNO WHERE T2.DName = 520
Step 1: For each row in trip table, find the corresponding rows in weather table.
Step 2: find start_date, weather's zip_code of the results of step 1 whose min_temperature_f equals 94107 and min_temperature_f less than 61
Output: SELECT T1.start_date , T2.zip_code FROM trip AS T1 JOIN weather AS T2 WHERE T2.min_temperature_f = 61 AND T2.min_temperature_f < 94107
Step 1: find the number of rows of each value of id in station table.
Step 2: find id, name in station table whose corresponding value in step 1 is greater than or equals 200
Output: SELECT id , name FROM station GROUP BY id HAVING Count ( * ) > = 200
Step 1: find the number of rows of each value of Claim_Status_Code in Claim_Headers table.
Step 2: find Claim_Status_Code of Claim_Headers table with largest value in the results of step 1
Output: SELECT Claim_Status_Code FROM Claim_Headers GROUP BY Claim_Status_Code ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in exhibition table, find the corresponding rows in exhibition_record table.
Step 2: find Theme of the results of step 1 whose Attendance greater than 100.
Step 3: find Theme of the results of step 1 whose Attendance less than 500.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T1.Theme FROM exhibition AS T1 JOIN exhibition_record AS T2 ON T1.Exhibition_ID = T2.Exhibition_ID WHERE T2.Attendance > 100 INTERSECT SELECT T1.Theme FROM exhibition AS T1 JOIN exhibition_record AS T2 ON T1.Exhibition_ID = T2.Exhibition_ID WHERE T2.Attendance < 500
Step 1: For each row in Part_Faults table, find the corresponding rows in Fault_Log_Parts table.
Step 2: find fault_description, fault_status of the results of step 1
Output: SELECT T1.fault_description , T2.fault_status FROM Part_Faults AS T1 JOIN Fault_Log_Parts AS T2 ON T1.part_fault_id = T2.part_fault_id
find the age of Person table with largest value of age
Output: SELECT age FROM Person ORDER BY age Desc LIMIT 1
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 greater 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: find the Title of film table for which Director equals Nicholas Meyer.
Step 2: find the Title of film table for which Director equals Walter Hill.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT Title FROM film WHERE Director = "Nicholas Meyer" INTERSECT SELECT Title FROM film WHERE Director = "Walter Hill"
Step 1: For each row in Office_locations table, find corresponding rows in buildings table and in Companies table.
Step 2: find the number of rows of each value of Headquarters in the results of step 1.
Step 3: find buildings's name of the results of step 1 with largest value in the results of step 2
Output: SELECT T1.name FROM buildings AS T1 JOIN Companies AS T2 JOIN Office_locations AS T3 ON T1.id = T3.building_id AND T3.company_id = T2.id GROUP BY T2.Headquarters ORDER BY Count ( * ) Desc LIMIT 1
find each value of part_id in Parts table along with the number of the corresponding rows to each value
Output: SELECT part_name , Count ( * ) FROM Parts GROUP BY part_id
find the maximum Age and the minimum Age in Student table whose city_code equals NYC
Output: SELECT Max ( Age ) , Min ( Age ) FROM Student WHERE city_code = "NYC"
Step 1: For each row in head table, find the corresponding rows in management table.
Step 2: find born_state of the results of step 1 whose temporary_acting equals Treasury.
Step 3: find born_state of the results of step 1 whose temporary_acting equals Homeland Security.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T1.born_state FROM head AS T1 JOIN management AS T2 ON T1.head_ID = T2.head_ID WHERE T2.temporary_acting = "Treasury" INTERSECT SELECT T1.born_state FROM head AS T1 JOIN management AS T2 ON T1.head_ID = T2.head_ID WHERE T2.temporary_acting = "Homeland Security"
Step 1: find the start_date, start_station_id of trip table ordered ascending by id.
Step 2: only show the first 3 rows of the results
Output: SELECT start_date , start_station_id FROM trip ORDER BY id Asc LIMIT 3
find the number of rows in Songs table whose Title equals Le Pop
Output: SELECT Count ( * ) FROM Songs WHERE Title = "Le Pop"
Step 1: find the Author of submission table.
Step 2: find the Author of submission table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT Author FROM submission EXCEPT SELECT Author FROM submission
find country of employees table whose first_name equals Roberto and last_name equals Almeida
Output: SELECT country FROM employees WHERE first_name = "Roberto" AND last_name = "Almeida"
Step 1: For each row in ACCOUNTS table, find the corresponding rows in SAVINGS table.
Step 2: find each value of ACCOUNTS's custid in the results of step 1 along with the summation of balance of the corresponding rows to each value
Output: SELECT T1.name , Sum ( T2.balance ) FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid GROUP BY T1.custid
Step 1: For each row in Person table, find the corresponding rows in PersonFriend table.
Step 2: find friend of the results of step 1 whose Person's name equals Alice
Output: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = "Alice"
Step 1: For each row in Staff table, find the corresponding rows in Problems table.
Step 2: find product_id of the results of step 1 whose staff_last_name greater than or equals Medhurst and staff_last_name less than or equals Christop.
Step 3: find product_id of the results of step 1 whose staff_first_name equals Ashley.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T2.product_id FROM Staff AS T1 JOIN Problems AS T2 ON T1.staff_id = T2.closure_authorised_by_staff_id WHERE T1.staff_last_name > = "Christop" AND T1.staff_last_name < = "Medhurst" INTERSECT SELECT T2.product_id FROM Staff AS T1 JOIN Problems AS T2 ON T1.staff_id = T2.closure_authorised_by_staff_id WHERE T1.staff_first_name = "Ashley"
find the truck_details of Trucks table ordered ascending by truck_details
Output: SELECT truck_details FROM Trucks ORDER BY truck_details Asc
find the Unsure_rate, Unsure_rate, Oppose_rate of candidate table ordered ascending by Unsure_rate
Output: SELECT Unsure_rate , Unsure_rate , Oppose_rate FROM candidate ORDER BY Unsure_rate Asc
find the Famous_Title of artist table for which Age greater than or equals 32
Output: SELECT Famous_Title FROM artist WHERE Age > = 32
Step 1: For each row in jobs table, find the corresponding rows in employees table.
Step 2: find EMPLOYEE_ID, SALARY of the results of step 1 whose JOB_TITLE equals Payam
Output: SELECT T2.EMPLOYEE_ID , T2.SALARY FROM jobs AS T1 JOIN employees AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T1.JOB_TITLE = "Payam"
Step 1: find the number of rows of each value of city in station table.
Step 2: find city, name of station table ordered descending by the results of step 1
Output: SELECT city , name FROM station GROUP BY city ORDER BY Count ( * ) Desc
find the number of rows in PersonFriend table whose friend equals Dan
Output: SELECT Count ( * ) FROM PersonFriend WHERE friend = "Dan"
find each value of product_id in Product table along with the number of the corresponding rows to each value
Output: SELECT product_name , Count ( * ) FROM Product GROUP BY product_id
Step 1: find the number of rows of each value of Service_ID in Services table.
Step 2: find Service_ID, Service_Type_Code of Services table with smallest value in the results of step 1
Output: SELECT Service_ID , Service_Type_Code FROM Services GROUP BY Service_ID ORDER BY Count ( * ) Asc LIMIT 1
find the maximum gradepoint and the minimum lettergrade in Gradeconversion table
Output: SELECT Max ( gradepoint ) , Min ( lettergrade ) FROM Gradeconversion
Step 1: For each row in jobs table, find the corresponding rows in employees table.
Step 2: find FIRST_NAME, LAST_NAME, SALARY of the results of step 1 whose JOB_TITLE ends with m
Output: SELECT T2.FIRST_NAME , T2.LAST_NAME , T2.SALARY FROM jobs AS T1 JOIN employees AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T1.JOB_TITLE LIKE "%m"
Step 1: find the number of rows of each value of EMPLOYEE_ID in employees table.
Step 2: find EMPLOYEE_ID in employees table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT EMPLOYEE_ID FROM employees GROUP BY EMPLOYEE_ID HAVING Count ( * ) > = 2
find each value of Name in artist table along with the number of the corresponding rows to each value
Output: SELECT Name , Count ( * ) FROM artist GROUP BY Name
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 EMPLOYEE_ID
Output: SELECT T2.FIRST_NAME , T2.LAST_NAME , 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.EMPLOYEE_ID Asc
find the number of rows in customers table whose first_name equals Lucas and last_name equals Mancini
Output: SELECT Count ( * ) FROM customers WHERE first_name = "Lucas" AND last_name = "Mancini"
Step 1: For each row in ACCOUNTS table, find the corresponding rows in SAVINGS table.
Step 2: find the average balance of each value of name 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 ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid GROUP BY T1.name ORDER BY Avg ( T2.balance ) Desc LIMIT 1
find the HIRE_DATE of employees table for which LAST_NAME not equals M
Output: SELECT HIRE_DATE FROM employees WHERE LAST_NAME ! = "M"
find the Team, Position of player table
Output: SELECT Team , Position FROM player
find the number of rows in Club table whose ClubName equals Tennis Club
Output: SELECT Count ( * ) FROM Club WHERE ClubName = "Tennis Club"
find JOB_TITLE of jobs table whose MIN_SALARY greater than 12000 or MIN_SALARY greater than 20000
Output: SELECT JOB_TITLE FROM jobs WHERE MIN_SALARY > 20000 OR MIN_SALARY > 12000
find the CName of Course table for which CName equals MTW
Output: SELECT CName FROM Course WHERE CName = "MTW"
find the Location_Name of Ref_Locations table for which Location_Description equals Robin CV
Output: SELECT Location_Name FROM Ref_Locations WHERE Location_Description = "Robin CV"
find the number of rows in Person table whose gender equals female and age equals 25
Output: SELECT Count ( * ) FROM Person WHERE gender = "female" AND age = 25
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 Bootup Baltimore and Position equals F
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 AND T1.StuID = T3.StuID WHERE T2.ClubName = "Bootup Baltimore" AND T3.Position = "F"
find each value of company_id in Third_Party_Companies table along with the number of the corresponding rows to each value
Output: SELECT Count ( * ) , company_id FROM Third_Party_Companies GROUP BY company_id
find JOB_TITLE, MIN_SALARY, MAX_SALARY of jobs table whose JOB_TITLE contains President and MAX_SALARY greater than 12000
Output: SELECT JOB_TITLE , MIN_SALARY , MAX_SALARY FROM jobs WHERE JOB_TITLE LIKE "President" AND MAX_SALARY > 12000
Step 1: find the Customer_ID of Customers table.
Step 2: find the Customer_ID of Policies table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT T1.Customer_ID FROM Customers AS T1 EXCEPT SELECT T2.Customer_ID FROM Policies AS T2
find the number of rows in Allergy_Type table
Output: SELECT Count ( * ) FROM Allergy_Type
find the Company, Rank of company table ordered ascending by Sales_billion
Output: SELECT Company , Rank FROM company ORDER BY Sales_billion Asc
Step 1: For each row in people table, find the corresponding rows in candidate table.
Step 2: find Name, Sex of the results of step 1 with largest value of Oppose_rate
Output: SELECT T2.Name , T2.Sex FROM candidate AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Oppose_rate Desc LIMIT 1
Step 1: For each row in Band table, find the corresponding rows in Vocals table.
Step 2: find Type of the results of step 1 whose Lastname equals Heilo and Lastname equals Der Kapitan
Output: SELECT T2.Type FROM Band AS T1 JOIN Vocals AS T2 ON T1.Id = T2.Bandmate WHERE T1.Lastname = "Der Kapitan" AND T1.Lastname = "Heilo"
find without repetition the Company of company table
Output: SELECT DISTINCT Company FROM company
find without repetition the Title of Songs table
Output: SELECT DISTINCT Title FROM Songs
find FIRST_NAME, LAST_NAME of employees table whose SALARY greater than 163 and MANAGER_ID equals 0
Output: SELECT FIRST_NAME , LAST_NAME FROM employees WHERE SALARY > 163 AND MANAGER_ID = 0
find the FIRST_NAME, LAST_NAME of employees table with smallest value of SALARY
Output: SELECT FIRST_NAME , LAST_NAME FROM employees ORDER BY SALARY Asc LIMIT 1
find the ClubName of Club table for which ClubName equals AKW
Output: SELECT ClubName FROM Club WHERE ClubName = "AKW"
find the Fname, LName of Student table for which Major equals Bootup Baltimore
Output: SELECT Fname , LName FROM Student WHERE Major = "Bootup Baltimore"
find the number of rows in exhibition table whose Ticket_Price greater than 100 or Ticket_Price less than 10
Output: SELECT Count ( * ) FROM exhibition WHERE Ticket_Price > 10 OR Ticket_Price < 100
find the roomName, decor of Rooms table with smallest value of basePrice
Output: SELECT roomName , decor FROM Rooms ORDER BY basePrice Asc LIMIT 1
Step 1: For each row in trip table, find the corresponding rows in weather table.
Step 2: find start_date of the results of step 1 ordered descending by precipitation_inches.
Step 3: only show the first 5 rows of the results
Output: SELECT T1.start_date FROM trip AS T1 JOIN weather AS T2 ORDER BY T2.precipitation_inches Desc LIMIT 5
Step 1: find the id of station table.
Step 2: find the station_id of status table for which bikes_available greater than 10.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT T1.id FROM station AS T1 EXCEPT SELECT T2.station_id FROM status AS T2 WHERE T2.bikes_available > 10
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, last_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 , T1.last_name ORDER BY Sum ( T2.total ) Desc LIMIT 10
find the end_date, start_date of trip table
Output: SELECT end_date , start_date FROM trip
Step 1: find the number of rows of each value of Name in artist table.
Step 2: find Name, Country of artist table with largest value in the results of step 1
Output: SELECT Name , Country FROM artist GROUP BY Name ORDER BY Count ( * ) Desc LIMIT 1
find the maximum Age in artist table
Output: SELECT Max ( Age ) FROM artist
Step 1: For each row in Person table, find the corresponding rows in PersonFriend table.
Step 2: find age of the results of step 1 with largest value of year
Output: SELECT T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name ORDER BY T2.year Desc LIMIT 1
Step 1: find the maximum Regional_Population in city table.
Step 2: find the City of city table whose Regional_Population equals the results of step 1
Output: SELECT City FROM city WHERE Regional_Population = ( SELECT Max ( Regional_Population ) FROM city )
find the date of weather table for which min_humidity equals or between 30.3 and 31
Output: SELECT date FROM weather WHERE min_humidity BETWEEN 31 AND 30.3
Step 1: For each row in station_company table, find corresponding rows in company table and in gas_station table.
Step 2: find Manager_Name, Headquarters of the results of step 1 ordered descending by Market_Value
Output: SELECT T2.Manager_Name , T1.Headquarters FROM company AS T1 JOIN gas_station AS T2 JOIN station_company AS T3 ON T1.Company_ID = T3.Company_ID AND T3.Station_ID = T2.Station_ID ORDER BY T1.Market_Value Desc
find the ClubName of Club table for which ClubName equals Pen and Paper Gaming
Output: SELECT ClubName FROM Club WHERE ClubName = "Pen and Paper Gaming"
Step 1: For each row in Band table, find the corresponding rows in Performance table.
Step 2: find the number of rows of each value of StagePosition in the results of step 1.
Step 3: find Lastname of step 1 results with largest value in the results of step 2
Output: SELECT T1.Lastname FROM Band AS T1 JOIN Performance AS T2 ON T1.Id = T2.Bandmate GROUP BY T2.StagePosition ORDER BY Count ( * ) Desc LIMIT 1
find address of customers table whose first_name equals Nancy and last_name equals Edwards
Output: SELECT address FROM customers WHERE first_name = "Nancy" AND last_name = "Edwards"
find the name of buildings table for which Status equals on-hold ordered ascending by name
Output: SELECT name FROM buildings WHERE Status = "on-hold" ORDER BY name Asc
find the number of rows in Songs table whose Title equals drums
Output: SELECT Count ( * ) FROM Songs WHERE Title = "drums"
find the number of rows in workshop table
Output: SELECT Count ( * ) FROM workshop
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 roomName equals 2010-10-23 and LastName equals CONRAD and LastName equals SELBIG
Output: SELECT Sum ( T2.Adults ) FROM Rooms AS T1 JOIN Reservations AS T2 ON T1.RoomId = T2.Room WHERE T1.roomName = "2010-10-23" AND T2.LastName = "SELBIG" AND T2.LastName = "CONRAD"
find the Document_ID, Document_Description of Documents table
Output: SELECT Document_ID , Document_Description FROM Documents
Step 1: For each row in Parts table, find the corresponding rows in Part_Faults table.
Step 2: find the number of rows of each value of part_fault_id in the results of step 1.
Step 3: find part_name of step 1 results with smallest value in the results of step 2
Output: SELECT T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T2.part_fault_id ORDER BY Count ( * ) Asc LIMIT 1
find name of Person table whose city equals Alice and gender equals male
Output: SELECT name FROM Person WHERE city = "Alice" AND gender = "male"
find the LName, Age of Student table for which Sex equals Cat
Output: SELECT LName , Age FROM Student WHERE Sex = "Cat"
find the number of rows in Songs table whose Title equals Flash
Output: SELECT Count ( * ) FROM Songs WHERE Title = "Flash"
Step 1: find the number of rows of each value of Destroyed_by_Employee_ID in Documents_to_be_Destroyed table.
Step 2: find Destroyed_by_Employee_ID in Documents_to_be_Destroyed table whose corresponding value in step 1 is greater than 1
Output: SELECT Destroyed_by_Employee_ID FROM Documents_to_be_Destroyed GROUP BY Destroyed_by_Employee_ID HAVING Count ( * ) > 1
Step 1: find the number of rows of each value of School_ID in school table.
Step 2: find Denomination in school table whose corresponding value in step 1 is greater than 1
Output: SELECT Denomination FROM school GROUP BY School_ID HAVING Count ( * ) > 1
find the number of rows in Projects table whose Hours greater than 300
Output: SELECT Count ( * ) FROM Projects WHERE Hours > 300
Step 1: For each row in AssignedTo table, find corresponding rows in Scientists table and in Projects table.
Step 2: find Projects's Name, Hours, Scientists's Name of the results of step 1 ordered ascending by Projects's Name
Output: SELECT T2.Name , T2.Hours , T1.Name FROM Scientists AS T1 JOIN Projects AS T2 JOIN AssignedTo AS T3 ON T1.SSN = T3.Scientist AND T3.Project = T2.Code ORDER BY T2.Name Asc
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, balance in the results of step 2 whose balance greater than the results of step 1
Output: SELECT T1.name , T2.balance FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid WHERE T2.balance > ( SELECT Avg ( T2.balance ) FROM SAVINGS AS T2 )
find the average min_temperature_f in weather table
Output: SELECT Avg ( min_temperature_f ) FROM weather
Step 1: For each row in Student table, find the corresponding rows in Has_Allergy table.
Step 2: find the number of rows in the results of step 1 whose Sex equals F or Allergy equals Milk
Output: SELECT Count ( * ) FROM Has_Allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Sex = "F" OR T1.Allergy = "Milk"
find the number of different Role_Code in Roles table
Output: SELECT Count ( DISTINCT Role_Code ) FROM Roles
Step 1: For each row in Ref_Locations table, find the corresponding rows in Document_Locations table.
Step 2: find Ref_Locations's Location_Code, Date_in_Location_From, Date_in_Locaton_To of the results of step 1
Output: SELECT T1.Location_Code , 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
Step 1: For each row in Band table, find the corresponding rows in Instruments table.
Step 2: find Instrument of the results of step 1 whose Lastname equals Heilo and Lastname equals Le Pop
Output: SELECT T2.Instrument FROM Band AS T1 JOIN Instruments AS T2 ON T1.Id = T2.BandmateId WHERE T1.Lastname = "Le Pop" AND T1.Lastname = "Heilo"
Step 1: find the DName of Department table for which Division equals AS.
Step 2: find DName of Department table whose Division equals EN and Building equals NEB.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT DName FROM Department WHERE Division = "AS" INTERSECT SELECT DName FROM Department WHERE Division = "EN" AND Building = "NEB"
find the number of rows in employees table whose first_name equals Steve and last_name equals Johnson
Output: SELECT Count ( * ) FROM employees WHERE first_name = "Steve" AND last_name = "Johnson"
Step 1: find the number of rows of each value of Customer_ID in Customers table.
Step 2: find Customer_Details of Customers table with largest value in the results of step 1
Output: SELECT Customer_Details FROM Customers GROUP BY Customer_ID ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the id of station table for which long greater than 37.4.
Step 2: find the station_id of status table for which bikes_available less than 7.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT T1.id FROM station AS T1 WHERE T1.long > 37.4 INTERSECT SELECT T2.station_id FROM status AS T2 WHERE T2.bikes_available < 7
Step 1: For each row in countries table, find the corresponding rows in employees table.
Step 2: find FIRST_NAME, LAST_NAME of the results of step 1 whose COUNTRY_NAME equals Argentina
Output: SELECT T2.FIRST_NAME , T2.LAST_NAME FROM countries AS T1 JOIN employees AS T2 WHERE T1.COUNTRY_NAME = "Argentina"
find decor of Rooms table whose roomName equals Recluse and defiance and roomName equals Recluse and defiance
Output: SELECT decor FROM Rooms WHERE roomName = "Recluse and defiance" AND roomName = "Recluse and defiance"
Step 1: find the Document_ID of Documents table.
Step 2: For each row in Documents table, find the corresponding rows in Documents_with_Expenses table.
Step 3: find Documents_with_Expenses's Document_ID of the results of step 2 whose Document_Type_Code equals CV.
Step 4: show the rows that are in the results of step 1 but not in the results of step 3
Output: SELECT T1.Document_ID FROM Documents AS T1 EXCEPT SELECT T2.Document_ID FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.Document_ID = T2.Document_ID WHERE T1.Document_Type_Code = "CV"
Step 1: find the maximum total in invoices table.
Step 2: find the billing_country, total of invoices table whose total equals the results of step 1
Output: SELECT billing_country , total FROM invoices WHERE total = ( SELECT Max ( total ) FROM invoices )
Step 1: For each row in school table, find the corresponding rows in player table.
Step 2: find the number of rows of each value of player's School_ID in the results of step 1.
Step 3: find School of step 1 results with largest value in the results of step 2
Output: SELECT T1.School FROM school AS T1 JOIN player AS T2 ON T1.School_ID = T2.School_ID GROUP BY T2.School_ID ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in AssignedTo table, find corresponding rows in Scientists table and in Projects table.
Step 2: find the summation of Hours of each value of Project in the results of step 1.
Step 3: find Projects's Name, Scientists's Name of the results of step 1 with largest value in the results of step 2
Output: SELECT T2.Name , T1.Name FROM Scientists AS T1 JOIN Projects AS T2 JOIN AssignedTo AS T3 ON T1.SSN = T3.Scientist AND T3.Project = T2.Code AND T1.SSN = T3.Scientist GROUP BY T3.Project ORDER BY Sum ( T2.Hours ) Desc LIMIT 1
Step 1: For each row in station table, find the corresponding rows in trip table.
Step 2: find name, city, start_date of the results of step 1 with smallest value of duration
Output: SELECT T1.name , T1.city , T2.start_date FROM station AS T1 JOIN trip AS T2 ORDER BY T2.duration Asc LIMIT 1
Step 1: find the date, mean_temperature_f, min_dew_point_f of weather table ordered descending by max_gust_speed_mph.
Step 2: only show the first 3 rows of the results
Output: SELECT date , mean_temperature_f , min_dew_point_f FROM weather ORDER BY max_gust_speed_mph Desc LIMIT 3
find without repetition the product_name of Product table ordered ascending by product_name
Output: SELECT DISTINCT product_name FROM Product ORDER BY product_name Asc
find the number of rows in artist table
Output: SELECT Count ( * ) FROM artist
Step 1: find the number of rows of each value of Document_Type_Code in Documents table.
Step 2: find Document_Type_Code of Documents table with largest value in the results of step 1
Output: SELECT Document_Type_Code FROM Documents GROUP BY Document_Type_Code ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in match table, find the corresponding rows in hosting_city table.
Step 2: find Host_City of the results of step 1 ordered descending by Date
Output: SELECT T2.Host_City FROM match AS T1 JOIN hosting_city AS T2 ON T1.Match_ID = T2.Match_ID ORDER BY T1.Date Desc
find the average duration and the average start_date in trip table
Output: SELECT Avg ( duration ) , Avg ( start_date ) FROM trip
find each value of city in station table along with the maximum long of the corresponding rows to each value
Output: SELECT city , Max ( long ) FROM station GROUP BY city
find the rows of regions table
Output: SELECT * FROM regions
find without repetition the zip_code of weather table for which wind_dir_degrees less than 70
Output: SELECT DISTINCT zip_code FROM weather WHERE wind_dir_degrees < 70
find the number of rows in Reservations table whose FirstName equals ROY and LastName equals SWEAZY
Output: SELECT Count ( * ) FROM Reservations WHERE FirstName = "ROY" AND LastName = "SWEAZY"
Step 1: For each row in station table, find the corresponding rows in trip table.
Step 2: find trip's id of the results of step 1 with largest value of lat
Output: SELECT T2.id FROM station AS T1 JOIN trip AS T2 ORDER BY T1.lat Desc LIMIT 1
find the number of rows in exhibition table whose Year equals 2005 or Year greater than 2004
Output: SELECT Count ( * ) FROM exhibition WHERE Year = 2004 OR Year > 2005
Step 1: For each row in Band table, find the corresponding rows in Instruments table.
Step 2: find Instrument of the results of step 1 whose Lastname equals Heilo
Output: SELECT T2.Instrument FROM Band AS T1 JOIN Instruments AS T2 ON T1.Id = T2.BandmateId WHERE T1.Lastname = "Heilo"
Step 1: find the number of rows of each value of Firstname 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 Firstname ORDER BY Count ( * ) Desc LIMIT 1
find the summation of balance in SAVINGS table
Output: SELECT Sum ( balance ) FROM SAVINGS
Step 1: For each row in departments table, find the corresponding rows in locations table.
Step 2: find DEPARTMENT_NAME, CITY, STATE_PROVINCE, STATE_PROVINCE of the results of step 1
Output: SELECT T1.DEPARTMENT_NAME , T2.CITY , T2.STATE_PROVINCE , T2.STATE_PROVINCE FROM departments AS T1 JOIN locations AS T2
find the name of station table for which long less than 37.5
Output: SELECT name FROM station WHERE long < 37.5
find the number of rows in Student table whose Sex equals Cat
Output: SELECT Count ( * ) FROM Student WHERE Sex = "Cat"
find the Name of Scientists table
Output: SELECT Name FROM Scientists
Step 1: find the Denomination of school table for which Founded greater than 1890.
Step 2: find the Denomination of school table for which Founded less than 1900.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT Denomination FROM school WHERE Founded > 1890 INTERSECT SELECT Denomination FROM school WHERE Founded < 1900
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 minimum MIN_SALARY of the corresponding rows to each value
Output: SELECT Min ( T1.MIN_SALARY ) , T2.DEPARTMENT_ID FROM jobs AS T1 JOIN employees AS T2 ON T1.JOB_ID = T2.JOB_ID GROUP BY T2.DEPARTMENT_ID
Step 1: find the Document_Date of Documents table for which Documents's Document_Type_Code equals GV.
Step 2: For each row in Ref_Document_Types table, find the corresponding rows in Documents table.
Step 3: find Document_Date of the results of step 2 whose Document_Type_Name equals SF.
Step 4: show the rows that are in both the results of step 1 and the results of step 3
Output: SELECT T1.Document_Date FROM Documents AS T1 WHERE T1.Document_Type_Code = "GV" INTERSECT SELECT T1.Document_Date FROM Ref_Document_Types AS T2 JOIN Documents AS T1 ON T2.Document_Type_Code = T1.Document_Type_Code WHERE T2.Document_Type_Name = "SF"
Step 1: find the number of rows of each value of Song in volume table.
Step 2: find Issue_Date in volume table whose corresponding value in step 1 is greater than 2
Output: SELECT Issue_Date FROM volume GROUP BY Song HAVING Count ( * ) > 2
Step 1: find the number of rows of each value of CID in Course table.
Step 2: find CName in Course table whose corresponding value in step 1 is greater than or equals 5
Output: SELECT CName FROM Course GROUP BY CID HAVING Count ( * ) > = 5
find the Major of Student table with largest value of Age
Output: SELECT Major FROM Student ORDER BY Age Desc LIMIT 1
Step 1: For each row in Rooms table, find the corresponding rows in Reservations table.
Step 2: find roomName of the results of step 1 whose Rate equals 60
Output: SELECT T1.roomName FROM Rooms AS T1 JOIN Reservations AS T2 ON T1.RoomId = T2.Room WHERE T2.Rate = 60
Step 1: find the asset_id, asset_details of Assets table.
Step 2: find the asset_details of Assets table for which asset_details less than 2.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT asset_id , asset_details FROM Assets INTERSECT SELECT asset_details FROM Assets WHERE asset_details < 2
find Match_ID of match table whose Score equals 1994 FIFA World Cup qualification and Competition equals Friendly match
Output: SELECT Match_ID FROM match WHERE Score = "1994 FIFA World Cup qualification" AND Competition = "Friendly match"
Step 1: For each row in ACCOUNTS table, find the corresponding rows in SAVINGS table.
Step 2: find name, balance of the results of step 1 with smallest value of balance
Output: SELECT T1.name , T2.balance FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid ORDER BY T2.balance Asc LIMIT 1
Step 1: find rows in Documents table whose Document_Type_Code equals BK.
Step 2: find each value of Document_Type_Code the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT Count ( * ) , Document_Type_Code FROM Documents WHERE Document_Type_Code = "BK" GROUP BY Document_Type_Code
Step 1: find the number of rows of each value of DEPARTMENT_ID in departments table.
Step 2: find DEPARTMENT_ID in departments table whose corresponding value in step 1 is greater than or equals 4
Output: SELECT DEPARTMENT_ID FROM departments GROUP BY DEPARTMENT_ID HAVING Count ( * ) > = 4
find the number of rows in trip table whose start_date not equals San Francisco
Output: SELECT Count ( * ) FROM trip WHERE start_date ! = "San Francisco"
find the number of different DName in Department table whose Division equals AS
Output: SELECT Count ( DISTINCT DName ) FROM Department WHERE Division = "AS"
Step 1: For each row in Policies table, find corresponding rows in Customers table and in Claim_Headers table.
Step 2: find the summation of Amount_Claimed of each value of Customers's Customer_ID in the results of step 1.
Step 3: find Customer_Details of the results of step 1 with smallest value in the results of step 2
Output: SELECT T1.Customer_Details FROM Customers AS T1 JOIN Policies AS T2 ON T1.Customer_ID = T2.Customer_ID JOIN Claim_Headers AS T3 ON T2.Policy_ID = T3.Policy_ID GROUP BY T1.Customer_ID ORDER BY Sum ( T3.Amount_Claimed ) Asc LIMIT 1
Step 1: For each row in departments table, find the corresponding rows in employees table.
Step 2: find FIRST_NAME, SALARY of the results of step 1 whose DEPARTMENT_NAME equals Finance
Output: SELECT T2.FIRST_NAME , T2.SALARY FROM departments AS T1 JOIN employees AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T1.DEPARTMENT_NAME = "Finance"
find without repetition the Fname of Student table for which Major equals 3.8
Output: SELECT DISTINCT Fname FROM Student WHERE Major = 3.8
find the City, Hanyu_Pinyin of city table with smallest value of GDP
Output: SELECT City , Hanyu_Pinyin FROM city ORDER BY GDP Asc LIMIT 1
Step 1: For each row in Person table, find the corresponding rows in PersonFriend table.
Step 2: find Person's name, age, job of the results of step 1 with largest value of year
Output: SELECT T1.name , T1.age , T1.job FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name ORDER BY T2.year Desc LIMIT 1
find each value of Name in Scientists table along with the number of the corresponding rows to each value
Output: SELECT Name , Count ( * ) FROM Scientists GROUP BY Name
find the DName of Department table for which Building equals 268
Output: SELECT DName FROM Department WHERE Building = 268
find the Document_Description, Document_Name of Documents table for which Other_Details equals Private Project
Output: SELECT Document_Description , Document_Name FROM Documents WHERE Other_Details = "Private Project"
Step 1: For each row in architect table, find corresponding rows in bridge table and in mill table.
Step 2: find bridge's name of the results of step 1 whose mill's name contains Moulin
Output: SELECT T2.name FROM architect AS T1 JOIN bridge AS T2 ON T2.architect_id = T1.id JOIN mill AS T3 ON T1.id = T3.architect_id WHERE T3.name LIKE "Moulin"
Step 1: For each row in departments table, find the corresponding rows in employees table.
Step 2: find each value of employees's DEPARTMENT_ID in the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT T1.DEPARTMENT_NAME , Count ( * ) FROM departments AS T1 JOIN employees AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID GROUP BY T2.DEPARTMENT_ID
find the number of rows in Band table whose Lastname equals Heilo
Output: SELECT Count ( * ) FROM Band WHERE Lastname = "Heilo"
Step 1: For each row in Person table, find the corresponding rows in PersonFriend table.
Step 2: find Person's name of the results of step 1 with largest value of year
Output: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name ORDER BY T2.year Desc LIMIT 1
find the first_name, last_name of Maintenance_Engineers table
Output: SELECT first_name , last_name FROM Maintenance_Engineers
Step 1: For each row in employees table, find the corresponding rows in customers table.
Step 2: find employees's first_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 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"
find the EMPLOYEE_ID, FIRST_NAME, LAST_NAME of employees table
Output: SELECT EMPLOYEE_ID , FIRST_NAME , LAST_NAME FROM employees
Step 1: For each row in Instruments table, find corresponding rows in Songs table and in Band table.
Step 2: find Firstname, Lastname of the results of step 1 whose Title equals Badlands
Output: SELECT T2.Firstname , T2.Lastname FROM Songs AS T1 JOIN Band AS T2 JOIN Instruments AS T3 ON T1.SongId = T3.SongId AND T3.BandmateId = T2.Id WHERE T1.Title = "Badlands"
find EMPLOYEE_ID of employees table whose HIRE_DATE greater than 1987-09-07 and LAST_NAME less than King
Output: SELECT EMPLOYEE_ID FROM employees WHERE HIRE_DATE > "1987-09-07" AND LAST_NAME < "King"
find the number of rows in Allergy_Type table whose AllergyType equals food
Output: SELECT Count ( * ) FROM Allergy_Type WHERE AllergyType = "food"
find the number of rows in Person table whose city equals Austin
Output: SELECT Count ( * ) FROM Person WHERE city = "Austin"
find the number of rows in employees table whose first_name equals Lucas
Output: SELECT Count ( * ) FROM employees WHERE first_name = "Lucas"
Step 1: find the number of rows of each value of Famous_Title in artist table.
Step 2: find Famous_Title in artist table whose corresponding value in step 1 is greater than 2
Output: SELECT Famous_Title FROM artist GROUP BY Famous_Title HAVING Count ( * ) > 2
Step 1: find the School of school table.
Step 2: find the Nickname of school_details table for which Division equals Division 1.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT T1.School FROM school AS T1 EXCEPT SELECT T2.Nickname FROM school_details AS T2 WHERE T2.Division = "Division 1"
Step 1: For each row in station table, find the corresponding rows in status table.
Step 2: find the number of rows of each value of station_id in the results of step 1.
Step 3: find id, name in the results of step 1 whose corresponding value in step 2 is greater than 12
Output: SELECT T1.id , T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING Count ( * ) > 12
Step 1: For each row in departments table, find the corresponding rows in employees table.
Step 2: find the number of rows of each value of employees's DEPARTMENT_ID in the results of step 1.
Step 3: find DEPARTMENT_NAME in the results of step 1 whose corresponding value in step 2 is greater than 10
Output: SELECT T1.DEPARTMENT_NAME FROM departments AS T1 JOIN employees AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID GROUP BY T2.DEPARTMENT_ID HAVING Count ( * ) > 10
Step 1: find the exhibition's Artist_ID of exhibition table for which Year equals 2004.
Step 2: find the Name of artist table whose artist's Artist_ID not one of the results of step 1
Output: SELECT T1.Name FROM artist AS T1 WHERE T1.Artist_ID NOT IN ( SELECT T2.Artist_ID FROM exhibition AS T2 WHERE T2.Year = 2004 )
find without repetition the start_date of trip table for which duration less than 100
Output: SELECT DISTINCT start_date FROM trip WHERE duration < 100
find the Destroyed_by_Employee_ID of Documents_to_be_Destroyed table for which Document_ID equals 7
Output: SELECT Destroyed_by_Employee_ID FROM Documents_to_be_Destroyed WHERE Document_ID = 7
find FIRST_NAME of employees table whose HIRE_DATE greater than 1987-09-07 and LAST_NAME less than King
Output: SELECT FIRST_NAME FROM employees WHERE HIRE_DATE > "1987-09-07" AND LAST_NAME < "King"
Step 1: For each row in Office_locations table, find corresponding rows in buildings table and in Companies table.
Step 2: find buildings's name of the results of step 1 whose Companies's name equals JPMorgan Chase
Output: SELECT T1.name FROM buildings AS T1 JOIN Companies AS T2 JOIN Office_locations AS T3 ON T1.id = T3.building_id AND T3.company_id = T2.id WHERE T2.name = "JPMorgan Chase"
Step 1: find the number of rows of each value of product_id in Products table.
Step 2: find product_name, product_price of Products table with largest value in the results of step 1
Output: SELECT product_name , product_price FROM Products GROUP BY product_id ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of first_name in employees table.
Step 2: find first_name, last_name of employees table with largest value in the results of step 1
Output: SELECT first_name , last_name FROM employees GROUP BY first_name ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in sqlite_sequence table, find the corresponding rows in tracks table.
Step 2: find seq of the results of step 1 whose tracks's name equals Fast As a Shark
Output: SELECT T1.seq FROM sqlite_sequence AS T1 JOIN tracks AS T2 WHERE T2.name = "Fast As a Shark"
Step 1: For each row in artist table, find the corresponding rows in volume table.
Step 2: find Issue_Date of the results of step 1 whose Age equals 23 or Age equals 34
Output: SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Age = 34 OR T1.Age = 23
Step 1: For each row in jobs table, find the corresponding rows in employees table.
Step 2: find FIRST_NAME, LAST_NAME of the results of step 1 whose JOB_TITLE contains T
Output: SELECT T2.FIRST_NAME , T2.LAST_NAME FROM jobs AS T1 JOIN employees AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T1.JOB_TITLE LIKE "T"
find the rows of candidate table
Output: SELECT * FROM candidate
Step 1: find the EMPLOYEE_ID of job_history table.
Step 2: find the employees's EMPLOYEE_ID of employees table whose employees's EMPLOYEE_ID not one of the results of step 1
Output: SELECT T1.EMPLOYEE_ID FROM employees AS T1 WHERE T1.EMPLOYEE_ID NOT IN ( SELECT T2.EMPLOYEE_ID FROM job_history AS T2 )
find the balance of SAVINGS table with largest value of balance
Output: SELECT balance FROM SAVINGS ORDER BY balance Desc LIMIT 1
Step 1: find the zip_code of weather table.
Step 2: find the zip_code of weather table whose zip_code not one of the results of step 1
Output: SELECT zip_code FROM weather WHERE zip_code NOT IN ( SELECT zip_code FROM weather )
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 Bootup Baltimore
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 = "Bootup Baltimore"
Step 1: find the number of rows of each value of Year in perpetrator table.
Step 2: find Year of perpetrator table with largest value in the results of step 1
Output: SELECT Year FROM perpetrator GROUP BY Year ORDER BY Count ( * ) Desc LIMIT 1
find the catalog_publisher of Catalogs table for which catalog_name contains Murray
Output: SELECT catalog_publisher FROM Catalogs WHERE catalog_name LIKE "Murray"
find the town_city, state_province_county of Addresses table
Output: SELECT town_city , state_province_county FROM Addresses
Step 1: find the number of rows of each value of ACC_Percent in basketball_match table.
Step 2: find ACC_Percent of basketball_match table with largest value in the results of step 1
Output: SELECT ACC_Percent FROM basketball_match GROUP BY ACC_Percent ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of Appelation in wine table.
Step 2: find Appelation in wine table whose corresponding value in step 1 is less than or equals 3
Output: SELECT Appelation FROM wine GROUP BY Appelation HAVING Count ( * ) < = 3
find the Publisher of book_club table for which Year not equals 1989
Output: SELECT Publisher FROM book_club WHERE Year ! = 1989
find each value of resident_id in Residents table along with the number of the corresponding rows to each value
Output: SELECT resident_id , Count ( * ) FROM Residents GROUP BY resident_id
find the number of rows in mountain table
Output: SELECT Count ( * ) FROM mountain
Step 1: For each row in team table, find corresponding rows in match_season table and in player table.
Step 2: find Season, Name, player's Team of the results of step 1
Output: SELECT T2.Season , T1.Name , T3.Team FROM team AS T1 JOIN match_season AS T2 ON T1.Team_id = T2.Team JOIN player AS T3 ON T1.Team_id = T3.Team
find each value of country in airports table along with the number of the corresponding rows to each value
Output: SELECT Count ( * ) , country FROM airports GROUP BY country
find the number of rows in swimmer table
Output: SELECT Count ( * ) FROM swimmer
Step 1: For each row in broadcast table, find corresponding rows in program table and in channel table.
Step 2: find channel's Name, channel's Owner, program's Owner of the results of step 1
Output: SELECT T2.Name , T2.Owner , T1.Owner FROM program AS T1 JOIN channel AS T2 JOIN broadcast AS T3 ON T1.Program_ID = T3.Program_ID AND T3.Channel_ID = T2.Channel_ID
find the maximum Price and the minimum Score in wine table whose Name equals St. Helena
Output: SELECT Max ( Price ) , Min ( Score ) FROM wine WHERE Name = "St. Helena"
Step 1: For each row in Catalog_Structure table, find corresponding rows in Catalogs table and in Catalog_Contents table.
Step 2: find catalog_entry_name of the results of step 1 whose catalog_name equals 2%
Output: SELECT T3.catalog_entry_name FROM Catalogs AS T1 JOIN Catalog_Structure AS T2 ON T1.catalog_id = T2.catalog_id JOIN Catalog_Contents AS T3 ON T2.catalog_level_number = T3.catalog_level_number WHERE T1.catalog_name = "2%"
find the Email of Customer table for which State equals NY
Output: SELECT Email FROM Customer WHERE State = "NY"
Step 1: find the Invoice's CustomerId of Invoice table for which Total greater than 20.
Step 2: find the LastName of Customer table whose Customer's CustomerId not one of the results of step 1
Output: SELECT T1.LastName FROM Customer AS T1 WHERE T1.CustomerId NOT IN ( SELECT T2.CustomerId FROM Invoice AS T2 WHERE T2.Total > 20 )
find the number of rows in Customers table whose customer_details equals Unsatisfied
Output: SELECT Count ( * ) FROM Customers WHERE customer_details = "Unsatisfied"
find without repetition the Name of Nurse table
Output: SELECT DISTINCT Name FROM Nurse