instruction
stringlengths
12
244
input
stringlengths
27
489
output
stringlengths
18
557
text
stringlengths
194
1.14k
What is the average rating of songs for each language?
CREATE TABLE song (languages VARCHAR, rating INTEGER)
SELECT AVG(rating), languages FROM song GROUP BY languages
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (languages VARCHAR, rating INTEGER) Question: What is the average rating of songs for each language? [/INST] SELECT AVG(rating), languages FROM song GROUP BY languages </s>
Return the gender and name of artist who produced the song with the lowest resolution.
CREATE TABLE artist (gender VARCHAR, artist_name VARCHAR); CREATE TABLE song (artist_name VARCHAR, resolution VARCHAR)
SELECT TOP 1 T1.gender, T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.resolution
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE artist (gender VARCHAR, artist_name VARCHAR); CREATE TABLE song (artist_name VARCHAR, resolution VARCHAR) Question: Return the gender and name of artist who produced the song with the lowest resolution. [/INST] SELECT TOP 1 T1.gender, T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.resolution </s>
For each file format, return the number of artists who released songs in that format.
CREATE TABLE files (formats VARCHAR)
SELECT COUNT(*), formats FROM files GROUP BY formats
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE files (formats VARCHAR) Question: For each file format, return the number of artists who released songs in that format. [/INST] SELECT COUNT(*), formats FROM files GROUP BY formats </s>
Find the distinct names of all songs that have a higher resolution than some songs in English.
CREATE TABLE song (song_name VARCHAR, resolution INTEGER, languages VARCHAR)
SELECT DISTINCT song_name FROM song WHERE resolution > (SELECT MIN(resolution) FROM song WHERE languages = "english")
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (song_name VARCHAR, resolution INTEGER, languages VARCHAR) Question: Find the distinct names of all songs that have a higher resolution than some songs in English. [/INST] SELECT DISTINCT song_name FROM song WHERE resolution > (SELECT MIN(resolution) FROM song WHERE languages = "english") </s>
What are the names of all songs that have a lower rating than some song of blues genre?
CREATE TABLE song (song_name VARCHAR, rating INTEGER, genre_is VARCHAR)
SELECT song_name FROM song WHERE rating < (SELECT MAX(rating) FROM song WHERE genre_is = "blues")
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (song_name VARCHAR, rating INTEGER, genre_is VARCHAR) Question: What are the names of all songs that have a lower rating than some song of blues genre? [/INST] SELECT song_name FROM song WHERE rating < (SELECT MAX(rating) FROM song WHERE genre_is = "blues") </s>
What is the name and country of origin of the artist who released a song that has "love" in its title?
CREATE TABLE song (artist_name VARCHAR, song_name VARCHAR); CREATE TABLE artist (artist_name VARCHAR, country VARCHAR)
SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.song_name LIKE "%love%"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (artist_name VARCHAR, song_name VARCHAR); CREATE TABLE artist (artist_name VARCHAR, country VARCHAR) Question: What is the name and country of origin of the artist who released a song that has "love" in its title? [/INST] SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.song_name LIKE "%love%" </s>
List the name and gender for all artists who released songs in March.
CREATE TABLE song (artist_name VARCHAR, releasedate VARCHAR); CREATE TABLE artist (artist_name VARCHAR, gender VARCHAR)
SELECT T1.artist_name, T1.gender FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.releasedate LIKE "%Mar%"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (artist_name VARCHAR, releasedate VARCHAR); CREATE TABLE artist (artist_name VARCHAR, gender VARCHAR) Question: List the name and gender for all artists who released songs in March. [/INST] SELECT T1.artist_name, T1.gender FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.releasedate LIKE "%Mar%" </s>
List the names of all genres in alphabetical oder, together with its ratings.
CREATE TABLE genre (g_name VARCHAR, rating VARCHAR)
SELECT g_name, rating FROM genre ORDER BY g_name
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE genre (g_name VARCHAR, rating VARCHAR) Question: List the names of all genres in alphabetical oder, together with its ratings. [/INST] SELECT g_name, rating FROM genre ORDER BY g_name </s>
Give me a list of the names of all songs ordered by their resolution.
CREATE TABLE song (song_name VARCHAR, resolution VARCHAR)
SELECT song_name FROM song ORDER BY resolution
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (song_name VARCHAR, resolution VARCHAR) Question: Give me a list of the names of all songs ordered by their resolution. [/INST] SELECT song_name FROM song ORDER BY resolution </s>
What are the ids of songs that are available in either mp4 format or have resolution above 720?
CREATE TABLE song (f_id VARCHAR, formats VARCHAR, resolution INTEGER); CREATE TABLE files (f_id VARCHAR, formats VARCHAR, resolution INTEGER)
SELECT f_id FROM files WHERE formats = "mp4" UNION SELECT f_id FROM song WHERE resolution > 720
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (f_id VARCHAR, formats VARCHAR, resolution INTEGER); CREATE TABLE files (f_id VARCHAR, formats VARCHAR, resolution INTEGER) Question: What are the ids of songs that are available in either mp4 format or have resolution above 720? [/INST] SELECT f_id FROM files WHERE formats = "mp4" UNION SELECT f_id FROM song WHERE resolution > 720 </s>
List the names of all songs that have 4 minute duration or are in English.
CREATE TABLE files (f_id VARCHAR, duration VARCHAR); CREATE TABLE song (song_name VARCHAR, f_id VARCHAR); CREATE TABLE song (song_name VARCHAR, languages VARCHAR)
SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE "4:%" UNION SELECT song_name FROM song WHERE languages = "english"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE files (f_id VARCHAR, duration VARCHAR); CREATE TABLE song (song_name VARCHAR, f_id VARCHAR); CREATE TABLE song (song_name VARCHAR, languages VARCHAR) Question: List the names of all songs that have 4 minute duration or are in English. [/INST] SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE "4:%" UNION SELECT song_name FROM song WHERE languages = "english" </s>
What is the language used most often in the songs?
CREATE TABLE song (languages VARCHAR)
SELECT TOP 1 languages FROM song GROUP BY languages ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (languages VARCHAR) Question: What is the language used most often in the songs? [/INST] SELECT TOP 1 languages FROM song GROUP BY languages ORDER BY COUNT(*) DESC </s>
What is the language that was used most often in songs with resolution above 500?
CREATE TABLE song (artist_name VARCHAR, languages VARCHAR, resolution INTEGER)
SELECT TOP 1 artist_name FROM song WHERE resolution > 500 GROUP BY languages ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (artist_name VARCHAR, languages VARCHAR, resolution INTEGER) Question: What is the language that was used most often in songs with resolution above 500? [/INST] SELECT TOP 1 artist_name FROM song WHERE resolution > 500 GROUP BY languages ORDER BY COUNT(*) DESC </s>
What are the names of artists who are Male and are from UK?
CREATE TABLE artist (artist_name VARCHAR, country VARCHAR, gender VARCHAR)
SELECT artist_name FROM artist WHERE country = "UK" AND gender = "Male"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE artist (artist_name VARCHAR, country VARCHAR, gender VARCHAR) Question: What are the names of artists who are Male and are from UK? [/INST] SELECT artist_name FROM artist WHERE country = "UK" AND gender = "Male" </s>
Find the names of songs whose genre is modern or language is English.
CREATE TABLE song (song_name VARCHAR, genre_is VARCHAR, languages VARCHAR)
SELECT song_name FROM song WHERE genre_is = "modern" OR languages = "english"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (song_name VARCHAR, genre_is VARCHAR, languages VARCHAR) Question: Find the names of songs whose genre is modern or language is English. [/INST] SELECT song_name FROM song WHERE genre_is = "modern" OR languages = "english" </s>
Return the names of songs for which format is mp3 and resolution is below 1000.
CREATE TABLE song (song_name VARCHAR, resolution INTEGER); CREATE TABLE song (song_name VARCHAR, f_id VARCHAR); CREATE TABLE files (f_id VARCHAR, formats VARCHAR)
SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = "mp3" INTERSECT SELECT song_name FROM song WHERE resolution < 1000
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (song_name VARCHAR, resolution INTEGER); CREATE TABLE song (song_name VARCHAR, f_id VARCHAR); CREATE TABLE files (f_id VARCHAR, formats VARCHAR) Question: Return the names of songs for which format is mp3 and resolution is below 1000. [/INST] SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = "mp3" INTERSECT SELECT song_name FROM song WHERE resolution < 1000 </s>
Return the names of singers who are from UK and released an English song.
CREATE TABLE song (artist_name VARCHAR, languages VARCHAR); CREATE TABLE artist (artist_name VARCHAR); CREATE TABLE artist (artist_name VARCHAR, country VARCHAR)
SELECT artist_name FROM artist WHERE country = "UK" INTERSECT SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = "english"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (artist_name VARCHAR, languages VARCHAR); CREATE TABLE artist (artist_name VARCHAR); CREATE TABLE artist (artist_name VARCHAR, country VARCHAR) Question: Return the names of singers who are from UK and released an English song. [/INST] SELECT artist_name FROM artist WHERE country = "UK" INTERSECT SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = "english" </s>
What are the average rating and resolution of songs that are in Bangla?
CREATE TABLE song (rating INTEGER, resolution INTEGER, languages VARCHAR)
SELECT AVG(rating), AVG(resolution) FROM song WHERE languages = "bangla"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (rating INTEGER, resolution INTEGER, languages VARCHAR) Question: What are the average rating and resolution of songs that are in Bangla? [/INST] SELECT AVG(rating), AVG(resolution) FROM song WHERE languages = "bangla" </s>
What are the maximum and minimum resolution of songs whose duration is 3 minutes?
CREATE TABLE files (f_id VARCHAR, duration VARCHAR); CREATE TABLE song (resolution INTEGER, f_id VARCHAR)
SELECT MAX(T2.resolution), MIN(T2.resolution) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE "3:%"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE files (f_id VARCHAR, duration VARCHAR); CREATE TABLE song (resolution INTEGER, f_id VARCHAR) Question: What are the maximum and minimum resolution of songs whose duration is 3 minutes? [/INST] SELECT MAX(T2.resolution), MIN(T2.resolution) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE "3:%" </s>
What are the maximum duration and resolution of songs grouped and ordered by languages?
CREATE TABLE song (languages VARCHAR, resolution INTEGER, f_id VARCHAR); CREATE TABLE files (duration INTEGER, f_id VARCHAR)
SELECT MAX(T1.duration), MAX(T2.resolution), T2.languages FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.languages ORDER BY T2.languages
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (languages VARCHAR, resolution INTEGER, f_id VARCHAR); CREATE TABLE files (duration INTEGER, f_id VARCHAR) Question: What are the maximum duration and resolution of songs grouped and ordered by languages? [/INST] SELECT MAX(T1.duration), MAX(T2.resolution), T2.languages FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.languages ORDER BY T2.languages </s>
What are the shortest duration and lowest rating of songs grouped by genre and ordered by genre?
CREATE TABLE song (genre_is VARCHAR, rating INTEGER, f_id VARCHAR); CREATE TABLE files (duration INTEGER, f_id VARCHAR)
SELECT MIN(T1.duration), MIN(T2.rating), T2.genre_is FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.genre_is ORDER BY T2.genre_is
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (genre_is VARCHAR, rating INTEGER, f_id VARCHAR); CREATE TABLE files (duration INTEGER, f_id VARCHAR) Question: What are the shortest duration and lowest rating of songs grouped by genre and ordered by genre? [/INST] SELECT MIN(T1.duration), MIN(T2.rating), T2.genre_is FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.genre_is ORDER BY T2.genre_is </s>
Find the names and number of works of all artists who have at least one English songs.
CREATE TABLE song (artist_name VARCHAR, languages VARCHAR); CREATE TABLE artist (artist_name VARCHAR)
SELECT T1.artist_name, COUNT(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = "english" GROUP BY T2.artist_name HAVING COUNT(*) >= 1
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (artist_name VARCHAR, languages VARCHAR); CREATE TABLE artist (artist_name VARCHAR) Question: Find the names and number of works of all artists who have at least one English songs. [/INST] SELECT T1.artist_name, COUNT(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = "english" GROUP BY T2.artist_name HAVING COUNT(*) >= 1 </s>
Find the name and country of origin for all artists who have release at least one song of resolution above 900.
CREATE TABLE song (artist_name VARCHAR, resolution INTEGER); CREATE TABLE artist (artist_name VARCHAR, country VARCHAR)
SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.resolution > 900 GROUP BY T2.artist_name HAVING COUNT(*) >= 1
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (artist_name VARCHAR, resolution INTEGER); CREATE TABLE artist (artist_name VARCHAR, country VARCHAR) Question: Find the name and country of origin for all artists who have release at least one song of resolution above 900. [/INST] SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.resolution > 900 GROUP BY T2.artist_name HAVING COUNT(*) >= 1 </s>
Find the names and number of works of the three artists who have produced the most songs.
CREATE TABLE song (artist_name VARCHAR); CREATE TABLE artist (artist_name VARCHAR)
SELECT TOP 3 T1.artist_name, COUNT(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (artist_name VARCHAR); CREATE TABLE artist (artist_name VARCHAR) Question: Find the names and number of works of the three artists who have produced the most songs. [/INST] SELECT TOP 3 T1.artist_name, COUNT(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY COUNT(*) DESC </s>
Find the country of origin for the artist who made the least number of songs?
CREATE TABLE song (artist_name VARCHAR); CREATE TABLE artist (country VARCHAR, artist_name VARCHAR)
SELECT TOP 1 T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY COUNT(*)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (artist_name VARCHAR); CREATE TABLE artist (country VARCHAR, artist_name VARCHAR) Question: Find the country of origin for the artist who made the least number of songs? [/INST] SELECT TOP 1 T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY COUNT(*) </s>
What are the names of the songs whose rating is below the rating of all songs in English?
CREATE TABLE song (song_name VARCHAR, rating INTEGER, languages VARCHAR)
SELECT song_name FROM song WHERE rating < (SELECT MIN(rating) FROM song WHERE languages = 'english')
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (song_name VARCHAR, rating INTEGER, languages VARCHAR) Question: What are the names of the songs whose rating is below the rating of all songs in English? [/INST] SELECT song_name FROM song WHERE rating < (SELECT MIN(rating) FROM song WHERE languages = 'english') </s>
What is ids of the songs whose resolution is higher than the resolution of any songs with rating lower than 8?
CREATE TABLE song (f_id VARCHAR, resolution INTEGER, rating INTEGER)
SELECT f_id FROM song WHERE resolution > (SELECT MAX(resolution) FROM song WHERE rating < 8)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (f_id VARCHAR, resolution INTEGER, rating INTEGER) Question: What is ids of the songs whose resolution is higher than the resolution of any songs with rating lower than 8? [/INST] SELECT f_id FROM song WHERE resolution > (SELECT MAX(resolution) FROM song WHERE rating < 8) </s>
What is ids of the songs whose resolution is higher than the average resolution of songs in modern genre?
CREATE TABLE song (f_id VARCHAR, resolution INTEGER, genre_is VARCHAR)
SELECT f_id FROM song WHERE resolution > (SELECT AVG(resolution) FROM song WHERE genre_is = "modern")
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (f_id VARCHAR, resolution INTEGER, genre_is VARCHAR) Question: What is ids of the songs whose resolution is higher than the average resolution of songs in modern genre? [/INST] SELECT f_id FROM song WHERE resolution > (SELECT AVG(resolution) FROM song WHERE genre_is = "modern") </s>
Find the top 3 artists who have the largest number of songs works whose language is Bangla.
CREATE TABLE song (artist_name VARCHAR, languages VARCHAR); CREATE TABLE artist (artist_name VARCHAR)
SELECT TOP 3 T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = "bangla" GROUP BY T2.artist_name ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (artist_name VARCHAR, languages VARCHAR); CREATE TABLE artist (artist_name VARCHAR) Question: Find the top 3 artists who have the largest number of songs works whose language is Bangla. [/INST] SELECT TOP 3 T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = "bangla" GROUP BY T2.artist_name ORDER BY COUNT(*) DESC </s>
List the id, genre and artist name of English songs ordered by rating.
CREATE TABLE song (f_id VARCHAR, genre_is VARCHAR, artist_name VARCHAR, languages VARCHAR, rating VARCHAR)
SELECT f_id, genre_is, artist_name FROM song WHERE languages = "english" ORDER BY rating
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (f_id VARCHAR, genre_is VARCHAR, artist_name VARCHAR, languages VARCHAR, rating VARCHAR) Question: List the id, genre and artist name of English songs ordered by rating. [/INST] SELECT f_id, genre_is, artist_name FROM song WHERE languages = "english" ORDER BY rating </s>
List the duration, file size and format of songs whose genre is pop, ordered by title?
CREATE TABLE song (f_id VARCHAR, genre_is VARCHAR, song_name VARCHAR); CREATE TABLE files (duration VARCHAR, file_size VARCHAR, formats VARCHAR, f_id VARCHAR)
SELECT T1.duration, T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.genre_is = "pop" ORDER BY T2.song_name
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (f_id VARCHAR, genre_is VARCHAR, song_name VARCHAR); CREATE TABLE files (duration VARCHAR, file_size VARCHAR, formats VARCHAR, f_id VARCHAR) Question: List the duration, file size and format of songs whose genre is pop, ordered by title? [/INST] SELECT T1.duration, T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.genre_is = "pop" ORDER BY T2.song_name </s>
Find the names of the artists who have produced English songs but have never received rating higher than 8.
CREATE TABLE song (artist_name VARCHAR, languages VARCHAR, rating INTEGER)
SELECT DISTINCT artist_name FROM song WHERE languages = "english" EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 8
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE song (artist_name VARCHAR, languages VARCHAR, rating INTEGER) Question: Find the names of the artists who have produced English songs but have never received rating higher than 8. [/INST] SELECT DISTINCT artist_name FROM song WHERE languages = "english" EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 8 </s>
Find the names of the artists who are from Bangladesh and have never received rating higher than 7.
CREATE TABLE artist (artist_name VARCHAR, country VARCHAR, rating INTEGER); CREATE TABLE song (artist_name VARCHAR, country VARCHAR, rating INTEGER)
SELECT DISTINCT artist_name FROM artist WHERE country = "Bangladesh" EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 7
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE artist (artist_name VARCHAR, country VARCHAR, rating INTEGER); CREATE TABLE song (artist_name VARCHAR, country VARCHAR, rating INTEGER) Question: Find the names of the artists who are from Bangladesh and have never received rating higher than 7. [/INST] SELECT DISTINCT artist_name FROM artist WHERE country = "Bangladesh" EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 7 </s>
what is the full name and id of the college with the largest number of baseball players?
CREATE TABLE player_college (college_id VARCHAR); CREATE TABLE college (name_full VARCHAR, college_id VARCHAR)
SELECT TOP 1 T1.name_full, T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id = T2.college_id GROUP BY T1.college_id ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE player_college (college_id VARCHAR); CREATE TABLE college (name_full VARCHAR, college_id VARCHAR) Question: what is the full name and id of the college with the largest number of baseball players? [/INST] SELECT TOP 1 T1.name_full, T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id = T2.college_id GROUP BY T1.college_id ORDER BY COUNT(*) DESC </s>
What is average salary of the players in the team named 'Boston Red Stockings' ?
CREATE TABLE salary (salary INTEGER, team_id VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR)
SELECT AVG(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE salary (salary INTEGER, team_id VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR) Question: What is average salary of the players in the team named 'Boston Red Stockings' ? [/INST] SELECT AVG(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' </s>
What are first and last names of players participating in all star game in 1998?
CREATE TABLE all_star (player_id VARCHAR); CREATE TABLE player (player_id VARCHAR)
SELECT name_first, name_last FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id WHERE YEAR = 1998
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE all_star (player_id VARCHAR); CREATE TABLE player (player_id VARCHAR) Question: What are first and last names of players participating in all star game in 1998? [/INST] SELECT name_first, name_last FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id WHERE YEAR = 1998 </s>
What are the first name, last name and id of the player with the most all star game experiences? Also list the count.
CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, player_id VARCHAR); CREATE TABLE all_star (player_id VARCHAR)
SELECT TOP 1 T1.name_first, T1.name_last, T1.player_id, COUNT(*) FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, player_id VARCHAR); CREATE TABLE all_star (player_id VARCHAR) Question: What are the first name, last name and id of the player with the most all star game experiences? Also list the count. [/INST] SELECT TOP 1 T1.name_first, T1.name_last, T1.player_id, COUNT(*) FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY COUNT(*) DESC </s>
How many players enter hall of fame each year?
CREATE TABLE hall_of_fame (yearid VARCHAR)
SELECT yearid, COUNT(*) FROM hall_of_fame GROUP BY yearid
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE hall_of_fame (yearid VARCHAR) Question: How many players enter hall of fame each year? [/INST] SELECT yearid, COUNT(*) FROM hall_of_fame GROUP BY yearid </s>
What is the average number of attendance at home games for each year?
CREATE TABLE home_game (YEAR VARCHAR, attendance INTEGER)
SELECT YEAR, AVG(attendance) FROM home_game GROUP BY YEAR
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE home_game (YEAR VARCHAR, attendance INTEGER) Question: What is the average number of attendance at home games for each year? [/INST] SELECT YEAR, AVG(attendance) FROM home_game GROUP BY YEAR </s>
In 2014, what are the id and rank of the team that has the largest average number of attendance?
CREATE TABLE team (team_id VARCHAR, rank VARCHAR); CREATE TABLE home_game (team_id VARCHAR, year VARCHAR, attendance INTEGER)
SELECT TOP 1 T2.team_id, T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id WHERE T1.year = 2014 GROUP BY T1.team_id ORDER BY AVG(T1.attendance) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE team (team_id VARCHAR, rank VARCHAR); CREATE TABLE home_game (team_id VARCHAR, year VARCHAR, attendance INTEGER) Question: In 2014, what are the id and rank of the team that has the largest average number of attendance? [/INST] SELECT TOP 1 T2.team_id, T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id WHERE T1.year = 2014 GROUP BY T1.team_id ORDER BY AVG(T1.attendance) DESC </s>
What are the manager's first name, last name and id who won the most manager award?
CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, player_id VARCHAR); CREATE TABLE manager_award (player_id VARCHAR)
SELECT TOP 1 T1.name_first, T1.name_last, T2.player_id FROM player AS T1 JOIN manager_award AS T2 ON T1.player_id = T2.player_id GROUP BY T2.player_id ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, player_id VARCHAR); CREATE TABLE manager_award (player_id VARCHAR) Question: What are the manager's first name, last name and id who won the most manager award? [/INST] SELECT TOP 1 T1.name_first, T1.name_last, T2.player_id FROM player AS T1 JOIN manager_award AS T2 ON T1.player_id = T2.player_id GROUP BY T2.player_id ORDER BY COUNT(*) DESC </s>
How many parks are there in the state of NY?
CREATE TABLE park (state VARCHAR)
SELECT COUNT(*) FROM park WHERE state = 'NY'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE park (state VARCHAR) Question: How many parks are there in the state of NY? [/INST] SELECT COUNT(*) FROM park WHERE state = 'NY' </s>
Which 3 players won the most player awards? List their full name and id.
CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, player_id VARCHAR); CREATE TABLE player_award (player_id VARCHAR)
SELECT TOP 3 T1.name_first, T1.name_last, T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, player_id VARCHAR); CREATE TABLE player_award (player_id VARCHAR) Question: Which 3 players won the most player awards? List their full name and id. [/INST] SELECT TOP 3 T1.name_first, T1.name_last, T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY COUNT(*) DESC </s>
List three countries which are the origins of the least players.
CREATE TABLE player (birth_country VARCHAR)
SELECT TOP 3 birth_country FROM player GROUP BY birth_country ORDER BY COUNT(*)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE player (birth_country VARCHAR) Question: List three countries which are the origins of the least players. [/INST] SELECT TOP 3 birth_country FROM player GROUP BY birth_country ORDER BY COUNT(*) </s>
Find all the players' first name and last name who have empty death record.
CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, death_year VARCHAR)
SELECT name_first, name_last FROM player WHERE death_year = ''
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, death_year VARCHAR) Question: Find all the players' first name and last name who have empty death record. [/INST] SELECT name_first, name_last FROM player WHERE death_year = '' </s>
How many players born in USA are right-handed batters? That is, have the batter value 'R'.
CREATE TABLE player (birth_country VARCHAR, bats VARCHAR)
SELECT COUNT(*) FROM player WHERE birth_country = 'USA' AND bats = 'R'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE player (birth_country VARCHAR, bats VARCHAR) Question: How many players born in USA are right-handed batters? That is, have the batter value 'R'. [/INST] SELECT COUNT(*) FROM player WHERE birth_country = 'USA' AND bats = 'R' </s>
What is the average height of the players from the college named 'Yale University'?
CREATE TABLE player_college (player_id VARCHAR, college_id VARCHAR); CREATE TABLE player (height INTEGER, player_id VARCHAR); CREATE TABLE college (college_id VARCHAR, name_full VARCHAR)
SELECT AVG(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_id JOIN college AS T3 ON T3.college_id = T2.college_id WHERE T3.name_full = 'Yale University'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE player_college (player_id VARCHAR, college_id VARCHAR); CREATE TABLE player (height INTEGER, player_id VARCHAR); CREATE TABLE college (college_id VARCHAR, name_full VARCHAR) Question: What is the average height of the players from the college named 'Yale University'? [/INST] SELECT AVG(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_id JOIN college AS T3 ON T3.college_id = T2.college_id WHERE T3.name_full = 'Yale University' </s>
What is the highest salary among each team? List the team name, id and maximum salary.
CREATE TABLE salary (salary INTEGER, team_id VARCHAR); CREATE TABLE team (name VARCHAR, team_id VARCHAR)
SELECT T1.name, T1.team_id, MAX(T2.salary) FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE salary (salary INTEGER, team_id VARCHAR); CREATE TABLE team (name VARCHAR, team_id VARCHAR) Question: What is the highest salary among each team? List the team name, id and maximum salary. [/INST] SELECT T1.name, T1.team_id, MAX(T2.salary) FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id </s>
What are the name and id of the team offering the lowest average salary?
CREATE TABLE team (name VARCHAR, team_id VARCHAR); CREATE TABLE salary (team_id VARCHAR, salary INTEGER)
SELECT TOP 1 T1.name, T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id ORDER BY AVG(T2.salary)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE team (name VARCHAR, team_id VARCHAR); CREATE TABLE salary (team_id VARCHAR, salary INTEGER) Question: What are the name and id of the team offering the lowest average salary? [/INST] SELECT TOP 1 T1.name, T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id ORDER BY AVG(T2.salary) </s>
Find the players' first name and last name who won award both in 1960 and in 1961.
CREATE TABLE player (name_first VARCHAR, name_last VARCHAR); CREATE TABLE player_award (year VARCHAR)
SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1960 INTERSECT SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1961
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE player (name_first VARCHAR, name_last VARCHAR); CREATE TABLE player_award (year VARCHAR) Question: Find the players' first name and last name who won award both in 1960 and in 1961. [/INST] SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1960 INTERSECT SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1961 </s>
List players' first name and last name who have weight greater than 220 or height shorter than 75.
CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, weight VARCHAR, height VARCHAR)
SELECT name_first, name_last FROM player WHERE weight > 220 OR height < 75
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, weight VARCHAR, height VARCHAR) Question: List players' first name and last name who have weight greater than 220 or height shorter than 75. [/INST] SELECT name_first, name_last FROM player WHERE weight > 220 OR height < 75 </s>
List the maximum scores of the team Boston Red Stockings when the team won in postseason?
CREATE TABLE team (team_id_br VARCHAR, name VARCHAR); CREATE TABLE postseason (wins INTEGER, team_id_winner VARCHAR)
SELECT MAX(T1.wins) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE team (team_id_br VARCHAR, name VARCHAR); CREATE TABLE postseason (wins INTEGER, team_id_winner VARCHAR) Question: List the maximum scores of the team Boston Red Stockings when the team won in postseason? [/INST] SELECT MAX(T1.wins) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' </s>
How many times did Boston Red Stockings lose in 2009 postseason?
CREATE TABLE postseason (team_id_loser VARCHAR, year VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR)
SELECT COUNT(*) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2009
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE postseason (team_id_loser VARCHAR, year VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR) Question: How many times did Boston Red Stockings lose in 2009 postseason? [/INST] SELECT COUNT(*) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2009 </s>
What are the name and id of the team with the most victories in 2008 postseason?
CREATE TABLE postseason (team_id_winner VARCHAR, year VARCHAR); CREATE TABLE team (name VARCHAR, team_id_br VARCHAR)
SELECT TOP 1 T2.name, T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T1.year = 2008 GROUP BY T1.team_id_winner ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE postseason (team_id_winner VARCHAR, year VARCHAR); CREATE TABLE team (name VARCHAR, team_id_br VARCHAR) Question: What are the name and id of the team with the most victories in 2008 postseason? [/INST] SELECT TOP 1 T2.name, T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T1.year = 2008 GROUP BY T1.team_id_winner ORDER BY COUNT(*) DESC </s>
What is the number of wins the team Boston Red Stockings got in the postseasons each year in history?
CREATE TABLE team (team_id_br VARCHAR, name VARCHAR); CREATE TABLE postseason (year VARCHAR, team_id_winner VARCHAR)
SELECT COUNT(*), T1.year FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' GROUP BY T1.year
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE team (team_id_br VARCHAR, name VARCHAR); CREATE TABLE postseason (year VARCHAR, team_id_winner VARCHAR) Question: What is the number of wins the team Boston Red Stockings got in the postseasons each year in history? [/INST] SELECT COUNT(*), T1.year FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' GROUP BY T1.year </s>
What is the total number of postseason games that team Boston Red Stockings participated in?
CREATE TABLE postseason (team_id_winner VARCHAR, team_id_loser VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR)
SELECT COUNT(*) FROM (SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' UNION SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings')
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE postseason (team_id_winner VARCHAR, team_id_loser VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR) Question: What is the total number of postseason games that team Boston Red Stockings participated in? [/INST] SELECT COUNT(*) FROM (SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' UNION SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings') </s>
How many games in 1885 postseason resulted in ties (that is, the value of "ties" is '1')?
CREATE TABLE postseason (YEAR VARCHAR, ties VARCHAR)
SELECT COUNT(*) FROM postseason WHERE YEAR = 1885 AND ties = 1
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE postseason (YEAR VARCHAR, ties VARCHAR) Question: How many games in 1885 postseason resulted in ties (that is, the value of "ties" is '1')? [/INST] SELECT COUNT(*) FROM postseason WHERE YEAR = 1885 AND ties = 1 </s>
What is the total salary paid by team Boston Red Stockings in 2010?
CREATE TABLE salary (salary INTEGER, team_id VARCHAR, year VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR)
SELECT SUM(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2010
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE salary (salary INTEGER, team_id VARCHAR, year VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR) Question: What is the total salary paid by team Boston Red Stockings in 2010? [/INST] SELECT SUM(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2010 </s>
How many players were in the team Boston Red Stockings in 2000?
CREATE TABLE salary (team_id VARCHAR, year VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR)
SELECT COUNT(*) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2000
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE salary (team_id VARCHAR, year VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR) Question: How many players were in the team Boston Red Stockings in 2000? [/INST] SELECT COUNT(*) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2000 </s>
List the 3 highest salaries of the players in 2001?
CREATE TABLE salary (salary VARCHAR, YEAR VARCHAR)
SELECT TOP 3 salary FROM salary WHERE YEAR = 2001 ORDER BY salary DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE salary (salary VARCHAR, YEAR VARCHAR) Question: List the 3 highest salaries of the players in 2001? [/INST] SELECT TOP 3 salary FROM salary WHERE YEAR = 2001 ORDER BY salary DESC </s>
What were all the salary values of players in 2010 and 2001?
CREATE TABLE salary (salary VARCHAR, YEAR VARCHAR)
SELECT salary FROM salary WHERE YEAR = 2010 UNION SELECT salary FROM salary WHERE YEAR = 2001
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE salary (salary VARCHAR, YEAR VARCHAR) Question: What were all the salary values of players in 2010 and 2001? [/INST] SELECT salary FROM salary WHERE YEAR = 2010 UNION SELECT salary FROM salary WHERE YEAR = 2001 </s>
In which year did the least people enter hall of fame?
CREATE TABLE hall_of_fame (yearid VARCHAR)
SELECT TOP 1 yearid FROM hall_of_fame GROUP BY yearid ORDER BY COUNT(*)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE hall_of_fame (yearid VARCHAR) Question: In which year did the least people enter hall of fame? [/INST] SELECT TOP 1 yearid FROM hall_of_fame GROUP BY yearid ORDER BY COUNT(*) </s>
How many parks are there in Atlanta city?
CREATE TABLE park (city VARCHAR)
SELECT COUNT(*) FROM park WHERE city = 'Atlanta'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE park (city VARCHAR) Question: How many parks are there in Atlanta city? [/INST] SELECT COUNT(*) FROM park WHERE city = 'Atlanta' </s>
How many games were played in park "Columbia Park" in 1907?
CREATE TABLE park (park_id VARCHAR, park_name VARCHAR); CREATE TABLE home_game (park_id VARCHAR, year VARCHAR)
SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 1907 AND T2.park_name = 'Columbia Park'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE park (park_id VARCHAR, park_name VARCHAR); CREATE TABLE home_game (park_id VARCHAR, year VARCHAR) Question: How many games were played in park "Columbia Park" in 1907? [/INST] SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 1907 AND T2.park_name = 'Columbia Park' </s>
How many games were played in city Atlanta in 2000?
CREATE TABLE park (park_id VARCHAR, city VARCHAR); CREATE TABLE home_game (park_id VARCHAR, year VARCHAR)
SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2000 AND T2.city = 'Atlanta'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE park (park_id VARCHAR, city VARCHAR); CREATE TABLE home_game (park_id VARCHAR, year VARCHAR) Question: How many games were played in city Atlanta in 2000? [/INST] SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2000 AND T2.city = 'Atlanta' </s>
What is the total home game attendance of team Boston Red Stockings from 2000 to 2010?
CREATE TABLE team (team_id_br VARCHAR, name VARCHAR); CREATE TABLE home_game (attendance INTEGER, team_id VARCHAR, year VARCHAR)
SELECT SUM(T1.attendance) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 2000 AND 2010
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE team (team_id_br VARCHAR, name VARCHAR); CREATE TABLE home_game (attendance INTEGER, team_id VARCHAR, year VARCHAR) Question: What is the total home game attendance of team Boston Red Stockings from 2000 to 2010? [/INST] SELECT SUM(T1.attendance) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 2000 AND 2010 </s>
How much did the the player with first name Len and last name Barker earn between 1985 to 1990 in total?
CREATE TABLE salary (salary INTEGER, player_id VARCHAR, year VARCHAR); CREATE TABLE player (player_id VARCHAR, name_first VARCHAR, name_last VARCHAR)
SELECT SUM(T1.salary) FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id WHERE T2.name_first = 'Len' AND T2.name_last = 'Barker' AND T1.year BETWEEN 1985 AND 1990
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE salary (salary INTEGER, player_id VARCHAR, year VARCHAR); CREATE TABLE player (player_id VARCHAR, name_first VARCHAR, name_last VARCHAR) Question: How much did the the player with first name Len and last name Barker earn between 1985 to 1990 in total? [/INST] SELECT SUM(T1.salary) FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id WHERE T2.name_first = 'Len' AND T2.name_last = 'Barker' AND T1.year BETWEEN 1985 AND 1990 </s>
List players' first name and last name who received salary from team Washington Nationals in both 2005 and 2007.
CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, player_id VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR); CREATE TABLE salary (player_id VARCHAR, team_id VARCHAR, year VARCHAR)
SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2005 AND T3.name = 'Washington Nationals' INTERSECT SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2007 AND T3.name = 'Washington Nationals'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE player (name_first VARCHAR, name_last VARCHAR, player_id VARCHAR); CREATE TABLE team (team_id_br VARCHAR, name VARCHAR); CREATE TABLE salary (player_id VARCHAR, team_id VARCHAR, year VARCHAR) Question: List players' first name and last name who received salary from team Washington Nationals in both 2005 and 2007. [/INST] SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2005 AND T3.name = 'Washington Nationals' INTERSECT SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2007 AND T3.name = 'Washington Nationals' </s>
How many home games did the team Boston Red Stockings play from 1990 to 2000 in total?
CREATE TABLE team (team_id_br VARCHAR, name VARCHAR); CREATE TABLE home_game (games INTEGER, team_id VARCHAR, year VARCHAR)
SELECT SUM(T1.games) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 1990 AND 2000
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE team (team_id_br VARCHAR, name VARCHAR); CREATE TABLE home_game (games INTEGER, team_id VARCHAR, year VARCHAR) Question: How many home games did the team Boston Red Stockings play from 1990 to 2000 in total? [/INST] SELECT SUM(T1.games) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 1990 AND 2000 </s>
Which team had the least number of attendances in home games in 1980?
CREATE TABLE home_game (team_id VARCHAR, year VARCHAR, attendance VARCHAR); CREATE TABLE team (name VARCHAR, team_id_br VARCHAR)
SELECT TOP 1 T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE home_game (team_id VARCHAR, year VARCHAR, attendance VARCHAR); CREATE TABLE team (name VARCHAR, team_id_br VARCHAR) Question: Which team had the least number of attendances in home games in 1980? [/INST] SELECT TOP 1 T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance </s>
List the names of states that have more than 2 parks.
CREATE TABLE park (state VARCHAR)
SELECT state FROM park GROUP BY state HAVING COUNT(*) > 2
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE park (state VARCHAR) Question: List the names of states that have more than 2 parks. [/INST] SELECT state FROM park GROUP BY state HAVING COUNT(*) > 2 </s>
How many team franchises are active, with active value 'Y'?
CREATE TABLE team_franchise (active VARCHAR)
SELECT COUNT(*) FROM team_franchise WHERE active = 'Y'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE team_franchise (active VARCHAR) Question: How many team franchises are active, with active value 'Y'? [/INST] SELECT COUNT(*) FROM team_franchise WHERE active = 'Y' </s>
Which cities have 2 to 4 parks?
CREATE TABLE park (city VARCHAR)
SELECT city FROM park GROUP BY city HAVING COUNT(*) BETWEEN 2 AND 4
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE park (city VARCHAR) Question: Which cities have 2 to 4 parks? [/INST] SELECT city FROM park GROUP BY city HAVING COUNT(*) BETWEEN 2 AND 4 </s>
Which park had most attendances in 2008?
CREATE TABLE park (park_name VARCHAR, park_id VARCHAR); CREATE TABLE home_game (park_id VARCHAR, year VARCHAR, attendance VARCHAR)
SELECT TOP 1 T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE park (park_name VARCHAR, park_id VARCHAR); CREATE TABLE home_game (park_id VARCHAR, year VARCHAR, attendance VARCHAR) Question: Which park had most attendances in 2008? [/INST] SELECT TOP 1 T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC </s>
How many camera lenses have a focal length longer than 15 mm?
CREATE TABLE camera_lens (focal_length_mm INTEGER)
SELECT COUNT(*) FROM camera_lens WHERE focal_length_mm > 15
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE camera_lens (focal_length_mm INTEGER) Question: How many camera lenses have a focal length longer than 15 mm? [/INST] SELECT COUNT(*) FROM camera_lens WHERE focal_length_mm > 15 </s>
Find the brand and name for each camera lens, and sort in descending order of maximum aperture.
CREATE TABLE camera_lens (brand VARCHAR, name VARCHAR, max_aperture VARCHAR)
SELECT brand, name FROM camera_lens ORDER BY max_aperture DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE camera_lens (brand VARCHAR, name VARCHAR, max_aperture VARCHAR) Question: Find the brand and name for each camera lens, and sort in descending order of maximum aperture. [/INST] SELECT brand, name FROM camera_lens ORDER BY max_aperture DESC </s>
List the id, color scheme, and name for all the photos.
CREATE TABLE photos (id VARCHAR, color VARCHAR, name VARCHAR)
SELECT id, color, name FROM photos
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE photos (id VARCHAR, color VARCHAR, name VARCHAR) Question: List the id, color scheme, and name for all the photos. [/INST] SELECT id, color, name FROM photos </s>
What are the maximum and average height of the mountains?
CREATE TABLE mountain (height INTEGER)
SELECT MAX(height), AVG(height) FROM mountain
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE mountain (height INTEGER) Question: What are the maximum and average height of the mountains? [/INST] SELECT MAX(height), AVG(height) FROM mountain </s>
What are the average prominence of the mountains in country 'Morocco'?
CREATE TABLE mountain (prominence INTEGER, country VARCHAR)
SELECT AVG(prominence) FROM mountain WHERE country = 'Morocco'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE mountain (prominence INTEGER, country VARCHAR) Question: What are the average prominence of the mountains in country 'Morocco'? [/INST] SELECT AVG(prominence) FROM mountain WHERE country = 'Morocco' </s>
What are the name, height and prominence of mountains which do not belong to the range 'Aberdare Range'?
CREATE TABLE mountain (name VARCHAR, height VARCHAR, prominence VARCHAR, range VARCHAR)
SELECT name, height, prominence FROM mountain WHERE range <> 'Aberdare Range'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE mountain (name VARCHAR, height VARCHAR, prominence VARCHAR, range VARCHAR) Question: What are the name, height and prominence of mountains which do not belong to the range 'Aberdare Range'? [/INST] SELECT name, height, prominence FROM mountain WHERE range <> 'Aberdare Range' </s>
What are the id and name of the photos for mountains?
CREATE TABLE photos (mountain_id VARCHAR); CREATE TABLE mountain (id VARCHAR, name VARCHAR, height INTEGER)
SELECT T1.id, T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.height > 4000
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE photos (mountain_id VARCHAR); CREATE TABLE mountain (id VARCHAR, name VARCHAR, height INTEGER) Question: What are the id and name of the photos for mountains? [/INST] SELECT T1.id, T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.height > 4000 </s>
What are the id and name of the mountains that have at least 2 photos?
CREATE TABLE mountain (id VARCHAR, name VARCHAR); CREATE TABLE photos (mountain_id VARCHAR)
SELECT T1.id, T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id GROUP BY T1.id HAVING COUNT(*) >= 2
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE mountain (id VARCHAR, name VARCHAR); CREATE TABLE photos (mountain_id VARCHAR) Question: What are the id and name of the mountains that have at least 2 photos? [/INST] SELECT T1.id, T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id GROUP BY T1.id HAVING COUNT(*) >= 2 </s>
What are the names of the cameras that have taken picture of the most mountains?
CREATE TABLE camera_lens (name VARCHAR, id VARCHAR); CREATE TABLE photos (camera_lens_id VARCHAR)
SELECT TOP 1 T2.name FROM photos AS T1 JOIN camera_lens AS T2 ON T1.camera_lens_id = T2.id GROUP BY T2.id ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE camera_lens (name VARCHAR, id VARCHAR); CREATE TABLE photos (camera_lens_id VARCHAR) Question: What are the names of the cameras that have taken picture of the most mountains? [/INST] SELECT TOP 1 T2.name FROM photos AS T1 JOIN camera_lens AS T2 ON T1.camera_lens_id = T2.id GROUP BY T2.id ORDER BY COUNT(*) DESC </s>
What are the names of photos taken with the lens brand 'Sigma' or 'Olympus'?
CREATE TABLE photos (camera_lens_id VARCHAR); CREATE TABLE camera_lens (name VARCHAR, id VARCHAR, brand VARCHAR)
SELECT T1.name FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id = T1.id WHERE T1.brand = 'Sigma' OR T1.brand = 'Olympus'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE photos (camera_lens_id VARCHAR); CREATE TABLE camera_lens (name VARCHAR, id VARCHAR, brand VARCHAR) Question: What are the names of photos taken with the lens brand 'Sigma' or 'Olympus'? [/INST] SELECT T1.name FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id = T1.id WHERE T1.brand = 'Sigma' OR T1.brand = 'Olympus' </s>
How many different kinds of lens brands are there?
CREATE TABLE camera_lens (brand VARCHAR)
SELECT COUNT(DISTINCT brand) FROM camera_lens
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE camera_lens (brand VARCHAR) Question: How many different kinds of lens brands are there? [/INST] SELECT COUNT(DISTINCT brand) FROM camera_lens </s>
How many camera lenses are not used in taking any photos?
CREATE TABLE photos (id VARCHAR, camera_lens_id VARCHAR); CREATE TABLE camera_lens (id VARCHAR, camera_lens_id VARCHAR)
SELECT COUNT(*) FROM camera_lens WHERE NOT id IN (SELECT camera_lens_id FROM photos)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE photos (id VARCHAR, camera_lens_id VARCHAR); CREATE TABLE camera_lens (id VARCHAR, camera_lens_id VARCHAR) Question: How many camera lenses are not used in taking any photos? [/INST] SELECT COUNT(*) FROM camera_lens WHERE NOT id IN (SELECT camera_lens_id FROM photos) </s>
How many distinct kinds of camera lenses are used to take photos of mountains in the country 'Ethiopia'?
CREATE TABLE mountain (id VARCHAR, country VARCHAR); CREATE TABLE photos (camera_lens_id VARCHAR, mountain_id VARCHAR)
SELECT COUNT(DISTINCT T2.camera_lens_id) FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.country = 'Ethiopia'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE mountain (id VARCHAR, country VARCHAR); CREATE TABLE photos (camera_lens_id VARCHAR, mountain_id VARCHAR) Question: How many distinct kinds of camera lenses are used to take photos of mountains in the country 'Ethiopia'? [/INST] SELECT COUNT(DISTINCT T2.camera_lens_id) FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.country = 'Ethiopia' </s>
List the brands of lenses that took both a picture of mountains with range 'Toubkal Atlas' and a picture of mountains with range 'Lasta Massif'
CREATE TABLE mountain (id VARCHAR, range VARCHAR); CREATE TABLE photos (mountain_id VARCHAR, camera_lens_id VARCHAR); CREATE TABLE camera_lens (brand VARCHAR, id VARCHAR)
SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Toubkal Atlas' INTERSECT SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Lasta Massif'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE mountain (id VARCHAR, range VARCHAR); CREATE TABLE photos (mountain_id VARCHAR, camera_lens_id VARCHAR); CREATE TABLE camera_lens (brand VARCHAR, id VARCHAR) Question: List the brands of lenses that took both a picture of mountains with range 'Toubkal Atlas' and a picture of mountains with range 'Lasta Massif' [/INST] SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Toubkal Atlas' INTERSECT SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Lasta Massif' </s>
Show the name and prominence of the mountains whose picture is not taken by a lens of brand 'Sigma'.
CREATE TABLE camera_lens (id VARCHAR, brand VARCHAR); CREATE TABLE mountain (name VARCHAR, prominence VARCHAR, id VARCHAR); CREATE TABLE photos (mountain_id VARCHAR, camera_lens_id VARCHAR); CREATE TABLE mountain (name VARCHAR, prominence VARCHAR)
SELECT name, prominence FROM mountain EXCEPT SELECT T1.name, T1.prominence FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T3.brand = 'Sigma'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE camera_lens (id VARCHAR, brand VARCHAR); CREATE TABLE mountain (name VARCHAR, prominence VARCHAR, id VARCHAR); CREATE TABLE photos (mountain_id VARCHAR, camera_lens_id VARCHAR); CREATE TABLE mountain (name VARCHAR, prominence VARCHAR) Question: Show the name and prominence of the mountains whose picture is not taken by a lens of brand 'Sigma'. [/INST] SELECT name, prominence FROM mountain EXCEPT SELECT T1.name, T1.prominence FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T3.brand = 'Sigma' </s>
List the camera lens names containing substring "Digital".
CREATE TABLE camera_lens (name VARCHAR)
SELECT name FROM camera_lens WHERE name LIKE "%Digital%"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE camera_lens (name VARCHAR) Question: List the camera lens names containing substring "Digital". [/INST] SELECT name FROM camera_lens WHERE name LIKE "%Digital%" </s>
What is the name of each camera lens and the number of photos taken by it? Order the result by the count of photos.
CREATE TABLE photos (camera_lens_id VARCHAR); CREATE TABLE camera_lens (name VARCHAR, id VARCHAR)
SELECT T1.name, COUNT(*) FROM camera_lens AS T1 JOIN photos AS T2 ON T1.id = T2.camera_lens_id GROUP BY T1.id ORDER BY COUNT(*)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE photos (camera_lens_id VARCHAR); CREATE TABLE camera_lens (name VARCHAR, id VARCHAR) Question: What is the name of each camera lens and the number of photos taken by it? Order the result by the count of photos. [/INST] SELECT T1.name, COUNT(*) FROM camera_lens AS T1 JOIN photos AS T2 ON T1.id = T2.camera_lens_id GROUP BY T1.id ORDER BY COUNT(*) </s>
Find the names of channels that are not owned by CCTV.
CREATE TABLE channel (name VARCHAR, OWNER VARCHAR)
SELECT name FROM channel WHERE OWNER <> 'CCTV'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE channel (name VARCHAR, OWNER VARCHAR) Question: Find the names of channels that are not owned by CCTV. [/INST] SELECT name FROM channel WHERE OWNER <> 'CCTV' </s>
List all channel names ordered by their rating in percent from big to small.
CREATE TABLE channel (name VARCHAR, rating_in_percent VARCHAR)
SELECT name FROM channel ORDER BY rating_in_percent DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE channel (name VARCHAR, rating_in_percent VARCHAR) Question: List all channel names ordered by their rating in percent from big to small. [/INST] SELECT name FROM channel ORDER BY rating_in_percent DESC </s>
What is the owner of the channel that has the highest rating ratio?
CREATE TABLE channel (OWNER VARCHAR, rating_in_percent VARCHAR)
SELECT TOP 1 OWNER FROM channel ORDER BY rating_in_percent DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE channel (OWNER VARCHAR, rating_in_percent VARCHAR) Question: What is the owner of the channel that has the highest rating ratio? [/INST] SELECT TOP 1 OWNER FROM channel ORDER BY rating_in_percent DESC </s>
how many programs are there?
CREATE TABLE program (Id VARCHAR)
SELECT COUNT(*) FROM program
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE program (Id VARCHAR) Question: how many programs are there? [/INST] SELECT COUNT(*) FROM program </s>
list all the names of programs, ordering by launch time.
CREATE TABLE program (name VARCHAR, launch VARCHAR)
SELECT name FROM program ORDER BY launch
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE program (name VARCHAR, launch VARCHAR) Question: list all the names of programs, ordering by launch time. [/INST] SELECT name FROM program ORDER BY launch </s>
List the name, origin and owner of each program.
CREATE TABLE program (name VARCHAR, origin VARCHAR, OWNER VARCHAR)
SELECT name, origin, OWNER FROM program
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE program (name VARCHAR, origin VARCHAR, OWNER VARCHAR) Question: List the name, origin and owner of each program. [/INST] SELECT name, origin, OWNER FROM program </s>
find the name of the program that was launched most recently.
CREATE TABLE program (name VARCHAR, launch VARCHAR)
SELECT TOP 1 name FROM program ORDER BY launch DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE program (name VARCHAR, launch VARCHAR) Question: find the name of the program that was launched most recently. [/INST] SELECT TOP 1 name FROM program ORDER BY launch DESC </s>
find the total percentage share of all channels owned by CCTV.
CREATE TABLE channel (Share_in_percent INTEGER, OWNER VARCHAR)
SELECT SUM(Share_in_percent) FROM channel WHERE OWNER = 'CCTV'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE channel (Share_in_percent INTEGER, OWNER VARCHAR) Question: find the total percentage share of all channels owned by CCTV. [/INST] SELECT SUM(Share_in_percent) FROM channel WHERE OWNER = 'CCTV' </s>
Find the names of the channels that are broadcast in the morning.
CREATE TABLE channel (name VARCHAR, channel_id VARCHAR); CREATE TABLE broadcast (channel_id VARCHAR, time_of_day VARCHAR)
SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE channel (name VARCHAR, channel_id VARCHAR); CREATE TABLE broadcast (channel_id VARCHAR, time_of_day VARCHAR) Question: Find the names of the channels that are broadcast in the morning. [/INST] SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning' </s>