Unnamed: 0
int64 0
60k
| text
stringlengths 109
1.06k
|
|---|---|
1,600
|
<question>: What is the storm name and max speed which affected the greatest number of regions? <context>: CREATE TABLE storm (name VARCHAR, max_speed VARCHAR, storm_id VARCHAR); CREATE TABLE affected_region (storm_id VARCHAR) <answer>: SELECT T1.name, T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id ORDER BY COUNT(*) DESC LIMIT 1
|
1,601
|
<question>: Show the name of storms which don't have affected region in record. <context>: CREATE TABLE affected_region (name VARCHAR, storm_id VARCHAR); CREATE TABLE storm (name VARCHAR, storm_id VARCHAR) <answer>: SELECT name FROM storm WHERE NOT storm_id IN (SELECT storm_id FROM affected_region)
|
1,602
|
<question>: Show storm name with at least two regions and 10 cities affected. <context>: CREATE TABLE affected_region (storm_id VARCHAR, number_city_affected INTEGER); CREATE TABLE storm (name VARCHAR, storm_id VARCHAR) <answer>: SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING COUNT(*) >= 2 INTERSECT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING SUM(T2.number_city_affected) >= 10
|
1,603
|
<question>: Show all storm names except for those with at least two affected regions. <context>: CREATE TABLE storm (name VARCHAR); CREATE TABLE affected_region (storm_id VARCHAR); CREATE TABLE storm (name VARCHAR, storm_id VARCHAR) <answer>: SELECT name FROM storm EXCEPT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING COUNT(*) >= 2
|
1,604
|
<question>: What are the region names affected by the storm with a number of deaths of least 10? <context>: CREATE TABLE region (region_name VARCHAR, region_id VARCHAR); CREATE TABLE affected_region (region_id VARCHAR, storm_id VARCHAR); CREATE TABLE storm (storm_id VARCHAR, number_deaths VARCHAR) <answer>: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T3.number_deaths >= 10
|
1,605
|
<question>: Show all storm names affecting region "Denmark". <context>: CREATE TABLE region (region_id VARCHAR, region_name VARCHAR); CREATE TABLE affected_region (region_id VARCHAR, storm_id VARCHAR); CREATE TABLE storm (name VARCHAR, storm_id VARCHAR) <answer>: SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.region_name = 'Denmark'
|
1,606
|
<question>: Show the region name with at least two storms. <context>: CREATE TABLE region (region_name VARCHAR, region_id VARCHAR); CREATE TABLE affected_region (region_id VARCHAR) <answer>: SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING COUNT(*) >= 2
|
1,607
|
<question>: Find the names of the regions which were affected by the storm that killed the greatest number of people. <context>: CREATE TABLE region (region_name VARCHAR, region_id VARCHAR); CREATE TABLE affected_region (region_id VARCHAR, storm_id VARCHAR); CREATE TABLE storm (storm_id VARCHAR, Number_Deaths VARCHAR) <answer>: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id ORDER BY T3.Number_Deaths DESC LIMIT 1
|
1,608
|
<question>: Find the name of the storm that affected both Afghanistan and Albania regions. <context>: CREATE TABLE storm (Name VARCHAR, storm_id VARCHAR); CREATE TABLE affected_region (region_id VARCHAR, storm_id VARCHAR); CREATE TABLE region (region_id VARCHAR, Region_name VARCHAR) <answer>: SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Afghanistan' INTERSECT SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Albania'
|
1,609
|
<question>: How many counties are there in total? <context>: CREATE TABLE county (Id VARCHAR) <answer>: SELECT COUNT(*) FROM county
|
1,610
|
<question>: Show the county name and population of all counties. <context>: CREATE TABLE county (County_name VARCHAR, Population VARCHAR) <answer>: SELECT County_name, Population FROM county
|
1,611
|
<question>: Show the average population of all counties. <context>: CREATE TABLE county (Population INTEGER) <answer>: SELECT AVG(Population) FROM county
|
1,612
|
<question>: Return the maximum and minimum population among all counties. <context>: CREATE TABLE county (Population INTEGER) <answer>: SELECT MAX(Population), MIN(Population) FROM county
|
1,613
|
<question>: Show all the distinct districts for elections. <context>: CREATE TABLE election (District VARCHAR) <answer>: SELECT DISTINCT District FROM election
|
1,614
|
<question>: Show the zip code of the county with name "Howard". <context>: CREATE TABLE county (Zip_code VARCHAR, County_name VARCHAR) <answer>: SELECT Zip_code FROM county WHERE County_name = "Howard"
|
1,615
|
<question>: Show the delegate from district 1 in election. <context>: CREATE TABLE election (Delegate VARCHAR, District VARCHAR) <answer>: SELECT Delegate FROM election WHERE District = 1
|
1,616
|
<question>: Show the delegate and committee information of elections. <context>: CREATE TABLE election (Delegate VARCHAR, Committee VARCHAR) <answer>: SELECT Delegate, Committee FROM election
|
1,617
|
<question>: How many distinct governors are there? <context>: CREATE TABLE party (Governor VARCHAR) <answer>: SELECT COUNT(DISTINCT Governor) FROM party
|
1,618
|
<question>: Show the lieutenant governor and comptroller from the democratic party. <context>: CREATE TABLE party (Lieutenant_Governor VARCHAR, Comptroller VARCHAR, Party VARCHAR) <answer>: SELECT Lieutenant_Governor, Comptroller FROM party WHERE Party = "Democratic"
|
1,619
|
<question>: In which distinct years was the governor "Eliot Spitzer"? <context>: CREATE TABLE party (YEAR VARCHAR, Governor VARCHAR) <answer>: SELECT DISTINCT YEAR FROM party WHERE Governor = "Eliot Spitzer"
|
1,620
|
<question>: Show all the information about election. <context>: CREATE TABLE election (Id VARCHAR) <answer>: SELECT * FROM election
|
1,621
|
<question>: Show the delegates and the names of county they belong to. <context>: CREATE TABLE election (Delegate VARCHAR, District VARCHAR); CREATE TABLE county (County_name VARCHAR, County_id VARCHAR) <answer>: SELECT T2.Delegate, T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District
|
1,622
|
<question>: Which delegates are from counties with population smaller than 100000? <context>: CREATE TABLE election (Delegate VARCHAR, District VARCHAR); CREATE TABLE county (County_id VARCHAR, Population INTEGER) <answer>: SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population < 100000
|
1,623
|
<question>: How many distinct delegates are from counties with population larger than 50000? <context>: CREATE TABLE election (Delegate VARCHAR, District VARCHAR); CREATE TABLE county (County_id VARCHAR, Population INTEGER) <answer>: SELECT COUNT(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population > 50000
|
1,624
|
<question>: What are the names of the county that the delegates on "Appropriations" committee belong to? <context>: CREATE TABLE election (District VARCHAR, Committee VARCHAR); CREATE TABLE county (County_name VARCHAR, County_id VARCHAR) <answer>: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = "Appropriations"
|
1,625
|
<question>: Show the delegates and the names of the party they belong to. <context>: CREATE TABLE election (Delegate VARCHAR, Party VARCHAR); CREATE TABLE party (Party VARCHAR, Party_ID VARCHAR) <answer>: SELECT T1.Delegate, T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID
|
1,626
|
<question>: Who were the governors of the parties associated with delegates from district 1? <context>: CREATE TABLE party (Governor VARCHAR, Party_ID VARCHAR); CREATE TABLE election (Party VARCHAR, District VARCHAR) <answer>: SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1
|
1,627
|
<question>: Who were the comptrollers of the parties associated with the delegates from district 1 or district 2? <context>: CREATE TABLE party (Comptroller VARCHAR, Party_ID VARCHAR); CREATE TABLE election (Party VARCHAR, District VARCHAR) <answer>: SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2
|
1,628
|
<question>: Return all the committees that have delegates from Democratic party. <context>: CREATE TABLE election (Committee VARCHAR, Party VARCHAR); CREATE TABLE party (Party_ID VARCHAR, Party VARCHAR) <answer>: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic"
|
1,629
|
<question>: Show the name of each county along with the corresponding number of delegates from that county. <context>: CREATE TABLE election (District VARCHAR); CREATE TABLE county (County_name VARCHAR, County_id VARCHAR) <answer>: SELECT T1.County_name, COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id
|
1,630
|
<question>: Show the name of each party and the corresponding number of delegates from that party. <context>: CREATE TABLE election (Party VARCHAR); CREATE TABLE party (Party VARCHAR, Party_ID VARCHAR) <answer>: SELECT T2.Party, COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party
|
1,631
|
<question>: Return the names of all counties sorted by population in ascending order. <context>: CREATE TABLE county (County_name VARCHAR, Population VARCHAR) <answer>: SELECT County_name FROM county ORDER BY Population
|
1,632
|
<question>: Return the names of all counties sorted by county name in descending alphabetical order. <context>: CREATE TABLE county (County_name VARCHAR) <answer>: SELECT County_name FROM county ORDER BY County_name DESC
|
1,633
|
<question>: Show the name of the county with the biggest population. <context>: CREATE TABLE county (County_name VARCHAR, Population VARCHAR) <answer>: SELECT County_name FROM county ORDER BY Population DESC LIMIT 1
|
1,634
|
<question>: Show the 3 counties with the smallest population. <context>: CREATE TABLE county (County_name VARCHAR, Population VARCHAR) <answer>: SELECT County_name FROM county ORDER BY Population LIMIT 3
|
1,635
|
<question>: Show the names of counties that have at least two delegates. <context>: CREATE TABLE election (District VARCHAR); CREATE TABLE county (County_name VARCHAR, County_id VARCHAR) <answer>: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id HAVING COUNT(*) >= 2
|
1,636
|
<question>: Show the name of the party that has at least two records. <context>: CREATE TABLE party (Party VARCHAR) <answer>: SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2
|
1,637
|
<question>: Show the name of the party that has the most delegates. <context>: CREATE TABLE election (Party VARCHAR); CREATE TABLE party (Party VARCHAR, Party_ID VARCHAR) <answer>: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1
|
1,638
|
<question>: Show the people that have been governor the most times. <context>: CREATE TABLE party (Governor VARCHAR) <answer>: SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1
|
1,639
|
<question>: Show the people that have been comptroller the most times and the corresponding number of times. <context>: CREATE TABLE party (Comptroller VARCHAR) <answer>: SELECT Comptroller, COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1
|
1,640
|
<question>: What are the names of parties that do not have delegates in election? <context>: CREATE TABLE election (Party VARCHAR, Party_ID VARCHAR); CREATE TABLE party (Party VARCHAR, Party_ID VARCHAR) <answer>: SELECT Party FROM party WHERE NOT Party_ID IN (SELECT Party FROM election)
|
1,641
|
<question>: What are the names of parties that have both delegates on "Appropriations" committee and <context>: CREATE TABLE election (Party VARCHAR, Committee VARCHAR); CREATE TABLE party (Party VARCHAR, Party_ID VARCHAR) <answer>: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = "Appropriations" INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = "Economic Matters"
|
1,642
|
<question>: Which committees have delegates from both democratic party and liberal party? <context>: CREATE TABLE election (Committee VARCHAR, Party VARCHAR); CREATE TABLE party (Party_ID VARCHAR, Party VARCHAR) <answer>: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Liberal"
|
1,643
|
<question>: How many journalists are there? <context>: CREATE TABLE journalist (Id VARCHAR) <answer>: SELECT COUNT(*) FROM journalist
|
1,644
|
<question>: List the names of journalists in ascending order of years working. <context>: CREATE TABLE journalist (Name VARCHAR, Years_working VARCHAR) <answer>: SELECT Name FROM journalist ORDER BY Years_working
|
1,645
|
<question>: What are the nationalities and ages of journalists? <context>: CREATE TABLE journalist (Nationality VARCHAR, Age VARCHAR) <answer>: SELECT Nationality, Age FROM journalist
|
1,646
|
<question>: Show the names of journalists from "England" or "Wales". <context>: CREATE TABLE journalist (Name VARCHAR, Nationality VARCHAR) <answer>: SELECT Name FROM journalist WHERE Nationality = "England" OR Nationality = "Wales"
|
1,647
|
<question>: What is the average number of years spent working as a journalist? <context>: CREATE TABLE journalist (Years_working INTEGER) <answer>: SELECT AVG(Years_working) FROM journalist
|
1,648
|
<question>: What is the nationality of the journalist with the largest number of years working? <context>: CREATE TABLE journalist (Nationality VARCHAR, Years_working VARCHAR) <answer>: SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1
|
1,649
|
<question>: Show the different nationalities and the number of journalists of each nationality. <context>: CREATE TABLE journalist (Nationality VARCHAR) <answer>: SELECT Nationality, COUNT(*) FROM journalist GROUP BY Nationality
|
1,650
|
<question>: Show the most common nationality for journalists. <context>: CREATE TABLE journalist (Nationality VARCHAR) <answer>: SELECT Nationality FROM journalist GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
|
1,651
|
<question>: Show the nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working. <context>: CREATE TABLE journalist (Nationality VARCHAR, Years_working INTEGER) <answer>: SELECT Nationality FROM journalist WHERE Years_working > 10 INTERSECT SELECT Nationality FROM journalist WHERE Years_working < 3
|
1,652
|
<question>: Show the dates, places, and names of events in descending order of the attendance. <context>: CREATE TABLE event (Date VARCHAR, Name VARCHAR, venue VARCHAR, Event_Attendance VARCHAR) <answer>: SELECT Date, Name, venue FROM event ORDER BY Event_Attendance DESC
|
1,653
|
<question>: Show the names of journalists and the dates of the events they reported. <context>: CREATE TABLE journalist (Name VARCHAR, journalist_ID VARCHAR); CREATE TABLE news_report (Event_ID VARCHAR, journalist_ID VARCHAR); CREATE TABLE event (Date VARCHAR, Event_ID VARCHAR) <answer>: SELECT T3.Name, T2.Date FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID
|
1,654
|
<question>: Show the names of journalists and the names of the events they reported in ascending order <context>: CREATE TABLE journalist (Name VARCHAR, journalist_ID VARCHAR); CREATE TABLE news_report (Event_ID VARCHAR, journalist_ID VARCHAR); CREATE TABLE event (Name VARCHAR, Event_ID VARCHAR, Event_Attendance VARCHAR) <answer>: SELECT T3.Name, T2.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID ORDER BY T2.Event_Attendance
|
1,655
|
<question>: Show the names of journalists and the number of events they reported. <context>: CREATE TABLE journalist (Name VARCHAR, journalist_ID VARCHAR); CREATE TABLE news_report (Event_ID VARCHAR, journalist_ID VARCHAR); CREATE TABLE event (Event_ID VARCHAR) <answer>: SELECT T3.Name, COUNT(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name
|
1,656
|
<question>: Show the names of journalists that have reported more than one event. <context>: CREATE TABLE journalist (Name VARCHAR, journalist_ID VARCHAR); CREATE TABLE news_report (Event_ID VARCHAR, journalist_ID VARCHAR); CREATE TABLE event (Event_ID VARCHAR) <answer>: SELECT T3.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name HAVING COUNT(*) > 1
|
1,657
|
<question>: List the names of journalists who have not reported any event. <context>: CREATE TABLE journalist (Name VARCHAR, journalist_ID VARCHAR); CREATE TABLE news_report (Name VARCHAR, journalist_ID VARCHAR) <answer>: SELECT Name FROM journalist WHERE NOT journalist_ID IN (SELECT journalist_ID FROM news_report)
|
1,658
|
<question>: what are the average and maximum attendances of all events? <context>: CREATE TABLE event (Event_Attendance INTEGER) <answer>: SELECT AVG(Event_Attendance), MAX(Event_Attendance) FROM event
|
1,659
|
<question>: Find the average age and experience working length of journalists working on different role type. <context>: CREATE TABLE news_report (work_type VARCHAR, journalist_id VARCHAR); CREATE TABLE journalist (age INTEGER, journalist_id VARCHAR) <answer>: SELECT AVG(t1.age), AVG(Years_working), t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id = t2.journalist_id GROUP BY t2.work_type
|
1,660
|
<question>: List the event venues and names that have the top 2 most number of people attended. <context>: CREATE TABLE event (venue VARCHAR, name VARCHAR, Event_Attendance VARCHAR) <answer>: SELECT venue, name FROM event ORDER BY Event_Attendance DESC LIMIT 2
|
1,661
|
<question>: Show me all the restaurants. <context>: CREATE TABLE Restaurant (ResName VARCHAR) <answer>: SELECT ResName FROM Restaurant
|
1,662
|
<question>: What is the address of the restaurant Subway? <context>: CREATE TABLE Restaurant (Address VARCHAR, ResName VARCHAR) <answer>: SELECT Address FROM Restaurant WHERE ResName = "Subway"
|
1,663
|
<question>: What is the rating of the restaurant Subway? <context>: CREATE TABLE Restaurant (Rating VARCHAR, ResName VARCHAR) <answer>: SELECT Rating FROM Restaurant WHERE ResName = "Subway"
|
1,664
|
<question>: List all restaurant types. <context>: CREATE TABLE Restaurant_Type (ResTypeName VARCHAR) <answer>: SELECT ResTypeName FROM Restaurant_Type
|
1,665
|
<question>: What is the description of the restaurant type Sandwich? <context>: CREATE TABLE Restaurant_Type (ResTypeDescription VARCHAR, ResTypeName VARCHAR) <answer>: SELECT ResTypeDescription FROM Restaurant_Type WHERE ResTypeName = "Sandwich"
|
1,666
|
<question>: Which restaurants have highest rating? List the restaurant name and its rating. <context>: CREATE TABLE Restaurant (ResName VARCHAR, Rating VARCHAR) <answer>: SELECT ResName, Rating FROM Restaurant ORDER BY Rating DESC LIMIT 1
|
1,667
|
<question>: What is the age of student Linda Smith? <context>: CREATE TABLE Student (Age VARCHAR, Fname VARCHAR, Lname VARCHAR) <answer>: SELECT Age FROM Student WHERE Fname = "Linda" AND Lname = "Smith"
|
1,668
|
<question>: What is the gender of the student Linda Smith? <context>: CREATE TABLE Student (Sex VARCHAR, Fname VARCHAR, Lname VARCHAR) <answer>: SELECT Sex FROM Student WHERE Fname = "Linda" AND Lname = "Smith"
|
1,669
|
<question>: List all students' first names and last names who majored in 600. <context>: CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, Major VARCHAR) <answer>: SELECT Fname, Lname FROM Student WHERE Major = 600
|
1,670
|
<question>: Which city does student Linda Smith live in? <context>: CREATE TABLE Student (city_code VARCHAR, Fname VARCHAR, Lname VARCHAR) <answer>: SELECT city_code FROM Student WHERE Fname = "Linda" AND Lname = "Smith"
|
1,671
|
<question>: Advisor 1121 has how many students? <context>: CREATE TABLE Student (Advisor VARCHAR) <answer>: SELECT COUNT(*) FROM Student WHERE Advisor = 1121
|
1,672
|
<question>: Which Advisor has most of students? List advisor and the number of students. <context>: CREATE TABLE Student (Advisor VARCHAR) <answer>: SELECT Advisor, COUNT(*) FROM Student GROUP BY Advisor ORDER BY COUNT(Advisor) DESC LIMIT 1
|
1,673
|
<question>: Which major has least number of students? List the major and the number of students. <context>: CREATE TABLE Student (Major VARCHAR) <answer>: SELECT Major, COUNT(*) FROM Student GROUP BY Major ORDER BY COUNT(Major) LIMIT 1
|
1,674
|
<question>: Which major has between 2 and 30 number of students? List major and the number of students. <context>: CREATE TABLE Student (Major VARCHAR) <answer>: SELECT Major, COUNT(*) FROM Student GROUP BY Major HAVING COUNT(Major) BETWEEN 2 AND 30
|
1,675
|
<question>: Which student's age is older than 18 and is majoring in 600? List each student's first and last name. <context>: CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, Age VARCHAR, Major VARCHAR) <answer>: SELECT Fname, Lname FROM Student WHERE Age > 18 AND Major = 600
|
1,676
|
<question>: List all female students age is older than 18 who is not majoring in 600. List students' first name and last name. <context>: CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, Sex VARCHAR, Age VARCHAR, Major VARCHAR) <answer>: SELECT Fname, Lname FROM Student WHERE Age > 18 AND Major <> 600 AND Sex = 'F'
|
1,677
|
<question>: How many restaurant is the Sandwich type restaurant? <context>: CREATE TABLE Type_Of_Restaurant (Id VARCHAR); CREATE TABLE Restaurant (Id VARCHAR); CREATE TABLE Restaurant_Type (Id VARCHAR) <answer>: SELECT COUNT(*) FROM Restaurant JOIN Type_Of_Restaurant ON Restaurant.ResID = Type_Of_Restaurant.ResID JOIN Restaurant_Type ON Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID GROUP BY Type_Of_Restaurant.ResTypeID HAVING Restaurant_Type.ResTypeName = 'Sandwich'
|
1,678
|
<question>: How long does student Linda Smith spend on the restaurant in total? <context>: CREATE TABLE Visits_Restaurant (Spent INTEGER); CREATE TABLE Student (Spent INTEGER) <answer>: SELECT SUM(Spent) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith"
|
1,679
|
<question>: How many times has the student Linda Smith visited Subway? <context>: CREATE TABLE Visits_Restaurant (Id VARCHAR); CREATE TABLE Student (Id VARCHAR); CREATE TABLE Restaurant (Id VARCHAR) <answer>: SELECT COUNT(*) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith" AND Restaurant.ResName = "Subway"
|
1,680
|
<question>: When did Linda Smith visit Subway? <context>: CREATE TABLE Restaurant (TIME VARCHAR); CREATE TABLE Visits_Restaurant (TIME VARCHAR); CREATE TABLE Student (TIME VARCHAR) <answer>: SELECT TIME FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith" AND Restaurant.ResName = "Subway"
|
1,681
|
<question>: At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total. <context>: CREATE TABLE Visits_Restaurant (Id VARCHAR); CREATE TABLE Restaurant (Id VARCHAR) <answer>: SELECT Restaurant.ResName, SUM(Visits_Restaurant.Spent) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY SUM(Visits_Restaurant.Spent) LIMIT 1
|
1,682
|
<question>: Which student visited restaurant most often? List student's first name and last name. <context>: CREATE TABLE Visits_Restaurant (Id VARCHAR); CREATE TABLE Student (Id VARCHAR) <answer>: SELECT Student.Fname, Student.Lname FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID GROUP BY Student.StuID ORDER BY COUNT(*) DESC LIMIT 1
|
1,683
|
<question>: Find the ids of orders whose status is 'Success'. <context>: CREATE TABLE actual_orders (actual_order_id VARCHAR, order_status_code VARCHAR) <answer>: SELECT actual_order_id FROM actual_orders WHERE order_status_code = 'Success'
|
1,684
|
<question>: Find the name and price of the product that has been ordered the greatest number of times. <context>: CREATE TABLE products (product_name VARCHAR, product_price VARCHAR, product_id VARCHAR); CREATE TABLE regular_order_products (product_id VARCHAR) <answer>: SELECT t1.product_name, t1.product_price FROM products AS t1 JOIN regular_order_products AS t2 ON t1.product_id = t2.product_id GROUP BY t2.product_id ORDER BY COUNT(*) DESC LIMIT 1
|
1,685
|
<question>: Find the number of customers in total. <context>: CREATE TABLE customers (Id VARCHAR) <answer>: SELECT COUNT(*) FROM customers
|
1,686
|
<question>: How many different payment methods are there? <context>: CREATE TABLE customers (payment_method VARCHAR) <answer>: SELECT COUNT(DISTINCT payment_method) FROM customers
|
1,687
|
<question>: Show the details of all trucks in the order of their license number. <context>: CREATE TABLE trucks (truck_details VARCHAR, truck_licence_number VARCHAR) <answer>: SELECT truck_details FROM trucks ORDER BY truck_licence_number
|
1,688
|
<question>: Find the name of the most expensive product. <context>: CREATE TABLE products (product_name VARCHAR, product_price VARCHAR) <answer>: SELECT product_name FROM products ORDER BY product_price DESC LIMIT 1
|
1,689
|
<question>: Find the names of customers who are not living in the state of California. <context>: CREATE TABLE customer_addresses (customer_id VARCHAR, address_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR); CREATE TABLE addresses (address_id VARCHAR, state_province_county VARCHAR) <answer>: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California'
|
1,690
|
<question>: List the names and emails of customers who payed by Visa card. <context>: CREATE TABLE customers (customer_email VARCHAR, customer_name VARCHAR, payment_method VARCHAR) <answer>: SELECT customer_email, customer_name FROM customers WHERE payment_method = 'Visa'
|
1,691
|
<question>: Find the names and phone numbers of customers living in California state. <context>: CREATE TABLE customer_addresses (customer_id VARCHAR, address_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE addresses (address_id VARCHAR, state_province_county VARCHAR) <answer>: SELECT t1.customer_name, t1.customer_phone FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California'
|
1,692
|
<question>: Find the states which do not have any employee in their record. <context>: CREATE TABLE Employees (state_province_county VARCHAR, address_id VARCHAR, employee_address_id VARCHAR); CREATE TABLE addresses (state_province_county VARCHAR, address_id VARCHAR, employee_address_id VARCHAR) <answer>: SELECT state_province_county FROM addresses WHERE NOT address_id IN (SELECT employee_address_id FROM Employees)
|
1,693
|
<question>: List the names, phone numbers, and emails of all customers sorted by their dates of becoming customers. <context>: CREATE TABLE Customers (customer_name VARCHAR, customer_phone VARCHAR, customer_email VARCHAR, date_became_customer VARCHAR) <answer>: SELECT customer_name, customer_phone, customer_email FROM Customers ORDER BY date_became_customer
|
1,694
|
<question>: Find the name of the first 5 customers. <context>: CREATE TABLE Customers (customer_name VARCHAR, date_became_customer VARCHAR) <answer>: SELECT customer_name FROM Customers ORDER BY date_became_customer LIMIT 5
|
1,695
|
<question>: Find the payment method that is used most frequently. <context>: CREATE TABLE Customers (payment_method VARCHAR) <answer>: SELECT payment_method FROM Customers GROUP BY payment_method ORDER BY COUNT(*) DESC LIMIT 1
|
1,696
|
<question>: List the names of all routes in alphabetic order. <context>: CREATE TABLE Delivery_Routes (route_name VARCHAR) <answer>: SELECT route_name FROM Delivery_Routes ORDER BY route_name
|
1,697
|
<question>: Find the name of route that has the highest number of deliveries. <context>: CREATE TABLE Delivery_Routes (route_name VARCHAR, route_id VARCHAR); CREATE TABLE Delivery_Route_Locations (route_id VARCHAR) <answer>: SELECT t1.route_name FROM Delivery_Routes AS t1 JOIN Delivery_Route_Locations AS t2 ON t1.route_id = t2.route_id GROUP BY t1.route_id ORDER BY COUNT(*) DESC LIMIT 1
|
1,698
|
<question>: List the state names and the number of customers living in each state. <context>: CREATE TABLE customer_addresses (address_id VARCHAR); CREATE TABLE addresses (state_province_county VARCHAR, address_id VARCHAR) <answer>: SELECT t2.state_province_county, COUNT(*) FROM customer_addresses AS t1 JOIN addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county
|
1,699
|
<question>: How many authors are there? <context>: CREATE TABLE authors (Id VARCHAR) <answer>: SELECT COUNT(*) FROM authors
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.