instruction
stringlengths
12
244
input
stringlengths
27
489
output
stringlengths
18
557
text
stringlengths
194
1.14k
A list of the top 5 countries by number of invoices. List country name and number of invoices.
CREATE TABLE invoices (billing_country VARCHAR)
SELECT TOP 5 billing_country, COUNT(*) FROM invoices GROUP BY billing_country ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (billing_country VARCHAR) Question: A list of the top 5 countries by number of invoices. List country name and number of invoices. [/INST] SELECT TOP 5 billing_country, COUNT(*) FROM invoices GROUP BY b...
A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size.
CREATE TABLE invoices (billing_country VARCHAR, total INTEGER)
SELECT TOP 8 billing_country, SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (billing_country VARCHAR, total INTEGER) Question: A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size. [/INST] SELECT TOP 8 billing_country, SUM(total) F...
A list of the top 10 countries by average invoice size. List country name and average invoice size.
CREATE TABLE invoices (billing_country VARCHAR, total INTEGER)
SELECT TOP 10 billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (billing_country VARCHAR, total INTEGER) Question: A list of the top 10 countries by average invoice size. List country name and average invoice size. [/INST] SELECT TOP 10 billing_country, AVG(total) F...
Find out 5 customers who most recently purchased something. List customers' first and last name.
CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR, invoice_date VARCHAR)
SELECT TOP 5 T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY T2.invoice_date DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR, invoice_date VARCHAR) Question: Find out 5 customers who most recently purchased something. List custome...
Find out the top 10 customers by total number of orders. List customers' first and last name and the number of total orders.
CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR)
SELECT TOP 10 T1.first_name, T1.last_name, COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR) Question: Find out the top 10 customers by total number of orders. List customers' first and last name a...
List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.
CREATE TABLE invoices (total INTEGER, customer_id VARCHAR); CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR)
SELECT TOP 10 T1.first_name, T1.last_name, SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (total INTEGER, customer_id VARCHAR); CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR) Question: List the top 10 customers by total gross sales. List customers' first and last ...
List the top 5 genres by number of tracks. List genres name and total tracks.
CREATE TABLE tracks (genre_id VARCHAR); CREATE TABLE genres (name VARCHAR, id VARCHAR)
SELECT TOP 5 T1.name, COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE tracks (genre_id VARCHAR); CREATE TABLE genres (name VARCHAR, id VARCHAR) Question: List the top 5 genres by number of tracks. List genres name and total tracks. [/INST] SELECT TOP 5 T1.name, COUNT(*) FROM genre...
List every album's title.
CREATE TABLE albums (title VARCHAR)
SELECT title FROM albums
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE albums (title VARCHAR) Question: List every album's title. [/INST] SELECT title FROM albums </s>
List every album ordered by album title in ascending order.
CREATE TABLE albums (title VARCHAR)
SELECT title FROM albums ORDER BY title
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE albums (title VARCHAR) Question: List every album ordered by album title in ascending order. [/INST] SELECT title FROM albums ORDER BY title </s>
List every album whose title starts with A in alphabetical order.
CREATE TABLE albums (title VARCHAR)
SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE albums (title VARCHAR) Question: List every album whose title starts with A in alphabetical order. [/INST] SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title </s>
List the customers first and last name of 10 least expensive invoices.
CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR)
SELECT TOP 10 T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR) Question: List the customers first and last name of 10 least expensive invoices. [/INST] SELECT TOP 10 T...
List total amount of invoice from Chicago, IL.
CREATE TABLE invoices (total INTEGER, billing_city VARCHAR, billing_state VARCHAR)
SELECT SUM(total) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (total INTEGER, billing_city VARCHAR, billing_state VARCHAR) Question: List total amount of invoice from Chicago, IL. [/INST] SELECT SUM(total) FROM invoices WHERE billing_city = "Chicago" AND billing_...
List the number of invoices from Chicago, IL.
CREATE TABLE invoices (billing_city VARCHAR, billing_state VARCHAR)
SELECT COUNT(*) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (billing_city VARCHAR, billing_state VARCHAR) Question: List the number of invoices from Chicago, IL. [/INST] SELECT COUNT(*) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL" </s>
List the number of invoices from the US, grouped by state.
CREATE TABLE invoices (billing_state VARCHAR, billing_country VARCHAR)
SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (billing_state VARCHAR, billing_country VARCHAR) Question: List the number of invoices from the US, grouped by state. [/INST] SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = "USA" G...
List the state in the US with the most invoices.
CREATE TABLE invoices (billing_state VARCHAR, billing_country VARCHAR)
SELECT TOP 1 billing_state, COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (billing_state VARCHAR, billing_country VARCHAR) Question: List the state in the US with the most invoices. [/INST] SELECT TOP 1 billing_state, COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP...
List the number of invoices and the invoice total from California.
CREATE TABLE invoices (billing_state VARCHAR, total INTEGER)
SELECT billing_state, COUNT(*), SUM(total) FROM invoices WHERE billing_state = "CA"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (billing_state VARCHAR, total INTEGER) Question: List the number of invoices and the invoice total from California. [/INST] SELECT billing_state, COUNT(*), SUM(total) FROM invoices WHERE billing_state =...
List Aerosmith's albums.
CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, artist_id VARCHAR)
SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Aerosmith"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, artist_id VARCHAR) Question: List Aerosmith's albums. [/INST] SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id ...
How many albums does Billy Cobham has?
CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (artist_id VARCHAR)
SELECT COUNT(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Billy Cobham"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (artist_id VARCHAR) Question: How many albums does Billy Cobham has? [/INST] SELECT COUNT(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id W...
Eduardo Martins is a customer at which company?
CREATE TABLE customers (company VARCHAR, first_name VARCHAR, last_name VARCHAR)
SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (company VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: Eduardo Martins is a customer at which company? [/INST] SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Ma...
What is Astrid Gruber's email and phone number?
CREATE TABLE customers (email VARCHAR, phone VARCHAR, first_name VARCHAR, last_name VARCHAR)
SELECT email, phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (email VARCHAR, phone VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: What is Astrid Gruber's email and phone number? [/INST] SELECT email, phone FROM customers WHERE first_name = "Astrid" AN...
How many customers live in Prague city?
CREATE TABLE customers (city VARCHAR)
SELECT COUNT(*) FROM customers WHERE city = "Prague"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (city VARCHAR) Question: How many customers live in Prague city? [/INST] SELECT COUNT(*) FROM customers WHERE city = "Prague" </s>
How many customers in state of CA?
CREATE TABLE customers (state VARCHAR)
SELECT COUNT(*) FROM customers WHERE state = "CA"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (state VARCHAR) Question: How many customers in state of CA? [/INST] SELECT COUNT(*) FROM customers WHERE state = "CA" </s>
What country does Roberto Almeida live?
CREATE TABLE customers (country VARCHAR, first_name VARCHAR, last_name VARCHAR)
SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (country VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: What country does Roberto Almeida live? [/INST] SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida" <...
List the name of albums that are released by aritist whose name has 'Led'
CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, artist_id VARCHAR)
SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, artist_id VARCHAR) Question: List the name of albums that are released by aritist whose name has 'Led' [/INST] SELECT T2.title FROM artists...
How many customers does Steve Johnson support?
CREATE TABLE employees (id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE customers (support_rep_id VARCHAR)
SELECT COUNT(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = "Steve" AND T1.last_name = "Johnson"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE employees (id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE customers (support_rep_id VARCHAR) Question: How many customers does Steve Johnson support? [/INST] SELECT COUNT(*) FROM employees AS T...
What is the title, phone and hire date of Nancy Edwards?
CREATE TABLE employees (title VARCHAR, phone VARCHAR, hire_date VARCHAR, first_name VARCHAR, last_name VARCHAR)
SELECT title, phone, hire_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE employees (title VARCHAR, phone VARCHAR, hire_date VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: What is the title, phone and hire date of Nancy Edwards? [/INST] SELECT title, phone, hire_date FROM e...
find the full name of employees who report to Nancy Edwards?
CREATE TABLE employees (id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, reports_to VARCHAR)
SELECT T2.first_name, T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = "Nancy" AND T1.last_name = "Edwards"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE employees (id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, reports_to VARCHAR) Question: find the full name of employees who report to Nancy Edw...
What is the address of employee Nancy Edwards?
CREATE TABLE employees (address VARCHAR, first_name VARCHAR, last_name VARCHAR)
SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE employees (address VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: What is the address of employee Nancy Edwards? [/INST] SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwar...
Find the full name of employee who supported the most number of customers.
CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE customers (support_rep_id VARCHAR)
SELECT TOP 1 T1.first_name, T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE customers (support_rep_id VARCHAR) Question: Find the full name of employee who supported the most number of customers. [/INST] SELECT ...
How many employees are living in Canada?
CREATE TABLE employees (country VARCHAR)
SELECT COUNT(*) FROM employees WHERE country = "Canada"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE employees (country VARCHAR) Question: How many employees are living in Canada? [/INST] SELECT COUNT(*) FROM employees WHERE country = "Canada" </s>
What is employee Nancy Edwards's phone number?
CREATE TABLE employees (phone VARCHAR, first_name VARCHAR, last_name VARCHAR)
SELECT phone FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE employees (phone VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: What is employee Nancy Edwards's phone number? [/INST] SELECT phone FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards" ...
Who is the youngest employee in the company? List employee's first and last name.
CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, birth_date VARCHAR)
SELECT TOP 1 first_name, last_name FROM employees ORDER BY birth_date DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, birth_date VARCHAR) Question: Who is the youngest employee in the company? List employee's first and last name. [/INST] SELECT TOP 1 first_name, last_name FROM e...
List top 10 employee work longest in the company. List employee's first and last name.
CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, hire_date VARCHAR)
SELECT TOP 10 first_name, last_name FROM employees ORDER BY hire_date
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, hire_date VARCHAR) Question: List top 10 employee work longest in the company. List employee's first and last name. [/INST] SELECT TOP 10 first_name, last_name F...
Find the number of employees whose title is IT Staff from each city?
CREATE TABLE employees (city VARCHAR, title VARCHAR)
SELECT COUNT(*), city FROM employees WHERE title = 'IT Staff' GROUP BY city
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE employees (city VARCHAR, title VARCHAR) Question: Find the number of employees whose title is IT Staff from each city? [/INST] SELECT COUNT(*), city FROM employees WHERE title = 'IT Staff' GROUP BY city </s>
Which employee manage most number of peoples? List employee's first and last name, and number of people report to that employee.
CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE employees (reports_to VARCHAR)
SELECT TOP 1 T2.first_name, T2.last_name, COUNT(T1.reports_to) FROM employees AS T1 JOIN employees AS T2 ON T1.reports_to = T2.id GROUP BY T1.reports_to ORDER BY COUNT(T1.reports_to) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE employees (reports_to VARCHAR) Question: Which employee manage most number of peoples? List employee's first and last name, and number ...
How many orders does Lucas Mancini has?
CREATE TABLE invoices (customer_id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCHAR, last_name VARCHAR)
SELECT COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = "Lucas" AND T1.last_name = "Mancini"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (customer_id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: How many orders does Lucas Mancini has? [/INST] SELECT COUNT(*) FROM customers AS T1 JOIN invo...
What is the total amount of money spent by Lucas Mancini?
CREATE TABLE invoices (total INTEGER, customer_id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCHAR, last_name VARCHAR)
SELECT SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = "Lucas" AND T1.last_name = "Mancini"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (total INTEGER, customer_id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCHAR, last_name VARCHAR) Question: What is the total amount of money spent by Lucas Mancini? [/INST] SELECT SUM(T2...
List all media types.
CREATE TABLE media_types (name VARCHAR)
SELECT name FROM media_types
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE media_types (name VARCHAR) Question: List all media types. [/INST] SELECT name FROM media_types </s>
List all different genre types.
CREATE TABLE genres (name VARCHAR)
SELECT DISTINCT name FROM genres
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE genres (name VARCHAR) Question: List all different genre types. [/INST] SELECT DISTINCT name FROM genres </s>
List the name of all playlist.
CREATE TABLE playlists (name VARCHAR)
SELECT name FROM playlists
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE playlists (name VARCHAR) Question: List the name of all playlist. [/INST] SELECT name FROM playlists </s>
Who is the composer of track Fast As a Shark?
CREATE TABLE tracks (composer VARCHAR, name VARCHAR)
SELECT composer FROM tracks WHERE name = "Fast As a Shark"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE tracks (composer VARCHAR, name VARCHAR) Question: Who is the composer of track Fast As a Shark? [/INST] SELECT composer FROM tracks WHERE name = "Fast As a Shark" </s>
How long does track Fast As a Shark has?
CREATE TABLE tracks (milliseconds VARCHAR, name VARCHAR)
SELECT milliseconds FROM tracks WHERE name = "Fast As a Shark"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE tracks (milliseconds VARCHAR, name VARCHAR) Question: How long does track Fast As a Shark has? [/INST] SELECT milliseconds FROM tracks WHERE name = "Fast As a Shark" </s>
What is the name of tracks whose genre is Rock?
CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR)
SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = "Rock"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR) Question: What is the name of tracks whose genre is Rock? [/INST] SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1....
What is title of album which track Balls to the Wall belongs to?
CREATE TABLE tracks (genre_id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, id VARCHAR)
SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T2.name = "Balls to the Wall"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE tracks (genre_id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, id VARCHAR) Question: What is title of album which track Balls to the Wall belongs to? [/INST] SELECT T1.title FROM albums AS T1 JOIN ...
List name of all tracks in Balls to the Wall.
CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR); CREATE TABLE albums (id VARCHAR, title VARCHAR)
SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = "Balls to the Wall"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR); CREATE TABLE albums (id VARCHAR, title VARCHAR) Question: List name of all tracks in Balls to the Wall. [/INST] SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.i...
List title of albums have the number of tracks greater than 10.
CREATE TABLE tracks (album_id VARCHAR); CREATE TABLE albums (title VARCHAR, id VARCHAR)
SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id HAVING COUNT(T1.id) > 10
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE tracks (album_id VARCHAR); CREATE TABLE albums (title VARCHAR, id VARCHAR) Question: List title of albums have the number of tracks greater than 10. [/INST] SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON...
List the name of tracks belongs to genre Rock and whose media type is MPEG audio file.
CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR, media_type_id VARCHAR); CREATE TABLE media_types (id VARCHAR, name VARCHAR)
SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = "Rock" AND T3.name = "MPEG audio file"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR, media_type_id VARCHAR); CREATE TABLE media_types (id VARCHAR, name VARCHAR) Question: List the name of tracks belongs to ge...
List the name of tracks belongs to genre Rock or media type is MPEG audio file.
CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR, media_type_id VARCHAR); CREATE TABLE media_types (id VARCHAR, name VARCHAR)
SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = "Rock" OR T3.name = "MPEG audio file"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR, media_type_id VARCHAR); CREATE TABLE media_types (id VARCHAR, name VARCHAR) Question: List the name of tracks belongs to ge...
List the name of tracks belongs to genre Rock or genre Jazz.
CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR)
SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = "Rock" OR T1.name = "Jazz"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR) Question: List the name of tracks belongs to genre Rock or genre Jazz. [/INST] SELECT T2.name FROM genres AS T1 JOIN tracks...
List the name of all tracks in the playlists of Movies.
CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR)
SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T3.id = T2.playlist_id WHERE T3.name = "Movies"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR) Question: List the name of all tracks in the playlists o...
List the name of playlist which has number of tracks greater than 100.
CREATE TABLE playlist_tracks (playlist_id VARCHAR, track_id VARCHAR); CREATE TABLE playlists (name VARCHAR, id VARCHAR)
SELECT T2.name FROM playlist_tracks AS T1 JOIN playlists AS T2 ON T2.id = T1.playlist_id GROUP BY T1.playlist_id HAVING COUNT(T1.track_id) > 100
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE playlist_tracks (playlist_id VARCHAR, track_id VARCHAR); CREATE TABLE playlists (name VARCHAR, id VARCHAR) Question: List the name of playlist which has number of tracks greater than 100. [/INST] SELECT T2.name ...
List all tracks bought by customer Daan Peeters.
CREATE TABLE invoices (id VARCHAR, customer_id VARCHAR); CREATE TABLE invoice_lines (track_id VARCHAR, invoice_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCHAR, last_name VARCHAR)
SELECT T1.name FROM tracks AS T1 JOIN invoice_lines AS T2 ON T1.id = T2.track_id JOIN invoices AS T3 ON T3.id = T2.invoice_id JOIN customers AS T4 ON T4.id = T3.customer_id WHERE T4.first_name = "Daan" AND T4.last_name = "Peeters"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE invoices (id VARCHAR, customer_id VARCHAR); CREATE TABLE invoice_lines (track_id VARCHAR, invoice_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCH...
How much is the track Fast As a Shark?
CREATE TABLE tracks (unit_price VARCHAR, name VARCHAR)
SELECT unit_price FROM tracks WHERE name = "Fast As a Shark"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE tracks (unit_price VARCHAR, name VARCHAR) Question: How much is the track Fast As a Shark? [/INST] SELECT unit_price FROM tracks WHERE name = "Fast As a Shark" </s>
Find the name of tracks which are in Movies playlist but not in music playlist.
CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR)
SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' EXCEPT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR) Question: Find the name of tracks which are in Movies pl...
Find the name of tracks which are in both Movies and music playlists.
CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR)
SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' INTERSECT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR) Question: Find the name of tracks which are in both Movi...
Find number of tracks in each genre?
CREATE TABLE tracks (genre_id VARCHAR); CREATE TABLE genres (name VARCHAR, id VARCHAR)
SELECT COUNT(*), T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE tracks (genre_id VARCHAR); CREATE TABLE genres (name VARCHAR, id VARCHAR) Question: Find number of tracks in each genre? [/INST] SELECT COUNT(*), T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_i...
How many editors are there?
CREATE TABLE editor (Id VARCHAR)
SELECT COUNT(*) FROM editor
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE editor (Id VARCHAR) Question: How many editors are there? [/INST] SELECT COUNT(*) FROM editor </s>
List the names of editors in ascending order of age.
CREATE TABLE editor (Name VARCHAR, Age VARCHAR)
SELECT Name FROM editor ORDER BY Age
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE editor (Name VARCHAR, Age VARCHAR) Question: List the names of editors in ascending order of age. [/INST] SELECT Name FROM editor ORDER BY Age </s>
What are the names and ages of editors?
CREATE TABLE editor (Name VARCHAR, Age VARCHAR)
SELECT Name, Age FROM editor
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE editor (Name VARCHAR, Age VARCHAR) Question: What are the names and ages of editors? [/INST] SELECT Name, Age FROM editor </s>
List the names of editors who are older than 25.
CREATE TABLE editor (Name VARCHAR, Age INTEGER)
SELECT Name FROM editor WHERE Age > 25
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE editor (Name VARCHAR, Age INTEGER) Question: List the names of editors who are older than 25. [/INST] SELECT Name FROM editor WHERE Age > 25 </s>
Show the names of editors of age either 24 or 25.
CREATE TABLE editor (Name VARCHAR, Age VARCHAR)
SELECT Name FROM editor WHERE Age = 24 OR Age = 25
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE editor (Name VARCHAR, Age VARCHAR) Question: Show the names of editors of age either 24 or 25. [/INST] SELECT Name FROM editor WHERE Age = 24 OR Age = 25 </s>
What is the name of the youngest editor?
CREATE TABLE editor (Name VARCHAR, Age VARCHAR)
SELECT TOP 1 Name FROM editor ORDER BY Age
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE editor (Name VARCHAR, Age VARCHAR) Question: What is the name of the youngest editor? [/INST] SELECT TOP 1 Name FROM editor ORDER BY Age </s>
What are the different ages of editors? Show each age along with the number of editors of that age.
CREATE TABLE editor (Age VARCHAR)
SELECT Age, COUNT(*) FROM editor GROUP BY Age
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE editor (Age VARCHAR) Question: What are the different ages of editors? Show each age along with the number of editors of that age. [/INST] SELECT Age, COUNT(*) FROM editor GROUP BY Age </s>
Please show the most common age of editors.
CREATE TABLE editor (Age VARCHAR)
SELECT TOP 1 Age FROM editor GROUP BY Age ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE editor (Age VARCHAR) Question: Please show the most common age of editors. [/INST] SELECT TOP 1 Age FROM editor GROUP BY Age ORDER BY COUNT(*) DESC </s>
Show the distinct themes of journals.
CREATE TABLE journal (Theme VARCHAR)
SELECT DISTINCT Theme FROM journal
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE journal (Theme VARCHAR) Question: Show the distinct themes of journals. [/INST] SELECT DISTINCT Theme FROM journal </s>
Show the names of editors and the theme of journals for which they serve on committees.
CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Theme VARCHAR, Journal_ID VARCHAR)
SELECT T2.Name, T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Theme VARCHAR, Journal_ID VARCHAR) Question: Show the names of editors and ...
Show the names and ages of editors and the theme of journals for which they serve on committees, in ascending alphabetical order of theme.
CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, age VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Theme VARCHAR, Journal_ID VARCHAR)
SELECT T2.Name, T2.age, T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID ORDER BY T3.Theme
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, age VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Theme VARCHAR, Journal_ID VARCHAR) Question: Show the names an...
Show the names of editors that are on the committee of journals with sales bigger than 3000.
CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Journal_ID VARCHAR, Sales INTEGER)
SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Sales > 3000
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Journal_ID VARCHAR, Sales INTEGER) Question: Show the names of editors that...
Show the id, name of each editor and the number of journal committees they are on.
CREATE TABLE editor (editor_id VARCHAR, Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal_committee (Editor_ID VARCHAR)
SELECT T1.editor_id, T1.Name, COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.editor_id
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE editor (editor_id VARCHAR, Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal_committee (Editor_ID VARCHAR) Question: Show the id, name of each editor and the number of journal committees they are on. [/INST...
Show the names of editors that are on at least two journal committees.
CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal_committee (Editor_ID VARCHAR)
SELECT T1.Name FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.Name HAVING COUNT(*) >= 2
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal_committee (Editor_ID VARCHAR) Question: Show the names of editors that are on at least two journal committees. [/INST] SELECT T1.Name FROM editor AS...
List the names of editors that are not on any journal committee.
CREATE TABLE editor (Name VARCHAR, editor_id VARCHAR); CREATE TABLE journal_committee (Name VARCHAR, editor_id VARCHAR)
SELECT Name FROM editor WHERE NOT editor_id IN (SELECT editor_id FROM journal_committee)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE editor (Name VARCHAR, editor_id VARCHAR); CREATE TABLE journal_committee (Name VARCHAR, editor_id VARCHAR) Question: List the names of editors that are not on any journal committee. [/INST] SELECT Name FROM edit...
List the date, theme and sales of the journal which did not have any of the listed editors serving on committee.
CREATE TABLE journal_committee (journal_ID VARCHAR); CREATE TABLE journal (date VARCHAR, theme VARCHAR, sales VARCHAR); CREATE TABLE journal (date VARCHAR, theme VARCHAR, sales VARCHAR, journal_ID VARCHAR)
SELECT date, theme, sales FROM journal EXCEPT SELECT T1.date, T1.theme, T1.sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE journal_committee (journal_ID VARCHAR); CREATE TABLE journal (date VARCHAR, theme VARCHAR, sales VARCHAR); CREATE TABLE journal (date VARCHAR, theme VARCHAR, sales VARCHAR, journal_ID VARCHAR) Question: List the...
What is the average sales of the journals that have an editor whose work type is 'Photo'?
CREATE TABLE journal_committee (journal_ID VARCHAR, work_type VARCHAR); CREATE TABLE journal (sales INTEGER, journal_ID VARCHAR)
SELECT AVG(T1.sales) FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID WHERE T2.work_type = 'Photo'
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE journal_committee (journal_ID VARCHAR, work_type VARCHAR); CREATE TABLE journal (sales INTEGER, journal_ID VARCHAR) Question: What is the average sales of the journals that have an editor whose work type is 'Pho...
How many accounts do we have?
CREATE TABLE Accounts (Id VARCHAR)
SELECT COUNT(*) FROM Accounts
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (Id VARCHAR) Question: How many accounts do we have? [/INST] SELECT COUNT(*) FROM Accounts </s>
Show ids, customer ids, names for all accounts.
CREATE TABLE Accounts (account_id VARCHAR, customer_id VARCHAR, account_name VARCHAR)
SELECT account_id, customer_id, account_name FROM Accounts
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (account_id VARCHAR, customer_id VARCHAR, account_name VARCHAR) Question: Show ids, customer ids, names for all accounts. [/INST] SELECT account_id, customer_id, account_name FROM Accounts </s>
Show other account details for account with name 338.
CREATE TABLE Accounts (other_account_details VARCHAR, account_name VARCHAR)
SELECT other_account_details FROM Accounts WHERE account_name = "338"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (other_account_details VARCHAR, account_name VARCHAR) Question: Show other account details for account with name 338. [/INST] SELECT other_account_details FROM Accounts WHERE account_name = "338" </s>
What is the first name, last name, and phone of the customer with account name 162?
CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR, account_name VARCHAR)
SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = "162"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR, account_name VARCHAR) Question: What is the first nam...
How many accounts does the customer with first name Art and last name Turcotte have?
CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR)
SELECT COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR) Question: How many accounts does the customer with first name Art and last na...
Show all customer ids and the number of accounts for each customer.
CREATE TABLE Accounts (customer_id VARCHAR)
SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (customer_id VARCHAR) Question: Show all customer ids and the number of accounts for each customer. [/INST] SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id </s>
Show the customer id and number of accounts with most accounts.
CREATE TABLE Accounts (customer_id VARCHAR)
SELECT TOP 1 customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (customer_id VARCHAR) Question: Show the customer id and number of accounts with most accounts. [/INST] SELECT TOP 1 customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC </s>
What is the customer first, last name and id with least number of accounts.
CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR)
SELECT TOP 1 T2.customer_first_name, T2.customer_last_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) Question: What is the customer first, last name and id with least number of a...
Show the number of all customers without an account.
CREATE TABLE Customers (customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR)
SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Accounts)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR) Question: Show the number of all customers without an account. [/INST] SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT...
Show the first names and last names of customers without any account.
CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR)
SELECT customer_first_name, customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARC...
Show distinct first and last names for all customers with an account.
CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR)
SELECT DISTINCT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) Question: Show distinct first and last names for all customers with an accoun...
How many customers have an account?
CREATE TABLE Accounts (customer_id VARCHAR)
SELECT COUNT(DISTINCT customer_id) FROM Accounts
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (customer_id VARCHAR) Question: How many customers have an account? [/INST] SELECT COUNT(DISTINCT customer_id) FROM Accounts </s>
How many customers do we have?
CREATE TABLE Customers (Id VARCHAR)
SELECT COUNT(*) FROM Customers
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (Id VARCHAR) Question: How many customers do we have? [/INST] SELECT COUNT(*) FROM Customers </s>
Show ids, first names, last names, and phones for all customers.
CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR)
SELECT customer_id, customer_first_name, customer_last_name, customer_phone FROM Customers
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR) Question: Show ids, first names, last names, and phones for all customers. [/INST] SELECT customer...
What is the phone and email for customer with first name Aniyah and last name Feest?
CREATE TABLE Customers (customer_phone VARCHAR, customer_email VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR)
SELECT customer_phone, customer_email FROM Customers WHERE customer_first_name = "Aniyah" AND customer_last_name = "Feest"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_phone VARCHAR, customer_email VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR) Question: What is the phone and email for customer with first name Aniyah and last name Feest? ...
Show the number of customer cards.
CREATE TABLE Customers_cards (Id VARCHAR)
SELECT COUNT(*) FROM Customers_cards
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers_cards (Id VARCHAR) Question: Show the number of customer cards. [/INST] SELECT COUNT(*) FROM Customers_cards </s>
Show ids, customer ids, card type codes, card numbers for all cards.
CREATE TABLE Customers_cards (card_id VARCHAR, customer_id VARCHAR, card_type_code VARCHAR, card_number VARCHAR)
SELECT card_id, customer_id, card_type_code, card_number FROM Customers_cards
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers_cards (card_id VARCHAR, customer_id VARCHAR, card_type_code VARCHAR, card_number VARCHAR) Question: Show ids, customer ids, card type codes, card numbers for all cards. [/INST] SELECT card_id, customer...
Show the date valid from and the date valid to for the card with card number '4560596484842'.
CREATE TABLE Customers_cards (date_valid_from VARCHAR, date_valid_to VARCHAR, card_number VARCHAR)
SELECT date_valid_from, date_valid_to FROM Customers_cards WHERE card_number = "4560596484842"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers_cards (date_valid_from VARCHAR, date_valid_to VARCHAR, card_number VARCHAR) Question: Show the date valid from and the date valid to for the card with card number '4560596484842'. [/INST] SELECT date_v...
What is the first name, last name, and phone of the customer with card 4560596484842.
CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE Customers_cards (customer_id VARCHAR, card_number VARCHAR)
SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = "4560596484842"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE Customers_cards (customer_id VARCHAR, card_number VARCHAR) Question: What is the fir...
How many cards does customer Art Turcotte have?
CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR)
SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR) Question: How many cards does customer Art Turcotte have? [/INST] SELE...
How many debit cards do we have?
CREATE TABLE Customers_cards (card_type_code VARCHAR)
SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = "Debit"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers_cards (card_type_code VARCHAR) Question: How many debit cards do we have? [/INST] SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = "Debit" </s>
How many credit cards does customer Blanche Huels have?
CREATE TABLE Customers_cards (customer_id VARCHAR, card_type_code VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR)
SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Blanche" AND T2.customer_last_name = "Huels" AND T1.card_type_code = "Credit"
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers_cards (customer_id VARCHAR, card_type_code VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR) Question: How many credit cards does customer ...
Show all customer ids and the number of cards owned by each customer.
CREATE TABLE Customers_cards (customer_id VARCHAR)
SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers_cards (customer_id VARCHAR) Question: Show all customer ids and the number of cards owned by each customer. [/INST] SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id </s>
What is the customer id with most number of cards, and how many does he have?
CREATE TABLE Customers_cards (customer_id VARCHAR)
SELECT TOP 1 customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers_cards (customer_id VARCHAR) Question: What is the customer id with most number of cards, and how many does he have? [/INST] SELECT TOP 1 customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id ...
Show id, first and last names for all customers with at least two cards.
CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR)
SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards 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_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) Question: Show id, first and last names for all customers with at leas...
What is the customer id, first and last name with least number of accounts.
CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR)
SELECT TOP 1 T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) Question: What is the customer id, first and last name with least numb...
Show all card type codes and the number of cards in each type.
CREATE TABLE Customers_cards (card_type_code VARCHAR)
SELECT card_type_code, COUNT(*) FROM Customers_cards GROUP BY card_type_code
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers_cards (card_type_code VARCHAR) Question: Show all card type codes and the number of cards in each type. [/INST] SELECT card_type_code, COUNT(*) FROM Customers_cards GROUP BY card_type_code </s>