Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of documents which don't have expense budgets? [/INST]

Output: SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Return the ids of documents that do not have expenses. [/INST]

Output: SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show ids for all documents in type CV without expense budgets. [/INST]

Output: SELECT document_id FROM Documents WHERE document_type_code  =  "CV" EXCEPT SELECT document_id FROM Documents_with_expenses;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of documents with the type code CV that do not have expenses. [/INST]

Output: SELECT document_id FROM Documents WHERE document_type_code  =  "CV" EXCEPT SELECT document_id FROM Documents_with_expenses;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of documents with letter 's' in the name with any expense budgets. [/INST]

Output: SELECT T1.document_id FROM Documents AS T1 JOIN Documents_with_expenses AS T2 ON T1.document_id  =  T2.document_id WHERE T1.document_name LIKE '%s%';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Give the ids of documents that have expenses and contain the letter s in their names. [/INST]

Output: SELECT T1.document_id FROM Documents AS T1 JOIN Documents_with_expenses AS T2 ON T1.document_id  =  T2.document_id WHERE T1.document_name LIKE '%s%';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: How many documents do not have any expense? [/INST]

Output: SELECT count(*) FROM Documents WHERE document_id NOT IN ( SELECT document_id FROM Documents_with_expenses );


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of documents that do not have expenses. [/INST]

Output: SELECT count(*) FROM Documents WHERE document_id NOT IN ( SELECT document_id FROM Documents_with_expenses );


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the dates for the documents with both 'GV' type and 'SF' type expenses? [/INST]

Output: SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id  =  T2.document_id WHERE T2.budget_type_code  =  'GV' INTERSECT SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id  =  T2.document_id WHERE T2.budget_type_code  =  'SF';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Give the dates of creation for documents that have both budget type codes 'GV' and 'SF'. [/INST]

Output: SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id  =  T2.document_id WHERE T2.budget_type_code  =  'GV' INTERSECT SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id  =  T2.document_id WHERE T2.budget_type_code  =  'SF';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the account details with the largest value or with value having char '5' in it? [/INST]

