aherntech/sparc huggingface dataset:
Database: insurance_and_eClaims
Question sequence:
What was the smallest policy amount paid?
Claim amount instead?
Which was the policy for this?
For the largest claim amount instead?
Which customer owns this policy?
SQL query sequence:
SELECT min(amount_piad) FROM claim_headers
SELECT min(amount_claimed) FROM claim_headers
SELECT * FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id WHERE t1.amount_claimed = (SELECT min(amount_claimed) FROM claim_headers)
SELECT * FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id WHERE t1.amount_claimed = (SELECT max(amount_claimed) FROM claim_headers)
SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id  =  t2.policy_id JOIN customers AS t3 ON t2.customer_id  =  t3.customer_id WHERE t1.amount_claimed  =  (SELECT max(amount_claimed) FROM claim_headers)
Final question: What is the name of the customer who has made the largest amount of claim in a single claim?
Final SQL: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id  =  t2.policy_id JOIN customers AS t3 ON t2.customer_id  =  t3.customer_id WHERE t1.amount_claimed  =  (SELECT max(amount_claimed) FROM claim_headers)
Database: insurance_and_eClaims
Question sequence:
What is the largest claim amount?
What was the policy for this?
What about for the smallest payment amount instead?
Who owned this policy?
SQL query sequence:
SELECT max(amount_claimed) FROM claim_headers
SELECT * FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id WHERE t1.amount_claimed = (SELECT max(amount_claimed) FROM claim_headers)
SELECT * FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id WHERE t1.amount_piad = (SELECT min(amount_piad) FROM claim_headers)
SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id  =  t2.policy_id JOIN customers AS t3 ON t2.customer_id  =  t3.customer_id WHERE t1.amount_piad  =  (SELECT min(amount_piad) FROM claim_headers)
Final question: What is the name of the customer who has made the minimum amount of payment in one claim?
Final SQL: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id  =  t2.policy_id JOIN customers AS t3 ON t2.customer_id  =  t3.customer_id WHERE t1.amount_piad  =  (SELECT min(amount_piad) FROM claim_headers)
Database: insurance_and_eClaims
Question sequence:
Who are the customers?
What are their policies?
Who doesn't have policies?
SQL query sequence:
SELECT customer_details FROM customers
SELECT * FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id
SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id
Final question: Find the names of customers who have no policies associated.
Final SQL: SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id
Database: insurance_and_eClaims
Question sequence:
What is the least frequent claim outcome?
Most frequent?
Show for claim status instead.
SQL query sequence:
SELECT Claim_Outcome_Code FROM claims_processing GROUP BY Claim_Outcome_Code ORDER BY count(Claim_Outcome_Code) ASC LIMIT 1
SELECT Claim_Outcome_Code FROM claims_processing GROUP BY Claim_Outcome_Code ORDER BY count(Claim_Outcome_Code) DESC LIMIT 1
SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id  =  t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY count(*) DESC LIMIT 1
Final question: What is the name of the claim processing stage that most of the claims are on?
Final SQL: SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id  =  t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY count(*) DESC LIMIT 1
Database: insurance_and_eClaims
Question sequence:
Who are the customers?
Only show their names.
Of these, which one contain "III"
Containing "Diana" instead?
SQL query sequence:
SELECT * FROM customers
SELECT customer_details FROM customers
SELECT customer_details FROM customers WHERE customer_details LIKE "%III%"
SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"
Final question: Find the names of customers whose name contains "Diana".
Final SQL: SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"
Database: insurance_and_eClaims
Question sequence:
What are all the start and end dates of the policies?
Give me the policy types instead.
Just the deputy policies.
Which customers have this policy? Give their names.
SQL query sequence:
SELECT Start_Date, End_Date FROM policies
SELECT policy_type_code FROM policies
SELECT policy_type_code FROM policies WHERE policy_type_code = "Deputy"
SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.policy_type_code  =  "Deputy"
Final question: Find the names of the customers who have an deputy policy.
Final SQL: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.policy_type_code  =  "Deputy"
Database: insurance_and_eClaims
Question sequence:
What are the policies of each customer? Give the names and policy type codes.
Of these, show only those with jurisdiction policies.
How about either deputy policy or uniformed policy?
Now show just the unique names for these.
SQL query sequence:
SELECT t2.customer_details, t1.policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id
SELECT t2.customer_details, t1.policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.policy_type_code = "Jurisdiction"
SELECT t2.customer_details, t1.policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.policy_type_code = "Deputy" OR t1.policy_type_code = "Uniformed"
SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.policy_type_code  =  "Deputy" OR t1.policy_type_code  =  "Uniformed"
Final question: Find the names of customers who either have an deputy policy or uniformed policy.
Final SQL: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.policy_type_code  =  "Deputy" OR t1.policy_type_code  =  "Uniformed"
Database: insurance_and_eClaims
Question sequence:
Who are the staff members?
Customers?
Who are both customers and staff?
How about either of them?
SQL query sequence:
SELECT staff_Details FROM staff
SELECT customer_details FROM customers
SELECT customer_details FROM customers INTERSECT SELECT staff_details FROM staff
SELECT customer_details FROM customers UNION SELECT staff_details FROM staff
Final question: Find the names of all the customers and staff members.
Final SQL: SELECT customer_details FROM customers UNION SELECT staff_details FROM staff
Database: insurance_and_eClaims
Question sequence:
Who are the customers?
Which customers have more than 1 policy?
Who has the most?
SQL query sequence:
SELECT customer_details FROM customers
SELECT t2.customer_details FROM policies AS T1 JOIN customers as t2 ON t1.customer_id = t2.customer_id GROUP BY t2.customer_details HAVING count(*) > 1
SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id GROUP BY t2.customer_details ORDER BY count(*) DESC LIMIT 1
Final question: Find the name of the customer that has been involved in the most policies.
Final SQL: SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id GROUP BY t2.customer_details ORDER BY count(*) DESC LIMIT 1
Database: aircraft
Question sequence:
How many total passengers are in any airport with the word London in its name?
How many International?
How about Transit?
How about Domestic?
SQL query sequence:
SELECT sum(Total_Passengers) FROM airport WHERE Airport_Name LIKE "%London%"
SELECT sum(International_Passengers) FROM airport WHERE Airport_Name LIKE "%London%"
SELECT sum(Transit_Passengers) FROM airport WHERE Airport_Name LIKE "%London%"
SELECT sum(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE "%London%"
Final question: What are the total number of Domestic Passengers of airports that contain the word "London".
Final SQL: SELECT sum(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE "%London%"
Database: aircraft
Question sequence:
How many transit passengers does each airport have?
What is the average number?
How about the maximum?
Please, show the minimum as well.
SQL query sequence:
SELECT Airport_ID, Transit_Passengers FROM airport
SELECT avg(Transit_Passengers) FROM airport
SELECT max(Transit_Passengers) FROM airport
SELECT max(Transit_Passengers), min(Transit_Passengers) FROM airport
Final question: What are the maximum and minimum number of transit passengers of all airports.
Final SQL: SELECT max(Transit_Passengers), min(Transit_Passengers) FROM airport
Database: aircraft
Question sequence:
Show all the pilot names and ages?
What are the names that are older younger than 50?
How about 30 or younger?
Sort them in reverse alphabetical order?
SQL query sequence:
SELECT Name, Age FROM pilot
SELECT Name FROM pilot WHERE Age  <=  50
SELECT Name FROM pilot WHERE Age  <=  30
SELECT Name FROM pilot WHERE Age  <=  50 ORDER BY Name DESC
Final question: List names of all pilot aged 30 or younger in descending alphabetical order.
Final SQL: SELECT Name FROM pilot WHERE Age  <=  30 ORDER BY Name DESC
Database: aircraft
Question sequence:
Is there an airport with the name "London Gatwick"?
How many aircrafts movements happen at this airport?
Also, how many aircrafts is the airport associated with?
What is its name?
SQL query sequence:
SELECT * FROM airport WHERE Airport_Name = "London Gatwick"
SELECT aircraft_movements FROM airport WHERE Airport_Name = "London Gatwick"
SELECT count(*) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Gatwick"
SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Gatwick"
Final question: Please show the names of aircrafts associated with airport with name "London Gatwick".
Final SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Gatwick"
Database: aircraft
Question sequence:
Show me a list of all the different airports!
What ones have more than 10000000 total passengers?
Show all the aircrafts associated with each of these airports.
Show only the names and descriptions.
SQL query sequence:
Select * FROM airport
Select * FROM airport where Total_Passengers > 10000000
SELECT * FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Total_Passengers  >  10000000
SELECT T1.Aircraft ,  T1.Description FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Total_Passengers  >  10000000
Final question: Please show the names and descriptions of aircrafts associated with airports that have a total number of passengers bigger than 10000000.
Final SQL: SELECT T1.Aircraft ,  T1.Description FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Total_Passengers  >  10000000
Database: aircraft
Question sequence:
Tell me more information about the aircraft called "Robinson R-22"!
How many airports use this aircraft?
What are their names, and total passengers?
What is the average total number passengers?
SQL query sequence:
SELECT * FROM Aircraft where Aircraft = "Robinson R-22"
SELECT * FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T1.Aircraft  =  "Robinson R-22"
SELECT T3.Airport_Name, T3.Total_Passengers FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T1.Aircraft  =  "Robinson R-22"
SELECT avg(T3.Total_Passengers) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T1.Aircraft  =  "Robinson R-22"
Final question: What is the average total number of passengers of airports that are associated with aircraft "Robinson R-22"?
Final SQL: SELECT avg(T3.Total_Passengers) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T1.Aircraft  =  "Robinson R-22"
Database: aircraft
Question sequence:
What are the names of all the winning pilots?
What are the names of the aircrafts that they used?
What one of the aircrafts won the most?
SQL query sequence:
SELECT T1.Name FROM pilot AS T1 JOIN MATCH AS T2 ON T1.Pilot_ID  =  T2.Winning_Pilot
SELECT T1.Name, T3.Aircraft FROM pilot AS T1 JOIN MATCH AS T2 ON T1.Pilot_ID  =  T2.Winning_Pilot JOIN aircraft as T3 ON T2.Winning_Aircraft = T3.Aircraft_ID
SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY COUNT(*) DESC LIMIT 1
Final question: List the name of the aircraft that has been named winning aircraft the most number of times.
Final SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY COUNT(*) DESC LIMIT 1
Database: aircraft
Question sequence:
How many aircrafts are there?
What are their names?
Which ones have won?
How any times have each won?
SQL query sequence:
SELECT count(*) FROM aircraft
SELECT Aircraft FROM aircraft
SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft
SELECT T1.Aircraft,  COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft
Final question: List the names of aircrafts and the number of times it won matches.
Final SQL: SELECT T1.Aircraft,  COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft
Database: aircraft
Question sequence:
How many matches have taken place?
How many of them have been won by the same aircraft?
Which aircrafts?
SQL query sequence:
SELECT count(*) FROM MATCH
SELECT count(*) FROM (SELECT T1.Aircraft,  COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft having COUNT(*) > 1)
SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*)  >=  2
Final question: List the names of aircrafts and that won matches at least twice.
Final SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*)  >=  2
Database: aircraft
Question sequence:
What are all the aircraft names?
How many matches have each won?
How about those that have not won any matches?
SQL query sequence:
SELECT Aircraft FROM Aircraft
SELECT T1.Aircraft,  COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft
SELECT Aircraft FROM aircraft WHERE Aircraft_ID NOT IN (SELECT Winning_Aircraft FROM MATCH)
Final question: List the names of aircrafts and that did not win any match.
Final SQL: SELECT Aircraft FROM aircraft WHERE Aircraft_ID NOT IN (SELECT Winning_Aircraft FROM MATCH)
Database: aircraft
Question sequence:
What airports have "London" in its name?
What aircraft names are associated with these airports?
Which ones are associated with an airport with "London Heathrow"
Which of these aircrafts are also associated with an airport named "London Gatwick"
SQL query sequence:
SELECT Airport_Name FROM Airport WHERE Airport_Name LIKE "%London%"
SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name LIKE "%London%"
SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick"
SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Heathrow" INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Gatwick"
Final question: Show the names of aircrafts that are associated with both an airport named "London Heathrow" and an airport named "London Gatwick"
Final SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Heathrow" INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Gatwick"
Database: aircraft
Question sequence:
What are the number of international passengers per airport?
What are all the airport details with the minimum?
With the maximum?
SQL query sequence:
SELECT airport_id, international_passengers FROM airport
SELECT * FROM airport ORDER BY International_Passengers ASC LIMIT 1
SELECT * FROM airport ORDER BY International_Passengers DESC LIMIT 1
Final question: Show all information on the airport that has the largest number of international passengers.
Final SQL: SELECT * FROM airport ORDER BY International_Passengers DESC LIMIT 1
Database: aircraft
Question sequence:
How many pilots are under 30?
What are their names and ages?
How many times have they each won?
Show me the name and age of the one that has won the most times.
SQL query sequence:
Select count(*) FROM pilot where age < 30
Select name, age FROM pilot where age < 30
SELECT t1.name, t1.age, count(*) FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id  =  t2.winning_pilot GROUP BY t2.winning_pilot
SELECT t1.name,  t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id  =  t2.winning_pilot WHERE t1.age  <  30 GROUP BY t2.winning_pilot ORDER BY count(*) DESC LIMIT 1
Final question: find the name and age of the pilot who has won the most number of times among the pilots who are younger than 30.
Final SQL: SELECT t1.name,  t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id  =  t2.winning_pilot WHERE t1.age  <  30 GROUP BY t2.winning_pilot ORDER BY count(*) DESC LIMIT 1
Database: aircraft
Question sequence:
Show all the information for all the pilots!
Show me only the winning-pilots!
What is the name and age of the oldest one?
How about the youngest one?
SQL query sequence:
Select * FROM pilot
SELECT * FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id  =  t2.winning_pilot
SELECT t1.name ,  t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id  =  t2.winning_pilot ORDER BY t1.age DESC LIMIT 1
SELECT t1.name ,  t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id  =  t2.winning_pilot ORDER BY t1.age ASC LIMIT 1
Final question: what is the name and age of the youngest winning pilot?
Final SQL: SELECT t1.name ,  t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id  =  t2.winning_pilot ORDER BY t1.age LIMIT 1
Database: cre_Docs_and_Epenses
Question sequence:
Show all account information.
Show the ids for them.
Also show the account details.
SQL query sequence:
SELECT *  FROM Accounts
SELECT account_id  FROM Accounts
SELECT account_id ,  account_details FROM Accounts
Final question: Show all account ids and account details.
Final SQL: SELECT account_id ,  account_details FROM Accounts
Database: cre_Docs_and_Epenses
Question sequence:
Show the info for all statements.
How many are there?
SQL query sequence:
SELECT * FROM Statements
SELECT count(*) FROM Statements
Final question: How many statements do we have?
Final SQL: SELECT count(*) FROM Statements
Database: cre_Docs_and_Epenses
Question sequence:
Show info for all statements.
Show their ids and statement details.
SQL query sequence:
SELECT * FROM Statements
SELECT STATEMENT_ID ,  statement_details FROM Statements
Final question: List all statement ids and statement details.
Final SQL: SELECT STATEMENT_ID ,  statement_details FROM Statements
Database: cre_Docs_and_Epenses
Question sequence:
Show the details of each account.
Also show the statement ids and statement details for them.
SQL query sequence:
SELECT account_details from Accounts
SELECT T1.statement_id ,  T2.statement_details ,  T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id  =  T2.statement_id
Final question: Show statement id, statement detail, account detail for accounts.
Final SQL: SELECT T1.statement_id ,  T2.statement_details ,  T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id  =  T2.statement_id
Database: cre_Docs_and_Epenses
Question sequence:
Show the statement ids from all accounts.
For each of them, also show the number of accounts.
SQL query sequence:
SELECT STATEMENT_ID FROM Accounts
SELECT STATEMENT_ID ,  count(*) FROM Accounts GROUP BY STATEMENT_ID
Final question: Show all statement id and the number of accounts for each statement.
Final SQL: SELECT STATEMENT_ID ,  count(*) FROM Accounts GROUP BY STATEMENT_ID
Database: cre_Docs_and_Epenses
Question sequence:
Show the ids and details for statments.
For each of them, also show the number of accounts.
Sort the results in the descending order of the number of accounts.
Show the id and details for the statment with the most accounts.
SQL query sequence:
SELECT statement_id ,  statement_details FROM Statements
SELECT T1.statement_id ,  T2.statement_details, count(*) FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id  =  T2.statement_id GROUP BY T1.statement_id
SELECT T1.statement_id ,  T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id  =  T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC
SELECT T1.statement_id ,  T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id  =  T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1
Final question: Show the statement id and the statement detail for the statement with most number of accounts.
Final SQL: SELECT T1.statement_id ,  T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id  =  T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1
Database: cre_Docs_and_Epenses
Question sequence:
Show information for all documents.
How many are there?
SQL query sequence:
SELECT * FROM Documents
SELECT count(*) FROM Documents
Final question: Show the number of documents.
Final SQL: SELECT count(*) FROM Documents