aherntech/sparc huggingface dataset:
Database: flight_4
Question sequence:
how many routes are operated by the airline with name 'American Airlines'.
how many of them list the US as the destination?
how about for Italy?
SQL query sequence:
SELECT count(*) FROM routes AS T1 JOIN airlines AS T2 ON T1.alid  =  T2.alid WHERE T2.name  =  'American Airlines'
SELECT count(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid  =  T2.apid JOIN airlines AS T3 ON T1.alid  =  T3.alid WHERE T2.country  =  'United States' AND T3.name  =  'American Airlines'
SELECT count(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid  =  T2.apid JOIN airlines AS T3 ON T1.alid  =  T3.alid WHERE T2.country  =  'Italy' AND T3.name  =  'American Airlines'
Final question: Return the number of routes with destination airport in Italy operated by the airline with name 'American Airlines'.
Final SQL: SELECT count(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid  =  T2.apid JOIN airlines AS T3 ON T1.alid  =  T3.alid WHERE T2.country  =  'Italy' AND T3.name  =  'American Airlines'
Database: flight_4
Question sequence:
which city is John F Kennedy International Airport located in?
which routes list it as a destination airport?
how many of those routes are there?
SQL query sequence:
SELECT city FROM airports WHERE name  =  'John F Kennedy International Airport'
SELECT * FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid WHERE T1.name  =  'John F Kennedy International Airport'
SELECT count(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid WHERE T1.name  =  'John F Kennedy International Airport'
Final question: Find the number of routes that list John F Kennedy International Airport as a destination.
Final SQL: SELECT count(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid WHERE T1.name  =  'John F Kennedy International Airport'
Database: flight_4
Question sequence:
Find the number of routes from the United States.
how many of them end up in Canada?
SQL query sequence:
SELECT count(*) FROM routes WHERE src_apid IN (SELECT apid FROM airports WHERE country  =  'United States')
SELECT count(*) FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country  =  'Canada') AND src_apid IN (SELECT apid FROM airports WHERE country  =  'United States')
Final question: Find the number of routes from the United States to Canada.
Final SQL: SELECT count(*) FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country  =  'Canada') AND src_apid IN (SELECT apid FROM airports WHERE country  =  'United States')
Database: flight_4
Question sequence:
how many routes end in the United States?
among them, how many fly from the United States?
what are their ids?
SQL query sequence:
SELECT count(*) FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country  =  'United States')
SELECT count(*) FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country  =  'United States') AND src_apid IN (SELECT apid FROM airports WHERE country  =  'United States')
SELECT rid FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country  =  'United States') AND src_apid IN (SELECT apid FROM airports WHERE country  =  'United States')
Final question: Find the id of routes whose source and destination airports are in the United States.
Final SQL: SELECT rid FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country  =  'United States') AND src_apid IN (SELECT apid FROM airports WHERE country  =  'United States')
Database: flight_4
Question sequence:
show info of all airlines.
find the number of routes for each airline. Show their names.
which airline has the most routes?
SQL query sequence:
SELECT * FROM airlines
SELECT count(*), T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid GROUP BY T1.name
SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1
Final question: Find the name of airline which runs the most number of routes.
Final SQL: SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1
Database: flight_4
Question sequence:
show all airports in China.
which one is listed as the source airport of the most routes?
SQL query sequence:
SELECT * FROM airports WHERE country  =  'China'
SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid WHERE T1.country  =  'China' GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1
Final question: Find the busiest source airport that runs most number of routes in China.
Final SQL: SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid WHERE T1.country  =  'China' GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1
Database: store_1
Question sequence:
Show me all the information from invoices!
What is the country with the least number of invoices?
How about the one with the most!
How about the top 5?
SQL query sequence:
Select * from invoices
SELECT billing_country ,  COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) ASC LIMIT 1;
SELECT billing_country ,  COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) DESC LIMIT 1;
SELECT billing_country ,  COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) DESC LIMIT 5;
Final question: A list of the top 5 countries by number of invoices. List country name and number of invoices.
Final SQL: SELECT billing_country ,  COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) DESC LIMIT 5;
Database: store_1
Question sequence:
Show me the number of invoices by country!
What is the total invoice for each!
Can you show me this sorted from greatest to least by total invoice size!
Now, show me just the billing country and total for the top 8!
SQL query sequence:
SELECT billing_country,  Count(*) FROM invoices GROUP BY billing_country;
SELECT billing_country,  Count(*), SUM(total) FROM invoices GROUP BY billing_country;
SELECT billing_country,  Count(*), SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC;
SELECT billing_country ,  SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;
Final question: A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size.
Final SQL: SELECT billing_country ,  SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;
Database: store_1
Question sequence:
Can you show me the total invoice size per country!
Instead, display the average per country!
Just, show the top 15 by average invoice size.
Actually, just list the top 10!
SQL query sequence:
SELECT billing_country ,  sum(total) FROM invoices GROUP BY billing_country;
SELECT billing_country ,  AVG(total) FROM invoices GROUP BY billing_country;
SELECT billing_country ,  AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 15;
SELECT billing_country ,  AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;
Final question: A list of the top 10 countries by average invoice size. List country name and average invoice size.
Final SQL: SELECT billing_country ,  AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;
Database: store_1
Question sequence:
Show all the ids, customer ids, and invoice dates from invoices.
Could you show me them in order of most recently purchased?
Also include the customer names of each purchase!!
Show just the first name and last names of the 5 most recent purchases.
SQL query sequence:
Select id, customer_id, invoice_date from invoices
SELECT id, Customer_id, invoice_date FROM invoices ORDER BY invoice_date DESC;
SELECT T1.first_name ,  T1.last_name, T2.id, T2.Customer_id, T2.invoice_date FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id ORDER BY T2.invoice_date DESC;
SELECT T1.first_name ,  T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id ORDER BY T2.invoice_date DESC LIMIT 5;
Final question: Find out 5 customers who most recently purchased something. List customers' first and last name.
Final SQL: SELECT T1.first_name ,  T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id ORDER BY T2.invoice_date DESC LIMIT 5;
Database: store_1
Question sequence:
How many orders have each customer created by customer name?
Show the entry with the lowest?
How about the highest!
How about the top 10!
SQL query sequence:
SELECT T1.first_name ,  T1.last_name ,  COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id;
SELECT T1.first_name ,  T1.last_name ,  COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id ORDER BY COUNT(*) ASC LIMIT 1;
SELECT T1.first_name ,  T1.last_name ,  COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1;
SELECT T1.first_name ,  T1.last_name ,  COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10;
Final question: Find out the top 10 customers by total number of orders. List customers' first and last name and the number of total orders.
Final SQL: SELECT T1.first_name ,  T1.last_name ,  COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10;
Database: store_1
Question sequence:
Show all the customer ids, and names!
How any invoices do each of them have?
What are their total gross sales?
Show just the names of the customers, and their total gross sales for the top 10 in gross sales!
SQL query sequence:
SELECT id, first_name, last_name FROM customers
SELECT T1.id, T1.first_name ,  T1.last_name , count(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id;
SELECT T1.id, T1.first_name ,  T1.last_name , count(*), SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id;
SELECT T1.first_name ,  T1.last_name ,  SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10;
Final question: List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.
Final SQL: SELECT T1.first_name ,  T1.last_name ,  SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10;
Database: store_1
Question sequence:
How many tracks are there?
What are the names, composers, and genre names of each?
Show how many tracks there are per genre!
Show the genre names, and number of tracks of the top 5 by number of tracks!
SQL query sequence:
Select count(*) from tracks
SELECT T2.name, T2.composer, T1.name FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id  =  T1.id;
SELECT T1.name , count(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id  =  T1.id GROUP BY T1.id;
SELECT T1.name ,  COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id  =  T1.id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 5;
Final question: List the top 5 genres by number of tracks. List genres name and total tracks.
Final SQL: SELECT T1.name ,  COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id  =  T1.id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 5;
Database: store_1
Question sequence:
What are all the albums titles?
Which ones start with A?
Can you order them in alphabetical order?
SQL query sequence:
Select title from albums
SELECT title FROM albums WHERE title LIKE 'A%'
SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;
Final question: List every album whose title starts with A in alphabetical order.
Final SQL: SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;
Database: store_1
Question sequence:
What are the invoices of each customer?
Show me the names of the customers with the top 15 totals!
How about the bottom 15!
How about the bottom 10!
SQL query sequence:
SELECT *, T2.total FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id;
SELECT T1.first_name ,  T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id ORDER BY total DESC LIMIT 15;
SELECT T1.first_name ,  T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id ORDER BY total LIMIT 15;
SELECT T1.first_name ,  T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id ORDER BY total LIMIT 10;
Final question: List the customers first and last name of 10 least expensive invoices.
Final SQL: SELECT T1.first_name ,  T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id ORDER BY total LIMIT 10;
Database: store_1
Question sequence:
What are the different cities, and states that have invoices?
What are the number of invoices for each city and state?
Also provide the total invoice!
Can you how just the total invoice for the city Chicago in state IL?
SQL query sequence:
SELECT distinct billing_city, billing_state FROM invoices;
SELECT billing_city, billing_state, count(*) FROM invoices group by billing_city, billing_state;
SELECT billing_city, billing_state, count(*), sum(total) FROM invoices group by billing_city, billing_state;
SELECT sum(total) FROM invoices WHERE billing_city  =  "Chicago" AND billing_state  =  "IL";
Final question: List total amount of  invoice from Chicago, IL.
Final SQL: SELECT sum(total) FROM invoices WHERE billing_city  =  "Chicago" AND billing_state  =  "IL";
Database: store_1
Question sequence:
Show all the invoices for the city Chicago in the state Illinois!
What is the total invoice?
How about the number of different customers?
How about the number of invoices?
SQL query sequence:
SELECT * FROM invoices WHERE billing_city  =  "Chicago" AND billing_state  =  "IL";
SELECT sum(total) FROM invoices WHERE billing_city  =  "Chicago" AND billing_state  =  "IL";
SELECT count(distinct customer_id) FROM invoices WHERE billing_city  =  "Chicago" AND billing_state  =  "IL";
SELECT COUNT(*) FROM invoices WHERE billing_city  =  "Chicago" AND billing_state  =  "IL";
Final question: List the number of invoices from Chicago, IL.
Final SQL: SELECT COUNT(*) FROM invoices WHERE billing_city  =  "Chicago" AND billing_state  =  "IL";
Database: store_1
Question sequence:
Show me all the ids, country and states for all the invoices!
Show me only those from the US?
What are the different states these comes from?
How many USA invoices are from each of them!
SQL query sequence:
SELECT id, billing_country, billing_state FROM invoices;
SELECT id, billing_country, billing_state FROM invoices WHERE billing_country  =  "USA";
SELECT distinct billing_state FROM invoices WHERE billing_country  =  "USA";
SELECT billing_state,  COUNT(*) FROM invoices WHERE billing_country  =  "USA" GROUP BY billing_state;
Final question: List the number of invoices from the US, grouped by state.
Final SQL: SELECT billing_state ,  COUNT(*) FROM invoices WHERE billing_country  =  "USA" GROUP BY billing_state;
Database: store_1
Question sequence:
What are the different states in the US that have invoices?
Which one has the least number of invoices?
How about the most?
SQL query sequence:
SELECT distinct billing_state FROM invoices WHERE billing_country  =  "USA";
SELECT billing_state ,  COUNT(*) FROM invoices WHERE billing_country  =  "USA" GROUP BY billing_state ORDER BY COUNT(*) ASC LIMIT 1;
SELECT billing_state ,  COUNT(*) FROM invoices WHERE billing_country  =  "USA" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1;
Final question: List the state in the US with the most invoices.
Final SQL: SELECT billing_state ,  COUNT(*) FROM invoices WHERE billing_country  =  "USA" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1;
Database: store_1
Question sequence:
Show me all the information about the invoices in California!
Actually just show the billing_state, billing_city, and billing_country.
Can you show the billing_state and the total invoice of these?
Also provide the number of invoices.
SQL query sequence:
SELECT * FROM invoices WHERE billing_state  =  "CA";
SELECT billing_state, billing_city, billing_country FROM invoices WHERE billing_state  =  "CA";
SELECT billing_state, SUM(total) FROM invoices WHERE billing_state  =  "CA";
SELECT billing_state,  COUNT(*) ,  SUM(total) FROM invoices WHERE billing_state  =  "CA";
Final question: List the number of invoices and the invoice total from California.
Final SQL: SELECT billing_state ,  COUNT(*) ,  SUM(total) FROM invoices WHERE billing_state  =  "CA";
Database: store_1
Question sequence:
How many different albums are there?
What are the titles of the albums?
What are the names of the artists for each!
Show me only the album titles by the artist named Aerosmith!
SQL query sequence:
SELECT count(*) FROM albums;
SELECT title FROM albums;
SELECT T1.title, T2.name FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id;
SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON  T1.artist_id = T2.id WHERE T2.name = "Aerosmith";
Final question: List Aerosmith's albums.
Final SQL: SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON  T1.artist_id = T2.id WHERE T2.name = "Aerosmith";
Database: store_1
Question sequence:
How many albums are there?
What are they?
Which ones are made by Billy Cobham?
How many are there?
SQL query sequence:
Select count(*) from albums
Select * from albums
SELECT * FROM albums AS T1 JOIN artists AS T2 ON  T1.artist_id = T2.id WHERE T2.name = "Billy Cobham";
SELECT count(*) FROM albums AS T1 JOIN artists AS T2 ON  T1.artist_id = T2.id WHERE T2.name = "Billy Cobham";
Final question: How many albums does Billy Cobham has?
Final SQL: SELECT count(*) FROM albums AS T1 JOIN artists AS T2 ON  T1.artist_id = T2.id WHERE T2.name = "Billy Cobham";
Database: store_1
Question sequence:
How many customers have the first name Eduardo and last name Martins?
Show me all his customer information!
Just show the company!
SQL query sequence:
SELECT count(*) FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";
SELECT * FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";
SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";
Final question: Eduardo Martins is a customer at which company?
Final SQL: SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";
Database: store_1
Question sequence:
Show me the id of customer with first name Astrid, and last name Gruber!
What is her address?
How about her company?
Just show me her email and phone number?
SQL query sequence:
SELECT id FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
SELECT address FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
SELECT company FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
SELECT email ,  phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
Final question: What is Astrid Gruber's email and phone number?
Final SQL: SELECT email ,  phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
Database: store_1
Question sequence:
How many different countries are the customers from?
What are they?
Show the customer names for each!
Which country has name Roberto Almeida?
SQL query sequence:
Select count(distinct country) from customers;
SELECT distinct country FROM customers;
SELECT country, first_name, last_name FROM customers;
SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida";
Final question: What country does Roberto Almeida live?
Final SQL: SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida";
Database: store_1
Question sequence:
How many different artists are there?
What are their names?
Show all the album titles for the one named Led!
SQL query sequence:
Select count(*) from artists
SELECT name FROM artists
SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id  =  T2.artist_id WHERE T1.name LIKE '%Led%'
Final question: List the name of albums that are released by artist whose name has 'Led'
Final SQL: SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id  =  T2.artist_id WHERE T1.name LIKE '%Led%'
Database: store_1
Question sequence:
What is the title of the employee with first name Steve and last name Johnson?
Who does he report to?
What customers does he support?
How many are there?
SQL query sequence:
Select title from employees WHERE first_name = "Steve" AND last_name = "Johnson";
Select T2.first_name, T2.last_name from employees as T1 JOIN employees as T2 on T1.reports_to = T2.id  WHERE T1.first_name = "Steve" AND T1.last_name = "Johnson";
SELECT T2.first_name, T2.last_name FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = "Steve" AND T1.last_name = "Johnson";
SELECT count(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = "Steve" AND T1.last_name = "Johnson";
Final question: How many customers does Steve Johnson support?
Final SQL: SELECT count(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = "Steve" AND T1.last_name = "Johnson";
Database: store_1
Question sequence:
Tell me the phone number and email of employee named Nancy Edwards?
What is her birth date?
How about her address?
Show her title, phone number, and hire date!
SQL query sequence:
SELECT phone ,  email FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
SELECT birth_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
SELECT title ,  phone ,  hire_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Final question: What is the title, phone and hire date of Nancy Edwards?
Final SQL: SELECT title ,  phone ,  hire_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Database: store_1
Question sequence:
What is the title of Nancy Edwards?
Who does she report to?
How many report to her?
What are their names?
SQL query sequence:
Select title from employees WHERE first_name = "Nancy" AND last_name = "Edwards";
SELECT T2.first_name, T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.reports_to = T2.id WHERE T1.first_name = "Nancy" AND T1.last_name = "Edwards";
SELECT count(*) FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = "Nancy" AND T1.last_name = "Edwards";
SELECT T2.first_name , T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = "Nancy" AND T1.last_name = "Edwards";
Final question: find the full name of employees who report to Nancy Edwards?
Final SQL: SELECT T2.first_name , T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = "Nancy" AND T1.last_name = "Edwards";
Database: store_1
Question sequence:
Show all the employee ids and addresses!
Order by country, state, and city!
Also provide employee name!
Just show the address of customer named Nancy Edwards!
SQL query sequence:
SELECT id, address FROM employees;
SELECT id, address FROM employees order by country, state, city;
SELECT first_name, last_name, id, address FROM employees order by country, state, city;
SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Final question: What is the address of employee Nancy Edwards?
Final SQL: SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Database: store_1
Question sequence:
Who are the employees that actually support customers?
How about the most?
What is the name of the employee that supports this many!
SQL query sequence:
SELECT T1.first_name, T2.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id  =  T2.support_rep_id
SELECT count(*) FROM employees AS T1 JOIN customers AS T2 ON T1.id  =  T2.support_rep_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
SELECT T1.first_name , T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id  =  T2.support_rep_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
Final question: Find the full name of employee who supported the most number of customers.
Final SQL: SELECT T1.first_name , T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id  =  T2.support_rep_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1