instruction
stringlengths 12
244
| input
stringlengths 27
489
| output
stringlengths 18
557
| text
stringlengths 194
1.14k
|
---|---|---|---|
Which winery is the wine that has the highest score from? | CREATE TABLE WINE (Winery VARCHAR, SCORE VARCHAR) | SELECT TOP 1 Winery FROM WINE ORDER BY SCORE | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Winery VARCHAR, SCORE VARCHAR) Question: Which winery is the wine that has the highest score from? [/INST] SELECT TOP 1 Winery FROM WINE ORDER BY SCORE </s> |
Find the names of all wines produced in 2008. | CREATE TABLE WINE (Name VARCHAR, YEAR VARCHAR) | SELECT Name FROM WINE WHERE YEAR = "2008" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Name VARCHAR, YEAR VARCHAR) Question: Find the names of all wines produced in 2008. [/INST] SELECT Name FROM WINE WHERE YEAR = "2008" </s> |
List the grapes and appelations of all wines. | CREATE TABLE WINE (Grape VARCHAR, Appelation VARCHAR) | SELECT Grape, Appelation FROM WINE | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Grape VARCHAR, Appelation VARCHAR) Question: List the grapes and appelations of all wines. [/INST] SELECT Grape, Appelation FROM WINE </s> |
List the names and scores of all wines. | CREATE TABLE WINE (Name VARCHAR, Score VARCHAR) | SELECT Name, Score FROM WINE | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Name VARCHAR, Score VARCHAR) Question: List the names and scores of all wines. [/INST] SELECT Name, Score FROM WINE </s> |
List the area and county of all appelations. | CREATE TABLE APPELLATIONS (Area VARCHAR, County VARCHAR) | SELECT Area, County FROM APPELLATIONS | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE APPELLATIONS (Area VARCHAR, County VARCHAR) Question: List the area and county of all appelations. [/INST] SELECT Area, County FROM APPELLATIONS </s> |
What are the prices of wines produced before the year of 2010? | CREATE TABLE WINE (Price VARCHAR, YEAR INTEGER) | SELECT Price FROM WINE WHERE YEAR < 2010 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Price VARCHAR, YEAR INTEGER) Question: What are the prices of wines produced before the year of 2010? [/INST] SELECT Price FROM WINE WHERE YEAR < 2010 </s> |
List the names of all distinct wines that have scores higher than 90. | CREATE TABLE WINE (Name VARCHAR, score INTEGER) | SELECT Name FROM WINE WHERE score > 90 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Name VARCHAR, score INTEGER) Question: List the names of all distinct wines that have scores higher than 90. [/INST] SELECT Name FROM WINE WHERE score > 90 </s> |
List the names of all distinct wines that are made of red color grape. | CREATE TABLE GRAPES (Grape VARCHAR, Color VARCHAR); CREATE TABLE WINE (Name VARCHAR, Grape VARCHAR) | SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "Red" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE GRAPES (Grape VARCHAR, Color VARCHAR); CREATE TABLE WINE (Name VARCHAR, Grape VARCHAR) Question: List the names of all distinct wines that are made of red color grape. [/INST] SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "Red" </s> |
Find the names of all distinct wines that have appellations in North Coast area. | CREATE TABLE APPELLATIONs (Appelation VARCHAR, Area VARCHAR); CREATE TABLE WINE (Name VARCHAR, Appelation VARCHAR) | SELECT DISTINCT T2.Name FROM APPELLATIONs AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = "North Coast" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE APPELLATIONs (Appelation VARCHAR, Area VARCHAR); CREATE TABLE WINE (Name VARCHAR, Appelation VARCHAR) Question: Find the names of all distinct wines that have appellations in North Coast area. [/INST] SELECT DISTINCT T2.Name FROM APPELLATIONs AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = "North Coast" </s> |
How many wines are produced at Robert Biale winery? | CREATE TABLE WINE (Winery VARCHAR) | SELECT COUNT(*) FROM WINE WHERE Winery = "Robert Biale" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Winery VARCHAR) Question: How many wines are produced at Robert Biale winery? [/INST] SELECT COUNT(*) FROM WINE WHERE Winery = "Robert Biale" </s> |
How many appelations are in Napa Country? | CREATE TABLE APPELLATIONS (County VARCHAR) | SELECT COUNT(*) FROM APPELLATIONS WHERE County = "Napa" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE APPELLATIONS (County VARCHAR) Question: How many appelations are in Napa Country? [/INST] SELECT COUNT(*) FROM APPELLATIONS WHERE County = "Napa" </s> |
Give me the average prices of wines that are produced by appelations in Sonoma County. | CREATE TABLE WINE (Price INTEGER, Appelation VARCHAR); CREATE TABLE APPELLATIONS (Appelation VARCHAR, County VARCHAR) | SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Sonoma" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Price INTEGER, Appelation VARCHAR); CREATE TABLE APPELLATIONS (Appelation VARCHAR, County VARCHAR) Question: Give me the average prices of wines that are produced by appelations in Sonoma County. [/INST] SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Sonoma" </s> |
What are the names and scores of wines that are made of white color grapes? | CREATE TABLE GRAPES (Grape VARCHAR, Color VARCHAR); CREATE TABLE WINE (Name VARCHAR, Score VARCHAR, Grape VARCHAR) | SELECT T2.Name, T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "White" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE GRAPES (Grape VARCHAR, Color VARCHAR); CREATE TABLE WINE (Name VARCHAR, Score VARCHAR, Grape VARCHAR) Question: What are the names and scores of wines that are made of white color grapes? [/INST] SELECT T2.Name, T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "White" </s> |
Find the maximum price of wins from the appelations in Central Coast area and produced before the year of 2005. | CREATE TABLE APPELLATIONS (Appelation VARCHAR, Area VARCHAR); CREATE TABLE WINE (Price INTEGER, Appelation VARCHAR, year VARCHAR) | 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 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE APPELLATIONS (Appelation VARCHAR, Area VARCHAR); CREATE TABLE WINE (Price INTEGER, Appelation VARCHAR, year VARCHAR) Question: Find the maximum price of wins from the appelations in Central Coast area and produced before the year of 2005. [/INST] 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 </s> |
Find the the grape whose white color grapes are used to produce wines with scores higher than 90. | CREATE TABLE GRAPES (Grape VARCHAR, Color VARCHAR); CREATE TABLE WINE (Grape VARCHAR, score VARCHAR) | 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 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE GRAPES (Grape VARCHAR, Color VARCHAR); CREATE TABLE WINE (Grape VARCHAR, score VARCHAR) Question: Find the the grape whose white color grapes are used to produce wines with scores higher than 90. [/INST] 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 </s> |
What are the wines that have prices higher than 50 and made of Red color grapes? | CREATE TABLE WINE (Name VARCHAR, Grape VARCHAR, price VARCHAR); CREATE TABLE Grapes (Grape VARCHAR, Color VARCHAR) | SELECT T2.Name FROM Grapes AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "Red" AND T2.price > 50 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Name VARCHAR, Grape VARCHAR, price VARCHAR); CREATE TABLE Grapes (Grape VARCHAR, Color VARCHAR) Question: What are the wines that have prices higher than 50 and made of Red color grapes? [/INST] SELECT T2.Name FROM Grapes AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "Red" AND T2.price > 50 </s> |
What are the wines that have prices lower than 50 and have appelations in Monterey county? | CREATE TABLE APPELLATIONS (Appelation VARCHAR, County VARCHAR); CREATE TABLE WINE (Name VARCHAR, Appelation VARCHAR, price VARCHAR) | SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Monterey" AND T2.price < 50 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE APPELLATIONS (Appelation VARCHAR, County VARCHAR); CREATE TABLE WINE (Name VARCHAR, Appelation VARCHAR, price VARCHAR) Question: What are the wines that have prices lower than 50 and have appelations in Monterey county? [/INST] SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Monterey" AND T2.price < 50 </s> |
What are the numbers of wines for different grapes? | CREATE TABLE WINE (Grape VARCHAR) | SELECT COUNT(*), Grape FROM WINE GROUP BY Grape | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Grape VARCHAR) Question: What are the numbers of wines for different grapes? [/INST] SELECT COUNT(*), Grape FROM WINE GROUP BY Grape </s> |
What are the average prices of wines for different years? | CREATE TABLE WINE (YEAR VARCHAR, Price INTEGER) | SELECT AVG(Price), YEAR FROM WINE GROUP BY YEAR | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (YEAR VARCHAR, Price INTEGER) Question: What are the average prices of wines for different years? [/INST] SELECT AVG(Price), YEAR FROM WINE GROUP BY YEAR </s> |
Find the distinct names of all wines that have prices higher than some wines from John Anthony winery. | CREATE TABLE wine (Name VARCHAR, Price INTEGER, Winery VARCHAR); CREATE TABLE WINE (Name VARCHAR, Price INTEGER, Winery VARCHAR) | SELECT DISTINCT Name FROM WINE WHERE Price > (SELECT MIN(Price) FROM wine WHERE Winery = "John Anthony") | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE wine (Name VARCHAR, Price INTEGER, Winery VARCHAR); CREATE TABLE WINE (Name VARCHAR, Price INTEGER, Winery VARCHAR) Question: Find the distinct names of all wines that have prices higher than some wines from John Anthony winery. [/INST] SELECT DISTINCT Name FROM WINE WHERE Price > (SELECT MIN(Price) FROM wine WHERE Winery = "John Anthony") </s> |
List the names of all distinct wines in alphabetical order. | CREATE TABLE WINE (Name VARCHAR) | SELECT DISTINCT Name FROM WINE ORDER BY Name | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Name VARCHAR) Question: List the names of all distinct wines in alphabetical order. [/INST] SELECT DISTINCT Name FROM WINE ORDER BY Name </s> |
List the names of all distinct wines ordered by price. | CREATE TABLE WINE (Name VARCHAR, price VARCHAR) | SELECT DISTINCT Name FROM WINE ORDER BY price | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Name VARCHAR, price VARCHAR) Question: List the names of all distinct wines ordered by price. [/INST] SELECT DISTINCT Name FROM WINE ORDER BY price </s> |
What is the area of the appelation that produces the highest number of wines before the year of 2010? | CREATE TABLE WINE (Appelation VARCHAR, year VARCHAR); CREATE TABLE APPELLATIONS (Area VARCHAR, Appelation VARCHAR) | SELECT TOP 1 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 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Appelation VARCHAR, year VARCHAR); CREATE TABLE APPELLATIONS (Area VARCHAR, Appelation VARCHAR) Question: What is the area of the appelation that produces the highest number of wines before the year of 2010? [/INST] SELECT TOP 1 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 </s> |
What is the color of the grape whose wine products has the highest average price? | CREATE TABLE GRAPES (Color VARCHAR, Grape VARCHAR); CREATE TABLE WINE (Grape VARCHAR) | SELECT TOP 1 T1.Color FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape GROUP BY T2.Grape ORDER BY AVG(Price) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE GRAPES (Color VARCHAR, Grape VARCHAR); CREATE TABLE WINE (Grape VARCHAR) Question: What is the color of the grape whose wine products has the highest average price? [/INST] SELECT TOP 1 T1.Color FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape GROUP BY T2.Grape ORDER BY AVG(Price) DESC </s> |
Find the distinct names of wines produced before the year of 2000 or after the year of 2010. | CREATE TABLE WINE (Name VARCHAR, YEAR VARCHAR) | SELECT DISTINCT Name FROM WINE WHERE YEAR < 2000 OR YEAR > 2010 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Name VARCHAR, YEAR VARCHAR) Question: Find the distinct names of wines produced before the year of 2000 or after the year of 2010. [/INST] SELECT DISTINCT Name FROM WINE WHERE YEAR < 2000 OR YEAR > 2010 </s> |
Find the distinct winery of wines having price between 50 and 100. | CREATE TABLE WINE (Winery VARCHAR, Price INTEGER) | SELECT DISTINCT Winery FROM WINE WHERE Price BETWEEN 50 AND 100 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Winery VARCHAR, Price INTEGER) Question: Find the distinct winery of wines having price between 50 and 100. [/INST] SELECT DISTINCT Winery FROM WINE WHERE Price BETWEEN 50 AND 100 </s> |
What are the average prices and cases of wines produced in the year of 2009 and made of Zinfandel grape? | CREATE TABLE WINE (Price INTEGER, Cases INTEGER, YEAR VARCHAR, Grape VARCHAR) | SELECT AVG(Price), AVG(Cases) FROM WINE WHERE YEAR = 2009 AND Grape = "Zinfandel" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Price INTEGER, Cases INTEGER, YEAR VARCHAR, Grape VARCHAR) Question: What are the average prices and cases of wines produced in the year of 2009 and made of Zinfandel grape? [/INST] SELECT AVG(Price), AVG(Cases) FROM WINE WHERE YEAR = 2009 AND Grape = "Zinfandel" </s> |
What are the maximum price and score of wines produced by St. Helena appelation? | CREATE TABLE WINE (Price INTEGER, Score INTEGER, Appelation VARCHAR) | SELECT MAX(Price), MAX(Score) FROM WINE WHERE Appelation = "St. Helena" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Price INTEGER, Score INTEGER, Appelation VARCHAR) Question: What are the maximum price and score of wines produced by St. Helena appelation? [/INST] SELECT MAX(Price), MAX(Score) FROM WINE WHERE Appelation = "St. Helena" </s> |
What are the maximum price and score of wines in each year? | CREATE TABLE WINE (YEAR VARCHAR, Price INTEGER, Score INTEGER) | SELECT MAX(Price), MAX(Score), YEAR FROM WINE GROUP BY YEAR | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (YEAR VARCHAR, Price INTEGER, Score INTEGER) Question: What are the maximum price and score of wines in each year? [/INST] SELECT MAX(Price), MAX(Score), YEAR FROM WINE GROUP BY YEAR </s> |
What are the average price and score of wines grouped by appelation? | CREATE TABLE WINE (Appelation VARCHAR, Price INTEGER, Score INTEGER) | SELECT AVG(Price), AVG(Score), Appelation FROM WINE GROUP BY Appelation | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Appelation VARCHAR, Price INTEGER, Score INTEGER) Question: What are the average price and score of wines grouped by appelation? [/INST] SELECT AVG(Price), AVG(Score), Appelation FROM WINE GROUP BY Appelation </s> |
Find the wineries that have at least four wines. | CREATE TABLE WINE (Winery VARCHAR) | SELECT Winery FROM WINE GROUP BY Winery HAVING COUNT(*) >= 4 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Winery VARCHAR) Question: Find the wineries that have at least four wines. [/INST] SELECT Winery FROM WINE GROUP BY Winery HAVING COUNT(*) >= 4 </s> |
Find the country of all appelations who have at most three wines. | CREATE TABLE APPELLATIONS (County VARCHAR, Appelation VARCHAR); CREATE TABLE WINE (Appelation VARCHAR) | SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation HAVING COUNT(*) <= 3 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE APPELLATIONS (County VARCHAR, Appelation VARCHAR); CREATE TABLE WINE (Appelation VARCHAR) Question: Find the country of all appelations who have at most three wines. [/INST] SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation HAVING COUNT(*) <= 3 </s> |
What are the names of wines whose production year are before the year of all wines by Brander winery? | CREATE TABLE WINE (Name VARCHAR, YEAR INTEGER, Winery VARCHAR) | SELECT Name FROM WINE WHERE YEAR < (SELECT MIN(YEAR) FROM WINE WHERE Winery = "Brander") | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Name VARCHAR, YEAR INTEGER, Winery VARCHAR) Question: What are the names of wines whose production year are before the year of all wines by Brander winery? [/INST] SELECT Name FROM WINE WHERE YEAR < (SELECT MIN(YEAR) FROM WINE WHERE Winery = "Brander") </s> |
What are the names of wines that are more expensive then all wines made in the year 2006? | CREATE TABLE WINE (Name VARCHAR, Price INTEGER, YEAR VARCHAR) | SELECT Name FROM WINE WHERE Price > (SELECT MAX(Price) FROM WINE WHERE YEAR = 2006) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Name VARCHAR, Price INTEGER, YEAR VARCHAR) Question: What are the names of wines that are more expensive then all wines made in the year 2006? [/INST] SELECT Name FROM WINE WHERE Price > (SELECT MAX(Price) FROM WINE WHERE YEAR = 2006) </s> |
Find the top 3 wineries with the greatest number of wines made of white color grapes. | CREATE TABLE GRAPES (GRAPE VARCHAR, Color VARCHAR); CREATE TABLE WINE (Winery VARCHAR, GRAPE VARCHAR) | SELECT TOP 3 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 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE GRAPES (GRAPE VARCHAR, Color VARCHAR); CREATE TABLE WINE (Winery VARCHAR, GRAPE VARCHAR) Question: Find the top 3 wineries with the greatest number of wines made of white color grapes. [/INST] SELECT TOP 3 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 </s> |
List the grape, winery and year of the wines whose price is bigger than 100 ordered by year. | CREATE TABLE WINE (Grape VARCHAR, Winery VARCHAR, YEAR VARCHAR, Price INTEGER) | SELECT Grape, Winery, YEAR FROM WINE WHERE Price > 100 ORDER BY YEAR | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Grape VARCHAR, Winery VARCHAR, YEAR VARCHAR, Price INTEGER) Question: List the grape, winery and year of the wines whose price is bigger than 100 ordered by year. [/INST] SELECT Grape, Winery, YEAR FROM WINE WHERE Price > 100 ORDER BY YEAR </s> |
List the grape, appelation and name of wines whose score is higher than 93 ordered by Name. | CREATE TABLE WINE (Grape VARCHAR, Appelation VARCHAR, Name VARCHAR, Score INTEGER) | SELECT Grape, Appelation, Name FROM WINE WHERE Score > 93 ORDER BY Name | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Grape VARCHAR, Appelation VARCHAR, Name VARCHAR, Score INTEGER) Question: List the grape, appelation and name of wines whose score is higher than 93 ordered by Name. [/INST] SELECT Grape, Appelation, Name FROM WINE WHERE Score > 93 ORDER BY Name </s> |
Find the appelations that produce wines after the year of 2008 but not in Central Coast area. | CREATE TABLE WINE (Appelation VARCHAR, YEAR INTEGER, Area VARCHAR); CREATE TABLE APPELLATIONS (Appelation VARCHAR, YEAR INTEGER, Area VARCHAR) | SELECT Appelation FROM WINE WHERE YEAR > 2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area = "Central Coast" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Appelation VARCHAR, YEAR INTEGER, Area VARCHAR); CREATE TABLE APPELLATIONS (Appelation VARCHAR, YEAR INTEGER, Area VARCHAR) Question: Find the appelations that produce wines after the year of 2008 but not in Central Coast area. [/INST] SELECT Appelation FROM WINE WHERE YEAR > 2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area = "Central Coast" </s> |
Find the average price of wines that are not produced from Sonoma county. | CREATE TABLE wine (price INTEGER, Appelation VARCHAR); CREATE TABLE APPELLATIONS (Appelation VARCHAR, County VARCHAR); CREATE TABLE WINE (Appelation VARCHAR) | SELECT AVG(price) FROM wine WHERE NOT Appelation IN (SELECT T1.Appelation FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Sonoma') | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE wine (price INTEGER, Appelation VARCHAR); CREATE TABLE APPELLATIONS (Appelation VARCHAR, County VARCHAR); CREATE TABLE WINE (Appelation VARCHAR) Question: Find the average price of wines that are not produced from Sonoma county. [/INST] SELECT AVG(price) FROM wine WHERE NOT Appelation IN (SELECT T1.Appelation FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Sonoma') </s> |
Find the county where produces the most number of wines with score higher than 90. | CREATE TABLE WINE (Appelation VARCHAR, Score INTEGER); CREATE TABLE APPELLATIONS (County VARCHAR, Appelation VARCHAR) | SELECT TOP 1 T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T2.Score > 90 GROUP BY T1.County ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE WINE (Appelation VARCHAR, Score INTEGER); CREATE TABLE APPELLATIONS (County VARCHAR, Appelation VARCHAR) Question: Find the county where produces the most number of wines with score higher than 90. [/INST] SELECT TOP 1 T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T2.Score > 90 GROUP BY T1.County ORDER BY COUNT(*) DESC </s> |
How many train stations are there? | CREATE TABLE station (Id VARCHAR) | SELECT COUNT(*) FROM station | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (Id VARCHAR) Question: How many train stations are there? [/INST] SELECT COUNT(*) FROM station </s> |
Show the name, location, and number of platforms for all stations. | CREATE TABLE station (name VARCHAR, LOCATION VARCHAR, number_of_platforms VARCHAR) | SELECT name, LOCATION, number_of_platforms FROM station | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (name VARCHAR, LOCATION VARCHAR, number_of_platforms VARCHAR) Question: Show the name, location, and number of platforms for all stations. [/INST] SELECT name, LOCATION, number_of_platforms FROM station </s> |
What are all locations of train stations? | CREATE TABLE station (LOCATION VARCHAR) | SELECT DISTINCT LOCATION FROM station | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (LOCATION VARCHAR) Question: What are all locations of train stations? [/INST] SELECT DISTINCT LOCATION FROM station </s> |
Show the names and total passengers for all train stations not in London. | CREATE TABLE station (name VARCHAR, total_passengers VARCHAR, LOCATION VARCHAR) | SELECT name, total_passengers FROM station WHERE LOCATION <> 'London' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (name VARCHAR, total_passengers VARCHAR, LOCATION VARCHAR) Question: Show the names and total passengers for all train stations not in London. [/INST] SELECT name, total_passengers FROM station WHERE LOCATION <> 'London' </s> |
Show the names and main services for train stations that have the top three total number of passengers. | CREATE TABLE station (name VARCHAR, main_services VARCHAR, total_passengers VARCHAR) | SELECT TOP 3 name, main_services FROM station ORDER BY total_passengers DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (name VARCHAR, main_services VARCHAR, total_passengers VARCHAR) Question: Show the names and main services for train stations that have the top three total number of passengers. [/INST] SELECT TOP 3 name, main_services FROM station ORDER BY total_passengers DESC </s> |
What is the average and maximum number of total passengers for train stations in London or Glasgow? | CREATE TABLE station (total_passengers INTEGER, LOCATION VARCHAR) | SELECT AVG(total_passengers), MAX(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (total_passengers INTEGER, LOCATION VARCHAR) Question: What is the average and maximum number of total passengers for train stations in London or Glasgow? [/INST] SELECT AVG(total_passengers), MAX(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow' </s> |
Show all locations and the total number of platforms and passengers for all train stations in each location. | CREATE TABLE station (LOCATION VARCHAR, number_of_platforms INTEGER, total_passengers INTEGER) | SELECT LOCATION, SUM(number_of_platforms), SUM(total_passengers) FROM station GROUP BY LOCATION | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (LOCATION VARCHAR, number_of_platforms INTEGER, total_passengers INTEGER) Question: Show all locations and the total number of platforms and passengers for all train stations in each location. [/INST] SELECT LOCATION, SUM(number_of_platforms), SUM(total_passengers) FROM station GROUP BY LOCATION </s> |
Show all locations that have train stations with at least 15 platforms and train stations with more than 25 total passengers. | CREATE TABLE station (LOCATION VARCHAR, number_of_platforms VARCHAR, total_passengers VARCHAR) | SELECT DISTINCT LOCATION FROM station WHERE number_of_platforms >= 15 AND total_passengers > 25 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (LOCATION VARCHAR, number_of_platforms VARCHAR, total_passengers VARCHAR) Question: Show all locations that have train stations with at least 15 platforms and train stations with more than 25 total passengers. [/INST] SELECT DISTINCT LOCATION FROM station WHERE number_of_platforms >= 15 AND total_passengers > 25 </s> |
Show all locations which don't have a train station with at least 15 platforms. | CREATE TABLE station (LOCATION VARCHAR, number_of_platforms VARCHAR) | SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms >= 15 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (LOCATION VARCHAR, number_of_platforms VARCHAR) Question: Show all locations which don't have a train station with at least 15 platforms. [/INST] SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms >= 15 </s> |
Show the location with most number of train stations. | CREATE TABLE station (LOCATION VARCHAR) | SELECT TOP 1 LOCATION FROM station GROUP BY LOCATION ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (LOCATION VARCHAR) Question: Show the location with most number of train stations. [/INST] SELECT TOP 1 LOCATION FROM station GROUP BY LOCATION ORDER BY COUNT(*) DESC </s> |
Show the name, time, and service for all trains. | CREATE TABLE train (name VARCHAR, TIME VARCHAR, service VARCHAR) | SELECT name, TIME, service FROM train | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE train (name VARCHAR, TIME VARCHAR, service VARCHAR) Question: Show the name, time, and service for all trains. [/INST] SELECT name, TIME, service FROM train </s> |
Show the number of trains | CREATE TABLE train (Id VARCHAR) | SELECT COUNT(*) FROM train | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE train (Id VARCHAR) Question: Show the number of trains [/INST] SELECT COUNT(*) FROM train </s> |
Show the name and service for all trains in order by time. | CREATE TABLE train (name VARCHAR, service VARCHAR, TIME VARCHAR) | SELECT name, service FROM train ORDER BY TIME | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE train (name VARCHAR, service VARCHAR, TIME VARCHAR) Question: Show the name and service for all trains in order by time. [/INST] SELECT name, service FROM train ORDER BY TIME </s> |
Show the station name and number of trains in each station. | CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR) | SELECT T2.name, COUNT(*) FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR) Question: Show the station name and number of trains in each station. [/INST] SELECT T2.name, COUNT(*) FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id </s> |
show the train name and station name for each train. | CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train (name VARCHAR, train_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR, train_id VARCHAR) | SELECT T2.name, T3.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train (name VARCHAR, train_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR, train_id VARCHAR) Question: show the train name and station name for each train. [/INST] SELECT T2.name, T3.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id </s> |
Show all train names and times in stations in London in descending order by train time. | CREATE TABLE train_station (station_id VARCHAR, train_id VARCHAR); CREATE TABLE station (station_id VARCHAR, location VARCHAR); CREATE TABLE train (name VARCHAR, time VARCHAR, train_id VARCHAR) | SELECT T3.name, T3.time FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T2.location = 'London' ORDER BY T3.time DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE train_station (station_id VARCHAR, train_id VARCHAR); CREATE TABLE station (station_id VARCHAR, location VARCHAR); CREATE TABLE train (name VARCHAR, time VARCHAR, train_id VARCHAR) Question: Show all train names and times in stations in London in descending order by train time. [/INST] SELECT T3.name, T3.time FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T2.location = 'London' ORDER BY T3.time DESC </s> |
Show the station name with greatest number of trains. | CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR) | SELECT TOP 1 T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR) Question: Show the station name with greatest number of trains. [/INST] SELECT TOP 1 T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id ORDER BY COUNT(*) DESC </s> |
Show the station name with at least two trains. | CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR) | SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id HAVING COUNT(*) >= 2 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR) Question: Show the station name with at least two trains. [/INST] SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id HAVING COUNT(*) >= 2 </s> |
Show all locations with only 1 station. | CREATE TABLE station (LOCATION VARCHAR) | SELECT LOCATION FROM station GROUP BY LOCATION HAVING COUNT(*) = 1 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (LOCATION VARCHAR) Question: Show all locations with only 1 station. [/INST] SELECT LOCATION FROM station GROUP BY LOCATION HAVING COUNT(*) = 1 </s> |
Show station names without any trains. | CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (name VARCHAR, station_id VARCHAR) | SELECT name FROM station WHERE NOT station_id IN (SELECT station_id FROM train_station) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (name VARCHAR, station_id VARCHAR) Question: Show station names without any trains. [/INST] SELECT name FROM station WHERE NOT station_id IN (SELECT station_id FROM train_station) </s> |
What are the names of the stations which serve both "Ananthapuri Express" and "Guruvayur Express" trains? | CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train (train_id VARCHAR, Name VARCHAR); CREATE TABLE train_station (station_id VARCHAR, train_id VARCHAR) | SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = "Ananthapuri Express" INTERSECT SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = "Guruvayur Express" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train (train_id VARCHAR, Name VARCHAR); CREATE TABLE train_station (station_id VARCHAR, train_id VARCHAR) Question: What are the names of the stations which serve both "Ananthapuri Express" and "Guruvayur Express" trains? [/INST] SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = "Ananthapuri Express" INTERSECT SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = "Guruvayur Express" </s> |
Find the names of the trains that do not pass any station located in London. | CREATE TABLE station (station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR); CREATE TABLE train_station (train_id VARCHAR, station_id VARCHAR); CREATE TABLE train (name VARCHAR, train_id VARCHAR) | SELECT T2.name FROM train_station AS T1 JOIN train AS T2 ON T1.train_id = T2.train_id WHERE NOT T1.station_id IN (SELECT T4.station_id FROM train_station AS T3 JOIN station AS T4 ON T3.station_id = T4.station_id WHERE t4.location = "London") | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR); CREATE TABLE train_station (train_id VARCHAR, station_id VARCHAR); CREATE TABLE train (name VARCHAR, train_id VARCHAR) Question: Find the names of the trains that do not pass any station located in London. [/INST] SELECT T2.name FROM train_station AS T1 JOIN train AS T2 ON T1.train_id = T2.train_id WHERE NOT T1.station_id IN (SELECT T4.station_id FROM train_station AS T3 JOIN station AS T4 ON T3.station_id = T4.station_id WHERE t4.location = "London") </s> |
List the names and locations of all stations ordered by their yearly entry exit and interchange amounts. | CREATE TABLE station (name VARCHAR, LOCATION VARCHAR, Annual_entry_exit VARCHAR, Annual_interchanges VARCHAR) | SELECT name, LOCATION FROM station ORDER BY Annual_entry_exit, Annual_interchanges | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE station (name VARCHAR, LOCATION VARCHAR, Annual_entry_exit VARCHAR, Annual_interchanges VARCHAR) Question: List the names and locations of all stations ordered by their yearly entry exit and interchange amounts. [/INST] SELECT name, LOCATION FROM station ORDER BY Annual_entry_exit, Annual_interchanges </s> |
List all vehicle id | CREATE TABLE Vehicles (vehicle_id VARCHAR) | SELECT vehicle_id FROM Vehicles | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Vehicles (vehicle_id VARCHAR) Question: List all vehicle id [/INST] SELECT vehicle_id FROM Vehicles </s> |
How many vehicle in total? | CREATE TABLE Vehicles (Id VARCHAR) | SELECT COUNT(*) FROM Vehicles | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Vehicles (Id VARCHAR) Question: How many vehicle in total? [/INST] SELECT COUNT(*) FROM Vehicles </s> |
Show the detail of vehicle with id 1. | CREATE TABLE Vehicles (vehicle_details VARCHAR, vehicle_id VARCHAR) | SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Vehicles (vehicle_details VARCHAR, vehicle_id VARCHAR) Question: Show the detail of vehicle with id 1. [/INST] SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1 </s> |
List the first name middle name and last name of all staff. | CREATE TABLE Staff (first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR) | SELECT first_name, middle_name, last_name FROM Staff | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Staff (first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR) Question: List the first name middle name and last name of all staff. [/INST] SELECT first_name, middle_name, last_name FROM Staff </s> |
What is the birthday of the staff member with first name as Janessa and last name as Sawayn? | CREATE TABLE Staff (date_of_birth VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT date_of_birth FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Staff (date_of_birth VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: What is the birthday of the staff member with first name as Janessa and last name as Sawayn? [/INST] SELECT date_of_birth FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn" </s> |
When did the staff member with first name as Janessa and last name as Sawayn join the company? | CREATE TABLE Staff (date_joined_staff VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT date_joined_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Staff (date_joined_staff VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: When did the staff member with first name as Janessa and last name as Sawayn join the company? [/INST] SELECT date_joined_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn" </s> |
When did the staff member with first name as Janessa and last name as Sawayn leave the company? | CREATE TABLE Staff (date_left_staff VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT date_left_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Staff (date_left_staff VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: When did the staff member with first name as Janessa and last name as Sawayn leave the company? [/INST] SELECT date_left_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn" </s> |
How many staff have the first name Ludie? | CREATE TABLE Staff (first_name VARCHAR) | SELECT COUNT(*) FROM Staff WHERE first_name = "Ludie" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Staff (first_name VARCHAR) Question: How many staff have the first name Ludie? [/INST] SELECT COUNT(*) FROM Staff WHERE first_name = "Ludie" </s> |
What is the nickname of staff with first name as Janessa and last name as Sawayn? | CREATE TABLE Staff (nickname VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT nickname FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Staff (nickname VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: What is the nickname of staff with first name as Janessa and last name as Sawayn? [/INST] SELECT nickname FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn" </s> |
How many staff in total? | CREATE TABLE Staff (Id VARCHAR) | SELECT COUNT(*) FROM Staff | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Staff (Id VARCHAR) Question: How many staff in total? [/INST] SELECT COUNT(*) FROM Staff </s> |
Which city does staff with first name as Janessa and last name as Sawayn live? | CREATE TABLE Staff (staff_address_id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE Addresses (city VARCHAR, address_id VARCHAR) | SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Staff (staff_address_id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE Addresses (city VARCHAR, address_id VARCHAR) Question: Which city does staff with first name as Janessa and last name as Sawayn live? [/INST] SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" </s> |
Which country and state does staff with first name as Janessa and last name as Sawayn lived? | CREATE TABLE Addresses (country VARCHAR, state_province_county VARCHAR, address_id VARCHAR); CREATE TABLE Staff (staff_address_id VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT T1.country, T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Addresses (country VARCHAR, state_province_county VARCHAR, address_id VARCHAR); CREATE TABLE Staff (staff_address_id VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: Which country and state does staff with first name as Janessa and last name as Sawayn lived? [/INST] SELECT T1.country, T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" </s> |
How long is the total lesson time took by customer with first name as Rylan and last name as Goodwin? | CREATE TABLE Lessons (lesson_time INTEGER, customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT SUM(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Lessons (lesson_time INTEGER, customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: How long is the total lesson time took by customer with first name as Rylan and last name as Goodwin? [/INST] SELECT SUM(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" </s> |
What is the zip code of staff with first name as Janessa and last name as Sawayn lived? | CREATE TABLE Addresses (zip_postcode VARCHAR, address_id VARCHAR); CREATE TABLE Staff (staff_address_id VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Addresses (zip_postcode VARCHAR, address_id VARCHAR); CREATE TABLE Staff (staff_address_id VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: What is the zip code of staff with first name as Janessa and last name as Sawayn lived? [/INST] SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" </s> |
How many staff live in state Georgia? | CREATE TABLE Addresses (state_province_county VARCHAR) | SELECT COUNT(*) FROM Addresses WHERE state_province_county = "Georgia" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Addresses (state_province_county VARCHAR) Question: How many staff live in state Georgia? [/INST] SELECT COUNT(*) FROM Addresses WHERE state_province_county = "Georgia" </s> |
Find out the first name and last name of staff lived in city Damianfort. | CREATE TABLE Staff (first_name VARCHAR, last_name VARCHAR, staff_address_id VARCHAR); CREATE TABLE Addresses (address_id VARCHAR, city VARCHAR) | SELECT T2.first_name, T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T1.city = "Damianfort" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Staff (first_name VARCHAR, last_name VARCHAR, staff_address_id VARCHAR); CREATE TABLE Addresses (address_id VARCHAR, city VARCHAR) Question: Find out the first name and last name of staff lived in city Damianfort. [/INST] SELECT T2.first_name, T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T1.city = "Damianfort" </s> |
Which city lives most of staffs? List the city name and number of staffs. | CREATE TABLE Staff (staff_address_id VARCHAR); CREATE TABLE Addresses (city VARCHAR, address_id VARCHAR) | SELECT TOP 1 T1.city, COUNT(*) FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.city ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Staff (staff_address_id VARCHAR); CREATE TABLE Addresses (city VARCHAR, address_id VARCHAR) Question: Which city lives most of staffs? List the city name and number of staffs. [/INST] SELECT TOP 1 T1.city, COUNT(*) FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.city ORDER BY COUNT(*) DESC </s> |
List the states which have between 2 to 4 staffs living there. | CREATE TABLE Addresses (state_province_county VARCHAR, address_id VARCHAR); CREATE TABLE Staff (staff_address_id VARCHAR) | SELECT T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.state_province_county HAVING COUNT(*) BETWEEN 2 AND 4 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Addresses (state_province_county VARCHAR, address_id VARCHAR); CREATE TABLE Staff (staff_address_id VARCHAR) Question: List the states which have between 2 to 4 staffs living there. [/INST] SELECT T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.state_province_county HAVING COUNT(*) BETWEEN 2 AND 4 </s> |
List the first name and last name of all customers. | CREATE TABLE Customers (first_name VARCHAR, last_name VARCHAR) | SELECT first_name, last_name FROM Customers | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (first_name VARCHAR, last_name VARCHAR) Question: List the first name and last name of all customers. [/INST] SELECT first_name, last_name FROM Customers </s> |
List email address and birthday of customer whose first name as Carole. | CREATE TABLE Customers (email_address VARCHAR, date_of_birth VARCHAR, first_name VARCHAR) | SELECT email_address, date_of_birth FROM Customers WHERE first_name = "Carole" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (email_address VARCHAR, date_of_birth VARCHAR, first_name VARCHAR) Question: List email address and birthday of customer whose first name as Carole. [/INST] SELECT email_address, date_of_birth FROM Customers WHERE first_name = "Carole" </s> |
List phone number and email address of customer with more than 2000 outstanding balance. | CREATE TABLE Customers (phone_number VARCHAR, email_address VARCHAR, amount_outstanding INTEGER) | SELECT phone_number, email_address FROM Customers WHERE amount_outstanding > 2000 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (phone_number VARCHAR, email_address VARCHAR, amount_outstanding INTEGER) Question: List phone number and email address of customer with more than 2000 outstanding balance. [/INST] SELECT phone_number, email_address FROM Customers WHERE amount_outstanding > 2000 </s> |
What is the status code, mobile phone number and email address of customer with last name as Kohler or first name as Marina? | CREATE TABLE Customers (customer_status_code VARCHAR, cell_mobile_phone_number VARCHAR, email_address VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT customer_status_code, cell_mobile_phone_number, email_address FROM Customers WHERE first_name = "Marina" OR last_name = "Kohler" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_status_code VARCHAR, cell_mobile_phone_number VARCHAR, email_address VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: What is the status code, mobile phone number and email address of customer with last name as Kohler or first name as Marina? [/INST] SELECT customer_status_code, cell_mobile_phone_number, email_address FROM Customers WHERE first_name = "Marina" OR last_name = "Kohler" </s> |
When are the birthdays of customer who are classified as 'Good Customer' status? | CREATE TABLE Customers (date_of_birth VARCHAR, customer_status_code VARCHAR) | SELECT date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (date_of_birth VARCHAR, customer_status_code VARCHAR) Question: When are the birthdays of customer who are classified as 'Good Customer' status? [/INST] SELECT date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer' </s> |
When did customer with first name as Carole and last name as Bernhard became a customer? | CREATE TABLE Customers (date_became_customer VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (date_became_customer VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: When did customer with first name as Carole and last name as Bernhard became a customer? [/INST] SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard" </s> |
List all customer status codes and the number of customers having each status code. | CREATE TABLE Customers (customer_status_code VARCHAR) | SELECT customer_status_code, COUNT(*) FROM Customers GROUP BY customer_status_code | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_status_code VARCHAR) Question: List all customer status codes and the number of customers having each status code. [/INST] SELECT customer_status_code, COUNT(*) FROM Customers GROUP BY customer_status_code </s> |
Which customer status code has least number of customers? | CREATE TABLE Customers (customer_status_code VARCHAR) | SELECT TOP 1 customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY COUNT(*) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_status_code VARCHAR) Question: Which customer status code has least number of customers? [/INST] SELECT TOP 1 customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY COUNT(*) </s> |
How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed? | CREATE TABLE Lessons (customer_id VARCHAR, lesson_status_code VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT COUNT(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Lessons (customer_id VARCHAR, lesson_status_code VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed? [/INST] SELECT COUNT(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed" </s> |
What is maximum, minimum and average amount of outstanding of customer? | CREATE TABLE Customers (amount_outstanding INTEGER) | SELECT MAX(amount_outstanding), MIN(amount_outstanding), AVG(amount_outstanding) FROM Customers | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (amount_outstanding INTEGER) Question: What is maximum, minimum and average amount of outstanding of customer? [/INST] SELECT MAX(amount_outstanding), MIN(amount_outstanding), AVG(amount_outstanding) FROM Customers </s> |
List the first name and last name of customers have the amount of outstanding between 1000 and 3000. | CREATE TABLE Customers (first_name VARCHAR, last_name VARCHAR, amount_outstanding INTEGER) | SELECT first_name, last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (first_name VARCHAR, last_name VARCHAR, amount_outstanding INTEGER) Question: List the first name and last name of customers have the amount of outstanding between 1000 and 3000. [/INST] SELECT first_name, last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000 </s> |
List first name and last name of customers lived in city Lockmanfurt. | CREATE TABLE Customers (first_name VARCHAR, last_name VARCHAR, customer_address_id VARCHAR); CREATE TABLE Addresses (address_id VARCHAR, city VARCHAR) | SELECT T1.first_name, T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (first_name VARCHAR, last_name VARCHAR, customer_address_id VARCHAR); CREATE TABLE Addresses (address_id VARCHAR, city VARCHAR) Question: List first name and last name of customers lived in city Lockmanfurt. [/INST] SELECT T1.first_name, T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt" </s> |
Which country does customer with first name as Carole and last name as Bernhard lived in? | CREATE TABLE Addresses (country VARCHAR, address_id VARCHAR); CREATE TABLE Customers (customer_address_id VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Addresses (country VARCHAR, address_id VARCHAR); CREATE TABLE Customers (customer_address_id VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: Which country does customer with first name as Carole and last name as Bernhard lived in? [/INST] SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard" </s> |
What is zip code of customer with first name as Carole and last name as Bernhard? | CREATE TABLE Addresses (zip_postcode VARCHAR, address_id VARCHAR); CREATE TABLE Customers (customer_address_id VARCHAR, first_name VARCHAR, last_name VARCHAR) | SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Addresses (zip_postcode VARCHAR, address_id VARCHAR); CREATE TABLE Customers (customer_address_id VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: What is zip code of customer with first name as Carole and last name as Bernhard? [/INST] SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard" </s> |
Which city does has most number of customers? | CREATE TABLE Customers (customer_address_id VARCHAR); CREATE TABLE Addresses (city VARCHAR, address_id VARCHAR) | SELECT TOP 1 T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_address_id VARCHAR); CREATE TABLE Addresses (city VARCHAR, address_id VARCHAR) Question: Which city does has most number of customers? [/INST] SELECT TOP 1 T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY COUNT(*) DESC </s> |
How much in total does customer with first name as Carole and last name as Bernhard paid? | CREATE TABLE Customers (customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE Customer_Payments (amount_payment INTEGER, customer_id VARCHAR) | SELECT SUM(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Carole" AND T2.last_name = "Bernhard" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE Customer_Payments (amount_payment INTEGER, customer_id VARCHAR) Question: How much in total does customer with first name as Carole and last name as Bernhard paid? [/INST] SELECT SUM(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Carole" AND T2.last_name = "Bernhard" </s> |
List the number of customers that did not have any payment history. | CREATE TABLE Customers (customer_id VARCHAR); CREATE TABLE Customer_Payments (customer_id VARCHAR) | SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Customer_Payments) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_id VARCHAR); CREATE TABLE Customer_Payments (customer_id VARCHAR) Question: List the number of customers that did not have any payment history. [/INST] SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Customer_Payments) </s> |
List first name and last name of customers that have more than 2 payments. | CREATE TABLE Customers (first_name VARCHAR, last_name VARCHAR, customer_id VARCHAR); CREATE TABLE Customer_Payments (customer_id VARCHAR) | SELECT T2.first_name, T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) > 2 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (first_name VARCHAR, last_name VARCHAR, customer_id VARCHAR); CREATE TABLE Customer_Payments (customer_id VARCHAR) Question: List first name and last name of customers that have more than 2 payments. [/INST] SELECT T2.first_name, T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) > 2 </s> |
List all payment methods and number of payments using each payment methods. | CREATE TABLE Customer_Payments (payment_method_code VARCHAR) | SELECT payment_method_code, COUNT(*) FROM Customer_Payments GROUP BY payment_method_code | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customer_Payments (payment_method_code VARCHAR) Question: List all payment methods and number of payments using each payment methods. [/INST] SELECT payment_method_code, COUNT(*) FROM Customer_Payments GROUP BY payment_method_code </s> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.