niryuu/sni-each-converted huggingface dataset:
Step 1: For each row in wrestler table, find the corresponding rows in Elimination table.
Step 2: find without repetition Event of the results of step 1 whose Team not equals Tokyo , Japan
Output: SELECT DISTINCT T1.Event FROM wrestler AS T1 JOIN Elimination AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID WHERE T2.Team ! = "Tokyo , Japan"
Step 1: find the Team of player table.
Step 2: find the Name of team table whose Team_id not one of the results of step 1
Output: SELECT T1.Name FROM team AS T1 WHERE T1.Team_id NOT IN ( SELECT T2.Team FROM player AS T2 )
Step 1: for each value of product_id in Order_Items table, calculate number of rows.
Step 2: show each value of product_id in Order_Items table along with the corresponding number of rows ordered ascending by the results of step 1
Output: SELECT product_id , Count ( * ) FROM Order_Items GROUP BY product_id ORDER BY Count ( * ) Asc
find the number of rows in Products table whose product_name equals flax
Output: SELECT Count ( * ) FROM Products WHERE product_name = "flax"
find the number of rows in building table whose Floors less than 20
Output: SELECT Count ( * ) FROM building WHERE Floors < 20
Step 1: For each row in Artist table, find the corresponding rows in Album table.
Step 2: find the number of rows of each value of Album's ArtistId in the results of step 1.
Step 3: find Name, Album's ArtistId in the results of step 1 whose corresponding value in step 2 is greater than or equals 3
Output: SELECT T2.Name , T1.ArtistId FROM Album AS T1 JOIN Artist AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T1.ArtistId HAVING Count ( * ) > = 3
find the ID of instructor table for which dept_name equals History
Output: SELECT ID FROM instructor WHERE dept_name = "History"
Step 1: For each row in Physician table, find the corresponding rows in Patient table.
Step 2: find Physician's Name, Position of the results of step 1 whose Patient's Name equals X
Output: SELECT T1.Name , T1.Position FROM Physician AS T1 JOIN Patient AS T2 ON T1.EmployeeID = T2.PCP WHERE T2.Name = "X"
Step 1: find the number of rows of each value of eid in employee table.
Step 2: find name, name of employee table with largest value in the results of step 1
Output: SELECT name , name FROM employee GROUP BY eid ORDER BY Count ( * ) Desc LIMIT 1
Step 1: for each value of year in takes table, calculate number of rows.
Step 2: show each value of year in takes table along with the corresponding number of rows with largest value in the results of step 1
Output: SELECT year , Count ( * ) FROM takes GROUP BY year ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the course_id of takes table.
Step 2: find the number of rows in section table whose section's course_id not one of the results of step 1
Output: SELECT Count ( * ) FROM section AS T1 WHERE T1.course_id NOT IN ( SELECT T2.course_id FROM takes AS T2 )
find the number of rows in storm table
Output: SELECT Count ( * ) FROM storm
find the number of rows in Products table whose product_name equals sesame
Output: SELECT Count ( * ) FROM Products WHERE product_name = "sesame"
Step 1: For each row in Patient table, find the corresponding rows in Appointment table.
Step 2: find Name of the results of step 1 whose ExaminationRoom equals 111
Output: SELECT T1.Name FROM Patient AS T1 JOIN Appointment AS T2 ON T1.SSN = T2.Patient WHERE T2.ExaminationRoom = 111
Step 1: find the number of rows of each value of first_name in actor table.
Step 2: find first_name, last_name of actor table with largest value in the results of step 1
Output: SELECT first_name , last_name FROM actor GROUP BY first_name ORDER BY Count ( * ) Desc LIMIT 1
find the maximum Sheep_and_Goats and the minimum Sheep_and_Goats in farm table
Output: SELECT Max ( Sheep_and_Goats ) , Min ( Sheep_and_Goats ) FROM farm
find the student_id of Student_Course_Registrations table with largest value of registration_date
Output: SELECT student_id FROM Student_Course_Registrations ORDER BY registration_date Desc LIMIT 1
find the number of rows in Products table whose product_name equals South
Output: SELECT Count ( * ) FROM Products WHERE product_name = "South"
find the EmployeeID, SSN of Physician table
Output: SELECT EmployeeID , SSN FROM Physician
find the Physician of Undergoes table with largest value of DateUndergoes
Output: SELECT Physician FROM Undergoes ORDER BY DateUndergoes Desc LIMIT 1
Step 1: find the number of rows of each value of Department in Affiliated_With table.
Step 2: find Department of Affiliated_With table with largest value in the results of step 1
Output: SELECT Department FROM Affiliated_With GROUP BY Department ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in appellations table, find the corresponding rows in wine table.
Step 2: find the number of rows of each value of appellations's Appelation in the results of step 1.
Step 3: find Winery in the results of step 1 whose corresponding value in step 2 is greater than or equals 4
Output: SELECT T2.Winery FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation GROUP BY T1.Appelation HAVING Count ( * ) > = 4
Step 1: find the Fname, LName of Student table.
Step 2: find the Fname, LName of Student table for which Major equals 1.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT Fname , LName FROM Student EXCEPT SELECT Fname , LName FROM Student WHERE Major = 1
Step 1: For each row in Customer table, find the corresponding rows in Invoice table.
Step 2: find FirstName of the results of step 1 whose BillingCountry equals Germany.
Step 3: find FirstName of the results of step 1 whose BillingCountry equals Brazil.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T1.FirstName FROM Customer AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.BillingCountry = "Germany" INTERSECT SELECT T1.FirstName FROM Customer AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.BillingCountry = "Brazil"
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 with smallest value of height
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 ORDER BY T3.height Asc LIMIT 1
find the card_id, card_type_code, card_number, other_card_details of Customers_Cards table
Output: SELECT card_id , card_type_code , card_number , other_card_details FROM Customers_Cards
Step 1: For each row in Bookings table, find the corresponding rows in Payments table.
Step 2: find the number of rows of each value of Payments's booking_id in the results of step 1.
Step 3: find Bookings's booking_id, amount_payable of step 1 results with largest value in the results of step 2
Output: SELECT T1.booking_id , T1.amount_payable FROM Bookings AS T1 JOIN Payments AS T2 ON T1.booking_id = T2.booking_id GROUP BY T2.booking_id ORDER BY Count ( * ) Desc LIMIT 1
find the address of address table for which address equals 1
Output: SELECT address FROM address WHERE address = 1
find the Store_Phone, Store_Email_Address of Stores table
Output: SELECT Store_Phone , Store_Email_Address FROM Stores
find the Card_Number of member table for which Name equals Kentucky
Output: SELECT Card_Number FROM member WHERE Name = "Kentucky"
find the number of rows in Attribute_Definitions table
Output: SELECT Count ( * ) FROM Attribute_Definitions
Step 1: For each row in races table, find the corresponding rows in constructorStandings table.
Step 2: find positionText, url of the results of step 1
Output: SELECT T2.positionText , T1.url FROM races AS T1 JOIN constructorStandings AS T2 ON T1.raceId = T2.raceId
Step 1: For each row in Department_Stores table, find corresponding rows in Department_Store_Chain table and in Departments table.
Step 2: find department_name, Departments's dept_store_id of the results of step 1 whose dept_store_chain_name equals marketing.
Step 3: find department_name, store_name of the results of step 1 whose dept_store_chain_name equals managing.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T3.department_name , T3.dept_store_id FROM Department_Store_Chain AS T1 JOIN Department_Stores AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id JOIN Departments AS T3 ON T2.dept_store_id = T3.dept_store_id WHERE T1.dept_store_chain_name = "marketing" INTERSECT SELECT T3.department_name , T2.store_name FROM Department_Store_Chain AS T1 JOIN Department_Stores AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id AND T1.dept_store_chain_id = T2.dept_store_chain_id JOIN Departments AS T3 ON T2.dept_store_id = T3.dept_store_id WHERE T1.dept_store_chain_name = "managing"
find the average payment_method in Customers table
Output: SELECT Avg ( payment_method ) FROM Customers
Step 1: For each row in Customers table, find the corresponding rows in Customer_Orders table.
Step 2: find without repetition Customers's customer_id of the results of step 1 whose order_date less than Cancelled
Output: SELECT DISTINCT T1.customer_id FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_date < "Cancelled"
find each value of name in user_profiles table along with the number of the corresponding rows to each value
Output: SELECT name , Count ( * ) FROM user_profiles GROUP BY name
find the Delegate of election table for which Committee equals 1
Output: SELECT Delegate FROM election WHERE Committee = 1
Step 1: For each row in Things table, find corresponding rows in Customer_Events table and in Timed_Status_of_Things table.
Step 2: find without repetition resident_id, service_type_code of the results of step 1 whose Status_of_Thing_Code equals Close or Date_and_Date less than 2017-06-19 02:59:21
Output: SELECT DISTINCT T2.resident_id , T1.service_type_code FROM Things AS T1 JOIN Customer_Events AS T2 ON T1.thing_id = T2.thing_id JOIN Timed_Status_of_Things AS T3 ON T1.thing_id = T3.thing_id WHERE T3.Status_of_Thing_Code = "Close" OR T3.Date_and_Date < "2017-06-19 02:59:21"
find each value of name in user_profiles table along with the summation of followers of the corresponding rows to each value
Output: SELECT Sum ( followers ) , name FROM user_profiles GROUP BY name
Step 1: For each row in School table, find corresponding rows in budget table and in endowment table.
Step 2: find the number of rows in the results of step 1 whose amount greater than 3000 or Year less than 2001
Output: SELECT Count ( * ) FROM School AS T1 JOIN budget AS T2 ON T2.School_id = T1.School_id JOIN endowment AS T3 ON T1.School_id = T3.School_id WHERE T3.amount > 3000 OR T2.Year < 2001
find the number of different transaction_type in Financial_Transactions table
Output: SELECT Count ( DISTINCT transaction_type ) FROM Financial_Transactions
Step 1: find the number of rows of each value of state in College table.
Step 2: find state in College table whose corresponding value in step 1 is equals 1
Output: SELECT state FROM College GROUP BY state HAVING Count ( * ) = 1
find the characteristic_data_type of Characteristics table for which characteristic_name equals cumin
Output: SELECT characteristic_data_type FROM Characteristics WHERE characteristic_name = "cumin"
find the customer_name of Customers table with largest value of date_became_customer
Output: SELECT customer_name FROM Customers ORDER BY date_became_customer Desc LIMIT 1
find the number of different Investor in entrepreneur table
Output: SELECT Count ( DISTINCT Investor ) FROM entrepreneur
find the number of rows in actor table
Output: SELECT Count ( * ) FROM actor
find each value of Award in musical table along with the number of the corresponding rows to each value
Output: SELECT Award , Count ( * ) FROM musical GROUP BY Award
Step 1: For each row in mountain table, find the corresponding rows in photos table.
Step 2: find mountain's id, photos's name of the results of step 1
Output: SELECT T1.id , T2.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id
find the Name of actor table for which age less than or equals 20
Output: SELECT Name FROM actor WHERE age < = 20
find without repetition the customer_name of Customers table ordered ascending by customer_id
Output: SELECT DISTINCT customer_name FROM Customers ORDER BY customer_id Asc
find dorm_name, dorm_name of Dorm table whose student_capacity greater than 300 or student_capacity less than 100
Output: SELECT dorm_name , dorm_name FROM Dorm WHERE student_capacity > 100 OR student_capacity < 300
find the rows of results table for which milliseconds greater than 5
Output: SELECT * FROM results WHERE milliseconds > 5
Step 1: For each row in user_profiles table, find the corresponding rows in tweets table.
Step 2: find the number of rows of each value of text in the results of step 1.
Step 3: find name, email of step 1 results with smallest value in the results of step 2
Output: SELECT T2.name , T2.email FROM tweets AS T1 JOIN user_profiles AS T2 ON T1.uid = T2.uid GROUP BY T1.text ORDER BY Count ( * ) Asc LIMIT 1
find each value of Player in player table along with the number of the corresponding rows to each value
Output: SELECT Player , Count ( * ) FROM player GROUP BY Player
Step 1: find the Fname of Student table for which city_code equals PHL.
Step 2: find the Fname of Student table for which Age less than 20.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT Fname FROM Student WHERE city_code = "PHL" INTERSECT SELECT Fname FROM Student WHERE Age < 20
find product_details of Products table whose product_details equals Latte or product_details equals Americano
Output: SELECT product_details FROM Products WHERE product_details = "Americano" OR product_details = "Latte"
find the meter_600, meter_400 of swimmer table for which Nationality equals Australia
Output: SELECT meter_600 , meter_400 FROM swimmer WHERE Nationality = "Australia"
Step 1: find the number of rows of each value of City in branch table.
Step 2: find without repetition City in branch table whose corresponding value in step 1 is greater than 100
Output: SELECT DISTINCT City FROM branch GROUP BY City HAVING Count ( * ) > 100
Step 1: find the department_name of Departments table.
Step 2: find the staff_id of Staff_Department_Assignments table whose date_assigned_to less than the results of step 1
Output: SELECT T1.staff_id FROM Staff_Department_Assignments AS T1 WHERE T1.date_assigned_to < ( SELECT T2.department_name FROM Departments AS T2 )
Step 1: find the customer_name of Customers table.
Step 2: find the customer_name of Customers table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT customer_name FROM Customers EXCEPT SELECT customer_name FROM Customers
find the Name, Location of station table ordered ascending by Total_Passengers
Output: SELECT Name , Location FROM station ORDER BY Total_Passengers Asc
find the number of rows in team table whose Name equals Columbus Crew
Output: SELECT Count ( * ) FROM team WHERE Name = "Columbus Crew"
Step 1: find the number of rows of each value of customer_id in Customers table.
Step 2: find customer_name, customer_phone, customer_email of Customers table with largest value in the results of step 1
Output: SELECT customer_name , customer_phone , customer_email FROM Customers GROUP BY customer_id ORDER BY Count ( * ) Desc LIMIT 1
find each value of Type in culture_company table along with the number of the corresponding rows to each value
Output: SELECT Count ( * ) , Type FROM culture_company GROUP BY Type
Step 1: For each row in College table, find the corresponding rows in Tryout table.
Step 2: find enr of the results of step 1 whose pPos equals yes
Output: SELECT T1.enr FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = "yes"
find the number of rows in Customers table whose customer_name equals Rodrick Heaney
Output: SELECT Count ( * ) FROM Customers WHERE customer_name = "Rodrick Heaney"
Step 1: find the Carrier of phone table for which Memory_in_G greater than 32.
Step 2: find the Carrier of phone table for which Memory_in_G less than 64.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT Carrier FROM phone WHERE Memory_in_G > 32 INTERSECT SELECT Carrier FROM phone WHERE Memory_in_G < 64
Step 1: For each row in county table, find the corresponding rows in election table.
Step 2: find Committee of the results of step 1 whose Population greater than 100000
Output: SELECT T2.Committee FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District WHERE T1.Population > 100000
Step 1: find the organization_id of Organizations table.
Step 2: find the organization_id of Organizations table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT organization_id FROM Organizations EXCEPT SELECT organization_id FROM Organizations
Step 1: find the number of rows of each value of Region_name in region table.
Step 2: find Region_name in region table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT Region_name FROM region GROUP BY Region_name HAVING Count ( * ) > = 2
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 length greater than 3 or height less than 5
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.length > 3 OR T3.height < 5
Step 1: For each row in department table, find corresponding rows in course table and in instructor table.
Step 2: find name of the results of step 1 whose title equals C Programming
Output: SELECT T3.name FROM department AS T1 JOIN course AS T2 ON T2.dept_name = T1.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name WHERE T2.title = "C Programming"
Step 1: find the number of rows of each value of product_details in Products table.
Step 2: find product_details of Products table with largest value in the results of step 1
Output: SELECT product_details FROM Products GROUP BY product_details ORDER BY Count ( * ) Desc LIMIT 1
find the product_name of Products table for which product_description equals red
Output: SELECT product_name FROM Products WHERE product_description = "red"
find the title of course table ordered ascending by credits
Output: SELECT title FROM course ORDER BY credits Asc
find the catalog_entry_name, height of Catalog_Contents table for which length equals or between 5 and 10
Output: SELECT catalog_entry_name , height FROM Catalog_Contents WHERE length BETWEEN 10 AND 5
Step 1: For each row in Performers_in_Bookings table, find corresponding rows in Performers table and in Bookings table.
Step 2: find Customer_Name of the results of step 1 whose Status_Code equals stop
Output: SELECT T1.Customer_Name FROM Performers AS T1 JOIN Bookings AS T2 JOIN Performers_in_Bookings AS T3 ON T1.Performer_ID = T3.Performer_ID AND T3.Order_ID = T2.Booking_ID WHERE T2.Status_Code = "stop"
Step 1: For each row in Manufacturers table, find the corresponding rows in Products table.
Step 2: find each value of Manufacturer in the results of step 1 along with the summation of Revenue of the corresponding rows to each value
Output: SELECT Sum ( T1.Revenue ) , T2.Manufacturer FROM Manufacturers AS T1 JOIN Products AS T2 ON T1.Code = T2.Manufacturer GROUP BY T2.Manufacturer
find the Country of stadium table for which Opening_year greater than 2006
Output: SELECT Country FROM stadium WHERE Opening_year > 2006
find the number of rows in Characteristics table whose characteristic_name equals hot
Output: SELECT Count ( * ) FROM Characteristics WHERE characteristic_name = "hot"
Step 1: For each row in Tryout table, find corresponding rows in College table and in Player table.
Step 2: find College's cName of the results of step 1 whose pName starts with D
Output: SELECT T1.cName FROM College AS T1 JOIN Player AS T2 JOIN Tryout AS T3 ON T1.cName = T3.cName AND T3.pID = T2.pID WHERE T2.pName LIKE "D%"
Step 1: For each row in aircraft table, find the corresponding rows in flight table.
Step 2: find origin, name of the results of step 1 whose price greater than 300
Output: SELECT T1.origin , T2.name FROM flight AS T1 JOIN aircraft AS T2 ON T1.aid = T2.aid WHERE T1.price > 300
Step 1: For each row in circuits table, find the corresponding rows in races table.
Step 2: find country, circuitRef of the results of step 1 whose races's name equals Lewis
Output: SELECT T1.country , T1.circuitRef FROM circuits AS T1 JOIN races AS T2 ON T1.circuitId = T2.circuitId WHERE T2.name = "Lewis"
find the country of circuits table for which lat equals or between 2009 and 2011
Output: SELECT country FROM circuits WHERE lat BETWEEN 2011 AND 2009
Step 1: find the average product_price in Products table.
Step 2: find the product_type_code of Products table whose product_price greater than the results of step 1
Output: SELECT product_type_code FROM Products WHERE product_price > ( SELECT Avg ( product_price ) FROM Products )
find the number of different dorm_name in Dorm table
Output: SELECT Count ( DISTINCT dorm_name ) FROM Dorm
find the rows of match_season table for which Player contains English
Output: SELECT * FROM match_season WHERE Player LIKE "English"
Step 1: find the Tryout's cName of Tryout table for which pPos equals goalie.
Step 2: find the College's cName of College table whose state not one of the results of step 1
Output: SELECT T1.cName FROM College AS T1 WHERE T1.state NOT IN ( SELECT T2.cName FROM Tryout AS T2 WHERE T2.pPos = "goalie" )
find name of user_profiles table whose email equals superstar or email equals edu
Output: SELECT name FROM user_profiles WHERE email = "edu" OR email = "superstar"
find the number of rows in Genre table whose Name equals Rock
Output: SELECT Count ( * ) FROM Genre WHERE Name = "Rock"
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 with smallest value in the results of step 1
Output: SELECT dept_store_id FROM Departments GROUP BY dept_store_id ORDER BY Count ( * ) Asc LIMIT 1
find the College of match_season table for which Position equals Defender
Output: SELECT College FROM match_season WHERE Position = "Defender"
find the Name, Winery, Year of wine table for which Price greater than 100 ordered descending by Price
Output: SELECT Name , Winery , Year FROM wine WHERE Price > 100 ORDER BY Price Desc
Step 1: For each row in Ref_Product_Categories table, find the corresponding rows in Products table.
Step 2: find product_name, typical_buying_price of the results of step 1 whose product_category_description equals yellow
Output: SELECT T2.product_name , T2.typical_buying_price FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T1.product_category_description = "yellow"
find title of film table whose replacement_cost greater than 200 or replacement_cost less than 100
Output: SELECT title FROM film WHERE replacement_cost > 100 OR replacement_cost < 200
Step 1: For each row in Ref_Characteristic_Types table, find the corresponding rows in Characteristics table.
Step 2: find the number of rows of each value of Characteristics's characteristic_type_code in the results of step 1.
Step 3: find characteristic_type_description of step 1 results with largest value in the results of step 2
Output: SELECT T1.characteristic_type_description FROM Ref_Characteristic_Types AS T1 JOIN Characteristics AS T2 ON T1.characteristic_type_code = T2.characteristic_type_code GROUP BY T2.characteristic_type_code ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in election table, find corresponding rows in county table and in party table.
Step 2: find Comptroller of the results of step 1 whose Population equals 1
Output: SELECT T2.Comptroller FROM county AS T1 JOIN party AS T2 JOIN election AS T3 ON T1.County_Id = T3.District AND T3.Party = T2.Party_ID WHERE T1.Population = 1
Step 1: find the number of rows of each value of Comptroller in party table.
Step 2: find Attorney_General of party table with largest value in the results of step 1
Output: SELECT Attorney_General FROM party GROUP BY Comptroller ORDER BY Count ( * ) Desc LIMIT 1
Step 1: for each value of employee_name in Employees table, calculate number of rows.
Step 2: show each value of employee_name in Employees table along with the corresponding number of rows with largest value in the results of step 1
Output: SELECT employee_name , Count ( * ) FROM Employees GROUP BY employee_name ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of College in match_season table.
Step 2: find College in match_season table whose corresponding value in step 1 is less than or equals 2
Output: SELECT College FROM match_season GROUP BY College HAVING Count ( * ) < = 2
find the average student_capacity and the average student_capacity in Dorm table whose gender equals X
Output: SELECT Avg ( student_capacity ) , Avg ( student_capacity ) FROM Dorm WHERE gender = "X"
Step 1: find the Manufacturer of Products table.
Step 2: find the number of rows in Manufacturers table whose Manufacturers's Code not one of the results of step 1
Output: SELECT Count ( * ) FROM Manufacturers AS T1 WHERE T1.Code NOT IN ( SELECT T2.Manufacturer FROM Products AS T2 )
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.
Step 3: find Physician's Name of the results of step 1 whose Department'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 T1.Name FROM Physician AS T1 JOIN Department AS T2 ON T1.EmployeeID = T2.Head WHERE T2.Name = "Surgery" INTERSECT SELECT T1.Name FROM Physician AS T1 JOIN Department AS T2 ON T1.EmployeeID = T2.Head WHERE T2.Name = "Psychiatry"
find the number of rows in Courses table whose course_name equals English
Output: SELECT Count ( * ) FROM Courses WHERE course_name = "English"
find the order_id, customer_id of Customer_Orders table ordered ascending by order_date
Output: SELECT order_id , customer_id FROM Customer_Orders ORDER BY order_date Asc
Step 1: For each row in Student_Course_Registrations table, find the corresponding rows in Student_Course_Attendance table.
Step 2: find Student_Course_Registrations's student_id of the results of step 1 ordered ascending by date_of_attendance
Output: SELECT T1.student_id FROM Student_Course_Registrations AS T1 JOIN Student_Course_Attendance AS T2 ON T1.course_id = T2.course_id ORDER BY T2.date_of_attendance Asc
find the Fname of Student table for which city_code equals 1
Output: SELECT Fname FROM Student WHERE city_code = 1
find the Founder of Manufacturers table for which Founder equals Sony
Output: SELECT Founder FROM Manufacturers WHERE Founder = "Sony"
find the Enrollment, Location of university table for which School equals Clemson
Output: SELECT Enrollment , Location FROM university WHERE School = "Clemson"
find the Name of editor table with largest value of Age
Output: SELECT Name FROM editor ORDER BY Age Desc LIMIT 1
find the number of different card_number in Customers_Cards table
Output: SELECT Count ( DISTINCT card_number ) FROM Customers_Cards
find Days_held of wrestler table whose Name equals Punk or Name equals Orton
Output: SELECT Days_held FROM wrestler WHERE Name = "Orton" OR Name = "Punk"
find the number of rows in course table whose dept_name equals Physics
Output: SELECT Count ( * ) FROM course WHERE dept_name = "Physics"
find the Name of channel table ordered ascending by Rating_in_percent
Output: SELECT Name FROM channel ORDER BY Rating_in_percent Asc
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 3.
Step 3: find the product_id of Product_Suppliers table for which total_value_purchased less than 80000.
Step 4: show the rows that are in any of the results of step 2 or the results of step 3
Output: SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING Count ( * ) > 3 UNION SELECT product_id FROM Product_Suppliers WHERE total_value_purchased < 80000
Step 1: find the cName of College table for which enr greater than 13000.
Step 2: find the cName of College table for which enr less than 15000.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT cName FROM College WHERE enr > 13000 INTERSECT SELECT cName FROM College WHERE enr < 15000
find the title of film table for which title contains Deleted Scenes
Output: SELECT title FROM film WHERE title LIKE "Deleted Scenes"
Step 1: For each row in broadcast table, find corresponding rows in program table and in channel table.
Step 2: find channel's Name of the results of step 1 whose Origin not equals Beijing
Output: SELECT T2.Name 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 WHERE T1.Origin ! = "Beijing"
find each value of Brand in Medication table along with the number of the corresponding rows to each value
Output: SELECT Count ( * ) , Brand FROM Medication GROUP BY Brand
find the attribute_name, attribute_id of Attribute_Definitions table
Output: SELECT attribute_name , attribute_id FROM Attribute_Definitions
find country of circuits table whose lat greater than 12:00:00 or lat less than 09:00:00
Output: SELECT country FROM circuits WHERE lat > "09:00:00" OR lat < "12:00:00"
Step 1: find the number of rows of each value of customer_id in Customers table.
Step 2: find customer_name, customer_address in Customers table whose corresponding value in step 1 is equals New.
Step 3: find customer_name, customer_address in Customers table whose corresponding value in step 1 is less than Pending.
Step 4: show the rows that are in both the results of step 2 and the results of step 4
Output: SELECT customer_name , customer_address FROM Customers GROUP BY customer_id HAVING Count ( * ) = "New" INTERSECT SELECT customer_name , customer_address FROM Customers GROUP BY customer_id HAVING Count ( * ) < "Pending"
Step 1: For each row in department table, find the corresponding rows in course table.
Step 2: find course's dept_name of the results of step 1 ordered descending by budget.
Step 3: only show the first 3 rows of the results
Output: SELECT T2.dept_name FROM department AS T1 JOIN course AS T2 ON T1.dept_name = T2.dept_name ORDER BY T1.budget Desc LIMIT 3
find the number of rows in budget table whose Invested greater than 8.5
Output: SELECT Count ( * ) FROM budget WHERE Invested > 8.5
Step 1: find the number of rows of each value of Name in Genre table.
Step 2: find Name of Genre table with largest value in the results of step 1
Output: SELECT Name FROM Genre GROUP BY Name ORDER BY Count ( * ) Desc LIMIT 1
find the state_province_county, country of Addresses table for which zip_postcode equals 4%
Output: SELECT state_province_county , country FROM Addresses WHERE zip_postcode = "4%"
Step 1: For each row in Product_Characteristics table, find corresponding rows in Characteristics table and in Products table.
Step 2: find product_name, other_characteristic_details, product_description of the results of step 1 whose product_category_code equals Herbs
Output: SELECT T2.product_name , T1.other_characteristic_details , T2.product_description FROM Characteristics AS T1 JOIN Products AS T2 JOIN Product_Characteristics AS T3 ON T1.characteristic_id = T3.characteristic_id AND T3.product_id = T2.product_id WHERE T2.product_category_code = "Herbs"
find the Name, Price of Products table with largest value of Price
Output: SELECT Name , Price FROM Products ORDER BY Price Desc LIMIT 1
find the Fname of Student table for which city_code equals Smith Hall
Output: SELECT Fname FROM Student WHERE city_code = "Smith Hall"
find the number of rows in flight table
Output: SELECT Count ( * ) FROM flight
find the average distance and the average price in flight table
Output: SELECT Avg ( distance ) , Avg ( price ) FROM flight
find the customer_id, other_customer_details of Customers table with smallest value of date_became_customer
Output: SELECT customer_id , other_customer_details FROM Customers ORDER BY date_became_customer Asc LIMIT 1
find the student_id of Students table
Output: SELECT student_id FROM Students
Step 1: find the number of rows of each value of Service_Type_Code in Ref_Service_Types table.
Step 2: find Service_Type_Description, Service_Type_Code of Ref_Service_Types table with largest value in the results of step 1
Output: SELECT Service_Type_Description , Service_Type_Code FROM Ref_Service_Types GROUP BY Service_Type_Code ORDER BY Count ( * ) Desc LIMIT 1
find the number of rows in Accounts table
Output: SELECT Count ( * ) FROM Accounts
Step 1: find the number of rows of each value of supplier_id in Product_Suppliers table.
Step 2: find supplier_id of Product_Suppliers table ordered descending by the results of step 1.
Step 3: only show the first 3 rows of the results
Output: SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY Count ( * ) Desc LIMIT 3
Step 1: find the number of rows of each value of Party in party table.
Step 2: find Party of party table with largest value in the results of step 1
Output: SELECT Party FROM party GROUP BY Party ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the Program_ID of broadcast_share table.
Step 2: find the Name of program table whose program's Program_ID not one of the results of step 1
Output: SELECT T1.Name FROM program AS T1 WHERE T1.Program_ID NOT IN ( SELECT T2.Program_ID FROM broadcast_share AS T2 )
Step 1: find the dorm_name of Dorm table.
Step 2: For each row in Has_amenity table, find corresponding rows in Dorm table and in Dorm_amenity table.
Step 3: find dorm_name of the results of step 2 whose amenity_name equals Study Room.
Step 4: show the rows that are in the results of step 1 but not in the results of step 3
Output: SELECT T1.dorm_name FROM Dorm AS T1 EXCEPT SELECT T1.dorm_name FROM Dorm AS T1 JOIN Dorm_amenity AS T2 JOIN Has_amenity AS T3 ON T1.dormid = T3.dormid AND T3.amenid = T2.amenid WHERE T2.amenity_name = "Study Room"
find without repetition the customer_name of Customers table
Output: SELECT DISTINCT customer_name FROM Customers
find each value of Major in Student table along with the number of the corresponding rows to each value
Output: SELECT Major , Count ( * ) FROM Student GROUP BY Major
Step 1: For each row in Ref_Characteristic_Types table, find the corresponding rows in Characteristics table.
Step 2: find characteristic_type_description of the results of step 1 whose characteristic_name equals catnip
Output: SELECT T1.characteristic_type_description FROM Ref_Characteristic_Types AS T1 JOIN Characteristics AS T2 ON T1.characteristic_type_code = T2.characteristic_type_code WHERE T2.characteristic_name = "catnip"
Step 1: For each row in Product_Suppliers table, find corresponding rows in Suppliers table and in Products table.
Step 2: find product_type_code, product_name, product_price of the results of step 1 whose supplier_name equals 3
Output: SELECT T2.product_type_code , T2.product_name , T2.product_price FROM Suppliers AS T1 JOIN Products AS T2 JOIN Product_Suppliers AS T3 ON T1.supplier_id = T3.supplier_id AND T3.product_id = T2.product_id WHERE T1.supplier_name = 3
Step 1: find the customer_name of Customers table for which payment_method equals Latte.
Step 2: find the customer_name of Customers table for which payment_method equals Americano.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT customer_name FROM Customers WHERE payment_method = "Latte" INTERSECT SELECT customer_name FROM Customers WHERE payment_method = "Americano"
find the average student_capacity and the minimum student_capacity in Dorm table whose gender equals X
Output: SELECT Avg ( student_capacity ) , Min ( student_capacity ) FROM Dorm WHERE gender = "X"
Step 1: find the number of rows of each value of characteristic_data_type in Characteristics table.
Step 2: find characteristic_name of Characteristics table with largest value in the results of step 1
Output: SELECT characteristic_name FROM Characteristics GROUP BY characteristic_data_type ORDER BY Count ( * ) Desc LIMIT 1
find the number of rows in Ref_Characteristic_Types table
Output: SELECT Count ( * ) FROM Ref_Characteristic_Types
find the Park of roller_coaster table with largest value of Height
Output: SELECT Park FROM roller_coaster ORDER BY Height Desc LIMIT 1
Step 1: find the number of rows of each value of Event in wrestler table.
Step 2: find Event of wrestler table with largest value in the results of step 1
Output: SELECT Event FROM wrestler GROUP BY Event ORDER BY Count ( * ) Desc LIMIT 1
find the name of student table with largest value of tot_cred
Output: SELECT name FROM student ORDER BY tot_cred Desc LIMIT 1
find the number of rows in Characteristics table whose characteristic_name equals red
Output: SELECT Count ( * ) FROM Characteristics WHERE characteristic_name = "red"
Step 1: For each row in airports table, find the corresponding rows in routes table.
Step 2: find the number of rows of each value of src_apid in the results of step 1.
Step 3: find 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 T2.name FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid GROUP BY T1.src_apid ORDER BY Count ( * ) Desc LIMIT 10
Step 1: For each row in PlaylistTrack table, find corresponding rows in Playlist table and in Track table.
Step 2: find Track's Name of the results of step 1 whose Playlist's Name contains you
Output: SELECT T3.Name FROM Playlist AS T1 JOIN PlaylistTrack AS T2 ON T1.PlaylistId = T2.PlaylistId JOIN Track AS T3 ON T2.TrackId = T3.TrackId WHERE T1.Name LIKE "you"
find the number of different name in instructor table
Output: SELECT Count ( DISTINCT name ) FROM instructor
find each value of name in aircraft table along with the number of the corresponding rows to each value
Output: SELECT name , Count ( * ) FROM aircraft GROUP BY name
Step 1: For each row in party table, find the corresponding rows in party_host table.
Step 2: find the number of rows of each value of party_host's Party_ID in the results of step 1.
Step 3: find Location of step 1 results with largest value in the results of step 2
Output: SELECT T1.Location FROM party AS T1 JOIN party_host AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T2.Party_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 the number of rows of each value of Physician's Position in the results of step 1.
Step 3: find Nurse's Name, Nurse's Position of the results of step 1 with smallest value in the results of step 2
Output: SELECT T2.Name , T2.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: find the name of student table.
Step 2: For each row in department table, find corresponding rows in course table and in student table.
Step 3: find name of the results of step 2 whose course's dept_name equals Biology.
Step 4: show the rows that are in the results of step 1 but not in the results of step 3
Output: SELECT T1.name FROM student AS T1 EXCEPT SELECT T1.name FROM department AS T2 JOIN course AS T3 ON T3.dept_name = T2.dept_name JOIN student AS T1 ON T2.dept_name = T1.dept_name WHERE T3.dept_name = "Biology"
Step 1: For each row in section table, find the corresponding rows in takes table.
Step 2: find section's semester of the results of step 1 whose takes's year not equals 2010
Output: SELECT T1.semester FROM section AS T1 JOIN takes AS T2 ON T1.year = T2.year WHERE T2.year ! = 2010
Step 1: for each value of Comptroller in party table, calculate number of rows.
Step 2: show each value of Comptroller in party table along with the corresponding number of rows with largest value in the results of step 1
Output: SELECT Governor , Count ( * ) FROM party GROUP BY Comptroller ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in ship table, find the corresponding rows in mission table.
Step 2: find Code, Name, Name of the results of step 1
Output: SELECT T1.Code , T2.Name , T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID
find each value of BlockCode in Room table along with the number of the corresponding rows to each value
Output: SELECT BlockCode , Count ( * ) FROM Room GROUP BY BlockCode
find the catalog_entry_name of Catalog_Contents table with largest value of price_in_pounds
Output: SELECT catalog_entry_name FROM Catalog_Contents ORDER BY price_in_pounds Desc LIMIT 1
Step 1: find the number of rows of each value of product_id in Products table.
Step 2: find product_id, product_description in Products table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT product_id , product_description FROM Products GROUP BY product_id HAVING Count ( * ) > = 2
find the Comptroller, Party of party table
Output: SELECT Comptroller , Party FROM party
Step 1: For each row in Product_Characteristics table, find corresponding rows in Characteristics table and in Products table.
Step 2: find product_name of the results of step 1 whose characteristic_name equals red
Output: SELECT T2.product_name FROM Characteristics AS T1 JOIN Products AS T2 JOIN Product_Characteristics AS T3 ON T1.characteristic_id = T3.characteristic_id AND T3.product_id = T2.product_id WHERE T1.characteristic_name = "red"
Step 1: For each row in appellations table, find the corresponding rows in wine table.
Step 2: only keep the results of step 1 whose Score greater than 90.
Step 3: find the number of rows of each value of wine's State in the results of step 2.
Step 4: find County of the results of step 2 with largest value in the results of step 3
Output: SELECT T1.County FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T2.Score > 90 GROUP BY T2.State ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the FacID of Faculty table.
Step 2: find the FacID of Faculty_Participates_in 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.FacID FROM Faculty AS T1 EXCEPT SELECT T2.FacID FROM Faculty_Participates_in AS T2
find the number of rows in MediaType table whose Name equals AAC audio file and Name equals MPEG audio file
Output: SELECT Count ( * ) FROM MediaType WHERE Name = "MPEG audio file" AND Name = "AAC audio file"
find the number of rows in people table whose Height greater than 1.84
Output: SELECT Count ( * ) FROM people WHERE Height > 1.84
find the cName of College table ordered ascending by cName
Output: SELECT cName FROM College ORDER BY cName Asc
Step 1: For each row in Customers_Cards table, find the corresponding rows in Financial_Transactions table.
Step 2: find each value of transaction_type in the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT T1.card_type_code , Count ( * ) FROM Customers_Cards AS T1 JOIN Financial_Transactions AS T2 ON T1.card_id = T2.card_id GROUP BY T2.transaction_type
find the catalog_entry_name of Catalog_Contents table for which parent_entry_id greater than 8
Output: SELECT catalog_entry_name FROM Catalog_Contents WHERE parent_entry_id > 8
Step 1: find the Name of member table.
Step 2: find the Name of member 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 member EXCEPT SELECT Name FROM member
Step 1: For each row in Roles table, find the corresponding rows in Users table.
Step 2: find the number of rows of each value of Users's role_code in the results of step 1.
Step 3: find role_description of step 1 results with largest value in the results of step 2
Output: SELECT T1.role_description FROM Roles AS T1 JOIN Users AS T2 ON T1.role_code = T2.role_code GROUP BY T2.role_code ORDER BY Count ( * ) Desc LIMIT 1
find the number of rows in program table
Output: SELECT Count ( * ) FROM program
find the eid, salary of employee table
Output: SELECT eid , salary FROM employee
Step 1: find the City of branch table for which Open_year equals 100.
Step 2: find the City of branch table for which membership_amount greater than 2001.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT City FROM branch WHERE Open_year = 100 INTERSECT SELECT City FROM branch WHERE membership_amount > 2001
Step 1: For each row in Product_Suppliers table, find corresponding rows in Suppliers table and in Products table.
Step 2: find supplier_name, supplier_phone of the results of step 1 ordered ascending by product_name
Output: SELECT T1.supplier_name , T1.supplier_phone FROM Suppliers AS T1 JOIN Products AS T2 JOIN Product_Suppliers AS T3 ON T1.supplier_id = T3.supplier_id AND T3.product_id = T2.product_id ORDER BY T2.product_name Asc
find the name of enzyme table for which Chromosome not equals Heme
Output: SELECT name FROM enzyme WHERE Chromosome ! = "Heme"
find the rows of Procedures table for which Cost greater than 5000
Output: SELECT * FROM Procedures WHERE Cost > 5000
find email, last_update of customer table whose first_name equals LINDA and last_name equals SMITH
Output: SELECT email , last_update FROM customer WHERE first_name = "LINDA" AND last_name = "SMITH"
Step 1: find the number of rows of each value of Days_held in wrestler table.
Step 2: find Days_held of wrestler table with largest value in the results of step 1
Output: SELECT Days_held FROM wrestler GROUP BY Days_held ORDER BY Count ( * ) Desc LIMIT 1
find the product_category_code, typical_selling_price of Products table for which typical_buying_price equals cumin
Output: SELECT product_category_code , typical_selling_price FROM Products WHERE typical_buying_price = "cumin"
find the characteristic_name of Characteristics table for which characteristic_type_code equals sesame
Output: SELECT characteristic_name FROM Characteristics WHERE characteristic_type_code = "sesame"
find the number of different Party_Theme in party table
Output: SELECT Count ( DISTINCT Party_Theme ) FROM party
find the Name of Physician table for which Name equals Thesisin
Output: SELECT Name FROM Physician WHERE Name = "Thesisin"
find the Season, Competition, Home_team of game table
Output: SELECT Season , Competition , Home_team FROM game
Step 1: For each row in film table, find the corresponding rows in inventory table.
Step 2: find the number of rows of each value of inventory_id in the results of step 1.
Step 3: find title, inventory_id of step 1 results with largest value in the results of step 2
Output: SELECT T1.title , T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T2.inventory_id ORDER BY Count ( * ) Desc LIMIT 1
find the number of rows in Customers table whose customer_first_name equals Art and customer_last_name equals Turcotte
Output: SELECT Count ( * ) FROM Customers WHERE customer_first_name = "Art" AND customer_last_name = "Turcotte"
Step 1: For each row in appellations table, find the corresponding rows in wine table.
Step 2: find Name of the results of step 1 whose Price less than 50 and County equals Monterey and County equals Sonoma
Output: SELECT T2.Name FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T2.Price < 50 AND T1.County = "Sonoma" AND T1.County = "Monterey"
Step 1: For each row in country table, find the corresponding rows in match_season table.
Step 2: find Country_name of the results of step 1 whose College equals Maryland or College equals Duke
Output: SELECT T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.College = "Duke" OR T2.College = "Maryland"
find the name, distance of aircraft table for which distance equals or between 5000 and 8430
Output: SELECT name , distance FROM aircraft WHERE distance BETWEEN 8430 AND 5000
find the Player_name, Sponsor_name of player table ordered descending by Votes
Output: SELECT Player_name , Sponsor_name FROM player ORDER BY Votes Desc