aherntech/sparc huggingface dataset:
Database: insurance_fnol
Question sequence:
Find the names of customers who have used both the service "Close a policy" or the service "Upgrade a policy".
How about customers who have used both "Close a policy" and "New policy application"?
SQL query sequence:
SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "Close a policy" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "Upgrade a policy"
SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "Close a policy" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "New policy application"
Final question: Find the names of customers who have used both the service "Close a policy" and the service "New policy application".
Final SQL: SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "Close a policy" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "New policy application"
Database: insurance_fnol
Question sequence:
How many customers are there whose name contains "Diana"?
Show me their IDs
SQL query sequence:
SELECT count(*) FROM customers WHERE customer_name LIKE "%Diana%"
SELECT customer_id FROM customers WHERE customer_name LIKE "%Diana%"
Final question: Find the IDs of customers whose name contains "Diana".
Final SQL: SELECT customer_id FROM customers WHERE customer_name LIKE "%Diana%"
Database: insurance_fnol
Question sequence:
What is the average settlement amount on record?
What are the maximum and minimum?
SQL query sequence:
SELECT avg(settlement_amount) FROM settlements
SELECT max(settlement_amount) ,  min(settlement_amount) FROM settlements
Final question: What are the maximum and minimum settlement amount on record?
Final SQL: SELECT max(settlement_amount) ,  min(settlement_amount) FROM settlements
Database: wine_1
Question sequence:
show all info of wines.
what is their average rated score?
find the name of the lowest rated wine.
what about the highest rated one?
SQL query sequence:
SELECT * FROM WINE
SELECT avg(Score) FROM WINE
SELECT Name FROM WINE ORDER BY Score LIMIT 1
SELECT Name FROM WINE ORDER BY Score DESC LIMIT 1
Final question: What is the name of the highest rated wine?
Final SQL: SELECT Name FROM WINE ORDER BY Score DESC LIMIT 1
Database: wine_1
Question sequence:
what is the name of the highest rated wine?
Which winery is it from?
SQL query sequence:
SELECT Name FROM WINE ORDER BY Score DESC LIMIT 1
SELECT Winery FROM WINE ORDER BY SCORE DESC LIMIT 1
Final question: Which winery is the wine that has the highest score from?
Final SQL: SELECT Winery FROM WINE ORDER BY SCORE DESC LIMIT 1
Database: wine_1
Question sequence:
how many wines are there?
how many are made of red color grape?
only show their names.
SQL query sequence:
SELECT count(*) FROM WINE
SELECT count(*) FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "Red"
SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "Red"
Final question: List the names of all distinct wines that are made of red color grape.
Final SQL: SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "Red"
Database: wine_1
Question sequence:
what are all appellations?
which of them are in the North Coast area?
Find the names of all distinct wines from those appellations.
SQL query sequence:
SELECT Appelation FROM APPELLATIONS
SELECT Appelation FROM APPELLATIONS WHERE Area  =  "North Coast"
SELECT DISTINCT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.Area  =  "North Coast"
Final question: Find the names of all distinct wines that have appellations in North Coast area.
Final SQL: SELECT DISTINCT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.Area  =  "North Coast"
Database: wine_1
Question sequence:
what appellations does Sonoma County have?
Give me the name of wines that are produced by them.
what is their average price?
SQL query sequence:
SELECT Appelation FROM APPELLATIONS WHERE County  =  "Sonoma"
SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  "Sonoma"
SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  "Sonoma"
Final question: Give me the average prices of wines that are produced by appellations in Sonoma County.
Final SQL: SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  "Sonoma"
Database: wine_1
Question sequence:
what are all the different colors of grapes?
What are the names of wines that are made of white color grapes?
also show their scores.
SQL query sequence:
SELECT distinct Color FROM GRAPES
SELECT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "White"
SELECT T2.Name, T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "White"
Final question: What are the names and scores of wines that are made of white color grapes?
Final SQL: SELECT T2.Name, T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "White"
Database: wine_1
Question sequence:
how many wines were produced before the year of 2005?
how many of them were made by appelations in the Central Coast area?
what is the maximum price among them?
SQL query sequence:
SELECT count(*) FROM WINE WHERE year  <  2005
SELECT count(*) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.Area  =  "Central Coast" AND T2.year  <  2005
SELECT max(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.Area  =  "Central Coast" AND T2.year  <  2005
Final question: Find the maximum price of wines from the appelations in Central Coast area and produced before the year of 2005.
Final SQL: SELECT max(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.Area  =  "Central Coast" AND T2.year  <  2005
Database: wine_1
Question sequence:
show the name of the wines with scores higher than 90.
among them, which are made from white grapes?
what different grape varieties were they made from?
SQL query sequence:
SELECT Name FROM WINE WHERE Score > 90
SELECT T2.name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "White" AND T2.score  >  90
SELECT DISTINCT T1.Grape FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "White" AND T2.score  >  90
Final question: Find the different white color grapes that produced wines with scores higher than 90.
Final SQL: SELECT DISTINCT T1.Grape FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "White" AND T2.score  >  90
Database: wine_1
Question sequence:
how many wines are there?
how many of them have a price higher than 50?
find their names.
which are made from red colored grapes?
SQL query sequence:
SELECT count(*) FROM WINE
SELECT count(*) FROM WINE WHERE price > 50
SELECT name FROM WINE WHERE price > 50
SELECT T2.Name FROM Grapes AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "Red" AND T2.price  >  50
Final question: What are the wines that have prices higher than 50 and made of Red color grapes?
Final SQL: SELECT T2.Name FROM Grapes AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "Red" AND T2.price  >  50
Database: wine_1
Question sequence:
Find the name of the wines that have prices lower than 50.
which ones have appellations from Monterey county?
SQL query sequence:
SELECT name FROM WINE WHERE price < 50
SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  "Monterey" AND T2.price  <  50
Final question: What are the wines that have prices lower than 50 and have appelations in Monterey county?
Final SQL: SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  "Monterey" AND T2.price  <  50
Database: wine_1
Question sequence:
find the lowest price of all wines.
how about among those from John Anthony winery?
Find the distinct names of all wines that have prices higher than that.
SQL query sequence:
SELECT min(Price) FROM WINE
SELECT min(Price) FROM wine WHERE Winery  =  "John Anthony"
SELECT DISTINCT Name FROM WINE WHERE Price  >  (SELECT min(Price) FROM wine WHERE Winery  =  "John Anthony")
Final question: Find the distinct names of all wines that have prices higher than some wines from John Anthony winery.
Final SQL: SELECT DISTINCT Name FROM WINE WHERE Price  >  (SELECT min(Price) FROM wine WHERE Winery  =  "John Anthony")
Database: wine_1
Question sequence:
how many wines were produced before the year of 2010?
which appellation produced the highest number of these?
What is the area where that appellation is from?
SQL query sequence:
SELECT count(*) FROM WINE WHERE year  <  2010
SELECT Appelation FROM WINE WHERE year  <  2010 GROUP BY Appelation ORDER BY count(*) DESC LIMIT 1
SELECT T1.Area FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation GROUP BY T2.Appelation HAVING T2.year  <  2010 ORDER BY count(*) DESC LIMIT 1
Final question: What is the area of the appelation that produces the highest number of wines before the year of 2010?
Final SQL: SELECT T1.Area FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation GROUP BY T2.Appelation HAVING T2.year  <  2010 ORDER BY count(*) DESC LIMIT 1
Database: wine_1
Question sequence:
what are all different colors of grapes?
which one produces the wines with the highest average price?
SQL query sequence:
SELECT distinct Color FROM GRAPES
SELECT T1.Color FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape GROUP BY T2.Grape ORDER BY AVG(Price) DESC LIMIT 1
Final question: What is the color of the grape whose wine products have the highest average price?
Final SQL: SELECT T1.Color FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape GROUP BY T2.Grape ORDER BY AVG(Price) DESC LIMIT 1
Database: wine_1
Question sequence:
Find the distinct names of wines produced before the year of 2000.
also list the different names of wines produced after 2010.
SQL query sequence:
SELECT DISTINCT Name FROM WINE WHERE YEAR  <  2000
SELECT DISTINCT Name FROM WINE WHERE YEAR  <  2000 OR YEAR  >  2010
Final question: Find the distinct names of wines produced before the year of 2000 or after the year of 2010.
Final SQL: SELECT DISTINCT Name FROM WINE WHERE YEAR  <  2000 OR YEAR  >  2010
Database: wine_1
Question sequence:
how many wines are made from Zinfandel grapes?
What are the average prices and number of cases for these wines?
only show numbers for the ones produced in 2009.
SQL query sequence:
SELECT count(*) FROM WINE WHERE Grape  =  "Zinfandel"
SELECT AVG(Price) ,  AVG(Cases) FROM WINE WHERE Grape  =  "Zinfandel"
SELECT AVG(Price) ,  AVG(Cases) FROM WINE WHERE YEAR  =  2009 AND Grape  =  "Zinfandel"
Final question: What are the average prices and cases of wines produced in the year of 2009 and made of Zinfandel grape?
Final SQL: SELECT AVG(Price) ,  AVG(Cases) FROM WINE WHERE YEAR  =  2009 AND Grape  =  "Zinfandel"
Database: wine_1
Question sequence:
find the names of all wines produced by the St. Helena appelation.
which one is the most expensive?
what is its price?
also show the best score earned by these wines.
SQL query sequence:
SELECT name FROM WINE WHERE Appelation  =  "St. Helena"
SELECT name FROM WINE WHERE Appelation  =  "St. Helena" ORDER BY price DESC LIMIT 1
SELECT max(Price) FROM WINE WHERE Appelation  =  "St. Helena"
SELECT max(Price) ,  max(Score) FROM WINE WHERE Appelation  =  "St. Helena"
Final question: What are the maximum price and score of wines produced by St. Helena appelation?
Final SQL: SELECT max(Price) ,  max(Score) FROM WINE WHERE Appelation  =  "St. Helena"
Database: wine_1
Question sequence:
how many wines were produced in each year?
What are the maximum price and score of wines in each year?
SQL query sequence:
SELECT count(*), YEAR FROM WINE GROUP BY YEAR
SELECT max(Price) ,  max(Score) ,  YEAR FROM WINE GROUP BY YEAR
Final question: What are the maximum price and score of wines in each year?
Final SQL: SELECT max(Price) ,  max(Score) ,  YEAR FROM WINE GROUP BY YEAR
Database: wine_1
Question sequence:
how many different appellations are there?
what is the average price for wines from each of them?
what are their average scores too?
SQL query sequence:
SELECT count(DISTINCT Appelation) FROM APPELLATIONS
SELECT avg(Price), Appelation FROM WINE GROUP BY Appelation
SELECT avg(Price) ,  avg(Score) ,  Appelation FROM WINE GROUP BY Appelation
Final question: What are the average price and score of wines grouped by appelation?
Final SQL: SELECT avg(Price) ,  avg(Score) ,  Appelation FROM WINE GROUP BY Appelation
Database: wine_1
Question sequence:
what are all the different wineries?
how many are there?
show those that have at least four wines.
SQL query sequence:
SELECT distinct Winery FROM WINE
SELECT count(distinct Winery) FROM WINE
SELECT Winery FROM WINE GROUP BY Winery HAVING count(*)  >=  4
Final question: Find the wineries that have at least four wines.
Final SQL: SELECT Winery FROM WINE GROUP BY Winery HAVING count(*)  >=  4
Database: wine_1
Question sequence:
find the appellations that have more three wines.
how about those that have at most three?
find the countries of these appellations.
SQL query sequence:
SELECT Appelation FROM WINE GROUP BY Appelation HAVING count(*) > 3
SELECT Appelation FROM WINE GROUP BY Appelation HAVING count(*) <= 3
SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation GROUP BY T2.Appelation HAVING count(*)  <=  3
Final question: Find the country of all appelations who have at most three wines.
Final SQL: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation GROUP BY T2.Appelation HAVING count(*)  <=  3
Database: wine_1
Question sequence:
show the name and year of all wines by Brander winery.
which one was made the earliest?
What are the names of all wines that were produced before this year?
SQL query sequence:
SELECT name, year FROM WINE WHERE Winery  =  "Brander"
SELECT name, year FROM WINE WHERE Winery  =  "Brander" ORDER BY year LIMIT 1
SELECT Name FROM WINE WHERE YEAR  <  (SELECT min(YEAR) FROM WINE WHERE Winery  =  "Brander")
Final question: What are the names of wines whose production year are before the year of all wines by Brander winery?
Final SQL: SELECT Name FROM WINE WHERE YEAR  <  (SELECT min(YEAR) FROM WINE WHERE Winery  =  "Brander")
Database: wine_1
Question sequence:
what are the names of wines made during the year 2006?
which one is the most expensive?
what is the price?
What are the names of wines that are more expensive than that?
SQL query sequence:
SELECT name FROM WINE WHERE YEAR  =  2006
SELECT name FROM WINE WHERE YEAR  =  2006 ORDER BY price DESC LIMIT 1
SELECT max(Price) FROM WINE WHERE YEAR  =  2006
SELECT Name FROM WINE WHERE Price  >  (SELECT max(Price) FROM WINE WHERE YEAR  =  2006)
Final question: What are the names of wines that are more expensive than all wines made in the year 2006?
Final SQL: SELECT Name FROM WINE WHERE Price  >  (SELECT max(Price) FROM WINE WHERE YEAR  =  2006)
Database: wine_1
Question sequence:
how many wines are made of white colored grapes?
which winery produced the greatest number of these wines?
how the top 3 wineries?
SQL query sequence:
SELECT count(*) FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE  =  T2.GRAPE WHERE T1.Color  =  "White"
SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE  =  T2.GRAPE WHERE T1.Color  =  "White" GROUP BY T2.Winery ORDER BY count(*) DESC LIMIT 1
SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE  =  T2.GRAPE WHERE T1.Color  =  "White" GROUP BY T2.Winery ORDER BY count(*) DESC LIMIT 3
Final question: Find the top 3 wineries with the greatest number of wines made of white color grapes.
Final SQL: SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE  =  T2.GRAPE WHERE T1.Color  =  "White" GROUP BY T2.Winery ORDER BY count(*) DESC LIMIT 3
Database: wine_1
Question sequence:
how many wines cost more than 100?
List the grape, winery and year of these wines.
order them by their produce year.
SQL query sequence:
SELECT count(*) FROM WINE WHERE Price  >   100
SELECT Grape ,  Winery ,  YEAR FROM WINE WHERE Price  >   100
SELECT Grape ,  Winery ,  YEAR FROM WINE WHERE Price  >   100 ORDER BY YEAR
Final question: List the grape, winery and year of the wines whose price is bigger than 100 ordered by year.
Final SQL: SELECT Grape ,  Winery ,  YEAR FROM WINE WHERE Price  >   100 ORDER BY YEAR
Database: wine_1
Question sequence:
list all info for wines ordered by their names.
only show those whose score is higher than 93.
show their name only.
also give me their grapes and appellations.
SQL query sequence:
SELECT * FROM WINE ORDER BY Name
SELECT * FROM WINE WHERE Score  >  93 ORDER BY Name
SELECT name FROM WINE WHERE Score  >  93 ORDER BY Name
SELECT Grape ,  Appelation ,  Name FROM WINE WHERE Score  >  93 ORDER BY Name
Final question: List the grape, appelation and name of wines whose score is higher than 93 ordered by Name.
Final SQL: SELECT Grape ,  Appelation ,  Name FROM WINE WHERE Score  >  93 ORDER BY Name
Database: wine_1
Question sequence:
how many wines were made after the year 2008?
what are their appellations?
which of them are not in the Central Coast area?
SQL query sequence:
SELECT count(*) FROM WINE WHERE YEAR  >  2008
SELECT Appelation FROM WINE WHERE YEAR  >  2008
SELECT Appelation FROM WINE WHERE YEAR  >  2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area  =  "Central Coast"
Final question: Find the appelations that produce wines after the year of 2008 but not in Central Coast area.
Final SQL: SELECT Appelation FROM WINE WHERE YEAR  >  2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area  =  "Central Coast"
Database: wine_1
Question sequence:
Find the average price of wines.
how about for the wines with appellations from Sonoma county?
what is the average for wines that are not produced from there?
SQL query sequence:
SELECT avg(price) FROM wine
SELECT avg(t2.price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  'Sonoma'
SELECT avg(price) FROM wine WHERE Appelation NOT IN (SELECT T1.Appelation FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  'Sonoma')
Final question: Find the average price of wines that are not produced from Sonoma county.
Final SQL: SELECT avg(price) FROM wine WHERE Appelation NOT IN (SELECT T1.Appelation FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  'Sonoma')
Database: company_office
Question sequence:
Show me the sales for each company!
Also, include the industry they are in!
Which ones are not in the Banking industry?
What are the minimum and maximum sales?
SQL query sequence:
SELECT id, sales_billion FROM Companies
SELECT id, sales_billion, industry FROM Companies
SELECT id, sales_billion, industry FROM Companies WHERE Industry != "Banking"
SELECT max(Sales_billion) ,  min(Sales_billion) FROM Companies WHERE Industry != "Banking"
Final question: What are the maximum and minimum sales of the companies whose industries are not "Banking".
Final SQL: SELECT max(Sales_billion) ,  min(Sales_billion) FROM Companies WHERE Industry != "Banking"
Database: company_office
Question sequence:
Show me the heights of each building.
What is the average height?
How about the max height?
How many stories does the building with this height have?
SQL query sequence:
SELECT id, height FROM buildings
SELECT avg(height) FROM buildings
SELECT height FROM buildings ORDER BY Height DESC LIMIT 1
SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1
Final question: Find the stories of the building with the largest height.
Final SQL: SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1
Database: company_office
Question sequence:
What are names of all the companies?
How many of them have office locations?
Which are they?
Also, provide the names all the office locations for each!
SQL query sequence:
SELECT name FROM companies
SELECT count(*) FROM Office_locations AS T1 JOIN Companies AS T2 ON T1.company_id  =  T2.id
SELECT T2.name FROM Office_locations AS T1 JOIN Companies AS T2 ON T1.company_id  =  T2.id
SELECT T3.name ,  T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id
Final question: List the name of a building along with the name of a company whose office is in the building.
Final SQL: SELECT T3.name ,  T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id
Database: company_office
Question sequence:
What are the names of all the buildings?
Which ones have at least one company office?
How about at least two?
SQL query sequence:
SELECT name FROM buildings
SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id
SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id HAVING COUNT(*)  >  1
Final question: Show the names of the buildings that have more than one company offices.
Final SQL: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id HAVING COUNT(*)  >  1
Database: company_office
Question sequence:
What are the buildings with at least one company office?
How many offices do they each have?
Which one has the most?
What is its name?
SQL query sequence:
SELECT * FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id
SELECT T1.building_id, count(*) FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id
SELECT * FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id ORDER BY COUNT(*) DESC LIMIT 1
SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id ORDER BY COUNT(*) DESC LIMIT 1
Final question: Show the name of the building that has the most company offices.
Final SQL: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id ORDER BY COUNT(*) DESC LIMIT 1