niryuu/sni-each-converted huggingface dataset:
Step 1: For each row in files table, find the corresponding rows in song table.
Step 2: find formats of the results of step 1 whose resolution less than 1000
Output: SELECT T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.resolution < 1000
find the number of rows in airports table whose country equals Italy
Output: SELECT Count ( * ) FROM airports WHERE country = "Italy"
find the maximum low_temperature and the average low_temperature in weekly_weather table
Output: SELECT Max ( low_temperature ) , Avg ( low_temperature ) FROM weekly_weather
find each value of Classroom in list table along with the number of the corresponding rows to each value
Output: SELECT Count ( * ) , Classroom FROM list GROUP BY Classroom
find the number of rows in Faculty table whose Sex equals F and Sex equals Professor
Output: SELECT Count ( * ) FROM Faculty WHERE Sex = "Professor" AND Sex = "F"
Step 1: For each row in Course_Authors_and_Tutors table, find the corresponding rows in Courses table.
Step 2: find course_description, course_name of the results of step 1 ordered ascending by personal_name
Output: SELECT T2.course_description , T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id ORDER BY T1.personal_name Asc
find the Name, Description of Tourist_Attractions table for which Name equals film festival
Output: SELECT Name , Description FROM Tourist_Attractions WHERE Name = "film festival"
find the organization_name of Organizations table with smallest value of date_formed
Output: SELECT organization_name FROM Organizations ORDER BY date_formed Asc LIMIT 1
Step 1: find the number of rows of each value of cust_name in customer table.
Step 2: find cust_name in customer table whose corresponding value in step 1 is greater than 1
Output: SELECT cust_name FROM customer GROUP BY cust_name HAVING Count ( * ) > 1
find the Room of Faculty table
Output: SELECT Room FROM Faculty
Step 1: For each row in Individuals table, find the corresponding rows in Organization_Contact_Individuals table.
Step 2: find individual_last_name of the results of step 1 with largest value of date_contact_to
Output: SELECT T1.individual_last_name FROM Individuals AS T1 JOIN Organization_Contact_Individuals AS T2 ON T1.individual_id = T2.individual_id ORDER BY T2.date_contact_to Desc LIMIT 1
Step 1: find the number of rows of each value of section_code in Document_Sections table.
Step 2: find section_code of Document_Sections table with smallest value in the results of step 1
Output: SELECT section_code FROM Document_Sections GROUP BY section_code ORDER BY Count ( * ) Asc LIMIT 1
find the cust_name, credit_score of customer table for which cust_name contains a
Output: SELECT cust_name , credit_score FROM customer WHERE cust_name LIKE "a"
find the number of rows in airports table whose country equals John F Kennedy International Airport
Output: SELECT Count ( * ) FROM airports WHERE country = "John F Kennedy International Airport"
find the price_range of Hotels table
Output: SELECT price_range FROM Hotels
find the Name of artwork table for which Type equals Program Talent Show
Output: SELECT Name FROM artwork WHERE Type = "Program Talent Show"
Step 1: For each row in Documents table, find the corresponding rows in Document_Sections table.
Step 2: find the number of rows of each value of document_name in the results of step 1.
Step 3: find section_title of step 1 results with smallest value in the results of step 2
Output: SELECT T2.section_title FROM Documents AS T1 JOIN Document_Sections AS T2 ON T1.document_code = T2.document_code GROUP BY T1.document_name ORDER BY Count ( * ) Asc LIMIT 1
Step 1: find the Year of festival_detail table for which Location equals United States.
Step 2: find the Year of festival_detail table for which Location equals United States.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT Year FROM festival_detail WHERE Location = "United States" INTERSECT SELECT Year FROM festival_detail WHERE Location = "United States"
Step 1: For each row in Student table, find the corresponding rows in Voting_record table.
Step 2: find without repetition President_Vote of the results of step 1 whose Fname equals Linda and Advisor equals 1121
Output: SELECT DISTINCT T2.President_Vote FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.StuID WHERE T1.Fname = "Linda" AND T1.Advisor = 1121
Step 1: find the cust_name of customer table.
Step 2: find the cust_name of customer table.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT cust_name FROM customer INTERSECT SELECT cust_name FROM customer
Step 1: For each row in Locations table, find the corresponding rows in Tourist_Attractions table.
Step 2: find Name, Opening_Hours of the results of step 1 whose Location_Name equals bus or Location_Name equals walk
Output: SELECT T2.Name , T2.Opening_Hours FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Location_Name = "walk" OR T1.Location_Name = "bus"
find without repetition the Building of Faculty table for which Room equals 224
Output: SELECT DISTINCT Building FROM Faculty WHERE Room = 224
find the average credit_score in customer table
Output: SELECT Avg ( credit_score ) FROM customer
Step 1: For each row in airports table, find the corresponding rows in routes table.
Step 2: find rid, dst_ap of the results of step 1 whose country equals United States
Output: SELECT T1.rid , T1.dst_ap FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid WHERE T2.country = "United States"
Step 1: For each row in Orders table, find the corresponding rows in Shipments table.
Step 2: find without repetition Orders's order_id of the results of step 1 ordered ascending by shipment_date
Output: SELECT DISTINCT T1.order_id FROM Orders AS T1 JOIN Shipments AS T2 ON T1.order_id = T2.order_id ORDER BY T2.shipment_date Asc
find without repetition the invoice_details of Invoices table for which invoice_date greater than or equals 1989-09-03
Output: SELECT DISTINCT invoice_details FROM Invoices WHERE invoice_date > = "1989-09-03"
find the Name of company table for which Sales_in_Billion greater than 200
Output: SELECT Name FROM company WHERE Sales_in_Billion > 200
Step 1: For each row in genre table, find the corresponding rows in song table.
Step 2: find f_id, g_name, artist_name of the results of step 1 ordered ascending by song's rating
Output: SELECT T2.f_id , T1.g_name , T2.artist_name FROM genre AS T1 JOIN song AS T2 ON T1.g_name = T2.genre_is ORDER BY T2.rating Asc
Step 1: find the artist's artist_name of artist table for which artist's country equals UK.
Step 2: For each row in artist table, find the corresponding rows in song table.
Step 3: find artist's artist_name of the results of step 2 whose song's country equals english.
Step 4: show the rows that are in both the results of step 1 and the results of step 3
Output: SELECT T1.artist_name FROM artist AS T1 WHERE T1.country = "UK" INTERSECT SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.country = "english"
Step 1: For each row in Locations table, find the corresponding rows in Tourist_Attractions table.
Step 2: find each value of Tourist_Attractions's Location_ID in the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT T1.Address , Count ( * ) FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID GROUP BY T2.Location_ID
Step 1: For each row in bank table, find corresponding rows in customer table and in loan table.
Step 2: find cust_name, credit_score of the results of step 1 whose amount greater than 5000
Output: SELECT T2.cust_name , T2.credit_score FROM bank AS T1 JOIN customer AS T2 ON T2.branch_ID = T1.branch_ID JOIN loan AS T3 ON T1.branch_ID = T3.branch_ID WHERE T3.amount > 5000
find the number of different product_category_code in Products table
Output: SELECT Count ( DISTINCT product_category_code ) FROM Products
Step 1: For each row in airports table, find the corresponding rows in routes table.
Step 2: find the number of different rid in the results of step 1 whose country equals American Airlines
Output: SELECT Count ( DISTINCT T1.rid ) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid WHERE T2.country = "American Airlines"
Step 1: For each row in Customers table, find the corresponding rows in Customer_Orders table.
Step 2: find customer_name, payment_method of the results of step 1 whose order_status_code equals Order.
Step 3: find customer_name, payment_method of the results of step 1 whose order_status_code equals No Response.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T1.customer_name , T1.payment_method FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Order" INTERSECT SELECT T1.customer_name , T1.payment_method FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "No Response"
find each value of country in airports table along with the average y of the corresponding rows to each value
Output: SELECT country , Avg ( y ) FROM airports GROUP BY country
Step 1: For each row in Faculty table, find the corresponding rows in Faculty_Participates_in table.
Step 2: find the number of rows of each value of Faculty_Participates_in's FacID in the results of step 1.
Step 3: find Fname, Lname in the results of step 1 whose corresponding value in step 2 is greater than or equals 1
Output: SELECT T2.Fname , T2.Lname FROM Faculty_Participates_in AS T1 JOIN Faculty AS T2 ON T1.FacID = T2.FacID GROUP BY T1.FacID HAVING Count ( * ) > = 1
Step 1: find the number of rows of each value of Product_Name in Products table.
Step 2: find Product_Name in Products table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT Product_Name FROM Products GROUP BY Product_Name HAVING Count ( * ) > = 2
find the Classroom of list table for which Grade equals 5 ordered ascending by Grade
Output: SELECT Classroom FROM list WHERE Grade = 5 ORDER BY Grade Asc
Step 1: For each row in Customers table, find the corresponding rows in Customer_Orders table.
Step 2: find customer_name of the results of step 1 whose order_status_code equals Paid.
Step 3: find customer_name of the results of step 1 whose order_status_code equals FedEx.
Step 4: show the rows that are in both the results of step 2 and the results of step 3
Output: SELECT T1.customer_name FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Paid" INTERSECT SELECT T1.customer_name FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "FedEx"
Step 1: For each row in bank table, find the corresponding rows in customer table.
Step 2: find the number of rows of each value of customer's state in the results of step 1.
Step 3: find bank's state of step 1 results with largest value in the results of step 2
Output: SELECT T1.state FROM bank AS T1 JOIN customer AS T2 ON T1.branch_ID = T2.branch_ID GROUP BY T2.state ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in Invoices table, find the corresponding rows in Shipments table.
Step 2: find order_id of the results of step 1 whose invoice_date greater than 2000-01-01
Output: SELECT T2.order_id FROM Invoices AS T1 JOIN Shipments AS T2 ON T1.invoice_number = T2.invoice_number WHERE T1.invoice_date > "2000-01-01"
find each value of Rank in Faculty table along with the number of the corresponding rows to each value
Output: SELECT Rank , Count ( * ) FROM Faculty GROUP BY Rank
Step 1: For each row in Tourist_Attraction_Features table, find corresponding rows in Features table and in Tourist_Attractions table.
Step 2: find Name of the results of step 1 whose Feature_Details equals shopping or Feature_Details equals park
Output: SELECT T2.Name FROM Features AS T1 JOIN Tourist_Attractions AS T2 JOIN Tourist_Attraction_Features AS T3 ON T1.Feature_ID = T3.Feature_ID AND T3.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T1.Feature_Details = "park" OR T1.Feature_Details = "shopping"
Step 1: For each row in Locations table, find the corresponding rows in Tourist_Attractions table.
Step 2: find Name of the results of step 1 whose Address equals 254 Ottilie Junction or Address equals bus
Output: SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = "bus" OR T1.Address = "254 Ottilie Junction"
Step 1: find the service_name of Services table.
Step 2: find the service_name of Services table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT service_name FROM Services EXCEPT SELECT service_name FROM Services
find the number of rows in Student table whose Fname equals Mark and LName equals Giuliano
Output: SELECT Count ( * ) FROM Student WHERE Fname = "Mark" AND LName = "Giuliano"
Step 1: For each row in Customers table, find the corresponding rows in Customer_Orders table.
Step 2: find rows in the results of step 1 whose order_status_code equals Order.
Step 3: find the number of rows of each value of Customer_Orders's customer_id in step 1 rsults.
Step 4: find customer_name in the results of step 1 whose corresponding value in step 2 is greater than or equals 2
Output: SELECT T1.customer_name FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Order" GROUP BY T2.customer_id HAVING Count ( * ) > = 2
Step 1: For each row in Student_Course_Enrolment table, find corresponding rows in Students table and in Courses table.
Step 2: find date_of_latest_logon of the results of step 1 whose course_name equals Fail
Output: SELECT T1.date_of_latest_logon FROM Students AS T1 JOIN Courses AS T2 JOIN Student_Course_Enrolment AS T3 ON T1.student_id = T3.student_id AND T3.course_id = T2.course_id WHERE T2.course_name = "Fail"
Step 1: find the personal_name of Course_Authors_and_Tutors table.
Step 2: find the personal_name of Course_Authors_and_Tutors table.
Step 3: show the rows that are in both the results of step 1 and the results of step 2
Output: SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Course_Authors_and_Tutors
find the Fname, Lname of Faculty table
Output: SELECT Fname , Lname FROM Faculty
Step 1: For each row in Parties table, find the corresponding rows in Party_Services table.
Step 2: find the number of rows of each value of customer_id in the results of step 1.
Step 3: find party_email of step 1 results with largest value in the results of step 2
Output: SELECT T1.party_email FROM Parties AS T1 JOIN Party_Services AS T2 ON T1.party_id = T2.customer_id GROUP BY T2.customer_id ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of city in airports table.
Step 2: find city in airports table whose corresponding value in step 1 is greater than or equals 2
Output: SELECT city FROM airports GROUP BY city HAVING Count ( * ) > = 2
Step 1: For each row in Students table, find the corresponding rows in Student_Course_Enrolment table.
Step 2: find the number of rows of each value of Student_Course_Enrolment's student_id in the results of step 1.
Step 3: find Student_Course_Enrolment's student_id, middle_name of step 1 results ordered descending by the results of step 2.
Step 4: only show the first 2 rows of the results
Output: SELECT T2.student_id , T1.middle_name FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id = T2.student_id GROUP BY T2.student_id ORDER BY Count ( * ) Desc LIMIT 2
find the f_id of song table for which song_name equals mp3
Output: SELECT f_id FROM song WHERE song_name = "mp3"
Step 1: find without repetition the LName of Student table.
Step 2: find the LName of Student table for which Advisor equals 2192.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT DISTINCT LName FROM Student EXCEPT SELECT LName FROM Student WHERE Advisor = 2192
Step 1: For each row in Student table, find the corresponding rows in Voting_record table.
Step 2: find Fname, LName of the results of step 1 whose Sex equals F and President_Vote equals 1004
Output: SELECT T1.Fname , T1.LName FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.StuID WHERE T1.Sex = "F" AND T2.President_Vote = 1004
Step 1: For each row in bank table, find corresponding rows in customer table and in loan table.
Step 2: find the summation of amount of each value of cust_name in the results of step 1.
Step 3: find cust_name of the results of step 1 with largest value in the results of step 2
Output: SELECT T2.cust_name FROM bank AS T1 JOIN customer AS T2 ON T2.branch_ID = T1.branch_ID JOIN loan AS T3 ON T1.branch_ID = T3.branch_ID GROUP BY T2.cust_name ORDER BY Sum ( T3.amount ) Desc LIMIT 1
find the Building of Faculty table for which Building equals NEB
Output: SELECT Building FROM Faculty WHERE Building = "NEB"
find the number of rows in Faculty table whose Sex equals AsstProf and Rank equals Instructor
Output: SELECT Count ( * ) FROM Faculty WHERE Sex = "AsstProf" AND Rank = "Instructor"
find the number of rows in Faculty table whose Building equals Professor
Output: SELECT Count ( * ) FROM Faculty WHERE Building = "Professor"
find the acc_bal, credit_score of customer table for which cust_name contains a
Output: SELECT acc_bal , credit_score FROM customer WHERE cust_name LIKE "a"
find without repetition the product_id of Order_Items table for which order_id equals or between 1975-01-01 and 1976-01-01
Output: SELECT DISTINCT product_id FROM Order_Items WHERE order_id BETWEEN "1976-01-01" AND "1975-01-01"
Step 1: For each row in Courses table, find the corresponding rows in Student_Course_Enrolment table.
Step 2: find each value of Student_Course_Enrolment's course_id in the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT T1.course_name , Count ( * ) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id
Step 1: For each row in bank table, find the corresponding rows in customer table.
Step 2: find the number of rows of each value of customer's branch_ID in the results of step 1.
Step 3: find bname of step 1 results with largest value in the results of step 2
Output: SELECT T1.bname FROM bank AS T1 JOIN customer AS T2 ON T1.branch_ID = T2.branch_ID GROUP BY T2.branch_ID ORDER BY Count ( * ) Desc LIMIT 1
find the LastName of teachers table for which Classroom equals 111
Output: SELECT LastName FROM teachers WHERE Classroom = 111
Step 1: find the number of rows of each value of city in airports table.
Step 2: find city in airports table whose corresponding value in step 1 is greater than 3
Output: SELECT city FROM airports GROUP BY city HAVING Count ( * ) > 3
Step 1: For each row in Locations table, find the corresponding rows in Tourist_Attractions table.
Step 2: find the number of rows of each value of Tourist_Attractions's Location_ID in the results of step 1.
Step 3: find Address of step 1 results with largest value in the results of step 2
Output: SELECT T1.Address FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID GROUP BY T2.Location_ID ORDER BY Count ( * ) Desc LIMIT 1
find the LastName of teachers table for which FirstName equals GELL
Output: SELECT LastName FROM teachers WHERE FirstName = "GELL"
Step 1: For each row in Locations table, find the corresponding rows in Tourist_Attractions table.
Step 2: find Name of the results of step 1 whose Address equals game1
Output: SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = "game1"
Step 1: find the rows in Student table whose Sex equals F.
Step 2: find each value of Sex in the results of step 1 ordered descending by number of rows that correspond of each value.
Step 3: only show the first row of the results
Output: SELECT Sex FROM Student WHERE Sex = "F" GROUP BY Sex ORDER BY Count ( * ) Desc LIMIT 1
find the document_name, access_count of Documents table ordered ascending by document_name
Output: SELECT document_name , access_count FROM Documents ORDER BY document_name Asc
find without repetition the LName of Student table for which Advisor equals 8741
Output: SELECT DISTINCT LName FROM Student WHERE Advisor = 8741
Step 1: For each row in files table, find the corresponding rows in song table.
Step 2: find formats of the results of step 1 whose rating less than 1000
Output: SELECT T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.rating < 1000
find the order_id, customer_id of Orders table with largest value of customer_id
Output: SELECT order_id , customer_id FROM Orders ORDER BY customer_id Desc LIMIT 1
Step 1: For each row in Ref_Hotel_Star_Ratings table, find the corresponding rows in Hotels table.
Step 2: find hotel_id, star_rating_description, price_range of the results of step 1 ordered ascending by price_range
Output: SELECT T2.hotel_id , T1.star_rating_description , T2.price_range FROM Ref_Hotel_Star_Ratings AS T1 JOIN Hotels AS T2 ON T1.star_rating_code = T2.star_rating_code ORDER BY T2.price_range Asc
find the StuID of Student table for which Advisor equals Professor
Output: SELECT StuID FROM Student WHERE Advisor = "Professor"
find the FirstName, LastName of list table for which FirstName equals OTHA
Output: SELECT FirstName , LastName FROM list WHERE FirstName = "OTHA"
Step 1: For each row in artwork table, find the corresponding rows in nomination table.
Step 2: find the number of rows of each value of Festival_ID in the results of step 1.
Step 3: find artwork's Artwork_ID, Name in the results of step 1 whose corresponding value in step 2 is greater than or equals 2
Output: SELECT T1.Artwork_ID , T1.Name FROM artwork AS T1 JOIN nomination AS T2 ON T1.Artwork_ID = T2.Artwork_ID GROUP BY T2.Festival_ID HAVING Count ( * ) > = 2
Step 1: For each row in artist table, find the corresponding rows in song table.
Step 2: find artist's artist_name, artist's country of the results of step 1 whose rating greater than 900
Output: SELECT T1.artist_name , T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.rating > 900
find without repetition the Major of Student table for which Advisor equals 1121
Output: SELECT DISTINCT Major FROM Student WHERE Advisor = 1121
Step 1: For each row in Student_Course_Enrolment table, find the corresponding rows in Student_Tests_Taken table.
Step 2: find date_of_enrolment, test_result of the results of step 1
Output: SELECT T1.date_of_enrolment , T2.test_result FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id
find each value of Grade in list table along with the number of the corresponding rows to each value
Output: SELECT Count ( * ) , Grade FROM list GROUP BY Grade
find the number of rows in Student table whose Major equals NYC
Output: SELECT Count ( * ) FROM Student WHERE Major = "NYC"
find the train_number, time of train table ordered ascending by time
Output: SELECT train_number , time FROM train ORDER BY time Asc
find the Classroom of list table for which Grade equals 4 ordered ascending by Classroom
Output: SELECT Classroom FROM list WHERE Grade = 4 ORDER BY Classroom Asc
find the Address of Locations table for which Location_Name equals UK Gallery
Output: SELECT Address FROM Locations WHERE Location_Name = "UK Gallery"
Step 1: find rows in customer table whose credit_score less than 50.
Step 2: find each value of acc_type in the results of step 1 along with the  no_of_loans of the corresponding rows to each value
Output: SELECT acc_type , Avg ( no_of_loans ) FROM customer WHERE credit_score < 50 GROUP BY acc_type
Step 1: find the number of rows of each value of FacID in Faculty table.
Step 2: find Fname, Lname of Faculty table with largest value in the results of step 1
Output: SELECT Fname , Lname FROM Faculty GROUP BY FacID ORDER BY Count ( * ) Desc LIMIT 1
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 airline 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 T2.name FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid GROUP BY T1.airline ORDER BY Count ( * ) Desc LIMIT 1
find the number of different Name in Tourist_Attractions table
Output: SELECT Count ( DISTINCT Name ) FROM Tourist_Attractions
Step 1: For each row in Locations table, find the corresponding rows in Tourist_Attractions table.
Step 2: find the number of rows of each value of Tourist_Attractions's Location_ID in the results of step 1.
Step 3: find Name, Address of step 1 results with largest value in the results of step 2
Output: SELECT T2.Name , T1.Address FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID GROUP BY T2.Location_ID ORDER BY Count ( * ) Desc LIMIT 1
find the email_address, phone_number of Customers table ordered ascending by email_address
Output: SELECT email_address , phone_number FROM Customers ORDER BY email_address Asc
find the number of rows in train table whose name equals Express
Output: SELECT Count ( * ) FROM train WHERE name = "Express"
Step 1: For each row in Faculty table, find the corresponding rows in Faculty_Participates_in table.
Step 2: find the number of rows of each value of Faculty_Participates_in's FacID in the results of step 1.
Step 3: find Fname in the results of step 1 whose corresponding value in step 2 is greater than or equals Canoeing
Output: SELECT T2.Fname FROM Faculty_Participates_in AS T1 JOIN Faculty AS T2 ON T1.FacID = T2.FacID GROUP BY T1.FacID HAVING Count ( * ) > = "Canoeing"
Step 1: For each row in artist table, find the corresponding rows in song table.
Step 2: find artist's artist_name of the results of step 1 whose rating greater than 7.
Step 3: find the song's artist_name of song table for which song's country equals Bangladesh.
Step 4: show the rows that are in the results of step 2 but not in the results of step 3
Output: SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.rating > 7 EXCEPT SELECT T2.artist_name FROM song AS T2 WHERE T2.country = "Bangladesh"
Step 1: For each row in Student_Course_Enrolment table, find corresponding rows in Students table and in Courses table.
Step 2: find date_of_latest_logon, course_name of the results of step 1 whose personal_name equals Karson and course_name equals database
Output: SELECT T1.date_of_latest_logon , T2.course_name FROM Students AS T1 JOIN Courses AS T2 JOIN Student_Course_Enrolment AS T3 ON T1.student_id = T3.student_id AND T3.course_id = T2.course_id WHERE T1.personal_name = "Karson" AND T2.course_name = "database"
find the number of rows in list table
Output: SELECT Count ( * ) FROM list
Step 1: find the cust_name of customer table.
Step 2: find the cust_name of customer table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer
Step 1: For each row in Course_Authors_and_Tutors table, find the corresponding rows in Courses table.
Step 2: find course_description, personal_name of the results of step 1 ordered ascending by personal_name
Output: SELECT T2.course_description , T1.personal_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id ORDER BY T1.personal_name Asc
Step 1: For each row in Customers table, find the corresponding rows in Complaints table.
Step 2: find the number of rows of each value of Complaints's customer_id in the results of step 1.
Step 3: find email_address of step 1 results with largest value in the results of step 2
Output: SELECT T1.email_address FROM Customers AS T1 JOIN Complaints AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in airports table, find the corresponding rows in routes table.
Step 2: for each value of dst_apid in the results of step 1, calculate number of rows.
Step 3: show each value of dst_apid in the results of step 1 along with the number of rows ordered descending by the results of step 2
Output: SELECT T2.name , Count ( * ) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid GROUP BY T1.dst_apid ORDER BY Count ( * ) Desc
Step 1: find the Tourist_Attraction_ID of Visits table.
Step 2: find the number of rows in Tourist_Attractions table whose Tourist_Attractions's Tourist_Attraction_ID not one of the results of step 1
Output: SELECT Count ( * ) FROM Tourist_Attractions AS T1 WHERE T1.Tourist_Attraction_ID NOT IN ( SELECT T2.Tourist_Attraction_ID FROM Visits AS T2 )
Step 1: For each row in files table, find the corresponding rows in song table.
Step 2: find the number of rows of each value of song's f_id in the results of step 1.
Step 3: find files's artist_name of step 1 results with largest value in the results of step 2
Output: SELECT T1.artist_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.f_id ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the rows in song table whose resolution greater than 500.
Step 2: find each value of artist_name in the results of step 1 ordered descending by number of rows that correspond of each value.
Step 3: only show the first row of the results
Output: SELECT artist_name FROM song WHERE resolution > 500 GROUP BY artist_name ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in artist table, find the corresponding rows in song table.
Step 2: find without repetition artist's artist_name of the results of step 1 whose rating greater than 7
Output: SELECT DISTINCT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.rating > 7
Step 1: For each row in Locations table, find the corresponding rows in Tourist_Attractions table.
Step 2: find Name of the results of step 1 whose Address equals 660 Shea Crescent or Address equals walk
Output: SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = "walk" OR T1.Address = "660 Shea Crescent"
find each value of Product_Name in Products table along with the number of the corresponding rows to each value
Output: SELECT Product_Name , Count ( * ) FROM Products GROUP BY Product_Name
Step 1: For each row in Products table, find the corresponding rows in Complaints table.
Step 2: find each value of Complaints's product_id in the results of step 1 along with the number of the corresponding rows to each value
Output: SELECT T1.product_name , Count ( * ) FROM Products AS T1 JOIN Complaints AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_id
Step 1: For each row in Tourist_Attractions table, find corresponding rows in Shops table and in Visits table.
Step 2: find Visit_Date, Visit_Details of the results of step 1 whose Shop_Details equals Vincent
Output: SELECT T3.Visit_Date , T3.Visit_Details FROM Tourist_Attractions AS T1 JOIN Shops AS T2 ON T2.Shop_ID = T1.Tourist_Attraction_ID JOIN Visits AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID WHERE T2.Shop_Details = "Vincent"
Step 1: For each row in genre table, find the corresponding rows in song table.
Step 2: find each value of languages in the results of step 1 along with the average song's rating of the corresponding rows to each value
Output: SELECT T1.rating , Avg ( T2.rating ) FROM genre AS T1 JOIN song AS T2 ON T1.g_name = T2.genre_is GROUP BY T2.languages
Step 1: find the number of rows of each value of Attraction_Type_Code in Ref_Attraction_Types table.
Step 2: find Attraction_Type_Description, Attraction_Type_Code of Ref_Attraction_Types table with largest value in the results of step 1
Output: SELECT Attraction_Type_Description , Attraction_Type_Code FROM Ref_Attraction_Types GROUP BY Attraction_Type_Code ORDER BY Count ( * ) Desc LIMIT 1
find the number of rows in Student table whose Sex equals M and Sex equals Fall
Output: SELECT Count ( * ) FROM Student WHERE Sex = "Fall" AND Sex = "M"
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 rid 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 T2.name FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid GROUP BY T1.rid ORDER BY Count ( * ) Desc LIMIT 1
find the average rating and the average resolution in song table
Output: SELECT Avg ( rating ) , Avg ( resolution ) FROM song
find the individual_last_name of Individuals table
Output: SELECT individual_last_name FROM Individuals
Step 1: for each value of artist_name in files table, calculate number of rows.
Step 2: show each value of artist_name in files table along with the corresponding number of rows ordered descending by the results of step 1.
Step 3: only show the first 3 rows of the results
Output: SELECT artist_name , Count ( * ) FROM files GROUP BY artist_name ORDER BY Count ( * ) Desc LIMIT 3
find the number of rows in Ref_Hotel_Star_Ratings table
Output: SELECT Count ( * ) FROM Ref_Hotel_Star_Ratings
Step 1: For each row in Student_Course_Enrolment table, find corresponding rows in Students table and in Courses table.
Step 2: find without repetition course_name, login_name of the results of step 1
Output: SELECT DISTINCT T2.course_name , T1.login_name FROM Students AS T1 JOIN Courses AS T2 JOIN Student_Course_Enrolment AS T3 ON T1.student_id = T3.student_id AND T3.course_id = T2.course_id
Step 1: For each row in Customer_Orders table, find the corresponding rows in Order_Items table.
Step 2: find product_id, customer_id of the results of step 1 whose order_status_code equals Cancelled or order_status_code equals Paid
Output: SELECT T2.product_id , T1.customer_id FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.order_id = T2.order_id WHERE T1.order_status_code = "Paid" OR T1.order_status_code = "Cancelled"
Step 1: For each row in Ref_Hotel_Star_Ratings table, find the corresponding rows in Hotels table.
Step 2: find the average price_range in the results of step 1 whose star_rating_description equals 5
Output: SELECT Avg ( T2.price_range ) FROM Ref_Hotel_Star_Ratings AS T1 JOIN Hotels AS T2 ON T1.star_rating_code = T2.star_rating_code WHERE T1.star_rating_description = 5
find without repetition the bname of bank table
Output: SELECT DISTINCT bname FROM bank
Step 1: find the rows in song table whose languages equals bangla.
Step 2: find each value of artist_name in the results of step 1 ordered descending by number of rows that correspond of each value.
Step 3: only show the first 3 rows of the results
Output: SELECT artist_name FROM song WHERE languages = "bangla" GROUP BY artist_name ORDER BY Count ( * ) Desc LIMIT 3
find the document_name of Documents table ordered ascending by access_count
Output: SELECT document_name FROM Documents ORDER BY access_count Asc
find the number of different rid in routes table whose airline equals American Airlines
Output: SELECT Count ( DISTINCT rid ) FROM routes WHERE airline = "American Airlines"
Step 1: For each row in list table, find the corresponding rows in teachers table.
Step 2: find FirstName, LastName of the results of step 1 whose FirstName equals OTHA and FirstName not equals MOYER
Output: SELECT T2.FirstName , T2.LastName FROM list AS T1 JOIN teachers AS T2 WHERE T1.FirstName = "OTHA" AND T2.FirstName ! = "MOYER"
find the summation of credit_score in customer table whose state equals Utah or state equals Texas
Output: SELECT Sum ( credit_score ) FROM customer WHERE state = "Texas" OR state = "Utah"
find the name, country, elevation of airports table for which city equals New York
Output: SELECT name , country , elevation FROM airports WHERE city = "New York"
find the maximum y in airports table whose country equals Iceland
Output: SELECT Max ( y ) FROM airports WHERE country = "Iceland"
find the Name of Tourist_Attractions table
Output: SELECT Name FROM Tourist_Attractions
Step 1: find rows in customer table whose credit_score greater than 100.
Step 2: find each value of state in the results of step 1 along with the  no_of_loans of the corresponding rows to each value
Output: SELECT state , Sum ( no_of_loans ) FROM customer WHERE credit_score > 100 GROUP BY state
find the number of rows in genre table
Output: SELECT Count ( * ) FROM genre
Step 1: For each row in Students table, find the corresponding rows in Student_Course_Enrolment table.
Step 2: find date_of_enrolment, date_of_enrolment of the results of step 1 whose family_name equals Zieme and personal_name equals Bernie
Output: SELECT T2.date_of_enrolment , T2.date_of_enrolment FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id = T2.student_id WHERE T1.family_name = "Zieme" AND T1.personal_name = "Bernie"
find address_line_1 of Course_Authors_and_Tutors table whose personal_name equals Cathrine or personal_name equals Cathrine
Output: SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name = "Cathrine" OR personal_name = "Cathrine"
Step 1: For each row in bank table, find corresponding rows in customer table and in loan table.
Step 2: find without repetition cust_name of the results of step 1 ordered ascending by amount
Output: SELECT DISTINCT T2.cust_name FROM bank AS T1 JOIN customer AS T2 ON T2.branch_ID = T1.branch_ID JOIN loan AS T3 ON T1.branch_ID = T3.branch_ID ORDER BY T3.amount Asc
Step 1: find the Fname of Faculty table.
Step 2: find the Fname of Faculty table.
Step 3: show the rows that are in any of the results of step 1 or the results of step 2
Output: SELECT Fname FROM Faculty UNION SELECT Fname FROM Faculty
find the number of rows in Student table whose city_code equals NYC and Major equals 600
Output: SELECT Count ( * ) FROM Student WHERE city_code = "NYC" AND Major = 600
find the f_id of song table for which resolution greater than 8
Output: SELECT f_id FROM song WHERE resolution > 8
Step 1: For each row in list table, find the corresponding rows in teachers table.
Step 2: find the number of rows in the results of step 1 whose FirstName equals MADLOCK and FirstName equals RAY
Output: SELECT Count ( * ) FROM list AS T1 JOIN teachers AS T2 WHERE T1.FirstName = "MADLOCK" AND T2.FirstName = "RAY"
find the order_id of Order_Items table for which product_id equals 11
Output: SELECT order_id FROM Order_Items WHERE product_id = 11
Step 1: For each row in Faculty_Participates_in table, find corresponding rows in Activity table and in Faculty table.
Step 2: find activity_name of the results of step 1 whose Lname equals Mark
Output: SELECT T1.activity_name FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid JOIN Faculty AS T3 ON T2.FacID = T3.FacID WHERE T3.Lname = "Mark"
Step 1: For each row in bank table, find the corresponding rows in customer table.
Step 2: find the average credit_score in the results of step 1 whose bank's state equals Utah
Output: SELECT Avg ( T2.credit_score ) FROM bank AS T1 JOIN customer AS T2 ON T1.branch_ID = T2.branch_ID WHERE T1.state = "Utah"
find without repetition the LName of Student table for which Advisor not equals 2192
Output: SELECT DISTINCT LName FROM Student WHERE Advisor ! = 2192
find the LastName of list table for which Grade equals 5
Output: SELECT LastName FROM list WHERE Grade = 5
Step 1: find the LastName of list table ordered ascending by Grade.
Step 2: only show the first 5 rows of the results
Output: SELECT LastName FROM list ORDER BY Grade Asc LIMIT 5
Step 1: For each row in bank table, find the corresponding rows in customer table.
Step 2: find city, cust_name of the results of step 1
Output: SELECT T1.city , T2.cust_name FROM bank AS T1 JOIN customer AS T2 ON T1.branch_ID = T2.branch_ID
Step 1: For each row in Courses table, find corresponding rows in Subjects table and in Student_Course_Enrolment table.
Step 2: find date_of_enrolment of the results of step 1 whose subject_name equals Spanish
Output: SELECT T3.date_of_enrolment FROM Subjects AS T1 JOIN Courses AS T2 ON T1.subject_id = T2.subject_id JOIN Student_Course_Enrolment AS T3 ON T2.course_id = T3.course_id WHERE T1.subject_name = "Spanish"
find without repetition the FirstName of list table for which Grade equals 1
Output: SELECT DISTINCT FirstName FROM list WHERE Grade = 1
Step 1: For each row in Customers table, find the corresponding rows in Orders table.
Step 2: find the number of rows of each value of Orders's customer_id in the results of step 1.
Step 3: find customer_name in the results of step 1 whose corresponding value in step 2 is greater than or equals 2
Output: SELECT T1.customer_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING Count ( * ) > = 2
Step 1: For each row in list table, find the corresponding rows in teachers table.
Step 2: find FirstName, LastName of the results of step 1 whose FirstName equals EVELINA
Output: SELECT T2.FirstName , T2.LastName FROM list AS T1 JOIN teachers AS T2 WHERE T1.FirstName = "EVELINA"
Step 1: For each row in Tourist_Attractions table, find corresponding rows in Locations table and in Street_Markets table.
Step 2: find Market_Details of the results of step 1 whose Market_Details equals walk or Location_Name equals bus
Output: SELECT T3.Market_Details FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID JOIN Street_Markets AS T3 ON T2.Tourist_Attraction_ID = T3.Market_ID WHERE T3.Market_Details = "walk" OR T1.Location_Name = "bus"
Step 1: For each row in Ref_Attraction_Types table, find the corresponding rows in Hotels table.
Step 2: find each value of Attraction_Type_Code in the results of step 1 along with the average price_range of the corresponding rows to each value
Output: SELECT T2.price_range , Avg ( T2.price_range ) FROM Ref_Attraction_Types AS T1 JOIN Hotels AS T2 GROUP BY T1.Attraction_Type_Code
Step 1: find the number of rows of each value of customer_name in Customers table.
Step 2: find customer_name of Customers table with largest value in the results of step 1
Output: SELECT customer_name FROM Customers GROUP BY customer_name ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of user_id in Users table.
Step 2: find user_id, user_id of Users table with largest value in the results of step 1
Output: SELECT user_id , user_id FROM Users GROUP BY user_id ORDER BY Count ( * ) Desc LIMIT 1
Step 1: find the number of rows of each value of FirstName in list table.
Step 2: find FirstName of list table with largest value in the results of step 1
Output: SELECT FirstName FROM list GROUP BY FirstName ORDER BY Count ( * ) Desc LIMIT 1
find the Address of Locations table
Output: SELECT Address FROM Locations
find without repetition the Advisor of Student table for which Major equals Fall
Output: SELECT DISTINCT Advisor FROM Student WHERE Major = "Fall"
find the g_name of genre table ordered ascending by rating
Output: SELECT g_name FROM genre ORDER BY rating Asc
Step 1: For each row in Organizations table, find the corresponding rows in Organization_Contact_Individuals table.
Step 2: find the number of rows of each value of Organization_Contact_Individuals's organization_id in the results of step 1.
Step 3: find organization_name of step 1 results with largest value in the results of step 2
Output: SELECT T1.organization_name FROM Organizations AS T1 JOIN Organization_Contact_Individuals AS T2 ON T1.organization_id = T2.organization_id GROUP BY T2.organization_id ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in bank table, find the corresponding rows in customer table.
Step 2: find bname of the results of step 1 whose credit_score less than 100
Output: SELECT T1.bname FROM bank AS T1 JOIN customer AS T2 ON T1.branch_ID = T2.branch_ID WHERE T2.credit_score < 100
Step 1: find the minimum rating in song table.
Step 2: find the song_name of song table whose rating less than the results of step 1
Output: SELECT song_name FROM song WHERE rating < ( SELECT Min ( rating ) FROM song )
Step 1: For each row in route table, find corresponding rows in train table and in station table.
Step 2: find name, network_name of the results of step 1 whose network_name equals Chiltern
Output: SELECT T1.name , T2.network_name FROM train AS T1 JOIN station AS T2 JOIN route AS T3 ON T1.id = T3.train_id AND T3.station_id = T2.id WHERE T2.network_name = "Chiltern"
Step 1: find the product_price of Products table.
Step 2: find the product_price of Products table.
Step 3: show the rows that are in the results of step 1 but not in the results of step 2
Output: SELECT product_price FROM Products EXCEPT SELECT product_price FROM Products
find the number of rows in routes table whose src_ap equals John F Kennedy International Airport
Output: SELECT Count ( * ) FROM routes WHERE src_ap = "John F Kennedy International Airport"
find the Shop_Details of Shops table
Output: SELECT Shop_Details FROM Shops
find without repetition the Age of Student table for which Major equals Fall
Output: SELECT DISTINCT Age FROM Student WHERE Major = "Fall"
find the Chair_Name, Location of festival_detail table
Output: SELECT Chair_Name , Location FROM festival_detail
Step 1: find the rows in airports table whose country equals China.
Step 2: find each value of name in the results of step 1 ordered descending by number of rows that correspond of each value.
Step 3: only show the first row of the results
Output: SELECT name FROM airports WHERE country = "China" GROUP BY name ORDER BY Count ( * ) Desc LIMIT 1
find without repetition Fname of Student table whose Advisor equals PIT and Advisor not equals 1121
Output: SELECT DISTINCT Fname FROM Student WHERE Advisor = 1121 AND Advisor ! = "PIT"
Step 1: For each row in Locations table, find the corresponding rows in Tourist_Attractions table.
Step 2: find the number of rows of each value of Tourist_Attractions's Location_ID in the results of step 1.
Step 3: find Name, Address in the results of step 1 whose corresponding value in step 2 is greater than or equals 2
Output: SELECT T2.Name , T1.Address FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID GROUP BY T2.Location_ID HAVING Count ( * ) > = 2
Step 1: For each row in Student table, find the corresponding rows in Voting_record table.
Step 2: find Fname, LName of the results of step 1 whose Election_Cycle equals Spring and President_Vote equals 18
Output: SELECT T1.Fname , T1.LName FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.StuID WHERE T2.Election_Cycle = "Spring" AND T2.President_Vote = 18
Step 1: find the number of rows of each value of document_name in Documents table.
Step 2: find document_name of Documents table with largest value in the results of step 1
Output: SELECT document_name FROM Documents GROUP BY document_name ORDER BY Count ( * ) Desc LIMIT 1
Step 1: For each row in files table, find the corresponding rows in song table.
Step 2: find song's f_id of the results of step 1 whose formats equals mp4 and rating less than 1000
Output: SELECT T2.f_id FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = "mp4" AND T2.rating < 1000
find the login_name of Students table
Output: SELECT login_name FROM Students
Step 1: For each row in genre table, find the corresponding rows in song table.
Step 2: find song_name of the results of step 1 whose g_name equals modern or g_name equals english
Output: SELECT T2.song_name FROM genre AS T1 JOIN song AS T2 ON T1.g_name = T2.genre_is WHERE T1.g_name = "english" OR T1.g_name = "modern"
Step 1: For each row in bank table, find corresponding rows in customer table and in loan table.
Step 2: find the average credit_score in the results of step 1 whose loan_type equals Mortgages
Output: SELECT Avg ( T2.credit_score ) FROM bank AS T1 JOIN customer AS T2 ON T2.branch_ID = T1.branch_ID JOIN loan AS T3 ON T1.branch_ID = T3.branch_ID WHERE T3.loan_type = "Mortgages"
Step 1: For each row in Course_Authors_and_Tutors table, find the corresponding rows in Courses table.
Step 2: find course_name, course_description of the results of step 1 whose login_name equals Computer Science
Output: SELECT T2.course_name , T2.course_description FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T1.login_name = "Computer Science"