aherntech/sparc huggingface dataset:
Database: loan_1
Question sequence:
what is the average amount of all loans?
how about the total amount?
Find the names of customer who have loans.
who has the largest amount of loans?
SQL query sequence:
SELECT avg(amount) FROM loan
SELECT sum(amount) FROM loan
SELECT DISTINCT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id
SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name ORDER BY sum(T2.amount) DESC LIMIT 1
Final question: Find the name of customer who has the highest amount of loans.
Final SQL: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name ORDER BY sum(T2.amount) DESC LIMIT 1
Database: loan_1
Question sequence:
show all different states where banks are located.
which state has the most bank customers?
SQL query sequence:
SELECT distinct state FROM bank
SELECT state FROM bank GROUP BY state ORDER BY sum(no_of_customers) DESC LIMIT 1
Final question: Find the state which has the most number of customers.
Final SQL: SELECT state FROM bank GROUP BY state ORDER BY sum(no_of_customers) DESC LIMIT 1
Database: loan_1
Question sequence:
what are the names of customers with a credit score lower than 50?
what is their average account balance?
find their average account balance for each different account type.
SQL query sequence:
SELECT cust_name FROM customer WHERE credit_score  <  50
SELECT avg(acc_bal) FROM customer WHERE credit_score  <  50
SELECT avg(acc_bal) ,  acc_type FROM customer WHERE credit_score  <  50 GROUP BY acc_type
Final question: For each account type, find the average account balance of customers with credit score lower than 50.
Final SQL: SELECT avg(acc_bal) ,  acc_type FROM customer WHERE credit_score  <  50 GROUP BY acc_type
Database: loan_1
Question sequence:
what states are the customers from?
For each state, how many customers have a credit score above 100?
find their total account balances.
SQL query sequence:
SELECT distinct state FROM customer
SELECT count(*),  state FROM customer WHERE credit_score  >  100 GROUP BY state
SELECT sum(acc_bal) ,  state FROM customer WHERE credit_score  >  100 GROUP BY state
Final question: For each state, find the total account balance of customers whose credit score is above 100.
Final SQL: SELECT sum(acc_bal) ,  state FROM customer WHERE credit_score  >  100 GROUP BY state
Database: loan_1
Question sequence:
how many bank branches are not in the state of New York?
what is the total number of bank branches?
how many loans are offered by each branch?
what is the total amount of loans offered by each of them?
SQL query sequence:
SELECT count(*) FROM bank WHERE state != "New York"
SELECT count(*) FROM bank
SELECT count(*),  T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id  =  T2.branch_id GROUP BY T1.bname
SELECT sum(amount) ,  T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id  =  T2.branch_id GROUP BY T1.bname
Final question: Find the total amount of loans offered by each bank branch.
Final SQL: SELECT sum(amount) ,  T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id  =  T2.branch_id GROUP BY T1.bname
Database: loan_1
Question sequence:
how many loans are there?
what is the total amount of loans?
Find the names of customers who have at least one loan.
which of them have more than one loan?
SQL query sequence:
SELECT count(*) FROM loan
SELECT sum(amount) FROM loan
SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id
SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name HAVING count(*)  >  1
Final question: Find the name of customers who have more than one loan.
Final SQL: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name HAVING count(*)  >  1
Database: loan_1
Question sequence:
Find the names of customers who have at least one loan.
which of them have loans with a total amount of more than 5000?
also show their account balances.
SQL query sequence:
SELECT DISTINCT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id
SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name HAVING sum(T2.amount)  >  5000
SELECT T1.cust_name ,  T1.acc_type FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name HAVING sum(T2.amount)  >  5000
Final question: Find the name and account balance of the customers who have loans with a total amount of more than 5000.
Final SQL: SELECT T1.cust_name ,  T1.acc_type FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name HAVING sum(T2.amount)  >  5000
Database: loan_1
Question sequence:
what is the total amount of all loans?
find the names of bank branches that provided these loans.
which one offered the greatest total amount of loans?
SQL query sequence:
SELECT sum(amount) FROM loan
SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id  =  T2.branch_id
SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id  =  T2.branch_id GROUP BY T1.bname ORDER BY sum(T2.amount) DESC LIMIT 1
Final question: Find the name of bank branch that provided the greatest total amount of loans.
Final SQL: SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id  =  T2.branch_id GROUP BY T1.bname ORDER BY sum(T2.amount) DESC LIMIT 1
Database: loan_1
Question sequence:
what are the names of customers whose credit score is higher than 200?
how about those whose credit score is less than 100?
what are the names of bank branches that provided any loans to them?
which bank branch gave the greatest total amount of loans to a customer whose credit score is less than 100?
SQL query sequence:
SELECT cust_name FROM customer WHERE credit_score > 200
SELECT cust_name FROM customer WHERE credit_score < 100
SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_id  =  T2.branch_id JOIN customer AS T3 ON T1.cust_id  =  T3.cust_id WHERE T3.credit_score  <  100
SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_id  =  T2.branch_id JOIN customer AS T3 ON T1.cust_id  =  T3.cust_id WHERE T3.credit_score  <  100 GROUP BY T2.bname ORDER BY sum(T1.amount) DESC LIMIT 1
Final question: Find the name of bank branch that provided the greatest total amount of loans to customers with credit score is less than 100.
Final SQL: SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_id  =  T2.branch_id JOIN customer AS T3 ON T1.cust_id  =  T3.cust_id WHERE T3.credit_score  <  100 GROUP BY T2.bname ORDER BY sum(T1.amount) DESC LIMIT 1
Database: loan_1
Question sequence:
how many loans have an amount greater than 3000?
what are their types?
Find the names of the customers who own these loans.
SQL query sequence:
SELECT count(*) FROM loan WHERE amount  >  3000
SELECT distinct loan_type FROM loan WHERE amount  >  3000
SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id WHERE amount  >  3000
Final question: Find the the name of the customers who have a loan with amount more than 3000.
Final SQL: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id WHERE amount  >  3000
Database: loan_1
Question sequence:
what is the total amount of all business loans?
what are the names of bank branches that provide these loans?
which cities are these banks located at?
SQL query sequence:
SELECT sum(amount) FROM loan WHERE loan_type  =  'Business'
SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id  =  T2.branch_id WHERE T2.loan_type  =  'Business'
SELECT T1.city FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id  =  T2.branch_id WHERE T2.loan_type  =  'Business'
Final question: Find the city and name of bank branches that provide business loans.
Final SQL: SELECT T1.bname,  T1.city FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id  =  T2.branch_id WHERE T2.loan_type  =  'Business'
Database: loan_1
Question sequence:
show the name and credit score of all customers.
which of them have a credit score below 100?
Find the names of bank branches that have provided a loan to them.
SQL query sequence:
SELECT cust_name, credit_score FROM customer
SELECT cust_name FROM customer WHERE credit_score  <  100
SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_id  =  T2.branch_id JOIN customer AS T3 ON T1.cust_id  =  T3.cust_id WHERE T3.credit_score  <  100
Final question: Find the names of bank branches that have provided a loan to any customer whose credit score is below 100.
Final SQL: SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_id  =  T2.branch_id JOIN customer AS T3 ON T1.cust_id  =  T3.cust_id WHERE T3.credit_score  <  100
Database: loan_1
Question sequence:
how many bank branches does the state of New York have?
what are their names?
what is the total amount of loans provided by them?
SQL query sequence:
SELECT count(*) FROM bank WHERE state  =  'New York'
SELECT bname FROM bank WHERE state  =  'New York'
SELECT sum(T2.amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id  =  T2.branch_id WHERE T1.state  =  'New York'
Final question: Find the total amount of loans provided by bank branches in the state of New York.
Final SQL: SELECT sum(T2.amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id  =  T2.branch_id WHERE T1.state  =  'New York'
Database: loan_1
Question sequence:
how many customers have at least one loan?
which states are they from?
show their credit scores.
what is the average?
SQL query sequence:
SELECT count(*) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)
SELECT state FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)
SELECT credit_score FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)
SELECT avg(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)
Final question: Find the average credit score of the customers who have some loan.
Final SQL: SELECT avg(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)
Database: flight_1
Question sequence:
Show all the aircraft information.
How many are there ?
SQL query sequence:
SELECT * FROM Aircraft
SELECT count(*) FROM Aircraft
Final question: How many aircrafts do we have?
Final SQL: SELECT count(*) FROM Aircraft
Database: flight_1
Question sequence:
Show the names of all aircraft.
Also show the distances for each of them.
SQL query sequence:
SELECT name  FROM Aircraft
SELECT name ,  distance FROM Aircraft
Final question: Show name and distance for all aircrafts.
Final SQL: SELECT name ,  distance FROM Aircraft
Database: flight_1
Question sequence:
Show the id for all aircrafts.
Only show the results for those with a distance longer than 1000.
SQL query sequence:
SELECT aid FROM Aircraft
SELECT aid FROM Aircraft WHERE distance  >  1000
Final question: Show ids for all aircrafts with more than 1000 distance.
Final SQL: SELECT aid FROM Aircraft WHERE distance  >  1000
Database: flight_1
Question sequence:
How many aircraft are there?
How many of them have a distance between 1000 and 5000?
SQL query sequence:
SELECT count(*) FROM Aircraft
SELECT count(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000
Final question: How many aircrafts have distance between 1000 and 5000?
Final SQL: SELECT count(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000
Database: flight_1
Question sequence:
Show the name for all aircraft.
What about the one with id 12?
Also show its distance.
SQL query sequence:
SELECT name FROM Aircraft
SELECT name FROM Aircraft WHERE aid  =  12
SELECT name ,  distance FROM Aircraft WHERE aid  =  12
Final question: What is the name and distance for aircraft with id 12?
Final SQL: SELECT name ,  distance FROM Aircraft WHERE aid  =  12
Database: flight_1
Question sequence:
Show the distance for all aircrafts.
Wnat is the minimum?
Also show the average and maximum.
SQL query sequence:
select distance FROM Aircraft
SELECT min(distance) FROM Aircraft
SELECT min(distance) ,  avg(distance) ,  max(distance) FROM Aircraft
Final question: What is the minimum, average, and maximum distance of all aircrafts.
Final SQL: SELECT min(distance) ,  avg(distance) ,  max(distance) FROM Aircraft
Database: flight_1
Question sequence:
Show the id and name for all aircraft.
Order the results in descending order of distance.
Which one has the maximum?
SQL query sequence:
SELECT aid ,  name FROM Aircraft
SELECT aid ,  name FROM Aircraft ORDER BY distance DESC
SELECT aid ,  name FROM Aircraft ORDER BY distance DESC LIMIT 1
Final question: Show the id and name of the aircraft with the maximum distance.
Final SQL: SELECT aid ,  name FROM Aircraft ORDER BY distance DESC LIMIT 1
Database: flight_1
Question sequence:
Show the name for all aircrafts.
Order them by the distance.
Which three have the lowest?
SQL query sequence:
SELECT name FROM Aircraft
SELECT name FROM Aircraft ORDER BY distance
SELECT name FROM Aircraft ORDER BY distance LIMIT 3
Final question: Show the name of aircrafts with top three lowest distances.
Final SQL: SELECT name FROM Aircraft ORDER BY distance LIMIT 3
Database: flight_1
Question sequence:
What is the average distance?
Show the name for all aircrafts with a distance above it.
SQL query sequence:
SELECT avg(distance) FROM Aircraft
SELECT name FROM Aircraft WHERE distance  >  (SELECT avg(distance) FROM Aircraft)
Final question: Show names for all aircrafts with distances more than the average.
Final SQL: SELECT name FROM Aircraft WHERE distance  >  (SELECT avg(distance) FROM Aircraft)
Database: flight_1
Question sequence:
Show information for all employees.
Show the number of them.
SQL query sequence:
SELECT * FROM Employee
SELECT count(*) FROM Employee
Final question: How many employees do we have?
Final SQL: SELECT count(*) FROM Employee
Database: flight_1
Question sequence:
Show the name for all employees.
Also show their salaries.
Order the results by their salary.
SQL query sequence:
SELECT name  FROM Employee
SELECT name ,  salary FROM Employee
SELECT name ,  salary FROM Employee ORDER BY salary
Final question: Show name and salary for all employees sorted by salary.
Final SQL: SELECT name ,  salary FROM Employee ORDER BY salary
Database: flight_1
Question sequence:
Show the id for all employees.
Which of them have a salary above 100000?
SQL query sequence:
SELECT eid FROM Employee
SELECT eid FROM Employee WHERE salary  >  100000
Final question: Show ids for all employees with at least 100000 salary.
Final SQL: SELECT eid FROM Employee WHERE salary  >  100000
Database: flight_1
Question sequence:
Show the total number of employees.
How many of them have a salary between 100000 and 200000?
SQL query sequence:
SELECT count(*) FROM Employee
SELECT count(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000
Final question: How many employees have salary between 100000 and 200000?
Final SQL: SELECT count(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000
Database: flight_1
Question sequence:
Show the information for the employee with id 242518965.
What is the name and salary for this employee?
SQL query sequence:
SELECT * FROM Employee WHERE eid  =  242518965
SELECT name ,  salary FROM Employee WHERE eid  =  242518965
Final question: What is the name and salary for employee with id 242518965?
Final SQL: SELECT name ,  salary FROM Employee WHERE eid  =  242518965
Database: flight_1
Question sequence:
What is the salary for all employees.
What are the average and maximum salaries.
SQL query sequence:
select salary FROM Employee
SELECT avg(salary) ,  max(salary) FROM Employee
Final question: What is average and maximum salary of all employees.
Final SQL: SELECT avg(salary) ,  max(salary) FROM Employee
Database: flight_1
Question sequence:
Show the id and name of the employees.
Order them by salary.
Who has the maximum salary?
SQL query sequence:
SELECT eid ,  name FROM Employee
SELECT eid ,  name FROM Employee ORDER BY salary
SELECT eid ,  name FROM Employee ORDER BY salary DESC LIMIT 1
Final question: Show the id and name of the employee with maximum salary.
Final SQL: SELECT eid ,  name FROM Employee ORDER BY salary DESC LIMIT 1
Database: flight_1
Question sequence:
Show the names of all employees.
Order the results by their salaries.
Which three have the lowest?
SQL query sequence:
SELECT name FROM Employee
SELECT name FROM Employee ORDER BY salary
SELECT name FROM Employee ORDER BY salary ASC LIMIT 3
Final question: Show the name of employees with three lowest salaries.
Final SQL: SELECT name FROM Employee ORDER BY salary ASC LIMIT 3
Database: flight_1
Question sequence:
Show the salaries for all employees.
What is the average of them?
Show the name for all employees with a salary above that.
SQL query sequence:
SELECT salary FROM Employee
SELECT avg(salary) FROM Employee
SELECT name FROM Employee WHERE salary  >  (SELECT avg(salary) FROM Employee)
Final question: Show names for all employees with salary more than the average.
Final SQL: SELECT name FROM Employee WHERE salary  >  (SELECT avg(salary) FROM Employee)
Database: flight_1
Question sequence:
Show ids for all the employees.
Show the id for employee Mark Young.
Also show his salary.
SQL query sequence:
SELECT eid  FROM Employee
SELECT eid  FROM Employee WHERE name  =  'Mark Young'
SELECT eid ,  salary FROM Employee WHERE name  =  'Mark Young'
Final question: Show the id and salary of Mark Young.
Final SQL: SELECT eid ,  salary FROM Employee WHERE name  =  'Mark Young'
Database: flight_1
Question sequence:
Show the info for all flights.
How many are there?
SQL query sequence:
SELECT * FROM Flight
SELECT count(*) FROM Flight
Final question: How many flights do we have?
Final SQL: SELECT count(*) FROM Flight
Database: flight_1
Question sequence:
Show the flight number of all flights.
Also show the origin and destination for them.
Order them in the alphabetical order of the departure cities.
SQL query sequence:
SELECT flno  FROM Flight
SELECT flno ,  origin ,  destination FROM Flight
SELECT flno ,  origin ,  destination FROM Flight ORDER BY origin
Final question: Show flight number, origin, destination of all flights in the alphabetical order of the departure cities.
Final SQL: SELECT flno ,  origin ,  destination FROM Flight ORDER BY origin
Database: flight_1
Question sequence:
Show all flight numbers
Filter for only those from Los Angeles?
SQL query sequence:
SELECT flno FROM Flight
SELECT flno FROM Flight WHERE origin  =  "Los Angeles"
Final question: Show all flight number from Los Angeles.
Final SQL: SELECT flno FROM Flight WHERE origin  =  "Los Angeles"
Database: flight_1
Question sequence:
Show the origin for all flights.
How about the origin for those with destination Honolulu?
SQL query sequence:
SELECT origin FROM Flight
SELECT origin FROM Flight WHERE destination  =  "Honolulu"
Final question: Show origins of all flights with destination Honolulu.
Final SQL: SELECT origin FROM Flight WHERE destination  =  "Honolulu"
Database: flight_1
Question sequence:
Show the  departure date and arrival date for all flights.
How about those from Los Angeles?
From these results, only show those flying to Honolulu.
SQL query sequence:
SELECT departure_date ,  arrival_date FROM Flight
SELECT departure_date ,  arrival_date FROM Flight WHERE origin  =  "Los Angeles"
SELECT departure_date ,  arrival_date FROM Flight WHERE origin  =  "Los Angeles" AND destination  =  "Honolulu"
Final question: Show me the departure date and arrival date for all flights from Los Angeles to Honolulu.
Final SQL: SELECT departure_date ,  arrival_date FROM Flight WHERE origin  =  "Los Angeles" AND destination  =  "Honolulu"
Database: flight_1
Question sequence:
Show the flight numbers for all flights.
How about those with distance longer than 2000?
SQL query sequence:
SELECT flno FROM Flight
SELECT flno FROM Flight WHERE distance  >  2000
Final question: Show flight number for all flights with more than 2000 distance.
Final SQL: SELECT flno FROM Flight WHERE distance  >  2000
Database: flight_1
Question sequence:
Show the price for all flights.
How about those from Los Angeles to Honolulu?
What is the average of them?
SQL query sequence:
SELECT price FROM Flight
SELECT price FROM Flight WHERE origin  =  "Los Angeles" AND destination  =  "Honolulu"
SELECT avg(price) FROM Flight WHERE origin  =  "Los Angeles" AND destination  =  "Honolulu"
Final question: What is the average price for flights from Los Angeles to Honolulu.
Final SQL: SELECT avg(price) FROM Flight WHERE origin  =  "Los Angeles" AND destination  =  "Honolulu"
Database: flight_1
Question sequence:
Show the origin for all flights.
How about those with a price higher than 300?
For each of them, also show the destination.
SQL query sequence:
SELECT origin  FROM Flight
SELECT origin  FROM Flight WHERE price  >  300
SELECT origin ,  destination FROM Flight WHERE price  >  300
Final question: Show origin and destination for flights with price higher than 300.
Final SQL: SELECT origin ,  destination FROM Flight WHERE price  >  300
Database: flight_1
Question sequence:
Show the flight number and distance of all the flights.
List them in the descending order of the price.
Which has the maximum price?
SQL query sequence:
SELECT flno ,  distance FROM Flight
SELECT flno ,  distance FROM Flight ORDER BY price DESC
SELECT flno ,  distance FROM Flight ORDER BY price DESC LIMIT 1
Final question: Show the flight number and distance of the flight with maximum price.
Final SQL: SELECT flno ,  distance FROM Flight ORDER BY price DESC LIMIT 1
Database: flight_1
Question sequence:
Show all flight numbers.
Order them by the distance.
Show the three shortest.
SQL query sequence:
SELECT flno FROM Flight
SELECT flno FROM Flight ORDER BY distance
SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3
Final question: Show the flight number of flights with three lowest distances.
Final SQL: SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3
Database: flight_1
Question sequence:
Show the distance and price for all flights.
Show the result only for those from Los Angeles.
What is the average distance and average price for them?
SQL query sequence:
SELECT distance , price FROM Flight
SELECT distance , price FROM Flight WHERE origin  =  "Los Angeles"
SELECT avg(distance) ,  avg(price) FROM Flight WHERE origin  =  "Los Angeles"
Final question: What is the average distance and average price for flights from Los Angeles.
Final SQL: SELECT avg(distance) ,  avg(price) FROM Flight WHERE origin  =  "Los Angeles"
Database: flight_1
Question sequence:
Show the number of flights in total.
Breakdown the count by the origin.
SQL query sequence:
SELECT count(*) FROM Flight
SELECT origin ,  count(*) FROM Flight GROUP BY origin
Final question: Show all origins and the number of flights from each origin.
Final SQL: SELECT origin ,  count(*) FROM Flight GROUP BY origin
Database: flight_1
Question sequence:
Show the destination for all flights.
For each of them, what is the number of flights?
SQL query sequence:
SELECT destination FROM Flight
SELECT destination ,  count(*) FROM Flight GROUP BY destination
Final question: Show all destinations and the number of flights to each destination.
Final SQL: SELECT destination ,  count(*) FROM Flight GROUP BY destination
Database: flight_1
Question sequence:
Show the origin for all flights.
For each city, how many flights are departing from there?
Order them in descending order of number of departures.
Which origin has the most?
SQL query sequence:
SELECT origin FROM Flight
SELECT origin, count(*) FROM Flight GROUP BY origin
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1
Final question: Which origin has most number of flights?
Final SQL: SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1
Database: flight_1
Question sequence:
Show the destination for all flights.
For each destination, show the number of flights arriving there.
Which destination has the fewest?
SQL query sequence:
SELECT destination FROM Flight
SELECT destination, count(*) FROM Flight GROUP BY destination
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1
Final question: Which destination has least number of flights?
Final SQL: SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1