niryuu/sni-each-converted huggingface dataset:
Step 1: find the number of rows of each value of Location in school table.
Step 2: find Location in school table whose corresponding value in step 1 is greater than 1
Output: SELECT Location FROM school GROUP BY Location HAVING Count ( * ) > 1
Step 1: For each row in Ref_Locations table, find the corresponding rows in Document_Locations table.
Step 2: find each value of Document_Locations's Location_Code in the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT T1.Location_Code , Count ( * ) FROM Ref_Locations AS T1 JOIN Document_Locations AS T2 ON T1.Location_Code = T2.Location_Code GROUP BY T2.Location_Code
Step 1: find the name, age of Person table for which job equals Dan.
Step 2: find the name, age of Person table for which job equals Alice.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT name , age FROM Person WHERE job = "Dan" INTERSECT SELECT name , age FROM Person WHERE job = "Alice"
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 Famous_Title equals Gorgoroth
Output: SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Famous_Title = "Gorgoroth"
Step 1: find the number of rows of each value of Title in film table.
Step 2: find Title of film table with largest value in the results of step 1
Output: SELECT Title FROM film GROUP BY Title ORDER BY Count ( * ) 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
Output: SELECT T2.Type FROM Band AS T1 JOIN Vocals AS T2 ON T1.Id = T2.Bandmate WHERE T1.Lastname = "Heilo"
find the friend of PersonFriend table
Output: SELECT friend FROM PersonFriend
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 ends with m
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 "%m"
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 Clara
Output: SELECT T1.FIRST_NAME , T1.LAST_NAME FROM employees AS T1 JOIN locations AS T2 WHERE T2.CITY = "Clara"
Step 1: For each row in Parts table, find the corresponding rows in Part_Faults table.
Step 2: find the summation of chargeable_amount of each value of Parts's part_id in the results of step 1.
Step 3: find Parts's part_id, part_fault_id of step 1 results with smallest value in the results of step 2
Output: SELECT T1.part_id , T2.part_fault_id FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_id ORDER BY Sum ( T1.chargeable_amount ) Asc LIMIT 1
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 and Regional_Population less than 23019148
Output: SELECT T1.City FROM city AS T1 JOIN hosting_city AS T2 ON T1.City_ID = T2.Host_City WHERE T2.Year = 2008 AND T1.Regional_Population < 23019148
Step 1: For each row in AssignedTo table, find corresponding rows in Scientists table and in Projects table.
Step 2: find Scientists's Name, Projects's Name of the results of step 1 with largest value of Hours
Output: SELECT T1.Name , T2.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.Hours Desc LIMIT 1
find without repetition the staff_first_name, staff_last_name of Staff table for which staff_id equals 1
Output: SELECT DISTINCT staff_first_name , staff_last_name FROM Staff WHERE staff_id = 1
find the FIRST_NAME, LAST_NAME of employees table for which SALARY equals or between 6000 and 24000
Output: SELECT FIRST_NAME , LAST_NAME FROM employees WHERE SALARY BETWEEN 24000 AND 6000
find the name of Person table for which gender equals Alice
Output: SELECT name FROM Person WHERE gender = "Alice"
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 or GDP less than 1919.57
Output: SELECT T1.City FROM city AS T1 JOIN hosting_city AS T2 ON T1.City_ID = T2.Host_City WHERE T2.Year = 2008 OR T1.GDP < 1919.57
find the EMPLOYEE_ID, HIRE_DATE of employees table for which SALARY equals 24000
Output: SELECT EMPLOYEE_ID , HIRE_DATE FROM employees WHERE SALARY = 24000
find the FIRST_NAME, LAST_NAME, SALARY, DEPARTMENT_ID of employees table
Output: SELECT FIRST_NAME , LAST_NAME , SALARY , DEPARTMENT_ID FROM employees
find the EMPLOYEE_ID, LAST_NAME of employees table for which FIRST_NAME contains T
Output: SELECT EMPLOYEE_ID , LAST_NAME FROM employees WHERE FIRST_NAME LIKE "T"
Step 1: find the number of rows of each value of Location_Code in Ref_Locations table.
Step 2: find Location_Name, Location_Code of Ref_Locations table with smallest value in the results of step 1
Output: SELECT Location_Name , Location_Code FROM Ref_Locations GROUP BY Location_Code ORDER BY Count ( * ) Asc LIMIT 1
find without repetition the Type of Vocals table
Output: SELECT DISTINCT Type FROM Vocals
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
Output: SELECT T1.City FROM city AS T1 JOIN hosting_city AS T2 ON T1.City_ID = T2.Host_City WHERE T2.Year = 2008
find the Lastname of Band table for which Firstname equals Le Pop
Output: SELECT Lastname FROM Band WHERE Firstname = "Le Pop"
find the name, age, city of Person table with largest value of age
Output: SELECT name , age , city FROM Person ORDER BY age Desc LIMIT 1
find the number of rows in Person table
Output: SELECT Count ( * ) FROM Person
Step 1: find the Document_Date of Documents table for which Document_Type_Code equals GV.
Step 2: For each row in Documents table, find the corresponding rows in Documents_with_Expenses table.
Step 3: find Document_Details of the results of step 2 whose Document_Type_Code 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 T2.Document_Details FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.Document_ID = T2.Document_ID WHERE T1.Document_Type_Code = "SF"
Step 1: For each row in All_Documents table, find corresponding rows in Document_Locations table and in Documents_to_be_Destroyed table.
Step 2: find Location_Code, Date_in_Location_From, Actual_Destruction_Date of the results of step 1
Output: SELECT T2.Location_Code , T2.Date_in_Location_From , T3.Actual_Destruction_Date FROM All_Documents AS T1 JOIN Document_Locations AS T2 ON T2.Document_ID = T1.Document_ID JOIN Documents_to_be_Destroyed AS T3 ON T1.Document_ID = T3.Document_ID
Step 1: For each row in Minor_in table, find corresponding rows in Student table and in Department table.
Step 2: find the number of rows of each value of Major in the results of step 1.
Step 3: find DName of the results of step 1 with largest value in the results of step 2
Output: SELECT T2.DName FROM Student AS T1 JOIN Department AS T2 JOIN Minor_in AS T3 ON T1.StuID = T3.StuID AND T3.DNO = T2.DNO GROUP BY T1.Major ORDER BY Count ( * ) Desc LIMIT 1
find the average Famous_Release_date in artist table whose Artist equals 25 or Artist equals Gorgoroth
Output: SELECT Avg ( Famous_Release_date ) FROM artist WHERE Artist = "Gorgoroth" OR Artist = 25
Step 1: For each row in countries table, find the corresponding rows in employees table.
Step 2: find EMPLOYEE_ID, COUNTRY_NAME of the results of step 1 whose COUNTRY_NAME equals Argentina
Output: SELECT T2.EMPLOYEE_ID , T1.COUNTRY_NAME FROM countries AS T1 JOIN employees AS T2 WHERE T1.COUNTRY_NAME = "Argentina"
Step 1: find the number of rows of each value of City in city table.
Step 2: find GDP, Regional_Population in city table whose corresponding value in step 1 is greater than 1
Output: SELECT GDP , Regional_Population FROM city GROUP BY City HAVING Count ( * ) > 1
Step 1: For each row in Statements table, find corresponding rows in Documents table and in Accounts table.
Step 2: find Accounts's Statement_ID, Document_Description, Account_Details of the results of step 1
Output: SELECT T3.Statement_ID , T1.Document_Description , T3.Account_Details FROM Documents AS T1 JOIN Statements AS T2 ON T1.Document_ID = T2.Statement_ID JOIN Accounts AS T3 ON T2.Statement_ID = T3.Statement_ID
Step 1: For each row in countries table, find the corresponding rows in employees table.
Step 2: find FIRST_NAME, LAST_NAME, COUNTRY_NAME of the results of step 1
Output: SELECT T2.FIRST_NAME , T2.LAST_NAME , T1.COUNTRY_NAME FROM countries AS T1 JOIN employees AS T2
find the Document_Name, Document_Date of Documents table for which Document_Description equals Graph Database project
Output: SELECT Document_Name , Document_Date FROM Documents WHERE Document_Description = "Graph Database project"
Step 1: find the number of rows of each value of bedType in Rooms table.
Step 2: find bedType of Rooms table with smallest value in the results of step 1
Output: SELECT bedType FROM Rooms GROUP BY bedType ORDER BY Count ( * ) Asc LIMIT 1
Step 1: For each row in Roles table, find the corresponding rows in Employees table.
Step 2: find Employee_ID of the results of step 1 whose Role_Name equals Human Resource
Output: SELECT T2.Employee_ID FROM Roles AS T1 JOIN Employees AS T2 ON T1.Role_Code = T2.Role_Code WHERE T1.Role_Name = "Human Resource"
find the number of different Budget_Type_Code in Documents_with_Expenses table
Output: SELECT Count ( DISTINCT Budget_Type_Code ) FROM Documents_with_Expenses
find the name, job, city of Person table ordered ascending by name
Output: SELECT name , job , city FROM Person ORDER BY name Asc
find the number of rows in Club table whose ClubName equals Pen and Paper Gaming and ClubName equals Bootup Baltimore
Output: SELECT Count ( * ) FROM Club WHERE ClubName = "Bootup Baltimore" AND ClubName = "Pen and Paper Gaming"
Step 1: For each row in Ref_Locations table, find the corresponding rows in Document_Locations table.
Step 2: find the number of rows of each value of Document_Locations's Location_Code in the results of step 1.
Step 3: find Location_Name, Location_Description of step 1 results with smallest value in the results of step 2
Output: SELECT T1.Location_Name , T1.Location_Description FROM Ref_Locations AS T1 JOIN Document_Locations AS T2 ON T1.Location_Code = T2.Location_Code GROUP BY T2.Location_Code ORDER BY Count ( * ) Asc LIMIT 1
Step 1: For each row in jobs table, find the corresponding rows in employees table.
Step 2: find FIRST_NAME, HIRE_DATE, SALARY of the results of step 1 whose JOB_TITLE not equals M
Output: SELECT T2.FIRST_NAME , T2.HIRE_DATE , T2.SALARY FROM jobs AS T1 JOIN employees AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T1.JOB_TITLE ! = "M"
Step 1: For each row in artist table, find the corresponding rows in volume table.
Step 2: find Song of the results of step 1 whose Age equals 32 or Age equals 34
Output: SELECT T2.Song FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Age = 34 OR T1.Age = 32
Step 1: For each row in Skills_Required_To_Fix table, find corresponding rows in Skills table and in Part_Faults table.
Step 2: find the number of rows of each value of Part_Faults's part_fault_id in the results of step 1.
Step 3: find Part_Faults's part_fault_id, skill_description, part_id of the results of step 1 with largest value in the results of step 2
Output: SELECT T2.part_fault_id , T1.skill_description , T2.part_id FROM Skills AS T1 JOIN Part_Faults AS T2 JOIN Skills_Required_To_Fix AS T3 ON T1.skill_id = T3.skill_id AND T3.part_fault_id = T2.part_fault_id GROUP BY T2.part_fault_id ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find rows in Documents table whose Document_Type_Code equals BK.
Step 2: find each value of Document_ID the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT Count ( * ) , Project_ID FROM Documents WHERE Document_Type_Code = "BK" GROUP BY Document_ID
Step 1: find the number of rows of each value of Studio in film table.
Step 2: find Title of film table with largest value in the results of step 1
Output: SELECT Title FROM film GROUP BY Studio ORDER BY Count ( * ) Desc LIMIT 1
find each value of School_ID in school table along with the number of the corresponding rows to each value
Output: SELECT Boys_or_Girls , Count ( * ) FROM school GROUP BY School_ID
Step 1: find the number of rows of each value of Account_Details in Accounts table.
Step 2: find Account_Details, Account_ID of Accounts table ordered descending by the results of step 1.
Step 3: find Account_Details of Accounts table ordered descending by the results of step 3.
Step 4: only keep the first row of the results of step 4.
Step 5: show the rows that are in both the results of step 2 and the results of step 5.
Step 6: only show the first row of the results
Output: SELECT Account_Details , Account_ID FROM Accounts GROUP BY Account_Details ORDER BY Count ( * ) Desc LIMIT 1 INTERSECT SELECT Account_Details FROM Accounts GROUP BY Account_Details ORDER BY Count ( * ) Desc LIMIT 1
find the number of rows in Student table whose Fname equals Linda and LName equals Smith
Output: SELECT Count ( * ) FROM Student WHERE Fname = "Linda" AND LName = "Smith"
find each value of Destruction_Authorised_by_Employee_ID in Documents_to_be_Destroyed table along with the number of Document_ID of the corresponding rows to each value
Output: SELECT Destruction_Authorised_by_Employee_ID , Count ( DISTINCT Document_ID ) FROM Documents_to_be_Destroyed GROUP BY Destruction_Authorised_by_Employee_ID
Step 1: For each row in Problems table, find the corresponding rows in Problem_Log table.
Step 2: find problem_log_id, problem_description of the results of step 1
Output: SELECT T1.problem_log_id , T2.problem_description FROM Problem_Log AS T1 JOIN Problems AS T2 ON T1.problem_id = T2.problem_id
find the Music_Festival of music_festival table for which Category equals Best Song
Output: SELECT Music_Festival FROM music_festival WHERE Category = "Best Song"
Step 1: For each row in operate_company table, find the corresponding rows in flight table.
Step 2: find without repetition Type of the results of step 1 whose Velocity less than or equals 200
Output: SELECT DISTINCT T1.Type FROM operate_company AS T1 JOIN flight AS T2 ON T1.id = T2.company_id WHERE T2.Velocity < = 200
Step 1: For each row in Projects table, find the corresponding rows in Documents table.
Step 2: find Document_Description, Document_Name of the results of step 1 whose Project_Details equals Private Project
Output: SELECT T2.Document_Description , T2.Document_Name FROM Projects AS T1 JOIN Documents AS T2 ON T1.Project_ID = T2.Project_ID WHERE T1.Project_Details = "Private Project"
find the maximum Age and the minimum Age in artist table
Output: SELECT Max ( Age ) , Min ( Age ) FROM artist
find the roomName of Rooms table ordered descending by basePrice
Output: SELECT roomName FROM Rooms ORDER BY basePrice Desc
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 less than A Kiss Before You Go: Live in Hamburg
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 < "A Kiss Before You Go: Live in Hamburg"
Step 1: For each row in Engineer_Skills table, find corresponding rows in Skills table and in Maintenance_Engineers table.
Step 2: find first_name, last_name, skill_description of the results of step 1
Output: SELECT T2.first_name , T2.last_name , T1.skill_description FROM Skills AS T1 JOIN Maintenance_Engineers AS T2 JOIN Engineer_Skills AS T3 ON T1.skill_id = T3.skill_id AND T3.engineer_id = T2.engineer_id
Step 1: For each row in Product table, find the corresponding rows in Problems table.
Step 2: find the number of rows of each value of Problems's product_id in the results of step 1.
Step 3: find product_name of step 1 results ordered descending by the results of step 2.
Step 4: only show the first 3 rows of the results
Output: SELECT T1.product_name FROM Product AS T1 JOIN Problems AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_id ORDER BY Count ( * ) Desc LIMIT 3
Step 1: find the number of rows of each value of DEPARTMENT_ID in employees table.
Step 2: find DEPARTMENT_ID in employees table whose corresponding value in step 1 is greater than 4
Output: SELECT DEPARTMENT_ID FROM employees GROUP BY DEPARTMENT_ID HAVING Count ( * ) > 4
Step 1: find the minimum year in PersonFriend table.
Step 2: For each row in Person table, find the corresponding rows in PersonFriend table.
Step 3: find PersonFriend's name in the results of step 2 whose age equals the results of step 1
Output: SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.age = ( SELECT Min ( T2.year ) FROM PersonFriend AS T2 )
Step 1: find the EMPLOYEE_ID of job_history table.
Step 2: find the average SALARY in employees table whose employees's EMPLOYEE_ID not one of the results of step 1
Output: SELECT Avg ( T1.SALARY ) FROM employees AS T1 WHERE T1.EMPLOYEE_ID NOT IN ( SELECT T2.EMPLOYEE_ID FROM job_history AS T2 )
Step 1: For each row in departments table, find the corresponding rows in employees table.
Step 2: find FIRST_NAME, LAST_NAME of the results of step 1 whose DEPARTMENT_NAME equals 70 or DEPARTMENT_NAME equals 90
Output: SELECT T2.FIRST_NAME , T2.LAST_NAME FROM departments AS T1 JOIN employees AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T1.DEPARTMENT_NAME = 90 OR T1.DEPARTMENT_NAME = 70
find the number of rows in Student table whose Fname equals Eric and LName equals Tai
Output: SELECT Count ( * ) FROM Student WHERE Fname = "Eric" AND LName = "Tai"
find the EMPLOYEE_ID, LAST_NAME of employees table with largest value of SALARY
Output: SELECT EMPLOYEE_ID , LAST_NAME FROM employees ORDER BY SALARY Desc LIMIT 1
Step 1: For each row in Minor_in table, find corresponding rows in Student table and in Department table.
Step 2: find DName of the results of step 1 whose Major equals 600.
Step 3: find DName of the results of step 1 whose Major equals 600.
Step 4: show the rows that are in the results of step 2 but not in the results of step 3
Output: SELECT T2.DName FROM Student AS T1 JOIN Department AS T2 JOIN Minor_in AS T3 ON T1.StuID = T3.StuID AND T3.DNO = T2.DNO WHERE T1.Major = 600 EXCEPT SELECT T2.DName FROM Student AS T1 JOIN Department AS T2 JOIN Minor_in AS T3 ON T1.StuID = T3.StuID AND T3.DNO = T2.DNO WHERE T1.Major = 600
Step 1: find the number of rows of each value of decor in Rooms table.
Step 2: find decor of Rooms table with smallest value in the results of step 1
Output: SELECT decor FROM Rooms GROUP BY decor ORDER BY Count ( * ) Asc LIMIT 1
Step 1: For each row in employees table, find the corresponding rows in locations table.
Step 2: find FIRST_NAME, LAST_NAME, HIRE_DATE of the results of step 1 whose CITY not equals Clara
Output: SELECT T1.FIRST_NAME , T1.LAST_NAME , T1.HIRE_DATE FROM employees AS T1 JOIN locations AS T2 WHERE T2.CITY ! = "Clara"
Step 1: find the number of rows of each value of product_name in Product table.
Step 2: find product_details, product_name of Product table with largest value in the results of step 1
Output: SELECT product_details , product_name FROM Product GROUP BY product_name ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of id in architect table.
Step 2: find name, gender, gender in architect table whose corresponding value in step 1 is greater than or equals 1
Output: SELECT name , gender , gender FROM architect GROUP BY id HAVING Count ( * ) > = 1
find the Studio of film table for which Director equals Walter Hill
Output: SELECT Studio FROM film WHERE Director = "Walter Hill"
Step 1: find DName of Department table whose Division equals AS and Building equals Mergenthaler.
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" AND Building = "Mergenthaler" INTERSECT SELECT DName FROM Department WHERE Division = "EN" AND Building = "NEB"
Step 1: For each row in departments table, find the corresponding rows in job_history table.
Step 2: find the number of different EMPLOYEE_ID of each value of job_history's DEPARTMENT_ID in the results of step 1.
Step 3: find without repetition departments's DEPARTMENT_ID in the results of step 1 whose corresponding value in step 2 is greater than or equals 4
Output: SELECT DISTINCT T1.DEPARTMENT_ID FROM departments AS T1 JOIN job_history AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID GROUP BY T2.DEPARTMENT_ID HAVING Count ( DISTINCT T2.EMPLOYEE_ID ) > = 4
find City of city table whose Regional_Population greater than 5000000 or Regional_Population greater than 10000000
Output: SELECT City FROM city WHERE Regional_Population > 10000000 OR Regional_Population > 5000000
Step 1: For each row in Roles table, find the corresponding rows in Employees table.
Step 2: find Role_Name, Employees's Role_Code, Date_of_Birth of the results of step 1 whose Employee_Name equals Armani
Output: SELECT T1.Role_Name , T2.Role_Code , T2.Date_of_Birth FROM Roles AS T1 JOIN Employees AS T2 ON T1.Role_Code = T2.Role_Code WHERE T2.Employee_Name = "Armani"
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 Firstname equals Solveig
Output: SELECT T2.Type FROM Band AS T1 JOIN Vocals AS T2 ON T1.Id = T2.Bandmate WHERE T1.Firstname = "Solveig"
Step 1: find the staff_name, staff_id of Staff table.
Step 2: find the staff_name, staff_id of Staff table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT staff_name , staff_id FROM Staff EXCEPT SELECT staff_name , staff_id FROM Staff
Step 1: find the average MIN_SALARY of each value of JOB_ID in jobs table.
Step 2: find JOB_ID in jobs table whose corresponding value in step 1 is greater than 8000
Output: SELECT JOB_ID FROM jobs GROUP BY JOB_ID HAVING Avg ( MIN_SALARY ) > 8000
find without repetition the Fname of Student table for which LName contains a
Output: SELECT DISTINCT Fname FROM Student WHERE LName LIKE "a"
find without repetition the skill_description, skill_description of Skills table
Output: SELECT DISTINCT skill_description , skill_description FROM Skills
Step 1: For each row in jobs table, find the corresponding rows in employees table.
Step 2: find rows of the results of step 1 whose SALARY greater than 8000 or MAX_SALARY equals 12000
Output: SELECT * FROM jobs AS T1 JOIN employees AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T2.SALARY > 8000 OR T1.MAX_SALARY = 12000
Step 1: For each row in jobs table, find the corresponding rows in employees table.
Step 2: find EMPLOYEE_ID, JOB_TITLE of the results of step 1 whose SALARY equals 80
Output: SELECT T2.EMPLOYEE_ID , T1.JOB_TITLE FROM jobs AS T1 JOIN employees AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T2.SALARY = 80
Step 1: find the decor of Rooms table for which decor equals modern.
Step 2: find the decor of Rooms table for which bedType equals Recluse and defiance.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT decor FROM Rooms WHERE decor = "modern" INTERSECT SELECT decor FROM Rooms WHERE bedType = "Recluse and defiance"
find the average Age in Student table whose LName equals Smith
Output: SELECT Avg ( Age ) FROM Student WHERE LName = "Smith"
find the name of Person table for which age greater than engineer ordered ascending by name
Output: SELECT name FROM Person WHERE age > "engineer" ORDER BY name Asc
find the FIRST_NAME, LAST_NAME of employees table for which COMMISSION_PCT equals null
Output: SELECT FIRST_NAME , LAST_NAME FROM employees WHERE COMMISSION_PCT = "null"
Step 1: find the Famous_Title of artist table.
Step 2: For each row in artist table, find the corresponding rows in volume table.
Step 3: find Famous_Title of the results of step 2 whose Weeks_on_Top less than 2.
Step 4: show the rows that are in the results of step 1 but not in the results of step 3
Output: SELECT T1.Famous_Title FROM artist AS T1 EXCEPT SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top < 2
Step 1: find the number of rows of each value of route_id in Delivery_Routes table.
Step 2: find route_name of Delivery_Routes table with largest value in the results of step 1
Output: SELECT route_name FROM Delivery_Routes GROUP BY route_id ORDER BY Count ( * ) Desc LIMIT 1
find the Author of submission table with smallest value of Scores
Output: SELECT Author FROM submission ORDER BY Scores Asc LIMIT 1
find the job of Person table with smallest value of age
Output: SELECT job FROM Person ORDER BY age Asc LIMIT 1
Step 1: For each row in Ref_Document_Types table, find the corresponding rows in Documents table.
Step 2: find Ref_Document_Types's Document_Type_Code, Document_Type_Name, Document_Type_Description of the results of step 1 whose Document_Name equals Noel CV or Document_Name equals King Book
Output: SELECT T1.Document_Type_Code , T1.Document_Type_Name , T1.Document_Type_Description FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code WHERE T2.Document_Name = "King Book" OR T2.Document_Name = "Noel CV"
Step 1: For each row in Ref_Document_Types table, find the corresponding rows in Documents table.
Step 2: find Document_Name, Document_Type_Description, Document_Date of the results of step 1
Output: SELECT T2.Document_Name , T1.Document_Type_Description , T2.Document_Date FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code
Step 1: find without repetition the SongId of Tracklists table.
Step 2: find without repetition the Title of Songs table whose Songs's SongId not one of the results of step 1
Output: SELECT DISTINCT T1.Title FROM Songs AS T1 WHERE T1.SongId NOT IN ( SELECT DISTINCT T2.SongId FROM Tracklists AS T2 )
find the Employee_ID of Employees table
Output: SELECT Employee_ID FROM Employees
find the age of Person table for which name equals doctor
Output: SELECT age FROM Person WHERE name = "doctor"
find the number of rows in Engineer_Visits table whose fault_status equals Waiting
Output: SELECT Count ( * ) FROM Engineer_Visits WHERE fault_status = "Waiting"
Step 1: find the average age in Person table.
Step 2: find the name, age of Person table whose age greater than the results of step 1
Output: SELECT name , age FROM Person WHERE age > ( SELECT Avg ( age ) FROM Person )
find the name of Person table for which job equals doctor
Output: SELECT name FROM Person WHERE job = "doctor"
Step 1: For each row in volume table, find the corresponding rows in music_festival table.
Step 2: find Song of the results of step 1 whose Category equals Nominated
Output: SELECT T1.Song FROM volume AS T1 JOIN music_festival AS T2 ON T1.Volume_ID = T2.Volume WHERE T2.Category = "Nominated"
find the number of different Document_Type_Code in All_Documents table
Output: SELECT Count ( DISTINCT Document_Type_Code ) FROM All_Documents
Step 1: For each row in Minor_in table, find corresponding rows in Student table and in Department table.
Step 2: find Fname, LName of the results of step 1 whose DName equals 140
Output: SELECT T1.Fname , T1.LName FROM Student AS T1 JOIN Department AS T2 JOIN Minor_in AS T3 ON T1.StuID = T3.StuID AND T3.DNO = T2.DNO WHERE T2.DName = 140
find FIRST_NAME, LAST_NAME of employees table whose JOB_ID equals AD_PRES and SALARY greater than 163
Output: SELECT FIRST_NAME , LAST_NAME FROM employees WHERE JOB_ID = "AD_PRES" AND SALARY > 163
find each value of state_province_county in Addresses table along with the number of the corresponding rows to each value
Output: SELECT state_province_county , Count ( * ) FROM Addresses GROUP BY state_province_county
find the name, age of Person table ordered ascending by age
Output: SELECT name , age FROM Person ORDER BY age Asc
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 FirstName equals ROY
Output: SELECT T1.roomName FROM Rooms AS T1 JOIN Reservations AS T2 ON T1.RoomId = T2.Room WHERE T2.FirstName = "ROY"
Step 1: find the number of rows of each value of Project_ID in Projects table.
Step 2: find Project_ID, Project_Details in Projects table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT Project_ID , Project_Details FROM Projects GROUP BY Project_ID HAVING Count ( * ) > = 2
Step 1: For each row in Enrolled_in table, find corresponding rows in Student table and in Gradeconversion table.
Step 2: find without repetition Fname of the results of step 1 whose Major equals 3.8 or gradepoint greater than 4
Output: SELECT DISTINCT T1.Fname FROM Student AS T1 JOIN Enrolled_in AS T2 ON T1.StuID = T2.StuID JOIN Gradeconversion AS T3 ON T2.Grade = T3.lettergrade WHERE T1.Major = 3.8 OR T3.gradepoint > 4
find the number of rows in flight table whose destination equals Los Angeles
Output: SELECT Count ( * ) FROM flight WHERE destination = "Los Angeles"
Step 1: find the distance of flight table ordered ascending by distance.
Step 2: only show the first 3 rows of the results
Output: SELECT distance FROM flight ORDER BY distance Asc LIMIT 3
find the number of different Comptroller in party table
Output: SELECT Count ( DISTINCT Comptroller ) FROM party
Step 1: For each row in team table, find the corresponding rows in match_season table.
Step 2: find without repetition Position of the results of step 1 whose Name equals UCLA or Name equals Duke
Output: SELECT DISTINCT T2.Position FROM team AS T1 JOIN match_season AS T2 ON T1.Team_id = T2.Team WHERE T1.Name = "Duke" OR T1.Name = "UCLA"
Step 1: find the Name of Patient table.
Step 2: find the Name of Patient table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT Name FROM Patient EXCEPT SELECT Name FROM Patient
Step 1: find the average total_value_purchased of each value of product_id in Product_Suppliers table.
Step 2: find supplier_id in Product_Suppliers table whose corresponding value in step 1 is greater than 50000
Output: SELECT supplier_id FROM Product_Suppliers GROUP BY product_id HAVING Avg ( total_value_purchased ) > 50000
find School_name of School table whose Enrollment greater than 10 or Enrollment less than 495
Output: SELECT School_name FROM School WHERE Enrollment > 495 OR Enrollment < 10
Step 1: For each row in wrestler table, find the corresponding rows in Elimination table.
Step 2: find Team of the results of step 1 whose Name equals Orton.
Step 3: find Team of the results of step 1 whose Name equals Benjamin.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T2.Team FROM wrestler AS T1 JOIN Elimination AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID WHERE T1.Name = "Orton" INTERSECT SELECT T2.Team FROM wrestler AS T1 JOIN Elimination AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID WHERE T1.Name = "Benjamin"
Step 1: find the number of rows of each value of country in country table.
Step 2: find country in country table whose corresponding value in step 1 is greater than or equals 3
Output: SELECT country FROM country GROUP BY country HAVING Count ( * ) > = 3
find the number of rows in Player_Attributes table
Output: SELECT Count ( * ) FROM Player_Attributes
Step 1: find the number of rows of each value of dept_store_id in Departments table.
Step 2: find dept_store_id of Departments table ordered descending by the results of step 1.
Step 3: only show the first 2 rows of the results
Output: SELECT dept_store_id FROM Departments GROUP BY dept_store_id ORDER BY Count ( * ) Desc LIMIT 2
find the Population of city table for which Status not equals Village
Output: SELECT Population FROM city WHERE Status ! = "Village"
find the eid, name of employee table
Output: SELECT eid , name FROM employee
Step 1: find the number of rows of each value of product_id in Product_Suppliers table.
Step 2: find product_id in Product_Suppliers table whose corresponding value in step 1 is greater than 80000
Output: SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING Count ( * ) > 80000
find the number of different Official_native_language in country table
Output: SELECT Count ( DISTINCT Official_native_language ) FROM country
find the order_id, customer_id, customer_id of Customer_Orders table for which order_status_code equals Cancelled ordered ascending by order_date
Output: SELECT order_id , customer_id , customer_id FROM Customer_Orders WHERE order_status_code = "Cancelled" ORDER BY order_date Asc
find the number of rows in follows table
Output: SELECT Count ( * ) FROM follows
find each value of Name in Physician table along with the number of the corresponding rows to each value
Output: SELECT Name , Count ( * ) FROM Physician GROUP BY Name
Step 1: For each row in Appointment table, find corresponding rows in Physician table and in Nurse table.
Step 2: find Physician's Name of the results of step 1 whose Nurse's Position equals senior
Output: SELECT T1.Name FROM Physician AS T1 JOIN Nurse AS T2 JOIN Appointment AS T3 ON T1.EmployeeID = T3.Physician AND T3.PrepNurse = T2.EmployeeID WHERE T2.Position = "senior"
find the Name of wrestler table for which Days_held equals 100
Output: SELECT Name FROM wrestler WHERE Days_held = 100
find without repetition the BlockCode of Room table
Output: SELECT DISTINCT BlockCode FROM Room
Step 1: find the Name of channel table.
Step 2: find the Name of channel table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT Name FROM channel EXCEPT SELECT Name FROM channel
Step 1: For each row in Appointment table, find corresponding rows in Physician table and in Nurse table.
Step 2: find Nurse's Name of the results of step 1 whose Physician's Name equals John Dorian
Output: SELECT T2.Name FROM Physician AS T1 JOIN Nurse AS T2 JOIN Appointment AS T3 ON T1.EmployeeID = T3.Physician AND T3.PrepNurse = T2.EmployeeID WHERE T1.Name = "John Dorian"
find the product_id, product_name of Products table for which product_price equals or between 600 and 900
Output: SELECT product_id , product_name FROM Products WHERE product_price BETWEEN 900 AND 600
find the average Num_Employees in department table whose Ranking less than 10 or Ranking less than 15
Output: SELECT Avg ( Num_Employees ) FROM department WHERE Ranking < 15 OR Ranking < 10
Step 1: find the name of employee table.
Step 2: find the name of employee table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT name FROM employee EXCEPT SELECT name FROM employee
Step 1: For each row in Appointment table, find corresponding rows in Physician table and in Nurse table.
Step 2: find the number of rows of each value of Physician's Position in the results of step 1.
Step 3: find Nurse's Name of the results of step 1 with largest value in the results of step 2
Output: SELECT T2.Name FROM Physician AS T1 JOIN Nurse AS T2 JOIN Appointment AS T3 ON T1.EmployeeID = T3.Physician AND T3.PrepNurse = T2.EmployeeID GROUP BY T1.Position ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of id in mountain table.
Step 2: find id, name in mountain table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT id , name FROM mountain GROUP BY id HAVING Count ( * ) > = 2
find the staff_name, staff_gender of Staff table for which staff_name equals 2016%
Output: SELECT staff_name , staff_gender FROM Staff WHERE staff_name = "2016%"
Step 1: find the number of rows of each value of product_id in Product_Suppliers table.
Step 2: find product_id of Product_Suppliers table with largest value in the results of step 1
Output: SELECT product_id FROM Product_Suppliers GROUP BY product_id ORDER BY Count ( * ) Desc LIMIT 1
find the Name of building table for which Height_feet equals or between 200 and 20
Output: SELECT Name FROM building WHERE Height_feet BETWEEN 20 AND 200
Step 1: For each row in School table, find the corresponding rows in endowment table.
Step 2: find School_name of the results of step 1 whose amount greater than 8.5
Output: SELECT T1.School_name FROM School AS T1 JOIN endowment AS T2 ON T1.School_id = T2.School_id WHERE T2.amount > 8.5
Step 1: For each row in county table, find the corresponding rows in election table.
Step 2: find the number of different Committee in the results of step 1 whose Population greater than 50000
Output: SELECT Count ( DISTINCT T2.Committee ) FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District WHERE T1.Population > 50000
Step 1: find the number of rows of each value of customer_name in Customers table.
Step 2: find customer_name in Customers table whose corresponding value in step 1 is greater than or equals 3
Output: SELECT customer_name FROM Customers GROUP BY customer_name HAVING Count ( * ) > = 3
find without repetition the Status of city table ordered ascending by Area_km_2
Output: SELECT DISTINCT Status FROM city ORDER BY Area_km_2 Asc
find the Governor, Party of party table
Output: SELECT Governor , Party FROM party
Step 1: For each row in party table, find the corresponding rows in election table.
Step 2: find Comptroller of the results of step 1 whose Committee equals 1 or Committee equals 2
Output: SELECT T1.Comptroller FROM party AS T1 JOIN election AS T2 ON T1.Party_ID = T2.Party WHERE T2.Committee = 2 OR T2.Committee = 1
find the text of tweets table for which text equals intern
Output: SELECT text FROM tweets WHERE text = "intern"
find without repetition the Name of Physician table
Output: SELECT DISTINCT Name FROM Physician
Step 1: For each row in actor table, find the corresponding rows in film_actor table.
Step 2: find the number of rows of each value of film_actor's actor_id in the results of step 1.
Step 3: find first_name of step 1 results with largest value in the results of step 2
Output: SELECT T1.first_name FROM actor AS T1 JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id ORDER BY Count ( * ) Desc LIMIT 1
find the first_name, last_name of customer table with smallest value of first_name
Output: SELECT first_name , last_name FROM customer ORDER BY first_name Asc LIMIT 1
Step 1: For each row in Appointment table, find corresponding rows in Physician table and in Nurse table.
Step 2: find the number of rows of each value of Physician's Position in the results of step 1.
Step 3: find Nurse's Name, Physician's Position of the results of step 1 with smallest value in the results of step 2
Output: SELECT T2.Name , T1.Position FROM Physician AS T1 JOIN Nurse AS T2 JOIN Appointment AS T3 ON T1.EmployeeID = T3.Physician AND T3.PrepNurse = T2.EmployeeID GROUP BY T1.Position ORDER BY Count ( * ) Asc LIMIT 1
Step 1: For each row in Physician table, find the corresponding rows in Patient table.
Step 2: find Patient's Name of the results of step 1 whose Physician's Name equals Surgery.
Step 3: find Patient's Name of the results of step 1 whose Physician's Name equals Psychiatry.
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 Physician AS T1 JOIN Patient AS T2 ON T1.EmployeeID = T2.PCP WHERE T1.Name = "Surgery" INTERSECT SELECT T2.Name FROM Physician AS T1 JOIN Patient AS T2 ON T1.EmployeeID = T2.PCP WHERE T1.Name = "Psychiatry"
Step 1: find the number of rows of each value of name in aircraft table.
Step 2: find name in aircraft table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT name FROM aircraft GROUP BY name HAVING Count ( * ) > = 2
find the average price in flight table whose destination equals Los Angeles
Output: SELECT Avg ( price ) FROM flight WHERE destination = "Los Angeles"
Step 1: For each row in Physician table, find the corresponding rows in Department table.
Step 2: find Physician's Name of the results of step 1 whose Department's Name equals Surgery or Department's Name equals Psychiatry
Output: SELECT T1.Name FROM Physician AS T1 JOIN Department AS T2 ON T1.EmployeeID = T2.Head WHERE T2.Name = "Psychiatry" OR T2.Name = "Surgery"
Step 1: For each row in Player table, find the corresponding rows in Player_Attributes table.
Step 2: find player_name of the results of step 1 whose overall_rating greater than 80
Output: SELECT T2.player_name FROM Player_Attributes AS T1 JOIN Player AS T2 ON T1.player_fifa_api_id = T2.player_fifa_api_id WHERE T1.overall_rating > 80
Step 1: For each row in Appointment table, find corresponding rows in Physician table and in Nurse table.
Step 2: find Physician's Name of the results of step 1 whose Nurse's Name equals Thesisin
Output: SELECT T1.Name FROM Physician AS T1 JOIN Nurse AS T2 JOIN Appointment AS T3 ON T1.EmployeeID = T3.Physician AND T3.PrepNurse = T2.EmployeeID WHERE T2.Name = "Thesisin"
find each value of Institution in Institution table along with the number of the corresponding rows to each value
Output: SELECT Institution , Count ( * ) FROM Institution GROUP BY Institution
Step 1: find the number of rows of each value of catalog_id in Catalogs table.
Step 2: find catalog_name of Catalogs table with largest value in the results of step 1
Output: SELECT catalog_name FROM Catalogs GROUP BY catalog_id ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in Appointment table, find corresponding rows in Physician table and in Nurse table.
Step 2: find Physician's Name of the results of step 1 ordered descending by Nurse's Name.
Step 3: only show the first row of the results
Output: SELECT T1.Name FROM Physician AS T1 JOIN Nurse AS T2 JOIN Appointment AS T3 ON T1.EmployeeID = T3.Physician AND T3.PrepNurse = T2.EmployeeID ORDER BY T2.Name Desc LIMIT 1
find each value of Party in party table along with the number of the corresponding rows to each value
Output: SELECT Party , Count ( * ) FROM party GROUP BY Party
find the number of rows in channel table whose Name equals Night
Output: SELECT Count ( * ) FROM channel WHERE Name = "Night"
find each value of County_name in county table along with the number of the corresponding rows to each value
Output: SELECT County_name , Count ( * ) FROM county GROUP BY County_name
Step 1: For each row in wrestler table, find the corresponding rows in Elimination table.
Step 2: find the number of rows of each value of Wrestler_ID in the results of step 1.
Step 3: find Event of step 1 results with largest value in the results of step 2
Output: SELECT T1.Event FROM wrestler AS T1 JOIN Elimination AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID GROUP BY T2.Wrestler_ID ORDER BY Count ( * ) Desc LIMIT 1
find the name of club table with largest value of Start_year
Output: SELECT name FROM club ORDER BY Start_year Desc LIMIT 1
Step 1: For each row in wrestler table, find the corresponding rows in Elimination table.
Step 2: find the number of rows of each value of Wrestler_ID in the results of step 1.
Step 3: find Name of step 1 results with smallest value in the results of step 2
Output: SELECT T1.Name FROM wrestler AS T1 JOIN Elimination AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID GROUP BY T2.Wrestler_ID ORDER BY Count ( * ) Asc LIMIT 1
Step 1: For each row in program table, find the corresponding rows in broadcast table.
Step 2: find program's Owner of the results of step 1 whose Time_of_day equals Morning.
Step 3: For each row in channel table, find the corresponding rows in broadcast table.
Step 4: find channel's Owner of the results of step 3 whose Time_of_day equals Night.
Step 5: show the rows that are in both the results of step 2 and the results of step 4
Output: SELECT T1.Owner FROM program AS T1 JOIN broadcast AS T2 ON T1.Program_ID = T2.Program_ID WHERE T2.Time_of_day = "Morning" INTERSECT SELECT T3.Owner FROM channel AS T3 JOIN broadcast AS T2 ON T3.Channel_ID = T2.Channel_ID WHERE T2.Time_of_day = "Night"
Step 1: For each row in aircraft table, find the corresponding rows in flight table.
Step 2: find the number of rows of each value of destination in the results of step 1.
Step 3: find name of step 1 results with smallest value in the results of step 2
Output: SELECT T2.name FROM flight AS T1 JOIN aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.destination ORDER BY Count ( * ) Asc LIMIT 1
find the attribute_name, attribute_id of Attribute_Definitions table for which attribute_data_type equals 0
Output: SELECT attribute_name , attribute_id FROM Attribute_Definitions WHERE attribute_data_type = 0
find the rows of county table
Output: SELECT * FROM county
Step 1: For each row in Physician table, find the corresponding rows in Appointment table.
Step 2: find the number of rows of each value of Physician 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 Physician AS T1 JOIN Appointment AS T2 ON T1.EmployeeID = T2.Physician GROUP BY T2.Physician ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in team table, find the corresponding rows in match_season table.
Step 2: find the number of rows of each value of College in the results of step 1.
Step 3: find Name in the results of step 1 whose corresponding value in step 2 is greater than or equals 2
Output: SELECT T1.Name FROM team AS T1 JOIN match_season AS T2 ON T1.Team_id = T2.Team GROUP BY T2.College HAVING Count ( * ) > = 2
find the number of rows in Appointment table whose ExaminationRoom equals 112
Output: SELECT Count ( * ) FROM Appointment WHERE ExaminationRoom = 112
Step 1: find the maximum followers in user_profiles table whose name equals Tyler Swift.
Step 2: find the name of user_profiles table whose followers greater than the results of step 1
Output: SELECT name FROM user_profiles WHERE followers > ( SELECT Max ( followers ) FROM user_profiles WHERE name = "Tyler Swift" )
find the name of category table
Output: SELECT name FROM category
Step 1: For each row in Patient table, find the corresponding rows in Appointment table.
Step 2: find the number of rows of each value of Physician in the results of step 1.
Step 3: find Name, Phone in the results of step 1 whose corresponding value in step 2 is greater than 1
Output: SELECT T1.Name , T1.Phone FROM Patient AS T1 JOIN Appointment AS T2 ON T1.SSN = T2.Patient GROUP BY T2.Physician HAVING Count ( * ) > 1
Step 1: For each row in aircraft table, find the corresponding rows in flight table.
Step 2: find arrival_date, departure_date of the results of step 1 whose name equals Los Angeles
Output: SELECT T1.arrival_date , T1.departure_date FROM flight AS T1 JOIN aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = "Los Angeles"
Step 1: find the Medication of Prescribes table.
Step 2: find the number of rows in Patient table whose SSN not one of the results of step 1
Output: SELECT Count ( * ) FROM Patient AS T1 WHERE T1.SSN NOT IN ( SELECT T2.Medication FROM Prescribes AS T2 )
find the catalog_name of Catalogs table
Output: SELECT catalog_name FROM Catalogs
find Party of party table whose Comptroller equals 1 or Comptroller equals 2
Output: SELECT Party FROM party WHERE Comptroller = 2 OR Comptroller = 1
Step 1: For each row in Catalog_Structure table, find corresponding rows in Catalogs table and in Catalog_Contents table.
Step 2: find catalog_name of the results of step 1 whose price_in_pounds equals 8
Output: SELECT T1.catalog_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 T3.price_in_pounds = 8
Step 1: find the Type of Institution table for which Enrollment greater than 1000.
Step 2: find the Type of Institution table for which Enrollment less than 1990.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT Type FROM Institution WHERE Enrollment > 1000 INTERSECT SELECT Type FROM Institution WHERE Enrollment < 1990
find the EmployeeID of Nurse table
Output: SELECT EmployeeID FROM Nurse