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