Output: SELECT max(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE "%5%";


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Return the account details with the greatest value, as well as those that include the character 5. [/INST]

Output: SELECT max(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE "%5%";


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the total number of scientists. [/INST]

Output: SELECT count(*) FROM scientists;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: How many scientists are there? [/INST]

Output: SELECT count(*) FROM scientists;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the total hours of all projects. [/INST]

Output: SELECT sum(hours) FROM projects;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What is the total number of hours for all projects? [/INST]

Output: SELECT sum(hours) FROM projects;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: How many different scientists are assigned to any project? [/INST]

Output: SELECT count(DISTINCT scientist) FROM assignedto;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Count the number of different scientists assigned to any project. [/INST]

Output: SELECT count(DISTINCT scientist) FROM assignedto;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the number of distinct projects. [/INST]

Output: SELECT count(DISTINCT name) FROM projects;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: How many different projects are there? [/INST]

Output: SELECT count(DISTINCT name) FROM projects;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the average hours of all projects. [/INST]

Output: SELECT avg(hours) FROM projects;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What is the average hours across all projects? [/INST]

Output: SELECT avg(hours) FROM projects;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the name of project that continues for the longest time. [/INST]

Output: SELECT name FROM projects ORDER BY hours DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What is the name of the project with the most hours? [/INST]

Output: SELECT name FROM projects ORDER BY hours DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: List the name of all projects that are operated longer than the average working hours of all projects. [/INST]

Output: SELECT name FROM projects WHERE hours  >  (SELECT avg(hours) FROM projects);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the names of projects that have taken longer than the average number of hours for all projects? [/INST]

Output: SELECT name FROM projects WHERE hours  >  (SELECT avg(hours) FROM projects);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the name and hours of project that has the most number of scientists. [/INST]

Output: SELECT T1.name ,  T1.hours FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project GROUP BY T2.project ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What is the name and hours for the project which has the most scientists assigned to it? [/INST]

Output: SELECT T1.name ,  T1.hours FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project GROUP BY T2.project ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the name of the project for which a scientist whose name contains ‘Smith’ is assigned to. [/INST]

Output: SELECT T2.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T3.name LIKE '%Smith%';


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What is the name of the project that has a scientist assigned to it whose name contains 'Smith'? [/INST]

Output: SELECT T2.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T3.name LIKE '%Smith%';


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the total hours of the projects that scientists named Michael Rogers or Carol Smith are assigned to. [/INST]

Output: SELECT sum(T2.hours) FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T3.name  =  'Michael Rogers' OR T3.name  =  'Carol Smith';


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What is the sum of hours for projects that scientists with the name Michael Rogers or Carol Smith are assigned to? [/INST]

Output: SELECT sum(T2.hours) FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T3.name  =  'Michael Rogers' OR T3.name  =  'Carol Smith';


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the name of projects that require between 100 and 300 hours of work. [/INST]

Output: SELECT name FROM projects WHERE hours BETWEEN 100 AND 300;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the names of projects that require between 100 and 300 hours? [/INST]

Output: SELECT name FROM projects WHERE hours BETWEEN 100 AND 300;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the name of the scientist who worked on both a project named 'Matter of Time' and a project named 'A Puzzling Parallax'. [/INST]

Output: SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.name  =  'Matter of Time' INTERSECT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.name  =  'A Puzzling Parallax';


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the names of any scientists who worked on projects named 'Matter of Time' and 'A Puzzling Pattern'? [/INST]

Output: SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.name  =  'Matter of Time' INTERSECT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.name  =  'A Puzzling Parallax';


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: List the names of all scientists sorted in alphabetical order. [/INST]

Output: SELECT name FROM scientists ORDER BY name;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the names of all the scientists in alphabetical order? [/INST]

Output: SELECT name FROM scientists ORDER BY name;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the number of scientists involved for each project name. [/INST]

Output: SELECT count(*) ,  T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project GROUP BY T1.name;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the naems of all the projects, and how many scientists were assigned to each of them? [/INST]

Output: SELECT count(*) ,  T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project GROUP BY T1.name;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the number of scientists involved for the projects that require more than 300 hours. [/INST]

Output: SELECT count(*) ,  T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project WHERE T1.hours  >  300 GROUP BY T1.name;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the names of projects that require more than 300 hours, and how many scientists are assigned to each? [/INST]

Output: SELECT count(*) ,  T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project WHERE T1.hours  >  300 GROUP BY T1.name;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the number of projects which each scientist is working on and scientist's name. [/INST]

Output: SELECT count(*) ,  T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn  =  T2.scientist GROUP BY T1.name;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the names of the scientists, and how many projects are each of them working on? [/INST]

Output: SELECT count(*) ,  T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn  =  T2.scientist GROUP BY T1.name;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the SSN and name of scientists who are assigned to the project with the longest hours. [/INST]

Output: SELECT T3.ssn ,  T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.hours  =  (SELECT max(hours) FROM projects);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the SSN and names of scientists working on the project with the most hours? [/INST]

Output: SELECT T3.ssn ,  T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.hours  =  (SELECT max(hours) FROM projects);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the name of scientists who are assigned to some project. [/INST]

Output: SELECT T2.name FROM assignedto AS T1 JOIN scientists AS T2 ON T1.scientist  =  T2.ssn;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the names of scientists who are assigned to any project? [/INST]

Output: SELECT T2.name FROM assignedto AS T1 JOIN scientists AS T2 ON T1.scientist  =  T2.ssn;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Select the project names which are not assigned yet. [/INST]

Output: SELECT Name FROM Projects WHERE Code NOT IN (SELECT Project FROM AssignedTo);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the names of projects that have not been assigned? [/INST]

Output: SELECT Name FROM Projects WHERE Code NOT IN (SELECT Project FROM AssignedTo);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the name of scientists who are not assigned to any project. [/INST]

Output: SELECT Name FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the names of scientists who have not been assigned a project? [/INST]

Output: SELECT Name FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the number of scientists who are not assigned to any project. [/INST]

Output: SELECT count(*) FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: How many scientists do not have any projects assigned to them? [/INST]

Output: SELECT count(*) FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find the names of scientists who are not working on the project with the highest hours. [/INST]

Output: SELECT name FROM scientists EXCEPT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.hours  =  (SELECT max(hours) FROM projects);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the names of scientists who are not working on the project with the most hours? [/INST]

Output: SELECT name FROM scientists EXCEPT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.hours  =  (SELECT max(hours) FROM projects);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: List all the scientists' names, their projects' names, and the hours worked by that scientist on each project, in alphabetical order of project name, and then scientist name. [/INST]

Output: SELECT T1.Name ,  T3.Name ,  T3.Hours FROM Scientists AS T1 JOIN AssignedTo AS T2 ON T1.SSN = T2.Scientist JOIN Projects AS T3 ON T2.Project = T3.Code ORDER BY T3.Name ,  T1.Name;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What are the names of each scientist, the names of the projects that they work on, and the hours for each of those projects, listed in alphabetical order by project name, then scientist name. [/INST]

Output: SELECT T1.Name ,  T3.Name ,  T3.Hours FROM Scientists AS T1 JOIN AssignedTo AS T2 ON T1.SSN = T2.Scientist JOIN Projects AS T3 ON T2.Project = T3.Code ORDER BY T3.Name ,  T1.Name;


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: Find name of the project that needs the least amount of time to finish and the name of scientists who worked on it. [/INST]

Output: SELECT T2.name ,  T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.hours  =  (SELECT min(hours) FROM projects);


Input:
[INST] Here is a database schema:
Scientists :
SSN [ INT ] primary_key
Name [ TEXT ]

Projects :
Code [ TEXT ] primary_key
Name [ TEXT ]
Hours [ INT ]

AssignedTo :
Scientist [ INT ] primary_key AssignedTo.Scientist = Scientists.SSN
Project [ TEXT ] AssignedTo.Project = Projects.Code

Please write me a SQL statement that answers the following question: What is the name of the project that requires the fewest number of hours, and the names of the scientists assigned to it? [/INST]

Output: SELECT T2.name ,  T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.hours  =  (SELECT min(hours) FROM projects);


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What is the name of the highest rated wine? [/INST]

Output: SELECT Name FROM WINE ORDER BY Score LIMIT 1;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Give the name of the wine with the highest score. [/INST]

Output: SELECT Name FROM WINE ORDER BY Score LIMIT 1;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Which winery is the wine that has the highest score from? [/INST]

Output: SELECT Winery FROM WINE ORDER BY SCORE LIMIT 1;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What is the winery at which the wine with the highest score was made? [/INST]

Output: SELECT Winery FROM WINE ORDER BY SCORE LIMIT 1;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of all wines produced in 2008. [/INST]

Output: SELECT Name FROM WINE WHERE YEAR  =  "2008";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all wines produced in 2008? [/INST]

Output: SELECT Name FROM WINE WHERE YEAR  =  "2008";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: List the grapes and appelations of all wines. [/INST]

Output: SELECT Grape ,  Appelation FROM WINE;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the grapes and appelations of each wine? [/INST]

Output: SELECT Grape ,  Appelation FROM WINE;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: List the names and scores of all wines. [/INST]

Output: SELECT Name ,  Score FROM WINE;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and scores of all wines? [/INST]

Output: SELECT Name ,  Score FROM WINE;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: List the area and county of all appelations. [/INST]

Output: SELECT Area ,  County FROM APPELLATIONS;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the areas and counties for all appelations? [/INST]

Output: SELECT Area ,  County FROM APPELLATIONS;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the prices of wines produced before the year of 2010? [/INST]

Output: SELECT Price FROM WINE WHERE YEAR  <  2010;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Return the prices of wines produced before 2010. [/INST]

Output: SELECT Price FROM WINE WHERE YEAR  <  2010;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of all distinct wines that have scores higher than 90. [/INST]

Output: SELECT Name FROM WINE WHERE score  >  90;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of wines with scores higher than 90? [/INST]

Output: SELECT Name FROM WINE WHERE score  >  90;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of all distinct wines that are made of red color grape. [/INST]

Output: SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "Red";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of wines made from red grapes? [/INST]

Output: SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "Red";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of all distinct wines that have appellations in North Coast area. [/INST]

Output: SELECT DISTINCT T2.Name FROM APPELLATIONs AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.Area  =  "North Coast";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the distinct names of wines that have appellations in the North Coast area? [/INST]

Output: SELECT DISTINCT T2.Name FROM APPELLATIONs AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.Area  =  "North Coast";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: How many wines are produced at Robert Biale winery? [/INST]

Output: SELECT count(*) FROM WINE WHERE Winery  =  "Robert Biale";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of wines produced at Robert Biale winery. [/INST]

Output: SELECT count(*) FROM WINE WHERE Winery  =  "Robert Biale";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: How many appelations are in Napa Country? [/INST]

Output: SELECT count(*) FROM APPELLATIONS WHERE County  =  "Napa";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of appelations in Napa County. [/INST]

Output: SELECT count(*) FROM APPELLATIONS WHERE County  =  "Napa";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Give me the average prices of wines that are produced by appelations in Sonoma County. [/INST]

Output: SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  "Sonoma";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average price of wines produced in appelations in Sonoma County? [/INST]

Output: SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  "Sonoma";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and scores of wines that are made of white color grapes? [/INST]

Output: SELECT T2.Name ,   T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "White";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Give the names and scores of wines made from white grapes. [/INST]

Output: SELECT T2.Name ,   T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "White";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the maximum price of wins from the appelations in Central Coast area and produced before the year of 2005. [/INST]

Output: SELECT max(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.Area  =  "Central Coast" AND T2.year  <  2005;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What is the maximum price of wines from the appelation in the Central Coast area, which was produced before 2005? [/INST]

Output: SELECT max(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.Area  =  "Central Coast" AND T2.year  <  2005;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the the grape whose white color grapes are used to produce wines with scores higher than 90. [/INST]

Output: SELECT DISTINCT T1.Grape FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "White" AND T2.score  >  90;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the white grape used to produce wines with scores above 90. [/INST]

Output: SELECT DISTINCT T1.Grape FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "White" AND T2.score  >  90;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the wines that have prices higher than 50 and made of Red color grapes? [/INST]

Output: SELECT T2.Name FROM Grapes AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "Red" AND T2.price  >  50;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of wines made from red grapes and with prices above 50? [/INST]

Output: SELECT T2.Name FROM Grapes AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape WHERE T1.Color  =  "Red" AND T2.price  >  50;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the wines that have prices lower than 50 and have appelations in Monterey county? [/INST]

Output: SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  "Monterey" AND T2.price  <  50;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Give the neames of wines with prices below 50 and with appelations in Monterey county. [/INST]

Output: SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  "Monterey" AND T2.price  <  50;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the numbers of wines for different grapes? [/INST]

Output: SELECT count(*) ,  Grape FROM WINE GROUP BY Grape;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: How many wines are there for each grape? [/INST]

Output: SELECT count(*) ,  Grape FROM WINE GROUP BY Grape;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the average prices of wines for different years? [/INST]

Output: SELECT avg(Price) ,  YEAR FROM WINE GROUP BY YEAR;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average prices of wines for each each? [/INST]

Output: SELECT avg(Price) ,  YEAR FROM WINE GROUP BY YEAR;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the distinct names of all wines that have prices higher than some wines from John Anthony winery. [/INST]

Output: SELECT DISTINCT Name FROM WINE WHERE Price  >  (SELECT min(Price) FROM wine WHERE Winery  =  "John Anthony");


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the distinct names of wines with prices higher than any wine from John Anthony winery. [/INST]

Output: SELECT DISTINCT Name FROM WINE WHERE Price  >  (SELECT min(Price) FROM wine WHERE Winery  =  "John Anthony");


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of all distinct wines in alphabetical order. [/INST]

Output: SELECT DISTINCT Name FROM WINE ORDER BY Name;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of wines, sorted in alphabetical order? [/INST]

Output: SELECT DISTINCT Name FROM WINE ORDER BY Name;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of all distinct wines ordered by price. [/INST]

Output: SELECT DISTINCT Name FROM WINE ORDER BY price;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of wines, sorted by price ascending? [/INST]

Output: SELECT DISTINCT Name FROM WINE ORDER BY price;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What is the area of the appelation that produces the highest number of wines before the year of 2010? [/INST]

Output: SELECT T1.Area FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation GROUP BY T2.Appelation HAVING T2.year  <  2010 ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What is the area for the appelation which produced the most wines prior to 2010? [/INST]

Output: SELECT T1.Area FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation GROUP BY T2.Appelation HAVING T2.year  <  2010 ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What is the color of the grape whose wine products has the highest average price? [/INST]

Output: SELECT T1.Color FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape GROUP BY T2.Grape ORDER BY AVG(Price) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Give the color of the grape whose wine products have the highest average price? [/INST]

Output: SELECT T1.Color FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape  =  T2.Grape GROUP BY T2.Grape ORDER BY AVG(Price) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the distinct names of wines produced before the year of 2000 or after the year of 2010. [/INST]

Output: SELECT DISTINCT Name FROM WINE WHERE YEAR  <  2000 OR YEAR  >  2010;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Give the distinct names of wines made before 2000 or after 2010. [/INST]

Output: SELECT DISTINCT Name FROM WINE WHERE YEAR  <  2000 OR YEAR  >  2010;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the distinct winery of wines having price between 50 and 100. [/INST]

Output: SELECT DISTINCT Winery FROM WINE WHERE Price BETWEEN 50 AND 100;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the distinct wineries which produce wines costing between 50 and 100? [/INST]

Output: SELECT DISTINCT Winery FROM WINE WHERE Price BETWEEN 50 AND 100;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the average prices and cases of wines produced in the year of 2009 and made of Zinfandel grape? [/INST]

Output: SELECT AVG(Price) ,  AVG(Cases) FROM WINE WHERE YEAR  =  2009 AND Grape  =  "Zinfandel";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Give the average price and case of wines made from Zinfandel grapes in the year 2009. [/INST]

Output: SELECT AVG(Price) ,  AVG(Cases) FROM WINE WHERE YEAR  =  2009 AND Grape  =  "Zinfandel";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the maximum price and score of wines produced by St. Helena appelation? [/INST]

Output: SELECT max(Price) ,  max(Score) FROM WINE WHERE Appelation  =  "St. Helena";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Give the maximum price and score for wines produced in the appelation St. Helena. [/INST]

Output: SELECT max(Price) ,  max(Score) FROM WINE WHERE Appelation  =  "St. Helena";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the maximum price and score of wines in each year? [/INST]

Output: SELECT max(Price) ,  max(Score) ,  YEAR FROM WINE GROUP BY YEAR;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the maximum price and score of wines for each year? [/INST]

Output: SELECT max(Price) ,  max(Score) ,  YEAR FROM WINE GROUP BY YEAR;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the average price and score of wines grouped by appelation? [/INST]

Output: SELECT avg(Price) ,  avg(Score) ,  Appelation FROM WINE GROUP BY Appelation;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the average price and score of wines for each appelation? [/INST]

Output: SELECT avg(Price) ,  avg(Score) ,  Appelation FROM WINE GROUP BY Appelation;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the wineries that have at least four wines. [/INST]

Output: SELECT Winery FROM WINE GROUP BY Winery HAVING count(*)  >=  4;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Which wineries produce at least four wines? [/INST]

Output: SELECT Winery FROM WINE GROUP BY Winery HAVING count(*)  >=  4;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the country of all appelations who have at most three wines. [/INST]

Output: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation GROUP BY T2.Appelation HAVING count(*)  <=  3;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the countries for appelations with at most 3 wines? [/INST]

Output: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation GROUP BY T2.Appelation HAVING count(*)  <=  3;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of wines whose production year are before the year of all wines by Brander winery? [/INST]

Output: SELECT Name FROM WINE WHERE YEAR  <  (SELECT min(YEAR) FROM WINE WHERE Winery  =  "Brander");


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of wines produced before any wine from the Brander winery? [/INST]

Output: SELECT Name FROM WINE WHERE YEAR  <  (SELECT min(YEAR) FROM WINE WHERE Winery  =  "Brander");


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of wines that are more expensive then all wines made in the year 2006? [/INST]

Output: SELECT Name FROM WINE WHERE Price  >  (SELECT max(Price) FROM WINE WHERE YEAR  =  2006);


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Give the names of wines with prices above any wine produced in 2006. [/INST]

Output: SELECT Name FROM WINE WHERE Price  >  (SELECT max(Price) FROM WINE WHERE YEAR  =  2006);


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the top 3 wineries with the greatest number of wines made of white color grapes. [/INST]

Output: SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE  =  T2.GRAPE WHERE T1.Color  =  "White" GROUP BY T2.Winery ORDER BY count(*) DESC LIMIT 3;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Which 3 wineries produce the most wines made from white grapes? [/INST]

Output: SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE  =  T2.GRAPE WHERE T1.Color  =  "White" GROUP BY T2.Winery ORDER BY count(*) DESC LIMIT 3;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: List the grape, winery and year of the wines whose price is bigger than 100 ordered by year. [/INST]

Output: SELECT Grape ,  Winery ,  YEAR FROM WINE WHERE Price  >   100 ORDER BY YEAR;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the grapes, wineries and years for wines with price higher than 100, sorted by year? [/INST]

Output: SELECT Grape ,  Winery ,  YEAR FROM WINE WHERE Price  >   100 ORDER BY YEAR;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: List the grape, appelation and name of wines whose score is higher than 93 ordered by Name. [/INST]

Output: SELECT Grape ,  Appelation ,  Name FROM WINE WHERE Score  >  93 ORDER BY Name;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the grapes, appelations, and wines with scores above 93, sorted by Name? [/INST]

Output: SELECT Grape ,  Appelation ,  Name FROM WINE WHERE Score  >  93 ORDER BY Name;


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: Find the appelations that produce wines after the year of 2008 but not in Central Coast area. [/INST]

Output: SELECT Appelation FROM WINE WHERE YEAR  >  2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area  =  "Central Coast";


Input:
[INST] Here is a database schema:
grapes :
ID [ INT ] primary_key
Grape [ TEXT ]
Color [ TEXT ]

appellations :
No [ INT ] primary_key
Appelation [ TEXT ]
County [ TEXT ]
State [ TEXT ]
Area [ TEXT ]
isAVA [ TEXT ]

wine :
No [ INT ]
Grape [ TEXT ] wine.Grape = grapes.Grape
Winery [ TEXT ]
Appelation [ TEXT ] wine.Appelation = appellations.Appelation
State [ TEXT ]
Name [ TEXT ]
Year [ INT ]
Price [ INT ]
Score [ INT ]
Cases [ INT ]
Drink [ TEXT ]

Please write me a SQL statement that answers the following question: What are the appelations for wines produced after 2008 but not in the Central Coast area? [/INST]

Output: SELECT Appelation FROM WINE WHERE YEAR  >  2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area  =  "Central Coast";