aherntech/sparc huggingface dataset:
Database: music_2
Question sequence:
Which vocal type does the musician with first name "Solveig" play?
Which one did that musician play in a song called "A Bar in Amsterdam"?
SQL query sequence:
SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid JOIN band AS T3 ON T1.bandmate  =  T3.id WHERE T3.firstname  =  "Solveig"
SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid JOIN band AS T3 ON T1.bandmate  =  T3.id WHERE T3.firstname  =  "Solveig" AND T2.title  =  "A Bar In Amsterdam"
Final question: Which vocal type did the musician with first name "Solveig" played in the song with title "A Bar in Amsterdam"?
Final SQL: SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid JOIN band AS T3 ON T1.bandmate  =  T3.id WHERE T3.firstname  =  "Solveig" AND T2.title  =  "A Bar In Amsterdam"
Database: music_2
Question sequence:
Find songs that have a lead vocal.
Find all other songs.
SQL query sequence:
SELECT DISTINCT title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid  =  t2.songid WHERE TYPE  =  "lead"
SELECT DISTINCT title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid  =  t2.songid EXCEPT SELECT t2.title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid  =  t2.songid WHERE TYPE  =  "lead"
Final question: Find all the songs that do not have a lead vocal.
Final SQL: SELECT DISTINCT title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid  =  t2.songid EXCEPT SELECT t2.title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid  =  t2.songid WHERE TYPE  =  "lead"
Database: music_2
Question sequence:
Find me id of the song named "Le Pop".
Who performed that song?
SQL query sequence:
SELECT SongId FROM Songs WHERE Title = "Le Pop"
SELECT T2.firstname ,  T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate  =  T2.id JOIN Songs AS T3 ON T3.SongId  =  T1.SongId WHERE T3.Title  =  "Le Pop"
Final question: Who performed the song named "Le Pop"?
Final SQL: SELECT T2.firstname ,  T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate  =  T2.id JOIN Songs AS T3 ON T3.SongId  =  T1.SongId WHERE T3.Title  =  "Le Pop"
Database: music_2
Question sequence:
What instrument is used in the song "Badlands"?
Which instrument did the musician with last name "Heilo" use in that song?
SQL query sequence:
SELECT T4.instrument FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate  =  T2.id JOIN Songs AS T3 ON T3.SongId  =  T1.SongId JOIN Instruments AS T4 ON T4.songid  =  T3.songid AND T4.bandmateid  =  T2.id WHERE T3.title  =  "Badlands"
SELECT T4.instrument FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate  =  T2.id JOIN Songs AS T3 ON T3.SongId  =  T1.SongId JOIN Instruments AS T4 ON T4.songid  =  T3.songid AND T4.bandmateid  =  T2.id WHERE T2.lastname  =  "Heilo" AND T3.title  =  "Badlands"
Final question: What instrument did the musician with last name "Heilo" use in the song "Badlands"?
Final SQL: SELECT T4.instrument FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate  =  T2.id JOIN Songs AS T3 ON T3.SongId  =  T1.SongId JOIN Instruments AS T4 ON T4.songid  =  T3.songid AND T4.bandmateid  =  T2.id WHERE T2.lastname  =  "Heilo" AND T3.title  =  "Badlands"
Database: music_2
Question sequence:
Show me all distinct instruments used in the song "Badlands".
How many are there?
SQL query sequence:
SELECT DISTINCT instrument FROM instruments AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE title  =  "Badlands"
SELECT count(DISTINCT instrument) FROM instruments AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE title  =  "Badlands"
Final question: How many instruments does the song "Badlands" use?
Final SQL: SELECT count(DISTINCT instrument) FROM instruments AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE title  =  "Badlands"
Database: music_2
Question sequence:
Show me all the bandmates in song "Badlands"
Show me all vocal types used in song "Badlands".
SQL query sequence:
SELECT Bandmate FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE title  =  "Badlands"
SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE title  =  "Badlands"
Final question: What are the vocal types used in song "Badlands"?
Final SQL: SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE title  =  "Badlands"
Database: music_2
Question sequence:
Show me all vocal types used in song "Le Pop".
How many are there?
SQL query sequence:
SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE title  =  "Le Pop"
SELECT count(*) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE title  =  "Le Pop"
Final question: Find the number of vocal types used in song "Le Pop"
Final SQL: SELECT count(*) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE title  =  "Le Pop"
Database: music_2
Question sequence:
Show me all songs with shared vocals.
How many are there?
SQL query sequence:
SELECT DISTINCT title FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE TYPE  =  "shared"
SELECT count(DISTINCT title) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE TYPE  =  "shared"
Final question: How many songs have a shared vocal?
Final SQL: SELECT count(DISTINCT title) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid WHERE TYPE  =  "shared"
Database: music_2
Question sequence:
How many songs do not have a back vocal?
Show me the titles of those songs.
SQL query sequence:
SELECT count(DISTINCT title) FROM vocals AS t1 JOIN songs AS t2 ON t1.songid  =  t2.songid EXCEPT SELECT t2.title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid  =  t2.songid WHERE TYPE  =  "back"
SELECT DISTINCT title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid  =  t2.songid EXCEPT SELECT t2.title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid  =  t2.songid WHERE TYPE  =  "back"
Final question: Find all the songs that do not have a back vocal.
Final SQL: SELECT DISTINCT title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid  =  t2.songid EXCEPT SELECT t2.title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid  =  t2.songid WHERE TYPE  =  "back"
Database: music_2
Question sequence:
Show me all vocal types played by a bandmate with first name "Solveig".
Which one is played the most?
SQL query sequence:
SELECT TYPE FROM vocals AS T1 JOIN band AS T2 ON T1.bandmate  =  T2.id WHERE firstname  =  "Solveig" GROUP BY TYPE
SELECT TYPE FROM vocals AS T1 JOIN band AS T2 ON T1.bandmate  =  T2.id WHERE firstname  =  "Solveig" GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
Final question: Which vocal type has the band mate with first name "Solveig" played the most?
Final SQL: SELECT TYPE FROM vocals AS T1 JOIN band AS T2 ON T1.bandmate  =  T2.id WHERE firstname  =  "Solveig" GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
Database: music_2
Question sequence:
Which vocal type is played in the song "Der Kapitan"?
Which vocal type did the musician with last name "Heilo" play?
SQL query sequence:
SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid JOIN band AS T3 ON T1.bandmate  =  T3.id WHERE T2.title  =  "Der Kapitan"
SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid JOIN band AS T3 ON T1.bandmate  =  T3.id WHERE T3.lastname  =  "Heilo" AND T2.title  =  "Der Kapitan"
Final question: Which vocal type did the musician with last name "Heilo" played in the song with title "Der Kapitan"?
Final SQL: SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid  =  T2.songid JOIN band AS T3 ON T1.bandmate  =  T3.id WHERE T3.lastname  =  "Heilo" AND T2.title  =  "Der Kapitan"
Database: music_2
Question sequence:
Which band mate performed in most songs? Show me the last name.
Show the first name.
SQL query sequence:
SELECT t2.lastname FROM Performance AS t1 JOIN Band AS t2 ON t1.bandmate  =  t2.id JOIN Songs AS T3 ON T3.SongId  =  T1.SongId GROUP BY firstname ORDER BY count(*) DESC LIMIT 1
SELECT t2.firstname FROM Performance AS t1 JOIN Band AS t2 ON t1.bandmate  =  t2.id JOIN Songs AS T3 ON T3.SongId  =  T1.SongId GROUP BY firstname ORDER BY count(*) DESC LIMIT 1
Final question: Find the first name of the band mate that has performed in most songs.
Final SQL: SELECT t2.firstname FROM Performance AS t1 JOIN Band AS t2 ON t1.bandmate  =  t2.id JOIN Songs AS T3 ON T3.SongId  =  T1.SongId GROUP BY firstname ORDER BY count(*) DESC LIMIT 1
Database: music_2
Question sequence:
Which vocal type has the band mate with first name "Marianne" played?
Which one did she play the most?
SQL query sequence:
SELECT TYPE FROM vocals AS T1 JOIN band AS T2 ON T1.bandmate  =  T2.id WHERE firstname  =  "Marianne" GROUP BY TYPE
SELECT TYPE FROM vocals AS T1 JOIN band AS T2 ON T1.bandmate  =  T2.id WHERE firstname  =  "Marianne" GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
Final question: Which vocal type has the band mate with first name "Marianne" played the most?
Final SQL: SELECT TYPE FROM vocals AS T1 JOIN band AS T2 ON T1.bandmate  =  T2.id WHERE firstname  =  "Marianne" GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
Database: music_2
Question sequence:
Which bandmates are performing in the song "Der Kapitan"? Show the first name and last name.
Who plays in the back stage position? Show first and last names.
SQL query sequence:
SELECT T2.firstname ,  T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate  =  T2.id JOIN Songs AS T3 ON T3.SongId  =  T1.SongId WHERE T3.Title  =  "Der Kapitan"
SELECT T2.firstname ,  T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate  =  T2.id JOIN Songs AS T3 ON T3.SongId  =  T1.SongId WHERE T3.Title  =  "Der Kapitan" AND T1.StagePosition  =  "back"
Final question: Who is performing in the back stage position for the song "Der Kapitan"? Show the first name and last name.
Final SQL: SELECT T2.firstname ,  T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate  =  T2.id JOIN Songs AS T3 ON T3.SongId  =  T1.SongId WHERE T3.Title  =  "Der Kapitan" AND T1.StagePosition  =  "back"
Database: music_2
Question sequence:
How many songs are there in album "A Kiss Before You Go: Live in Hamburg"?
What are those songs? Show me the title.
SQL query sequence:
SELECT count(T3.title) FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid  =  T2.albumid JOIN songs AS T3 ON T2.songid  =  T3.songid WHERE T1.title  =  "A Kiss Before You Go: Live in Hamburg"
SELECT T3.title FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid  =  T2.albumid JOIN songs AS T3 ON T2.songid  =  T3.songid WHERE T1.title  =  "A Kiss Before You Go: Live in Hamburg"
Final question: What are the songs in album "A Kiss Before You Go: Live in Hamburg"?
Final SQL: SELECT T3.title FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid  =  T2.albumid JOIN songs AS T3 ON T2.songid  =  T3.songid WHERE T1.title  =  "A Kiss Before You Go: Live in Hamburg"
Database: music_2
Question sequence:
How many songs are in albums under label "Universal Music Group"?
Show me the titles of those songs.
SQL query sequence:
SELECT count(T3.title) FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid  =  T2.albumid JOIN songs AS T3 ON T2.songid  =  T3.songid WHERE t1.label  =  "Universal Music Group"
SELECT T3.title FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid  =  T2.albumid JOIN songs AS T3 ON T2.songid  =  T3.songid WHERE t1.label  =  "Universal Music Group"
Final question: What are all the songs in albums under label "Universal Music Group"?
Final SQL: SELECT T3.title FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid  =  T2.albumid JOIN songs AS T3 ON T2.songid  =  T3.songid WHERE t1.label  =  "Universal Music Group"
Database: soccer_1
Question sequence:
Tell me the country of the league named "France Ligue 1".
How about that of the league named "Poland Ekstraklasa"
How many leagues are there in England?
SQL query sequence:
SELECT T1.name FROM Country AS T1 JOIN League AS T2 ON T1.id  =  T2.country_id WHERE T2.name  =  "France Ligue 1"
SELECT T1.name FROM Country AS T1 JOIN League AS T2 ON T1.id  =  T2.country_id WHERE T2.name  =  "Poland Ekstraklasa"
SELECT count(*) FROM Country AS T1 JOIN League AS T2 ON T1.id  =  T2.country_id WHERE T1.name  =  "England"
Final question: How many leagues are there in England?
Final SQL: SELECT count(*) FROM Country AS T1 JOIN League AS T2 ON T1.id  =  T2.country_id WHERE T1.name  =  "England"
Database: soccer_1
Question sequence:
Tell me the birthday of the player named Aaron Hunt.
How about his weight?
tell me the maximum and minimum weight of all players.
SQL query sequence:
SELECT birthday FROM Player WHERE player_name = "Aaron Hunt"
SELECT weight FROM Player WHERE player_name = "Aaron Hunt"
SELECT max(weight) ,  min(weight) FROM Player
Final question: What is the maximum and minimum weight of all players?
Final SQL: SELECT max(weight) ,  min(weight) FROM Player
Database: soccer_1
Question sequence:
Tell me the potential of the player named "Abasse Ba".
How about his finishing times?
list all player names who have an overall rating higher than the average.
SQL query sequence:
SELECT T2.potential FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T1.player_name = "Abasse Ba"
SELECT T2.finishing FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T1.player_name = "Abasse Ba"
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating  >  ( SELECT avg(overall_rating) FROM Player_Attributes )
Final question: List all player names who have an overall rating higher than the average.
Final SQL: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating  >  ( SELECT avg(overall_rating) FROM Player_Attributes )
Database: soccer_1
Question sequence:
What are the names of players who have the best crossing?
What are the names of players who have the best short passing?
What are the names of players who have the best dribbling?
SQL query sequence:
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.crossing  =  ( SELECT max(crossing) FROM Player_Attributes)
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.short_passing  =  ( SELECT max(short_passing) FROM Player_Attributes)
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.dribbling  =  ( SELECT max(dribbling) FROM Player_Attributes)
Final question: What are the names of players who have the best dribbling?
Final SQL: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.dribbling  =  ( SELECT max(dribbling) FROM Player_Attributes)
Database: soccer_1
Question sequence:
Tell me all the players whose defensive work rate is high.
How about players whose attacking work rate is high?
Tell me the names of all players who have a crossing score higher than 90 and prefer their right foot.
SQL query sequence:
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.defensive_work_rate = "high"
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.defensive_work_rate = "high" AND T2.attacking_work_rate = "high"
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.crossing  >  90 AND T2.preferred_foot  =  "right"
Final question: List the names of all players who have a crossing score higher than 90 and prefer their right foot.
Final SQL: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.crossing  >  90 AND T2.preferred_foot  =  "right"
Database: soccer_1
Question sequence:
Tell me the names of players who have an overall rating larger than 80.
Tell me their preferred foot.
tell me the names of all left-footed players who have overall rating between 85 and 90.
SQL query sequence:
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating  >  80
SELECT DISTINCT T1.player_name, T2.preferred_foot FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating  >  80
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.preferred_foot  =  "left" AND T2.overall_rating  >=  85 AND T2.overall_rating  <=  90
Final question: List the names of all left-footed players who have overall rating between 85 and 90.
Final SQL: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.preferred_foot  =  "left" AND T2.overall_rating  >=  85 AND T2.overall_rating  <=  90
Database: soccer_1
Question sequence:
How many players have an overall rating of 60 or greater?
How many players have potential of 80 or greater?
Of all players with an overall rating greater than 80, how many are right-footed and left-footed?
SQL query sequence:
SELECT COUNT(DISTINCT T1.player_name) FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating  >=  60
SELECT COUNT(DISTINCT T1.player_name) FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.potential  >=  80
SELECT preferred_foot ,  count(*) FROM Player_Attributes WHERE overall_rating  >  80 GROUP BY preferred_foot
Final question: Of all players with an overall rating greater than 80, how many are right-footed and left-footed?
Final SQL: SELECT preferred_foot ,  count(*) FROM Player_Attributes WHERE overall_rating  >  80 GROUP BY preferred_foot
Database: soccer_1
Question sequence:
What is the height of the player named Abdoulaye Toure?
What is his overall rating?
Tell me all of the player ids with a height of at least 180cm and an overall rating higher than 85.
SQL query sequence:
SELECT height FROM Player WHERE player_name = "Abdoulaye Toure"
SELECT T2.overall_rating FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T1.player_name = "Abdoulaye Toure"
SELECT player_api_id FROM Player WHERE height  >=  180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating  >  85
Final question: List all of the player ids with a height of at least 180cm and an overall rating higher than 85.
Final SQL: SELECT player_api_id FROM Player WHERE height  >=  180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating  >  85
Database: soccer_1
Question sequence:
Tell me the birthday of the player named "Aaron Hunt".
What is his preferred foot?
List all of the ids for left-footed players with a height between 180cm and 190cm.
SQL query sequence:
SELECT birthday FROM Player WHERE player_name = "Aaron Hunt"
SELECT T2.preferred_foot FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T1.player_name = "Aaron Hunt"
SELECT player_api_id FROM Player WHERE height  >=  180 AND height  <=  190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot  =  "left"
Final question: List all of the ids for left-footed players with a height between 180cm and 190cm.
Final SQL: SELECT player_api_id FROM Player WHERE height  >=  180 AND height  <=  190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot  =  "left"
Database: soccer_1
Question sequence:
How many players have heading accuracy larger than 70?
Tell me the top three of these?
Who are the top 3 players in terms of overall rating?
SQL query sequence:
SELECT COUNT(DISTINCT T1.player_name) FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id  =  T2.player_api_id WHERE T2.heading_accuracy > 70
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id  =  T2.player_api_id WHERE T2.heading_accuracy > 70 ORDER BY overall_rating DESC LIMIT 3
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id  =  T2.player_api_id ORDER BY overall_rating DESC LIMIT 3
Final question: Who are the top 3 players in terms of overall rating?
Final SQL: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id  =  T2.player_api_id ORDER BY overall_rating DESC LIMIT 3
Database: customer_deliveries
Question sequence:
How many different products are available to order?
Order them by the number of times they have been ordered.
Which has been ordered the greatest number of times?
Only show the name and price.
SQL query sequence:
SELECT count(DISTINCT product_id) FROM products
SELECT * 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(*)
SELECT * 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
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
Final question: Find the name and price of the product that has been ordered the greatest number of times.
Final SQL: 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
Database: customer_deliveries
Question sequence:
What is the average price of all products?
Which of the procucts cost more than this?
Which is the name of the most expensive product?
SQL query sequence:
SELECT avg(product_price) FROM products
SELECT * FROM products WHERE product_price > (SELECT avg(product_price) FROM products)
SELECT product_name FROM products ORDER BY product_price DESC LIMIT 1
Final question: Find the name of the most expensive product.
Final SQL: SELECT product_name FROM products ORDER BY product_price DESC LIMIT 1
Database: customer_deliveries
Question sequence:
How many customers have addresses on file?
What different states are they from?
Show all information for customers living in the state of California.
Show the names of all customers except these.
SQL query sequence:
SELECT count(DISTINCT customer_id) FROM customer_addresses AS t1 JOIN addresses AS t2 ON t1.address_id = t2.address_id
SELECT DISTINCT state_province_county FROM addresses
SELECT * 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'
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'
Final question: Find the names of customers who are not living in the state of California.
Final SQL: 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'