instruction
stringlengths 12
244
| input
stringlengths 27
489
| output
stringlengths 18
557
| text
stringlengths 194
1.14k
|
---|---|---|---|
How many institutions are there? | CREATE TABLE inst (Id VARCHAR) | SELECT COUNT(*) FROM inst | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE inst (Id VARCHAR) Question: How many institutions are there? [/INST] SELECT COUNT(*) FROM inst </s> |
How many papers are published in total? | CREATE TABLE papers (Id VARCHAR) | SELECT COUNT(*) FROM papers | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE papers (Id VARCHAR) Question: How many papers are published in total? [/INST] SELECT COUNT(*) FROM papers </s> |
What are the titles of papers published by "Jeremy Gibbons"? | CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) | SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Jeremy" AND t1.lname = "Gibbons" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) Question: What are the titles of papers published by "Jeremy Gibbons"? [/INST] SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Jeremy" AND t1.lname = "Gibbons" </s> |
Find all the papers published by "Aaron Turon". | CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) | SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Aaron" AND t1.lname = "Turon" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) Question: Find all the papers published by "Aaron Turon". [/INST] SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Aaron" AND t1.lname = "Turon" </s> |
How many papers have "Atsushi Ohori" published? | CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE papers (paperid VARCHAR) | SELECT COUNT(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Atsushi" AND t1.lname = "Ohori" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE papers (paperid VARCHAR) Question: How many papers have "Atsushi Ohori" published? [/INST] SELECT COUNT(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Atsushi" AND t1.lname = "Ohori" </s> |
What is the name of the institution that "Matthias Blume" belongs to? | CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE inst (name VARCHAR, instid VARCHAR) | SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Matthias" AND t1.lname = "Blume" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE inst (name VARCHAR, instid VARCHAR) Question: What is the name of the institution that "Matthias Blume" belongs to? [/INST] SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Matthias" AND t1.lname = "Blume" </s> |
Which institution does "Katsuhiro Ueno" belong to? | CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE inst (name VARCHAR, instid VARCHAR) | SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Katsuhiro" AND t1.lname = "Ueno" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE inst (name VARCHAR, instid VARCHAR) Question: Which institution does "Katsuhiro Ueno" belong to? [/INST] SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Katsuhiro" AND t1.lname = "Ueno" </s> |
Who belong to the institution "University of Oxford"? Show the first names and last names. | CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (fname VARCHAR, lname VARCHAR, authid VARCHAR); CREATE TABLE inst (instid VARCHAR, name VARCHAR) | SELECT DISTINCT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Oxford" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (fname VARCHAR, lname VARCHAR, authid VARCHAR); CREATE TABLE inst (instid VARCHAR, name VARCHAR) Question: Who belong to the institution "University of Oxford"? Show the first names and last names. [/INST] SELECT DISTINCT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Oxford" </s> |
Which authors belong to the institution "Google"? Show the first names and last names. | CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (fname VARCHAR, lname VARCHAR, authid VARCHAR); CREATE TABLE inst (instid VARCHAR, name VARCHAR) | SELECT DISTINCT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (fname VARCHAR, lname VARCHAR, authid VARCHAR); CREATE TABLE inst (instid VARCHAR, name VARCHAR) Question: Which authors belong to the institution "Google"? Show the first names and last names. [/INST] SELECT DISTINCT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" </s> |
What are the last names of the author of the paper titled "Binders Unbound"? | CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (lname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR) | SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Binders Unbound" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (lname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR) Question: What are the last names of the author of the paper titled "Binders Unbound"? [/INST] SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Binders Unbound" </s> |
Find the first and last name of the author(s) who wrote the paper "Nameless, Painless". | CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR); CREATE TABLE authors (fname VARCHAR, lname VARCHAR, authid VARCHAR) | SELECT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Nameless , Painless" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR); CREATE TABLE authors (fname VARCHAR, lname VARCHAR, authid VARCHAR) Question: Find the first and last name of the author(s) who wrote the paper "Nameless, Painless". [/INST] SELECT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Nameless , Painless" </s> |
What are the papers published under the institution "Indiana University"? | CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) | SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Indiana University" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) Question: What are the papers published under the institution "Indiana University"? [/INST] SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Indiana University" </s> |
Find all the papers published by the institution "Google". | CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) | SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) Question: Find all the papers published by the institution "Google". [/INST] SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" </s> |
How many papers are published by the institution "Tokohu University"? | CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) | SELECT COUNT(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Tokohu University" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) Question: How many papers are published by the institution "Tokohu University"? [/INST] SELECT COUNT(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Tokohu University" </s> |
Find the number of papers published by the institution "University of Pennsylvania". | CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) | SELECT COUNT(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Pennsylvania" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) Question: Find the number of papers published by the institution "University of Pennsylvania". [/INST] SELECT COUNT(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Pennsylvania" </s> |
Find the papers which have "Olin Shivers" as an author. | CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) | SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Olin" AND t1.lname = "Shivers" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) Question: Find the papers which have "Olin Shivers" as an author. [/INST] SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Olin" AND t1.lname = "Shivers" </s> |
Which papers have "Stephanie Weirich" as an author? | CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) | SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Stephanie" AND t1.lname = "Weirich" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) Question: Which papers have "Stephanie Weirich" as an author? [/INST] SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Stephanie" AND t1.lname = "Weirich" </s> |
Which paper is published in an institution in "USA" and have "Turon" as its second author? | CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR, instid VARCHAR, authorder VARCHAR); CREATE TABLE authors (authid VARCHAR, lname VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE inst (instid VARCHAR, country VARCHAR) | SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "USA" AND t2.authorder = 2 AND t1.lname = "Turon" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR, instid VARCHAR, authorder VARCHAR); CREATE TABLE authors (authid VARCHAR, lname VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE inst (instid VARCHAR, country VARCHAR) Question: Which paper is published in an institution in "USA" and have "Turon" as its second author? [/INST] SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "USA" AND t2.authorder = 2 AND t1.lname = "Turon" </s> |
Find the titles of papers whose first author is affiliated with an institution in the country "Japan" and has last name "Ohori"? | CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR, instid VARCHAR, authorder VARCHAR); CREATE TABLE authors (authid VARCHAR, lname VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE inst (instid VARCHAR, country VARCHAR) | SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "Japan" AND t2.authorder = 1 AND t1.lname = "Ohori" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR, instid VARCHAR, authorder VARCHAR); CREATE TABLE authors (authid VARCHAR, lname VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE inst (instid VARCHAR, country VARCHAR) Question: Find the titles of papers whose first author is affiliated with an institution in the country "Japan" and has last name "Ohori"? [/INST] SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "Japan" AND t2.authorder = 1 AND t1.lname = "Ohori" </s> |
What is the last name of the author that has published the most papers? | CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (lname VARCHAR, fname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR) | SELECT TOP 1 t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname, t1.lname ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (lname VARCHAR, fname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR) Question: What is the last name of the author that has published the most papers? [/INST] SELECT TOP 1 t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname, t1.lname ORDER BY COUNT(*) DESC </s> |
Retrieve the country that has published the most papers. | CREATE TABLE inst (country VARCHAR, instid VARCHAR); CREATE TABLE authorship (instid VARCHAR, paperid VARCHAR); CREATE TABLE papers (paperid VARCHAR) | SELECT TOP 1 t1.country FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.country ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE inst (country VARCHAR, instid VARCHAR); CREATE TABLE authorship (instid VARCHAR, paperid VARCHAR); CREATE TABLE papers (paperid VARCHAR) Question: Retrieve the country that has published the most papers. [/INST] SELECT TOP 1 t1.country FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.country ORDER BY COUNT(*) DESC </s> |
Find the name of the organization that has published the largest number of papers. | CREATE TABLE inst (name VARCHAR, instid VARCHAR); CREATE TABLE authorship (instid VARCHAR, paperid VARCHAR); CREATE TABLE papers (paperid VARCHAR) | SELECT TOP 1 t1.name FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.name ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE inst (name VARCHAR, instid VARCHAR); CREATE TABLE authorship (instid VARCHAR, paperid VARCHAR); CREATE TABLE papers (paperid VARCHAR) Question: Find the name of the organization that has published the largest number of papers. [/INST] SELECT TOP 1 t1.name FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.name ORDER BY COUNT(*) DESC </s> |
Find the titles of the papers that contain the word "ML". | CREATE TABLE papers (title VARCHAR) | SELECT title FROM papers WHERE title LIKE "%ML%" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE papers (title VARCHAR) Question: Find the titles of the papers that contain the word "ML". [/INST] SELECT title FROM papers WHERE title LIKE "%ML%" </s> |
Which paper's title contains the word "Database"? | CREATE TABLE papers (title VARCHAR) | SELECT title FROM papers WHERE title LIKE "%Database%" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE papers (title VARCHAR) Question: Which paper's title contains the word "Database"? [/INST] SELECT title FROM papers WHERE title LIKE "%Database%" </s> |
Find the first names of all the authors who have written a paper with title containing the word "Functional". | CREATE TABLE authors (fname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR); CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR) | SELECT t1.fname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE "%Functional%" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authors (fname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR); CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR) Question: Find the first names of all the authors who have written a paper with title containing the word "Functional". [/INST] SELECT t1.fname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE "%Functional%" </s> |
Find the last names of all the authors that have written a paper with title containing the word "Monadic". | CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (lname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR) | SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE "%Monadic%" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (lname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR) Question: Find the last names of all the authors that have written a paper with title containing the word "Monadic". [/INST] SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE "%Monadic%" </s> |
Retrieve the title of the paper that has the largest number of authors. | CREATE TABLE authorship (authorder INTEGER); CREATE TABLE authorship (paperid VARCHAR, authorder INTEGER); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) | SELECT t2.title FROM authorship AS t1 JOIN papers AS t2 ON t1.paperid = t2.paperid WHERE t1.authorder = (SELECT MAX(authorder) FROM authorship) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authorship (authorder INTEGER); CREATE TABLE authorship (paperid VARCHAR, authorder INTEGER); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) Question: Retrieve the title of the paper that has the largest number of authors. [/INST] SELECT t2.title FROM authorship AS t1 JOIN papers AS t2 ON t1.paperid = t2.paperid WHERE t1.authorder = (SELECT MAX(authorder) FROM authorship) </s> |
What is the first name of the author with last name "Ueno"? | CREATE TABLE authors (fname VARCHAR, lname VARCHAR) | SELECT fname FROM authors WHERE lname = "Ueno" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authors (fname VARCHAR, lname VARCHAR) Question: What is the first name of the author with last name "Ueno"? [/INST] SELECT fname FROM authors WHERE lname = "Ueno" </s> |
Find the last name of the author with first name "Amal". | CREATE TABLE authors (lname VARCHAR, fname VARCHAR) | SELECT lname FROM authors WHERE fname = "Amal" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authors (lname VARCHAR, fname VARCHAR) Question: Find the last name of the author with first name "Amal". [/INST] SELECT lname FROM authors WHERE fname = "Amal" </s> |
Find the first names of all the authors ordered in alphabetical order. | CREATE TABLE authors (fname VARCHAR) | SELECT fname FROM authors ORDER BY fname | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authors (fname VARCHAR) Question: Find the first names of all the authors ordered in alphabetical order. [/INST] SELECT fname FROM authors ORDER BY fname </s> |
Retrieve all the last names of authors in alphabetical order. | CREATE TABLE authors (lname VARCHAR) | SELECT lname FROM authors ORDER BY lname | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authors (lname VARCHAR) Question: Retrieve all the last names of authors in alphabetical order. [/INST] SELECT lname FROM authors ORDER BY lname </s> |
Retrieve all the first and last names of authors in the alphabetical order of last names. | CREATE TABLE authors (fname VARCHAR, lname VARCHAR) | SELECT fname, lname FROM authors ORDER BY lname | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE authors (fname VARCHAR, lname VARCHAR) Question: Retrieve all the first and last names of authors in the alphabetical order of last names. [/INST] SELECT fname, lname FROM authors ORDER BY lname </s> |
How many different last names do the actors and actresses have? | CREATE TABLE actor (last_name VARCHAR) | SELECT COUNT(DISTINCT last_name) FROM actor | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE actor (last_name VARCHAR) Question: How many different last names do the actors and actresses have? [/INST] SELECT COUNT(DISTINCT last_name) FROM actor </s> |
What is the most popular first name of the actors? | CREATE TABLE actor (first_name VARCHAR) | SELECT TOP 1 first_name FROM actor GROUP BY first_name ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE actor (first_name VARCHAR) Question: What is the most popular first name of the actors? [/INST] SELECT TOP 1 first_name FROM actor GROUP BY first_name ORDER BY COUNT(*) DESC </s> |
What is the most popular full name of the actors? | CREATE TABLE actor (first_name VARCHAR, last_name VARCHAR) | SELECT TOP 1 first_name, last_name FROM actor GROUP BY first_name, last_name ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE actor (first_name VARCHAR, last_name VARCHAR) Question: What is the most popular full name of the actors? [/INST] SELECT TOP 1 first_name, last_name FROM actor GROUP BY first_name, last_name ORDER BY COUNT(*) DESC </s> |
Which districts have at least two addresses? | CREATE TABLE address (district VARCHAR) | SELECT district FROM address GROUP BY district HAVING COUNT(*) >= 2 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE address (district VARCHAR) Question: Which districts have at least two addresses? [/INST] SELECT district FROM address GROUP BY district HAVING COUNT(*) >= 2 </s> |
What is the phone number and postal code of the address 1031 Daugavpils Parkway? | CREATE TABLE address (phone VARCHAR, postal_code VARCHAR, address VARCHAR) | SELECT phone, postal_code FROM address WHERE address = '1031 Daugavpils Parkway' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE address (phone VARCHAR, postal_code VARCHAR, address VARCHAR) Question: What is the phone number and postal code of the address 1031 Daugavpils Parkway? [/INST] SELECT phone, postal_code FROM address WHERE address = '1031 Daugavpils Parkway' </s> |
Which city has the most addresses? List the city name, number of addresses, and city id. | CREATE TABLE address (city_id VARCHAR); CREATE TABLE city (city VARCHAR, city_id VARCHAR) | SELECT TOP 1 T2.city, COUNT(*), T1.city_id FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id GROUP BY T1.city_id ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE address (city_id VARCHAR); CREATE TABLE city (city VARCHAR, city_id VARCHAR) Question: Which city has the most addresses? List the city name, number of addresses, and city id. [/INST] SELECT TOP 1 T2.city, COUNT(*), T1.city_id FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id GROUP BY T1.city_id ORDER BY COUNT(*) DESC </s> |
How many addresses are in the district of California? | CREATE TABLE address (district VARCHAR) | SELECT COUNT(*) FROM address WHERE district = 'California' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE address (district VARCHAR) Question: How many addresses are in the district of California? [/INST] SELECT COUNT(*) FROM address WHERE district = 'California' </s> |
Which film is rented at a fee of 0.99 and has less than 3 in the inventory? List the film title and id. | CREATE TABLE film (title VARCHAR, film_id VARCHAR, rental_rate VARCHAR); CREATE TABLE inventory (film_id VARCHAR); CREATE TABLE film (title VARCHAR, film_id VARCHAR) | SELECT title, film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT T1.title, T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id HAVING COUNT(*) < 3 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film (title VARCHAR, film_id VARCHAR, rental_rate VARCHAR); CREATE TABLE inventory (film_id VARCHAR); CREATE TABLE film (title VARCHAR, film_id VARCHAR) Question: Which film is rented at a fee of 0.99 and has less than 3 in the inventory? List the film title and id. [/INST] SELECT title, film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT T1.title, T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id HAVING COUNT(*) < 3 </s> |
How many cities are in Australia? | CREATE TABLE country (country_id VARCHAR, country VARCHAR); CREATE TABLE city (country_id VARCHAR) | SELECT COUNT(*) FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE country (country_id VARCHAR, country VARCHAR); CREATE TABLE city (country_id VARCHAR) Question: How many cities are in Australia? [/INST] SELECT COUNT(*) FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia' </s> |
Which countries have at least 3 cities? | CREATE TABLE country (country VARCHAR, country_id VARCHAR); CREATE TABLE city (country_id VARCHAR) | SELECT T2.country FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id GROUP BY T2.country_id HAVING COUNT(*) >= 3 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE country (country VARCHAR, country_id VARCHAR); CREATE TABLE city (country_id VARCHAR) Question: Which countries have at least 3 cities? [/INST] SELECT T2.country FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id GROUP BY T2.country_id HAVING COUNT(*) >= 3 </s> |
Find all the payment dates for the payments with an amount larger than 10 and the payments handled by a staff person with the first name Elsa. | CREATE TABLE payment (payment_date VARCHAR, staff_id VARCHAR); CREATE TABLE staff (staff_id VARCHAR, first_name VARCHAR); CREATE TABLE payment (payment_date VARCHAR, amount INTEGER) | SELECT payment_date FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE payment (payment_date VARCHAR, staff_id VARCHAR); CREATE TABLE staff (staff_id VARCHAR, first_name VARCHAR); CREATE TABLE payment (payment_date VARCHAR, amount INTEGER) Question: Find all the payment dates for the payments with an amount larger than 10 and the payments handled by a staff person with the first name Elsa. [/INST] SELECT payment_date FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa' </s> |
How many customers have an active value of 1? | CREATE TABLE customer (active VARCHAR) | SELECT COUNT(*) FROM customer WHERE active = '1' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (active VARCHAR) Question: How many customers have an active value of 1? [/INST] SELECT COUNT(*) FROM customer WHERE active = '1' </s> |
Which film has the highest rental rate? And what is the rate? | CREATE TABLE film (title VARCHAR, rental_rate VARCHAR) | SELECT TOP 1 title, rental_rate FROM film ORDER BY rental_rate DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film (title VARCHAR, rental_rate VARCHAR) Question: Which film has the highest rental rate? And what is the rate? [/INST] SELECT TOP 1 title, rental_rate FROM film ORDER BY rental_rate DESC </s> |
Which film has the most number of actors or actresses? List the film name, film id and description. | CREATE TABLE film_actor (film_id VARCHAR); CREATE TABLE film (title VARCHAR, film_id VARCHAR, description VARCHAR) | SELECT TOP 1 T2.title, T2.film_id, T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.film_id ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film_actor (film_id VARCHAR); CREATE TABLE film (title VARCHAR, film_id VARCHAR, description VARCHAR) Question: Which film has the most number of actors or actresses? List the film name, film id and description. [/INST] SELECT TOP 1 T2.title, T2.film_id, T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.film_id ORDER BY COUNT(*) DESC </s> |
Which film actor (actress) starred the most films? List his or her first name, last name and actor id. | CREATE TABLE film_actor (actor_id VARCHAR); CREATE TABLE actor (first_name VARCHAR, last_name VARCHAR, actor_id VARCHAR) | SELECT TOP 1 T2.first_name, T2.last_name, T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film_actor (actor_id VARCHAR); CREATE TABLE actor (first_name VARCHAR, last_name VARCHAR, actor_id VARCHAR) Question: Which film actor (actress) starred the most films? List his or her first name, last name and actor id. [/INST] SELECT TOP 1 T2.first_name, T2.last_name, T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id ORDER BY COUNT(*) DESC </s> |
Which film actors (actresses) played a role in more than 30 films? List his or her first name and last name. | CREATE TABLE film_actor (actor_id VARCHAR); CREATE TABLE actor (first_name VARCHAR, last_name VARCHAR, actor_id VARCHAR) | SELECT T2.first_name, T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id HAVING COUNT(*) > 30 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film_actor (actor_id VARCHAR); CREATE TABLE actor (first_name VARCHAR, last_name VARCHAR, actor_id VARCHAR) Question: Which film actors (actresses) played a role in more than 30 films? List his or her first name and last name. [/INST] SELECT T2.first_name, T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id HAVING COUNT(*) > 30 </s> |
Which store owns most items? | CREATE TABLE inventory (store_id VARCHAR) | SELECT TOP 1 store_id FROM inventory GROUP BY store_id ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE inventory (store_id VARCHAR) Question: Which store owns most items? [/INST] SELECT TOP 1 store_id FROM inventory GROUP BY store_id ORDER BY COUNT(*) DESC </s> |
What is the total amount of all payments? | CREATE TABLE payment (amount INTEGER) | SELECT SUM(amount) FROM payment | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE payment (amount INTEGER) Question: What is the total amount of all payments? [/INST] SELECT SUM(amount) FROM payment </s> |
Which customer, who has made at least one payment, has spent the least money? List his or her first name, last name, and the id. | CREATE TABLE payment (customer_id VARCHAR); CREATE TABLE customer (first_name VARCHAR, last_name VARCHAR, customer_id VARCHAR) | SELECT TOP 1 T1.first_name, T1.last_name, T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY SUM(amount) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE payment (customer_id VARCHAR); CREATE TABLE customer (first_name VARCHAR, last_name VARCHAR, customer_id VARCHAR) Question: Which customer, who has made at least one payment, has spent the least money? List his or her first name, last name, and the id. [/INST] SELECT TOP 1 T1.first_name, T1.last_name, T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY SUM(amount) </s> |
What is the genre name of the film HUNGER ROOF? | CREATE TABLE film_category (category_id VARCHAR, film_id VARCHAR); CREATE TABLE film (film_id VARCHAR, title VARCHAR); CREATE TABLE category (name VARCHAR, category_id VARCHAR) | SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'HUNGER ROOF' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film_category (category_id VARCHAR, film_id VARCHAR); CREATE TABLE film (film_id VARCHAR, title VARCHAR); CREATE TABLE category (name VARCHAR, category_id VARCHAR) Question: What is the genre name of the film HUNGER ROOF? [/INST] SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'HUNGER ROOF' </s> |
How many films are there in each category? List the genre name, genre id and the count. | CREATE TABLE film_category (category_id VARCHAR); CREATE TABLE category (name VARCHAR, category_id VARCHAR) | SELECT T2.name, T1.category_id, COUNT(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T1.category_id | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film_category (category_id VARCHAR); CREATE TABLE category (name VARCHAR, category_id VARCHAR) Question: How many films are there in each category? List the genre name, genre id and the count. [/INST] SELECT T2.name, T1.category_id, COUNT(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T1.category_id </s> |
Which film has the most copies in the inventory? List both title and id. | CREATE TABLE film (title VARCHAR, film_id VARCHAR); CREATE TABLE inventory (film_id VARCHAR) | SELECT TOP 1 T1.title, T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film (title VARCHAR, film_id VARCHAR); CREATE TABLE inventory (film_id VARCHAR) Question: Which film has the most copies in the inventory? List both title and id. [/INST] SELECT TOP 1 T1.title, T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id ORDER BY COUNT(*) DESC </s> |
What is the film title and inventory id of the item in the inventory which was rented most frequently? | CREATE TABLE film (title VARCHAR, film_id VARCHAR); CREATE TABLE inventory (inventory_id VARCHAR, film_id VARCHAR); CREATE TABLE rental (inventory_id VARCHAR) | SELECT TOP 1 T1.title, T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T2.inventory_id ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film (title VARCHAR, film_id VARCHAR); CREATE TABLE inventory (inventory_id VARCHAR, film_id VARCHAR); CREATE TABLE rental (inventory_id VARCHAR) Question: What is the film title and inventory id of the item in the inventory which was rented most frequently? [/INST] SELECT TOP 1 T1.title, T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T2.inventory_id ORDER BY COUNT(*) DESC </s> |
How many languages are in these films? | CREATE TABLE film (language_id VARCHAR) | SELECT COUNT(DISTINCT language_id) FROM film | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film (language_id VARCHAR) Question: How many languages are in these films? [/INST] SELECT COUNT(DISTINCT language_id) FROM film </s> |
What are all the movies rated as R? List the titles. | CREATE TABLE film (title VARCHAR, rating VARCHAR) | SELECT title FROM film WHERE rating = 'R' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film (title VARCHAR, rating VARCHAR) Question: What are all the movies rated as R? List the titles. [/INST] SELECT title FROM film WHERE rating = 'R' </s> |
Where is store 1 located? | CREATE TABLE store (address_id VARCHAR); CREATE TABLE address (address VARCHAR, address_id VARCHAR) | SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE store_id = 1 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE store (address_id VARCHAR); CREATE TABLE address (address VARCHAR, address_id VARCHAR) Question: Where is store 1 located? [/INST] SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE store_id = 1 </s> |
Which staff handled least number of payments? List the full name and the id. | CREATE TABLE payment (staff_id VARCHAR); CREATE TABLE staff (first_name VARCHAR, last_name VARCHAR, staff_id VARCHAR) | SELECT TOP 1 T1.first_name, T1.last_name, T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.staff_id ORDER BY COUNT(*) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE payment (staff_id VARCHAR); CREATE TABLE staff (first_name VARCHAR, last_name VARCHAR, staff_id VARCHAR) Question: Which staff handled least number of payments? List the full name and the id. [/INST] SELECT TOP 1 T1.first_name, T1.last_name, T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.staff_id ORDER BY COUNT(*) </s> |
Which language does the film AIRPORT POLLOCK use? List the language name. | CREATE TABLE film (language_id VARCHAR, title VARCHAR); CREATE TABLE LANGUAGE (name VARCHAR, language_id VARCHAR) | SELECT T2.name FROM film AS T1 JOIN LANGUAGE AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'AIRPORT POLLOCK' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film (language_id VARCHAR, title VARCHAR); CREATE TABLE LANGUAGE (name VARCHAR, language_id VARCHAR) Question: Which language does the film AIRPORT POLLOCK use? List the language name. [/INST] SELECT T2.name FROM film AS T1 JOIN LANGUAGE AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'AIRPORT POLLOCK' </s> |
How many stores are there? | CREATE TABLE store (Id VARCHAR) | SELECT COUNT(*) FROM store | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE store (Id VARCHAR) Question: How many stores are there? [/INST] SELECT COUNT(*) FROM store </s> |
How many kinds of different ratings are listed? | CREATE TABLE film (rating VARCHAR) | SELECT COUNT(DISTINCT rating) FROM film | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film (rating VARCHAR) Question: How many kinds of different ratings are listed? [/INST] SELECT COUNT(DISTINCT rating) FROM film </s> |
Which movies have 'Deleted Scenes' as a substring in the special feature? | CREATE TABLE film (title VARCHAR, special_features VARCHAR) | SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film (title VARCHAR, special_features VARCHAR) Question: Which movies have 'Deleted Scenes' as a substring in the special feature? [/INST] SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%' </s> |
How many items in inventory does store 1 have? | CREATE TABLE inventory (store_id VARCHAR) | SELECT COUNT(*) FROM inventory WHERE store_id = 1 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE inventory (store_id VARCHAR) Question: How many items in inventory does store 1 have? [/INST] SELECT COUNT(*) FROM inventory WHERE store_id = 1 </s> |
When did the first payment happen? | CREATE TABLE payment (payment_date VARCHAR) | SELECT TOP 1 payment_date FROM payment ORDER BY payment_date | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE payment (payment_date VARCHAR) Question: When did the first payment happen? [/INST] SELECT TOP 1 payment_date FROM payment ORDER BY payment_date </s> |
Where does the customer with the first name Linda live? And what is her email? | CREATE TABLE customer (email VARCHAR, address_id VARCHAR, first_name VARCHAR); CREATE TABLE address (address VARCHAR, address_id VARCHAR) | SELECT T2.address, T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id = T1.address_id WHERE T1.first_name = 'LINDA' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (email VARCHAR, address_id VARCHAR, first_name VARCHAR); CREATE TABLE address (address VARCHAR, address_id VARCHAR) Question: Where does the customer with the first name Linda live? And what is her email? [/INST] SELECT T2.address, T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id = T1.address_id WHERE T1.first_name = 'LINDA' </s> |
Find all the films longer than 100 minutes, or rated PG, except those who cost more than 200 for replacement. List the titles. | CREATE TABLE film (title VARCHAR, replacement_cost INTEGER, LENGTH VARCHAR, rating VARCHAR) | SELECT title FROM film WHERE LENGTH > 100 OR rating = 'PG' EXCEPT SELECT title FROM film WHERE replacement_cost > 200 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE film (title VARCHAR, replacement_cost INTEGER, LENGTH VARCHAR, rating VARCHAR) Question: Find all the films longer than 100 minutes, or rated PG, except those who cost more than 200 for replacement. List the titles. [/INST] SELECT title FROM film WHERE LENGTH > 100 OR rating = 'PG' EXCEPT SELECT title FROM film WHERE replacement_cost > 200 </s> |
What is the first name and the last name of the customer who made the earliest rental? | CREATE TABLE customer (first_name VARCHAR, last_name VARCHAR, customer_id VARCHAR); CREATE TABLE rental (customer_id VARCHAR, rental_date VARCHAR) | SELECT TOP 1 T1.first_name, T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (first_name VARCHAR, last_name VARCHAR, customer_id VARCHAR); CREATE TABLE rental (customer_id VARCHAR, rental_date VARCHAR) Question: What is the first name and the last name of the customer who made the earliest rental? [/INST] SELECT TOP 1 T1.first_name, T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date </s> |
What is the full name of the staff member who has rented a film to a customer with the first name April and the last name Burns? | CREATE TABLE customer (customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE rental (staff_id VARCHAR, customer_id VARCHAR); CREATE TABLE staff (first_name VARCHAR, last_name VARCHAR, staff_id VARCHAR) | SELECT DISTINCT T1.first_name, T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE rental (staff_id VARCHAR, customer_id VARCHAR); CREATE TABLE staff (first_name VARCHAR, last_name VARCHAR, staff_id VARCHAR) Question: What is the full name of the staff member who has rented a film to a customer with the first name April and the last name Burns? [/INST] SELECT DISTINCT T1.first_name, T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS' </s> |
Which store has most the customers? | CREATE TABLE customer (store_id VARCHAR) | SELECT TOP 1 store_id FROM customer GROUP BY store_id ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (store_id VARCHAR) Question: Which store has most the customers? [/INST] SELECT TOP 1 store_id FROM customer GROUP BY store_id ORDER BY COUNT(*) DESC </s> |
What is the largest payment amount? | CREATE TABLE payment (amount VARCHAR) | SELECT TOP 1 amount FROM payment ORDER BY amount DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE payment (amount VARCHAR) Question: What is the largest payment amount? [/INST] SELECT TOP 1 amount FROM payment ORDER BY amount DESC </s> |
Where does the staff member with the first name Elsa live? | CREATE TABLE staff (address_id VARCHAR, first_name VARCHAR); CREATE TABLE address (address VARCHAR, address_id VARCHAR) | SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE staff (address_id VARCHAR, first_name VARCHAR); CREATE TABLE address (address VARCHAR, address_id VARCHAR) Question: Where does the staff member with the first name Elsa live? [/INST] SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa' </s> |
What are the first names of customers who have not rented any films after '2005-08-23 02:06:01'? | CREATE TABLE customer (first_name VARCHAR, customer_id VARCHAR, rental_date INTEGER); CREATE TABLE rental (first_name VARCHAR, customer_id VARCHAR, rental_date INTEGER) | SELECT first_name FROM customer WHERE NOT customer_id IN (SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01') | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (first_name VARCHAR, customer_id VARCHAR, rental_date INTEGER); CREATE TABLE rental (first_name VARCHAR, customer_id VARCHAR, rental_date INTEGER) Question: What are the first names of customers who have not rented any films after '2005-08-23 02:06:01'? [/INST] SELECT first_name FROM customer WHERE NOT customer_id IN (SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01') </s> |
How many bank branches are there? | CREATE TABLE bank (Id VARCHAR) | SELECT COUNT(*) FROM bank | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE bank (Id VARCHAR) Question: How many bank branches are there? [/INST] SELECT COUNT(*) FROM bank </s> |
How many customers are there? | CREATE TABLE bank (no_of_customers INTEGER) | SELECT SUM(no_of_customers) FROM bank | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE bank (no_of_customers INTEGER) Question: How many customers are there? [/INST] SELECT SUM(no_of_customers) FROM bank </s> |
Find the number of customers in the banks at New York City. | CREATE TABLE bank (no_of_customers INTEGER, city VARCHAR) | SELECT SUM(no_of_customers) FROM bank WHERE city = 'New York City' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE bank (no_of_customers INTEGER, city VARCHAR) Question: Find the number of customers in the banks at New York City. [/INST] SELECT SUM(no_of_customers) FROM bank WHERE city = 'New York City' </s> |
Find the average number of customers in all banks of Utah state. | CREATE TABLE bank (no_of_customers INTEGER, state VARCHAR) | SELECT AVG(no_of_customers) FROM bank WHERE state = 'Utah' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE bank (no_of_customers INTEGER, state VARCHAR) Question: Find the average number of customers in all banks of Utah state. [/INST] SELECT AVG(no_of_customers) FROM bank WHERE state = 'Utah' </s> |
Find the average number of customers cross all banks. | CREATE TABLE bank (no_of_customers INTEGER) | SELECT AVG(no_of_customers) FROM bank | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE bank (no_of_customers INTEGER) Question: Find the average number of customers cross all banks. [/INST] SELECT AVG(no_of_customers) FROM bank </s> |
Find the city and state of the bank branch named morningside. | CREATE TABLE bank (city VARCHAR, state VARCHAR, bname VARCHAR) | SELECT city, state FROM bank WHERE bname = 'morningside' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE bank (city VARCHAR, state VARCHAR, bname VARCHAR) Question: Find the city and state of the bank branch named morningside. [/INST] SELECT city, state FROM bank WHERE bname = 'morningside' </s> |
Find the branch names of banks in the New York state. | CREATE TABLE bank (bname VARCHAR, state VARCHAR) | SELECT bname FROM bank WHERE state = 'New York' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE bank (bname VARCHAR, state VARCHAR) Question: Find the branch names of banks in the New York state. [/INST] SELECT bname FROM bank WHERE state = 'New York' </s> |
List the name of all customers sorted by their account balance in ascending order. | CREATE TABLE customer (cust_name VARCHAR, acc_bal VARCHAR) | SELECT cust_name FROM customer ORDER BY acc_bal | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (cust_name VARCHAR, acc_bal VARCHAR) Question: List the name of all customers sorted by their account balance in ascending order. [/INST] SELECT cust_name FROM customer ORDER BY acc_bal </s> |
List the name of all different customers who have some loan sorted by their total loan amount. | CREATE TABLE loan (cust_id VARCHAR, amount INTEGER); CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR) | SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY SUM(T2.amount) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE loan (cust_id VARCHAR, amount INTEGER); CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR) Question: List the name of all different customers who have some loan sorted by their total loan amount. [/INST] SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY SUM(T2.amount) </s> |
Find the state, account type, and credit score of the customer whose number of loan is 0. | CREATE TABLE customer (state VARCHAR, acc_type VARCHAR, credit_score VARCHAR, no_of_loans VARCHAR) | SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (state VARCHAR, acc_type VARCHAR, credit_score VARCHAR, no_of_loans VARCHAR) Question: Find the state, account type, and credit score of the customer whose number of loan is 0. [/INST] SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0 </s> |
Find the number of different cities which banks are located at. | CREATE TABLE bank (city VARCHAR) | SELECT COUNT(DISTINCT city) FROM bank | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE bank (city VARCHAR) Question: Find the number of different cities which banks are located at. [/INST] SELECT COUNT(DISTINCT city) FROM bank </s> |
Find the number of different states which banks are located at. | CREATE TABLE bank (state VARCHAR) | SELECT COUNT(DISTINCT state) FROM bank | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE bank (state VARCHAR) Question: Find the number of different states which banks are located at. [/INST] SELECT COUNT(DISTINCT state) FROM bank </s> |
How many distinct types of accounts are there? | CREATE TABLE customer (acc_type VARCHAR) | SELECT COUNT(DISTINCT acc_type) FROM customer | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (acc_type VARCHAR) Question: How many distinct types of accounts are there? [/INST] SELECT COUNT(DISTINCT acc_type) FROM customer </s> |
Find the name and account balance of the customer whose name includes the letter ‘a’. | CREATE TABLE customer (cust_name VARCHAR, acc_bal VARCHAR) | SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (cust_name VARCHAR, acc_bal VARCHAR) Question: Find the name and account balance of the customer whose name includes the letter ‘a’. [/INST] SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%' </s> |
Find the total account balance of each customer from Utah or Texas. | CREATE TABLE customer (acc_bal INTEGER, state VARCHAR) | SELECT SUM(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (acc_bal INTEGER, state VARCHAR) Question: Find the total account balance of each customer from Utah or Texas. [/INST] SELECT SUM(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas' </s> |
Find the name of customers who have both saving and checking account types. | CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR) | SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR) Question: Find the name of customers who have both saving and checking account types. [/INST] SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking' </s> |
Find the name of customers who do not have an saving account. | CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR) | SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR) Question: Find the name of customers who do not have an saving account. [/INST] SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving' </s> |
Find the name of customers who do not have a loan with a type of Mortgages. | CREATE TABLE loan (cust_id VARCHAR, loan_type VARCHAR); CREATE TABLE customer (cust_name VARCHAR); CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR) | SELECT cust_name FROM customer EXCEPT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE T2.loan_type = 'Mortgages' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE loan (cust_id VARCHAR, loan_type VARCHAR); CREATE TABLE customer (cust_name VARCHAR); CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR) Question: Find the name of customers who do not have a loan with a type of Mortgages. [/INST] SELECT cust_name FROM customer EXCEPT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE T2.loan_type = 'Mortgages' </s> |
Find the name of customers who have loans of both Mortgages and Auto. | CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR) | SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE loan_type = 'Mortgages' INTERSECT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE loan_type = 'Auto' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR) Question: Find the name of customers who have loans of both Mortgages and Auto. [/INST] SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE loan_type = 'Mortgages' INTERSECT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE loan_type = 'Auto' </s> |
Find the name of customers whose credit score is below the average credit scores of all customers. | CREATE TABLE customer (cust_name VARCHAR, credit_score INTEGER) | SELECT cust_name FROM customer WHERE credit_score < (SELECT AVG(credit_score) FROM customer) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (cust_name VARCHAR, credit_score INTEGER) Question: Find the name of customers whose credit score is below the average credit scores of all customers. [/INST] SELECT cust_name FROM customer WHERE credit_score < (SELECT AVG(credit_score) FROM customer) </s> |
Find the branch name of the bank that has the most number of customers. | CREATE TABLE bank (bname VARCHAR, no_of_customers VARCHAR) | SELECT TOP 1 bname FROM bank ORDER BY no_of_customers DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE bank (bname VARCHAR, no_of_customers VARCHAR) Question: Find the branch name of the bank that has the most number of customers. [/INST] SELECT TOP 1 bname FROM bank ORDER BY no_of_customers DESC </s> |
Find the name of customer who has the lowest credit score. | CREATE TABLE customer (cust_name VARCHAR, credit_score VARCHAR) | SELECT TOP 1 cust_name FROM customer ORDER BY credit_score | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (cust_name VARCHAR, credit_score VARCHAR) Question: Find the name of customer who has the lowest credit score. [/INST] SELECT TOP 1 cust_name FROM customer ORDER BY credit_score </s> |
Find the name, account type, and account balance of the customer who has the highest credit score. | CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR, acc_bal VARCHAR, credit_score VARCHAR) | SELECT TOP 1 cust_name, acc_type, acc_bal FROM customer ORDER BY credit_score DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR, acc_bal VARCHAR, credit_score VARCHAR) Question: Find the name, account type, and account balance of the customer who has the highest credit score. [/INST] SELECT TOP 1 cust_name, acc_type, acc_bal FROM customer ORDER BY credit_score DESC </s> |
Find the name of customer who has the highest amount of loans. | CREATE TABLE loan (cust_id VARCHAR, amount INTEGER); CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR) | SELECT TOP 1 T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY SUM(T2.amount) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE loan (cust_id VARCHAR, amount INTEGER); CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR) Question: Find the name of customer who has the highest amount of loans. [/INST] SELECT TOP 1 T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY SUM(T2.amount) DESC </s> |
Find the state which has the most number of customers. | CREATE TABLE bank (state VARCHAR, no_of_customers INTEGER) | SELECT TOP 1 state FROM bank GROUP BY state ORDER BY SUM(no_of_customers) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE bank (state VARCHAR, no_of_customers INTEGER) Question: Find the state which has the most number of customers. [/INST] SELECT TOP 1 state FROM bank GROUP BY state ORDER BY SUM(no_of_customers) DESC </s> |
For each account type, find the average account balance of customers with credit score lower than 50. | CREATE TABLE customer (acc_type VARCHAR, acc_bal INTEGER, credit_score INTEGER) | SELECT AVG(acc_bal), acc_type FROM customer WHERE credit_score < 50 GROUP BY acc_type | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (acc_type VARCHAR, acc_bal INTEGER, credit_score INTEGER) Question: For each account type, find the average account balance of customers with credit score lower than 50. [/INST] SELECT AVG(acc_bal), acc_type FROM customer WHERE credit_score < 50 GROUP BY acc_type </s> |
For each state, find the total account balance of customers whose credit score is above 100. | CREATE TABLE customer (state VARCHAR, acc_bal INTEGER, credit_score INTEGER) | SELECT SUM(acc_bal), state FROM customer WHERE credit_score > 100 GROUP BY state | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customer (state VARCHAR, acc_bal INTEGER, credit_score INTEGER) Question: For each state, find the total account balance of customers whose credit score is above 100. [/INST] SELECT SUM(acc_bal), state FROM customer WHERE credit_score > 100 GROUP BY state </s> |
Subsets and Splits