answer
stringlengths
18
557
context
stringlengths
27
489
question
stringlengths
12
244
text
stringlengths
275
1.7k
SELECT name FROM employee ORDER BY age
CREATE TABLE employee (name VARCHAR, age VARCHAR)
Sort employee names by their age in ascending order.
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM employee ORDER BY age Context: CREATE TABLE employee (name VARCHAR, age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Sort employee names by their age in ascending order. The answer to your question is: SELECT...
SELECT COUNT(*), city FROM employee GROUP BY city
CREATE TABLE employee (city VARCHAR)
What is the number of employees from each city?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), city FROM employee GROUP BY city Context: CREATE TABLE employee (city VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the number of employees from each city? The answer to your question is: SELECT COUNT(...
SELECT city FROM employee WHERE age < 30 GROUP BY city HAVING COUNT(*) > 1
CREATE TABLE employee (city VARCHAR, age INTEGER)
Which cities do more than one employee under age 30 come from?
<s>[INST] Given the following SQL query and context: Query: SELECT city FROM employee WHERE age < 30 GROUP BY city HAVING COUNT(*) > 1 Context: CREATE TABLE employee (city VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Which cities do more than one employee under age 30 com...
SELECT COUNT(*), LOCATION FROM shop GROUP BY LOCATION
CREATE TABLE shop (LOCATION VARCHAR)
Find the number of shops in each location.
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), LOCATION FROM shop GROUP BY LOCATION Context: CREATE TABLE shop (LOCATION VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of shops in each location. The answer to your question is: SELECT COUNT(*...
SELECT manager_name, district FROM shop ORDER BY number_products DESC LIMIT 1
CREATE TABLE shop (manager_name VARCHAR, district VARCHAR, number_products VARCHAR)
Find the manager name and district of the shop whose number of products is the largest.
<s>[INST] Given the following SQL query and context: Query: SELECT manager_name, district FROM shop ORDER BY number_products DESC LIMIT 1 Context: CREATE TABLE shop (manager_name VARCHAR, district VARCHAR, number_products VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the manager n...
SELECT MIN(Number_products), MAX(Number_products) FROM shop
CREATE TABLE shop (Number_products INTEGER)
find the minimum and maximum number of products of all stores.
<s>[INST] Given the following SQL query and context: Query: SELECT MIN(Number_products), MAX(Number_products) FROM shop Context: CREATE TABLE shop (Number_products INTEGER) [/INST] Based on the provided SQL query and context, your question is: find the minimum and maximum number of products of all stores. The answer to...
SELECT name, LOCATION, district FROM shop ORDER BY number_products DESC
CREATE TABLE shop (name VARCHAR, LOCATION VARCHAR, district VARCHAR, number_products VARCHAR)
Return the name, location and district of all shops in descending order of number of products.
<s>[INST] Given the following SQL query and context: Query: SELECT name, LOCATION, district FROM shop ORDER BY number_products DESC Context: CREATE TABLE shop (name VARCHAR, LOCATION VARCHAR, district VARCHAR, number_products VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Return the nam...
SELECT name FROM shop WHERE number_products > (SELECT AVG(number_products) FROM shop)
CREATE TABLE shop (name VARCHAR, number_products INTEGER)
Find the names of stores whose number products is more than the average number of products.
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM shop WHERE number_products > (SELECT AVG(number_products) FROM shop) Context: CREATE TABLE shop (name VARCHAR, number_products INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the names of stores whose numbe...
SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID = t2.Employee_ID GROUP BY t2.Employee_ID ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE evaluation (Employee_ID VARCHAR); CREATE TABLE employee (name VARCHAR, Employee_ID VARCHAR)
find the name of employee who was awarded the most times in the evaluation.
<s>[INST] Given the following SQL query and context: Query: SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID = t2.Employee_ID GROUP BY t2.Employee_ID ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE evaluation (Employee_ID VARCHAR); CREATE TABLE employee (name VARCHAR, Employee_ID VARCHAR)...
SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID = t2.Employee_ID ORDER BY t2.bonus DESC LIMIT 1
CREATE TABLE evaluation (Employee_ID VARCHAR, bonus VARCHAR); CREATE TABLE employee (name VARCHAR, Employee_ID VARCHAR)
Find the name of the employee who got the highest one time bonus.
<s>[INST] Given the following SQL query and context: Query: SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID = t2.Employee_ID ORDER BY t2.bonus DESC LIMIT 1 Context: CREATE TABLE evaluation (Employee_ID VARCHAR, bonus VARCHAR); CREATE TABLE employee (name VARCHAR, Employee_ID VARCHAR) [/INST] ...
SELECT name FROM employee WHERE NOT Employee_ID IN (SELECT Employee_ID FROM evaluation)
CREATE TABLE evaluation (name VARCHAR, Employee_ID VARCHAR); CREATE TABLE employee (name VARCHAR, Employee_ID VARCHAR)
Find the names of employees who never won any award in the evaluation.
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM employee WHERE NOT Employee_ID IN (SELECT Employee_ID FROM evaluation) Context: CREATE TABLE evaluation (name VARCHAR, Employee_ID VARCHAR); CREATE TABLE employee (name VARCHAR, Employee_ID VARCHAR) [/INST] Based on the provided SQL query and ...
SELECT t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t1.shop_id ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE shop (name VARCHAR, shop_id VARCHAR); CREATE TABLE hiring (shop_id VARCHAR)
What is the name of the shop that is hiring the largest number of employees?
<s>[INST] Given the following SQL query and context: Query: SELECT t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t1.shop_id ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE shop (name VARCHAR, shop_id VARCHAR); CREATE TABLE hiring (shop_id VARCHAR) [/INST] Based on the provided SQL q...
SELECT name FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM hiring)
CREATE TABLE shop (name VARCHAR, shop_id VARCHAR); CREATE TABLE hiring (name VARCHAR, shop_id VARCHAR)
Find the name of the shops that do not hire any employee.
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM hiring) Context: CREATE TABLE shop (name VARCHAR, shop_id VARCHAR); CREATE TABLE hiring (name VARCHAR, shop_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find ...
SELECT COUNT(*), t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t2.name
CREATE TABLE shop (name VARCHAR, shop_id VARCHAR); CREATE TABLE hiring (shop_id VARCHAR)
Find the number of employees hired in each shop; show the shop name as well.
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t2.name Context: CREATE TABLE shop (name VARCHAR, shop_id VARCHAR); CREATE TABLE hiring (shop_id VARCHAR) [/INST] Based on the provided SQL query and context, your q...
SELECT SUM(bonus) FROM evaluation
CREATE TABLE evaluation (bonus INTEGER)
What is total bonus given in all evaluations?
<s>[INST] Given the following SQL query and context: Query: SELECT SUM(bonus) FROM evaluation Context: CREATE TABLE evaluation (bonus INTEGER) [/INST] Based on the provided SQL query and context, your question is: What is total bonus given in all evaluations? The answer to your question is: SELECT SUM(bonus) FROM evalu...
SELECT * FROM hiring
CREATE TABLE hiring (Id VARCHAR)
Give me all the information about hiring.
<s>[INST] Given the following SQL query and context: Query: SELECT * FROM hiring Context: CREATE TABLE hiring (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Give me all the information about hiring. The answer to your question is: SELECT * FROM hiring. [/s>
SELECT district FROM shop WHERE Number_products < 3000 INTERSECT SELECT district FROM shop WHERE Number_products > 10000
CREATE TABLE shop (district VARCHAR, Number_products INTEGER)
Which district has both stores with less than 3000 products and stores with more than 10000 products?
<s>[INST] Given the following SQL query and context: Query: SELECT district FROM shop WHERE Number_products < 3000 INTERSECT SELECT district FROM shop WHERE Number_products > 10000 Context: CREATE TABLE shop (district VARCHAR, Number_products INTEGER) [/INST] Based on the provided SQL query and context, your question i...
SELECT COUNT(DISTINCT LOCATION) FROM shop
CREATE TABLE shop (LOCATION VARCHAR)
How many different store locations are there?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT LOCATION) FROM shop Context: CREATE TABLE shop (LOCATION VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many different store locations are there? The answer to your question is: SELECT COUNT(DISTINCT L...
SELECT document_id, document_name, document_description FROM Documents
CREATE TABLE Documents (document_id VARCHAR, document_name VARCHAR, document_description VARCHAR)
List document IDs, document names, and document descriptions for all documents.
<s>[INST] Given the following SQL query and context: Query: SELECT document_id, document_name, document_description FROM Documents Context: CREATE TABLE Documents (document_id VARCHAR, document_name VARCHAR, document_description VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List docume...
SELECT document_name, template_id FROM Documents WHERE Document_Description LIKE "%w%"
CREATE TABLE Documents (document_name VARCHAR, template_id VARCHAR, Document_Description VARCHAR)
What is the document name and template id for document with description with the letter 'w' in it?
<s>[INST] Given the following SQL query and context: Query: SELECT document_name, template_id FROM Documents WHERE Document_Description LIKE "%w%" Context: CREATE TABLE Documents (document_name VARCHAR, template_id VARCHAR, Document_Description VARCHAR) [/INST] Based on the provided SQL query and context, your question...
SELECT document_id, template_id, Document_Description FROM Documents WHERE document_name = "Robbin CV"
CREATE TABLE Documents (document_id VARCHAR, template_id VARCHAR, Document_Description VARCHAR, document_name VARCHAR)
What is the document id, template id and description for document named "Robbin CV"?
<s>[INST] Given the following SQL query and context: Query: SELECT document_id, template_id, Document_Description FROM Documents WHERE document_name = "Robbin CV" Context: CREATE TABLE Documents (document_id VARCHAR, template_id VARCHAR, Document_Description VARCHAR, document_name VARCHAR) [/INST] Based on the provided...
SELECT COUNT(DISTINCT template_id) FROM Documents
CREATE TABLE Documents (template_id VARCHAR)
How many different templates do all document use?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT template_id) FROM Documents Context: CREATE TABLE Documents (template_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many different templates do all document use? The answer to your question is: SEL...
SELECT COUNT(*) FROM Documents AS T1 JOIN Templates AS T2 ON T1.Template_ID = T2.Template_ID WHERE T2.Template_Type_Code = 'PPT'
CREATE TABLE Templates (Template_ID VARCHAR, Template_Type_Code VARCHAR); CREATE TABLE Documents (Template_ID VARCHAR)
How many documents are using the template with type code 'PPT'?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Documents AS T1 JOIN Templates AS T2 ON T1.Template_ID = T2.Template_ID WHERE T2.Template_Type_Code = 'PPT' Context: CREATE TABLE Templates (Template_ID VARCHAR, Template_Type_Code VARCHAR); CREATE TABLE Documents (Template_ID VARCHAR) [/I...
SELECT template_id, COUNT(*) FROM Documents GROUP BY template_id
CREATE TABLE Documents (template_id VARCHAR)
Show all template ids and number of documents using each template.
<s>[INST] Given the following SQL query and context: Query: SELECT template_id, COUNT(*) FROM Documents GROUP BY template_id Context: CREATE TABLE Documents (template_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all template ids and number of documents using each template. The...
SELECT T1.template_id, T2.Template_Type_Code FROM Documents AS T1 JOIN Templates AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_id ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE Documents (template_id VARCHAR); CREATE TABLE Templates (Template_Type_Code VARCHAR, template_id VARCHAR)
What is the id and type code for the template used by the most documents?
<s>[INST] Given the following SQL query and context: Query: SELECT T1.template_id, T2.Template_Type_Code FROM Documents AS T1 JOIN Templates AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_id ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE Documents (template_id VARCHAR); CREATE TABLE Templates (Temp...
SELECT template_id FROM Documents GROUP BY template_id HAVING COUNT(*) > 1
CREATE TABLE Documents (template_id VARCHAR)
Show ids for all templates that are used by more than one document.
<s>[INST] Given the following SQL query and context: Query: SELECT template_id FROM Documents GROUP BY template_id HAVING COUNT(*) > 1 Context: CREATE TABLE Documents (template_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show ids for all templates that are used by more than one do...
SELECT template_id FROM Templates EXCEPT SELECT template_id FROM Documents
CREATE TABLE Documents (template_id VARCHAR); CREATE TABLE Templates (template_id VARCHAR)
Show ids for all templates not used by any document.
<s>[INST] Given the following SQL query and context: Query: SELECT template_id FROM Templates EXCEPT SELECT template_id FROM Documents Context: CREATE TABLE Documents (template_id VARCHAR); CREATE TABLE Templates (template_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show ids for a...
SELECT COUNT(*) FROM Templates
CREATE TABLE Templates (Id VARCHAR)
How many templates do we have?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Templates Context: CREATE TABLE Templates (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many templates do we have? The answer to your question is: SELECT COUNT(*) FROM Templates. [/s>
SELECT template_id, version_number, template_type_code FROM Templates
CREATE TABLE Templates (template_id VARCHAR, version_number VARCHAR, template_type_code VARCHAR)
Show template ids, version numbers, and template type codes for all templates.
<s>[INST] Given the following SQL query and context: Query: SELECT template_id, version_number, template_type_code FROM Templates Context: CREATE TABLE Templates (template_id VARCHAR, version_number VARCHAR, template_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show template...
SELECT DISTINCT template_type_code FROM Templates
CREATE TABLE Templates (template_type_code VARCHAR)
Show all distinct template type codes for all templates.
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT template_type_code FROM Templates Context: CREATE TABLE Templates (template_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all distinct template type codes for all templates. The answer to your qu...
SELECT template_id FROM Templates WHERE template_type_code = "PP" OR template_type_code = "PPT"
CREATE TABLE Templates (template_id VARCHAR, template_type_code VARCHAR)
What are the ids of templates with template type code PP or PPT?
<s>[INST] Given the following SQL query and context: Query: SELECT template_id FROM Templates WHERE template_type_code = "PP" OR template_type_code = "PPT" Context: CREATE TABLE Templates (template_id VARCHAR, template_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are th...
SELECT COUNT(*) FROM Templates WHERE template_type_code = "CV"
CREATE TABLE Templates (template_type_code VARCHAR)
How many templates have template type code CV?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Templates WHERE template_type_code = "CV" Context: CREATE TABLE Templates (template_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many templates have template type code CV? The answer to your...
SELECT version_number, template_type_code FROM Templates WHERE version_number > 5
CREATE TABLE Templates (version_number INTEGER, template_type_code VARCHAR)
What is the version number and template type code for the template with version number later than 5?
<s>[INST] Given the following SQL query and context: Query: SELECT version_number, template_type_code FROM Templates WHERE version_number > 5 Context: CREATE TABLE Templates (version_number INTEGER, template_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the version nu...
SELECT template_type_code, COUNT(*) FROM Templates GROUP BY template_type_code
CREATE TABLE Templates (template_type_code VARCHAR)
Show all template type codes and number of templates for each.
<s>[INST] Given the following SQL query and context: Query: SELECT template_type_code, COUNT(*) FROM Templates GROUP BY template_type_code Context: CREATE TABLE Templates (template_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all template type codes and number of templa...
SELECT template_type_code FROM Templates GROUP BY template_type_code ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE Templates (template_type_code VARCHAR)
Which template type code has most number of templates?
<s>[INST] Given the following SQL query and context: Query: SELECT template_type_code FROM Templates GROUP BY template_type_code ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE Templates (template_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which template type code has...
SELECT template_type_code FROM Templates GROUP BY template_type_code HAVING COUNT(*) < 3
CREATE TABLE Templates (template_type_code VARCHAR)
Show all template type codes with less than three templates.
<s>[INST] Given the following SQL query and context: Query: SELECT template_type_code FROM Templates GROUP BY template_type_code HAVING COUNT(*) < 3 Context: CREATE TABLE Templates (template_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all template type codes with less ...
SELECT MIN(Version_Number), template_type_code FROM Templates
CREATE TABLE Templates (template_type_code VARCHAR, Version_Number INTEGER)
What the smallest version number and its template type code?
<s>[INST] Given the following SQL query and context: Query: SELECT MIN(Version_Number), template_type_code FROM Templates Context: CREATE TABLE Templates (template_type_code VARCHAR, Version_Number INTEGER) [/INST] Based on the provided SQL query and context, your question is: What the smallest version number and its t...
SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id WHERE T2.document_name = "Data base"
CREATE TABLE Templates (template_type_code VARCHAR, template_id VARCHAR); CREATE TABLE Documents (template_id VARCHAR, document_name VARCHAR)
What is the template type code of the template used by document with the name "Data base"?
<s>[INST] Given the following SQL query and context: Query: SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id WHERE T2.document_name = "Data base" Context: CREATE TABLE Templates (template_type_code VARCHAR, template_id VARCHAR); CREATE TABLE Documents (template_i...
SELECT T2.document_name FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id WHERE T1.template_type_code = "BK"
CREATE TABLE Documents (document_name VARCHAR, template_id VARCHAR); CREATE TABLE Templates (template_id VARCHAR, template_type_code VARCHAR)
Show all document names using templates with template type code BK.
<s>[INST] Given the following SQL query and context: Query: SELECT T2.document_name FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id WHERE T1.template_type_code = "BK" Context: CREATE TABLE Documents (document_name VARCHAR, template_id VARCHAR); CREATE TABLE Templates (template_id VARCHAR, t...
SELECT T1.template_type_code, COUNT(*) FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code
CREATE TABLE Documents (template_id VARCHAR); CREATE TABLE Templates (template_type_code VARCHAR, template_id VARCHAR)
Show all template type codes and the number of documents using each type.
<s>[INST] Given the following SQL query and context: Query: SELECT T1.template_type_code, COUNT(*) FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code Context: CREATE TABLE Documents (template_id VARCHAR); CREATE TABLE Templates (template_type_code VARCHAR, templa...
SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE Documents (template_id VARCHAR); CREATE TABLE Templates (template_type_code VARCHAR, template_id VARCHAR)
Which template type code is used by most number of documents?
<s>[INST] Given the following SQL query and context: Query: SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE Documents (template_id VARCHAR); CREATE TABLE Templates (template_type...
SELECT template_type_code FROM Templates EXCEPT SELECT template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id
CREATE TABLE Documents (template_id VARCHAR); CREATE TABLE Templates (template_id VARCHAR); CREATE TABLE Templates (template_type_code VARCHAR)
Show all template type codes that are not used by any document.
<s>[INST] Given the following SQL query and context: Query: SELECT template_type_code FROM Templates EXCEPT SELECT template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id Context: CREATE TABLE Documents (template_id VARCHAR); CREATE TABLE Templates (template_id VARCHAR); CREATE T...
SELECT template_type_code, template_type_description FROM Ref_template_types
CREATE TABLE Ref_template_types (template_type_code VARCHAR, template_type_description VARCHAR)
Show all template type codes and descriptions.
<s>[INST] Given the following SQL query and context: Query: SELECT template_type_code, template_type_description FROM Ref_template_types Context: CREATE TABLE Ref_template_types (template_type_code VARCHAR, template_type_description VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show al...
SELECT template_type_description FROM Ref_template_types WHERE template_type_code = "AD"
CREATE TABLE Ref_template_types (template_type_description VARCHAR, template_type_code VARCHAR)
What is the template type descriptions for template type code "AD".
<s>[INST] Given the following SQL query and context: Query: SELECT template_type_description FROM Ref_template_types WHERE template_type_code = "AD" Context: CREATE TABLE Ref_template_types (template_type_description VARCHAR, template_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question...
SELECT template_type_code FROM Ref_template_types WHERE template_type_description = "Book"
CREATE TABLE Ref_template_types (template_type_code VARCHAR, template_type_description VARCHAR)
What is the template type code for template type description "Book".
<s>[INST] Given the following SQL query and context: Query: SELECT template_type_code FROM Ref_template_types WHERE template_type_description = "Book" Context: CREATE TABLE Ref_template_types (template_type_code VARCHAR, template_type_description VARCHAR) [/INST] Based on the provided SQL query and context, your questi...
SELECT DISTINCT T1.template_type_description FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code = T2.template_type_code JOIN Documents AS T3 ON T2.Template_ID = T3.template_ID
CREATE TABLE Templates (template_type_code VARCHAR, Template_ID VARCHAR); CREATE TABLE Documents (template_ID VARCHAR); CREATE TABLE Ref_template_types (template_type_description VARCHAR, template_type_code VARCHAR)
What are the distinct template type descriptions for the templates ever used by any document?
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT T1.template_type_description FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code = T2.template_type_code JOIN Documents AS T3 ON T2.Template_ID = T3.template_ID Context: CREATE TABLE Templates (template_type_code VARCHAR...
SELECT T2.template_id FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code = T2.template_type_code WHERE T1.template_type_description = "Presentation"
CREATE TABLE Templates (template_id VARCHAR, template_type_code VARCHAR); CREATE TABLE Ref_template_types (template_type_code VARCHAR, template_type_description VARCHAR)
What are the template ids with template type description "Presentation".
<s>[INST] Given the following SQL query and context: Query: SELECT T2.template_id FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code = T2.template_type_code WHERE T1.template_type_description = "Presentation" Context: CREATE TABLE Templates (template_id VARCHAR, template_type_code VARCHAR); CRE...
SELECT COUNT(*) FROM Paragraphs
CREATE TABLE Paragraphs (Id VARCHAR)
How many paragraphs in total?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Paragraphs Context: CREATE TABLE Paragraphs (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many paragraphs in total? The answer to your question is: SELECT COUNT(*) FROM Paragraphs. [/s>
SELECT COUNT(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_ID = T2.document_ID WHERE T2.document_name = 'Summer Show'
CREATE TABLE Documents (document_ID VARCHAR, document_name VARCHAR); CREATE TABLE Paragraphs (document_ID VARCHAR)
How many paragraphs for the document with name 'Summer Show'?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_ID = T2.document_ID WHERE T2.document_name = 'Summer Show' Context: CREATE TABLE Documents (document_ID VARCHAR, document_name VARCHAR); CREATE TABLE Paragraphs (document_ID VARCHAR) [/I...
SELECT other_details FROM paragraphs WHERE paragraph_text LIKE 'korea'
CREATE TABLE paragraphs (other_details VARCHAR, paragraph_text VARCHAR)
Show paragraph details for paragraph with text 'Korea ' .
<s>[INST] Given the following SQL query and context: Query: SELECT other_details FROM paragraphs WHERE paragraph_text LIKE 'korea' Context: CREATE TABLE paragraphs (other_details VARCHAR, paragraph_text VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show paragraph details for paragraph ...
SELECT T1.paragraph_id, T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id WHERE T2.Document_Name = 'Welcome to NY'
CREATE TABLE Documents (document_id VARCHAR, Document_Name VARCHAR); CREATE TABLE Paragraphs (paragraph_id VARCHAR, paragraph_text VARCHAR, document_id VARCHAR)
Show all paragraph ids and texts for the document with name 'Welcome to NY'.
<s>[INST] Given the following SQL query and context: Query: SELECT T1.paragraph_id, T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id WHERE T2.Document_Name = 'Welcome to NY' Context: CREATE TABLE Documents (document_id VARCHAR, Document_Name VARCHAR); CREATE TABLE Paragrap...
SELECT T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id WHERE T2.document_name = "Customer reviews"
CREATE TABLE Paragraphs (paragraph_text VARCHAR, document_id VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_name VARCHAR)
Show all paragraph texts for the document "Customer reviews".
<s>[INST] Given the following SQL query and context: Query: SELECT T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id WHERE T2.document_name = "Customer reviews" Context: CREATE TABLE Paragraphs (paragraph_text VARCHAR, document_id VARCHAR); CREATE TABLE Documents (document_...
SELECT document_id, COUNT(*) FROM Paragraphs GROUP BY document_id ORDER BY document_id
CREATE TABLE Paragraphs (document_id VARCHAR)
Show all document ids and the number of paragraphs in each document. Order by document id.
<s>[INST] Given the following SQL query and context: Query: SELECT document_id, COUNT(*) FROM Paragraphs GROUP BY document_id ORDER BY document_id Context: CREATE TABLE Paragraphs (document_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all document ids and the number of paragra...
SELECT T1.document_id, T2.document_name, COUNT(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id
CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR); CREATE TABLE Paragraphs (document_id VARCHAR)
Show all document ids, names and the number of paragraphs in each document.
<s>[INST] Given the following SQL query and context: Query: SELECT T1.document_id, T2.document_name, COUNT(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id Context: CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR); CREATE TABLE Paragraphs (docum...
SELECT document_id FROM Paragraphs GROUP BY document_id HAVING COUNT(*) >= 2
CREATE TABLE Paragraphs (document_id VARCHAR)
List all document ids with at least two paragraphs.
<s>[INST] Given the following SQL query and context: Query: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING COUNT(*) >= 2 Context: CREATE TABLE Paragraphs (document_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List all document ids with at least two paragraphs. The a...
SELECT T1.document_id, T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR); CREATE TABLE Paragraphs (document_id VARCHAR)
What is the document id and name with greatest number of paragraphs?
<s>[INST] Given the following SQL query and context: Query: SELECT T1.document_id, T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR); CREATE TA...
SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY COUNT(*) LIMIT 1
CREATE TABLE Paragraphs (document_id VARCHAR)
What is the document id with least number of paragraphs?
<s>[INST] Given the following SQL query and context: Query: SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY COUNT(*) LIMIT 1 Context: CREATE TABLE Paragraphs (document_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the document id with least number of paragra...
SELECT document_id FROM Paragraphs GROUP BY document_id HAVING COUNT(*) BETWEEN 1 AND 2
CREATE TABLE Paragraphs (document_id VARCHAR)
What is the document id with 1 to 2 paragraphs?
<s>[INST] Given the following SQL query and context: Query: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING COUNT(*) BETWEEN 1 AND 2 Context: CREATE TABLE Paragraphs (document_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the document id with 1 to 2 paragraphs...
SELECT document_id FROM Paragraphs WHERE paragraph_text = 'Brazil' INTERSECT SELECT document_id FROM Paragraphs WHERE paragraph_text = 'Ireland'
CREATE TABLE Paragraphs (document_id VARCHAR, paragraph_text VARCHAR)
Show the document id with paragraph text 'Brazil' and 'Ireland'.
<s>[INST] Given the following SQL query and context: Query: SELECT document_id FROM Paragraphs WHERE paragraph_text = 'Brazil' INTERSECT SELECT document_id FROM Paragraphs WHERE paragraph_text = 'Ireland' Context: CREATE TABLE Paragraphs (document_id VARCHAR, paragraph_text VARCHAR) [/INST] Based on the provided SQL qu...
SELECT COUNT(*) FROM teacher
CREATE TABLE teacher (Id VARCHAR)
How many teachers are there?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM teacher Context: CREATE TABLE teacher (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many teachers are there? The answer to your question is: SELECT COUNT(*) FROM teacher. [/s>
SELECT Name FROM teacher ORDER BY Age
CREATE TABLE teacher (Name VARCHAR, Age VARCHAR)
List the names of teachers in ascending order of age.
<s>[INST] Given the following SQL query and context: Query: SELECT Name FROM teacher ORDER BY Age Context: CREATE TABLE teacher (Name VARCHAR, Age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the names of teachers in ascending order of age. The answer to your question is: SELECT ...
SELECT Age, Hometown FROM teacher
CREATE TABLE teacher (Age VARCHAR, Hometown VARCHAR)
What are the age and hometown of teachers?
<s>[INST] Given the following SQL query and context: Query: SELECT Age, Hometown FROM teacher Context: CREATE TABLE teacher (Age VARCHAR, Hometown VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the age and hometown of teachers? The answer to your question is: SELECT Age, Hometo...
SELECT name FROM teacher WHERE hometown <> "little lever urban district"
CREATE TABLE teacher (name VARCHAR, hometown VARCHAR)
List the name of teachers whose hometown is not `` Little Lever Urban District '' .
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM teacher WHERE hometown <> "little lever urban district" Context: CREATE TABLE teacher (name VARCHAR, hometown VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the name of teachers whose hometown is not `` Li...
SELECT Name FROM teacher WHERE Age = 32 OR Age = 33
CREATE TABLE teacher (Name VARCHAR, Age VARCHAR)
Show the name of teachers aged either 32 or 33?
<s>[INST] Given the following SQL query and context: Query: SELECT Name FROM teacher WHERE Age = 32 OR Age = 33 Context: CREATE TABLE teacher (Name VARCHAR, Age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the name of teachers aged either 32 or 33? The answer to your question is:...
SELECT Hometown FROM teacher ORDER BY Age LIMIT 1
CREATE TABLE teacher (Hometown VARCHAR, Age VARCHAR)
What is the hometown of the youngest teacher?
<s>[INST] Given the following SQL query and context: Query: SELECT Hometown FROM teacher ORDER BY Age LIMIT 1 Context: CREATE TABLE teacher (Hometown VARCHAR, Age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the hometown of the youngest teacher? The answer to your question is:...
SELECT Hometown, COUNT(*) FROM teacher GROUP BY Hometown
CREATE TABLE teacher (Hometown VARCHAR)
Show different hometown of teachers and the number of teachers from each hometown.
<s>[INST] Given the following SQL query and context: Query: SELECT Hometown, COUNT(*) FROM teacher GROUP BY Hometown Context: CREATE TABLE teacher (Hometown VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show different hometown of teachers and the number of teachers from each hometown. ...
SELECT Hometown FROM teacher GROUP BY Hometown ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE teacher (Hometown VARCHAR)
List the most common hometown of teachers.
<s>[INST] Given the following SQL query and context: Query: SELECT Hometown FROM teacher GROUP BY Hometown ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE teacher (Hometown VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the most common hometown of teachers. The answer to your ...
SELECT Hometown FROM teacher GROUP BY Hometown HAVING COUNT(*) >= 2
CREATE TABLE teacher (Hometown VARCHAR)
Show the hometowns shared by at least two teachers.
<s>[INST] Given the following SQL query and context: Query: SELECT Hometown FROM teacher GROUP BY Hometown HAVING COUNT(*) >= 2 Context: CREATE TABLE teacher (Hometown VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the hometowns shared by at least two teachers. The answer to your q...
SELECT T3.Name, T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID
CREATE TABLE course_arrange (Course_ID VARCHAR, Teacher_ID VARCHAR); CREATE TABLE teacher (Name VARCHAR, Teacher_ID VARCHAR); CREATE TABLE course (Course VARCHAR, Course_ID VARCHAR)
Show names of teachers and the courses they are arranged to teach.
<s>[INST] Given the following SQL query and context: Query: SELECT T3.Name, T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID Context: CREATE TABLE course_arrange (Course_ID VARCHAR, Teacher_ID VARCHAR); CREATE TABLE teacher (Name VA...
SELECT T3.Name, T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID ORDER BY T3.Name
CREATE TABLE course_arrange (Course_ID VARCHAR, Teacher_ID VARCHAR); CREATE TABLE teacher (Name VARCHAR, Teacher_ID VARCHAR); CREATE TABLE course (Course VARCHAR, Course_ID VARCHAR)
Show names of teachers and the courses they are arranged to teach in ascending alphabetical order of the teacher's name.
<s>[INST] Given the following SQL query and context: Query: SELECT T3.Name, T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID ORDER BY T3.Name Context: CREATE TABLE course_arrange (Course_ID VARCHAR, Teacher_ID VARCHAR); CREATE TABLE...
SELECT T3.Name FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID WHERE T2.Course = "Math"
CREATE TABLE course_arrange (Course_ID VARCHAR, Teacher_ID VARCHAR); CREATE TABLE course (Course_ID VARCHAR, Course VARCHAR); CREATE TABLE teacher (Name VARCHAR, Teacher_ID VARCHAR)
Show the name of the teacher for the math course.
<s>[INST] Given the following SQL query and context: Query: SELECT T3.Name FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID WHERE T2.Course = "Math" Context: CREATE TABLE course_arrange (Course_ID VARCHAR, Teacher_ID VARCHAR); CREATE TABLE co...
SELECT T2.Name, COUNT(*) FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name
CREATE TABLE teacher (Name VARCHAR, Teacher_ID VARCHAR); CREATE TABLE course_arrange (Teacher_ID VARCHAR)
Show names of teachers and the number of courses they teach.
<s>[INST] Given the following SQL query and context: Query: SELECT T2.Name, COUNT(*) FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name Context: CREATE TABLE teacher (Name VARCHAR, Teacher_ID VARCHAR); CREATE TABLE course_arrange (Teacher_ID VARCHAR) [/INST] Based on the prov...
SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*) >= 2
CREATE TABLE teacher (Name VARCHAR, Teacher_ID VARCHAR); CREATE TABLE course_arrange (Teacher_ID VARCHAR)
Show names of teachers that teach at least two courses.
<s>[INST] Given the following SQL query and context: Query: SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*) >= 2 Context: CREATE TABLE teacher (Name VARCHAR, Teacher_ID VARCHAR); CREATE TABLE course_arrange (Teacher_ID VARCHAR) [/INST] Based ...
SELECT Name FROM teacher WHERE NOT Teacher_id IN (SELECT Teacher_id FROM course_arrange)
CREATE TABLE course_arrange (Name VARCHAR, Teacher_id VARCHAR); CREATE TABLE teacher (Name VARCHAR, Teacher_id VARCHAR)
List the names of teachers who have not been arranged to teach courses.
<s>[INST] Given the following SQL query and context: Query: SELECT Name FROM teacher WHERE NOT Teacher_id IN (SELECT Teacher_id FROM course_arrange) Context: CREATE TABLE course_arrange (Name VARCHAR, Teacher_id VARCHAR); CREATE TABLE teacher (Name VARCHAR, Teacher_id VARCHAR) [/INST] Based on the provided SQL query an...
SELECT COUNT(*) FROM visitor WHERE age < 30
CREATE TABLE visitor (age INTEGER)
How many visitors below age 30 are there?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM visitor WHERE age < 30 Context: CREATE TABLE visitor (age INTEGER) [/INST] Based on the provided SQL query and context, your question is: How many visitors below age 30 are there? The answer to your question is: SELECT COUNT(*) FROM visito...
SELECT name FROM visitor WHERE Level_of_membership > 4 ORDER BY Level_of_membership DESC
CREATE TABLE visitor (name VARCHAR, Level_of_membership INTEGER)
Find the names of the visitors whose membership level is higher than 4, and order the results by the level from high to low.
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM visitor WHERE Level_of_membership > 4 ORDER BY Level_of_membership DESC Context: CREATE TABLE visitor (name VARCHAR, Level_of_membership INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the names of the visi...
SELECT AVG(age) FROM visitor WHERE Level_of_membership <= 4
CREATE TABLE visitor (age INTEGER, Level_of_membership VARCHAR)
What is the average age of the visitors whose membership level is not higher than 4?
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(age) FROM visitor WHERE Level_of_membership <= 4 Context: CREATE TABLE visitor (age INTEGER, Level_of_membership VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the average age of the visitors whose membership...
SELECT name, Level_of_membership FROM visitor WHERE Level_of_membership > 4 ORDER BY age DESC
CREATE TABLE visitor (name VARCHAR, Level_of_membership INTEGER, age VARCHAR)
Find the name and membership level of the visitors whose membership level is higher than 4, and sort by their age from old to young.
<s>[INST] Given the following SQL query and context: Query: SELECT name, Level_of_membership FROM visitor WHERE Level_of_membership > 4 ORDER BY age DESC Context: CREATE TABLE visitor (name VARCHAR, Level_of_membership INTEGER, age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the...
SELECT museum_id, name FROM museum ORDER BY num_of_staff DESC LIMIT 1
CREATE TABLE museum (museum_id VARCHAR, name VARCHAR, num_of_staff VARCHAR)
Find the id and name of the museum that has the most staff members?
<s>[INST] Given the following SQL query and context: Query: SELECT museum_id, name FROM museum ORDER BY num_of_staff DESC LIMIT 1 Context: CREATE TABLE museum (museum_id VARCHAR, name VARCHAR, num_of_staff VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the id and name of the museum...
SELECT AVG(num_of_staff) FROM museum WHERE open_year < 2009
CREATE TABLE museum (num_of_staff INTEGER, open_year INTEGER)
Find the average number of staff working for the museums that were open before 2009.
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(num_of_staff) FROM museum WHERE open_year < 2009 Context: CREATE TABLE museum (num_of_staff INTEGER, open_year INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the average number of staff working for the museums t...
SELECT Num_of_Staff, Open_Year FROM museum WHERE name = 'Plaza Museum'
CREATE TABLE museum (Num_of_Staff VARCHAR, Open_Year VARCHAR, name VARCHAR)
What are the opening year and staff number of the museum named Plaza Museum?
<s>[INST] Given the following SQL query and context: Query: SELECT Num_of_Staff, Open_Year FROM museum WHERE name = 'Plaza Museum' Context: CREATE TABLE museum (Num_of_Staff VARCHAR, Open_Year VARCHAR, name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the opening year and sta...
SELECT name FROM museum WHERE num_of_staff > (SELECT MIN(num_of_staff) FROM museum WHERE open_year > 2010)
CREATE TABLE museum (name VARCHAR, num_of_staff INTEGER, open_year INTEGER)
find the names of museums which have more staff than the minimum staff number of all museums opened after 2010.
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM museum WHERE num_of_staff > (SELECT MIN(num_of_staff) FROM museum WHERE open_year > 2010) Context: CREATE TABLE museum (name VARCHAR, num_of_staff INTEGER, open_year INTEGER) [/INST] Based on the provided SQL query and context, your question i...
SELECT t1.id, t1.name, t1.age FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id GROUP BY t1.id HAVING COUNT(*) > 1
CREATE TABLE visit (visitor_id VARCHAR); CREATE TABLE visitor (id VARCHAR, name VARCHAR, age VARCHAR)
find the id, name and age for visitors who visited some museums more than once.
<s>[INST] Given the following SQL query and context: Query: SELECT t1.id, t1.name, t1.age FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id GROUP BY t1.id HAVING COUNT(*) > 1 Context: CREATE TABLE visit (visitor_id VARCHAR); CREATE TABLE visitor (id VARCHAR, name VARCHAR, age VARCHAR) [/INST] Based on the pr...
SELECT t2.visitor_id, t1.name, t1.Level_of_membership FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id GROUP BY t2.visitor_id ORDER BY SUM(t2.Total_spent) DESC LIMIT 1
CREATE TABLE visit (visitor_id VARCHAR, Total_spent INTEGER); CREATE TABLE visitor (name VARCHAR, Level_of_membership VARCHAR, id VARCHAR)
What are the id, name and membership level of visitors who have spent the largest amount of money in total in all museum tickets?
<s>[INST] Given the following SQL query and context: Query: SELECT t2.visitor_id, t1.name, t1.Level_of_membership FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id GROUP BY t2.visitor_id ORDER BY SUM(t2.Total_spent) DESC LIMIT 1 Context: CREATE TABLE visit (visitor_id VARCHAR, Total_spent INTEGER); CREATE TA...
SELECT t2.Museum_ID, t1.name FROM museum AS t1 JOIN visit AS t2 ON t1.Museum_ID = t2.Museum_ID GROUP BY t2.Museum_ID ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE museum (name VARCHAR, Museum_ID VARCHAR); CREATE TABLE visit (Museum_ID VARCHAR)
What are the id and name of the museum visited most times?
<s>[INST] Given the following SQL query and context: Query: SELECT t2.Museum_ID, t1.name FROM museum AS t1 JOIN visit AS t2 ON t1.Museum_ID = t2.Museum_ID GROUP BY t2.Museum_ID ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE museum (name VARCHAR, Museum_ID VARCHAR); CREATE TABLE visit (Museum_ID VARCHAR) [/INST] B...
SELECT name FROM museum WHERE NOT Museum_ID IN (SELECT museum_id FROM visit)
CREATE TABLE visit (name VARCHAR, Museum_ID VARCHAR, museum_id VARCHAR); CREATE TABLE museum (name VARCHAR, Museum_ID VARCHAR, museum_id VARCHAR)
What is the name of the museum that had no visitor yet?
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM museum WHERE NOT Museum_ID IN (SELECT museum_id FROM visit) Context: CREATE TABLE visit (name VARCHAR, Museum_ID VARCHAR, museum_id VARCHAR); CREATE TABLE museum (name VARCHAR, Museum_ID VARCHAR, museum_id VARCHAR) [/INST] Based on the provide...
SELECT t1.name, t1.age FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id ORDER BY t2.num_of_ticket DESC LIMIT 1
CREATE TABLE visitor (name VARCHAR, age VARCHAR, id VARCHAR); CREATE TABLE visit (visitor_id VARCHAR, num_of_ticket VARCHAR)
Find the name and age of the visitor who bought the most tickets at once.
<s>[INST] Given the following SQL query and context: Query: SELECT t1.name, t1.age FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id ORDER BY t2.num_of_ticket DESC LIMIT 1 Context: CREATE TABLE visitor (name VARCHAR, age VARCHAR, id VARCHAR); CREATE TABLE visit (visitor_id VARCHAR, num_of_ticket VARCHAR) [/I...
SELECT AVG(num_of_ticket), MAX(num_of_ticket) FROM visit
CREATE TABLE visit (num_of_ticket INTEGER)
What are the average and maximum number of tickets bought in all visits?
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(num_of_ticket), MAX(num_of_ticket) FROM visit Context: CREATE TABLE visit (num_of_ticket INTEGER) [/INST] Based on the provided SQL query and context, your question is: What are the average and maximum number of tickets bought in all visits? The ans...
SELECT SUM(t2.Total_spent) FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id WHERE t1.Level_of_membership = 1
CREATE TABLE visit (Total_spent INTEGER, visitor_id VARCHAR); CREATE TABLE visitor (id VARCHAR, Level_of_membership VARCHAR)
What is the total ticket expense of the visitors whose membership level is 1?
<s>[INST] Given the following SQL query and context: Query: SELECT SUM(t2.Total_spent) FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id WHERE t1.Level_of_membership = 1 Context: CREATE TABLE visit (Total_spent INTEGER, visitor_id VARCHAR); CREATE TABLE visitor (id VARCHAR, Level_of_membership VARCHAR) [/INS...
SELECT t1.name FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id JOIN museum AS t3 ON t3.Museum_ID = t2.Museum_ID WHERE t3.open_year < 2009 INTERSECT SELECT t1.name FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id JOIN museum AS t3 ON t3.Museum_ID = t2.Museum_ID WHERE t3.open_year > 2011
CREATE TABLE visitor (name VARCHAR, id VARCHAR); CREATE TABLE museum (Museum_ID VARCHAR, open_year INTEGER); CREATE TABLE visit (visitor_id VARCHAR, Museum_ID VARCHAR)
What is the name of the visitor who visited both a museum opened before 2009 and a museum opened after 2011?
<s>[INST] Given the following SQL query and context: Query: SELECT t1.name FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id JOIN museum AS t3 ON t3.Museum_ID = t2.Museum_ID WHERE t3.open_year < 2009 INTERSECT SELECT t1.name FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id JOIN museum AS t3 ON t3...
SELECT COUNT(*) FROM visitor WHERE NOT id IN (SELECT t2.visitor_id FROM museum AS t1 JOIN visit AS t2 ON t1.Museum_ID = t2.Museum_ID WHERE t1.open_year > 2010)
CREATE TABLE museum (Museum_ID VARCHAR, open_year INTEGER); CREATE TABLE visitor (id VARCHAR); CREATE TABLE visit (visitor_id VARCHAR, Museum_ID VARCHAR)
Find the number of visitors who did not visit any museum opened after 2010.
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM visitor WHERE NOT id IN (SELECT t2.visitor_id FROM museum AS t1 JOIN visit AS t2 ON t1.Museum_ID = t2.Museum_ID WHERE t1.open_year > 2010) Context: CREATE TABLE museum (Museum_ID VARCHAR, open_year INTEGER); CREATE TABLE visitor (id VARCHA...
SELECT COUNT(*) FROM museum WHERE open_year > 2013 OR open_year < 2008
CREATE TABLE museum (open_year VARCHAR)
How many museums were opened after 2013 or before 2008?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM museum WHERE open_year > 2013 OR open_year < 2008 Context: CREATE TABLE museum (open_year VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many museums were opened after 2013 or before 2008? The answer to...
SELECT COUNT(*) FROM players
CREATE TABLE players (Id VARCHAR)
Find the total number of players.
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM players Context: CREATE TABLE players (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the total number of players. The answer to your question is: SELECT COUNT(*) FROM players. [/s>
SELECT COUNT(*) FROM matches
CREATE TABLE matches (Id VARCHAR)
Find the total number of matches.
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM matches Context: CREATE TABLE matches (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the total number of matches. The answer to your question is: SELECT COUNT(*) FROM matches. [/s>
SELECT first_name, birth_date FROM players WHERE country_code = 'USA'
CREATE TABLE players (first_name VARCHAR, birth_date VARCHAR, country_code VARCHAR)
List the first name and birth date of all players from the country with code USA.
<s>[INST] Given the following SQL query and context: Query: SELECT first_name, birth_date FROM players WHERE country_code = 'USA' Context: CREATE TABLE players (first_name VARCHAR, birth_date VARCHAR, country_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the first name and bi...
SELECT AVG(loser_age), AVG(winner_age) FROM matches
CREATE TABLE matches (loser_age INTEGER, winner_age INTEGER)
Find the average age of losers and winners of all matches.
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(loser_age), AVG(winner_age) FROM matches Context: CREATE TABLE matches (loser_age INTEGER, winner_age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the average age of losers and winners of all matches. The answ...
SELECT AVG(winner_rank) FROM matches
CREATE TABLE matches (winner_rank INTEGER)
Find the average rank of winners in all matches.
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(winner_rank) FROM matches Context: CREATE TABLE matches (winner_rank INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the average rank of winners in all matches. The answer to your question is: SELECT AVG(winner_r...
SELECT MIN(loser_rank) FROM matches
CREATE TABLE matches (loser_rank INTEGER)
Find the highest rank of losers in all matches.
<s>[INST] Given the following SQL query and context: Query: SELECT MIN(loser_rank) FROM matches Context: CREATE TABLE matches (loser_rank INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the highest rank of losers in all matches. The answer to your question is: SELECT MIN(loser_rank)...
SELECT COUNT(DISTINCT country_code) FROM players
CREATE TABLE players (country_code VARCHAR)
find the number of distinct country codes of all players.
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT country_code) FROM players Context: CREATE TABLE players (country_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: find the number of distinct country codes of all players. The answer to your question i...
SELECT COUNT(DISTINCT loser_name) FROM matches
CREATE TABLE matches (loser_name VARCHAR)
Find the number of distinct name of losers.
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT loser_name) FROM matches Context: CREATE TABLE matches (loser_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of distinct name of losers. The answer to your question is: SELECT COUNT(DI...