spider_version int64 1 2 | db_id stringclasses 204 values | schema stringclasses 187 values | question stringlengths 3 328 | query stringlengths 20 3.81k |
|---|---|---|---|---|
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | Show budget type codes and the number of documents in each budget type. | SELECT budget_type_code , count(*) FROM Documents_with_expenses GROUP BY budget_type_code |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | What are the different budget type codes, and how many documents are there for each? | SELECT budget_type_code , count(*) FROM Documents_with_expenses GROUP BY budget_type_code |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | What is the budget type code with most number of documents. | SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY count(*) DESC LIMIT 1 |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | Give the budget type code that is most common among documents with expenses. | SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY count(*) DESC LIMIT 1 |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | What are the ids of documents which don't have expense budgets? | SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | Return the ids of documents that do not have expenses. | SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | Show ids for all documents in type CV without expense budgets. | SELECT document_id FROM Documents WHERE document_type_code = "CV" EXCEPT SELECT document_id FROM Documents_with_expenses |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | What are the ids of documents with the type code CV that do not have expenses. | SELECT document_id FROM Documents WHERE document_type_code = "CV" EXCEPT SELECT document_id FROM Documents_with_expenses |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | What are the ids of documents with letter 's' in the name with any expense budgets. | 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%' |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | Give the ids of documents that have expenses and contain the letter s in their names. | 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%' |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | How many documents do not have any expense? | SELECT count(*) FROM Documents WHERE document_id NOT IN ( SELECT document_id FROM Documents_with_expenses ) |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | Count the number of documents that do not have expenses. | SELECT count(*) FROM Documents WHERE document_id NOT IN ( SELECT document_id FROM Documents_with_expenses ) |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | What are the dates for the documents with both 'GV' type and 'SF' type expenses? | 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' |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | Give the dates of creation for documents that have both budget type codes 'GV' and 'SF'. | 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' |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | What are the account details with the largest value or with value having char '5' in it? | SELECT max(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE "%5%" |
1 | cre_Docs_and_Epenses | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL,
Budget_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL,
Project_Details VARCHAR(255),
PRIMARY KEY (Project_ID)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
);
CREATE TABLE Statements (
STATEMENT_ID INTEGER NOT NULL,
Statement_Details VARCHAR(255),
PRIMARY KEY (STATEMENT_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL,
STATEMENT_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
PRIMARY KEY (Account_ID),
FOREIGN KEY (STATEMENT_ID) REFERENCES Statements (STATEMENT_ID)
) | Return the account details with the greatest value, as well as those that include the character 5. | SELECT max(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE "%5%" |
1 | scientist_1 | Find the total number of scientists. | SELECT count(*) FROM scientists | |
1 | scientist_1 | How many scientists are there? | SELECT count(*) FROM scientists | |
1 | scientist_1 | Find the total hours of all projects. | SELECT sum(hours) FROM projects | |
1 | scientist_1 | What is the total number of hours for all projects? | SELECT sum(hours) FROM projects | |
1 | scientist_1 | How many different scientists are assigned to any project? | SELECT count(DISTINCT scientist) FROM assignedto | |
1 | scientist_1 | Count the number of different scientists assigned to any project. | SELECT count(DISTINCT scientist) FROM assignedto | |
1 | scientist_1 | Find the number of distinct projects. | SELECT count(DISTINCT name) FROM projects | |
1 | scientist_1 | How many different projects are there? | SELECT count(DISTINCT name) FROM projects | |
1 | scientist_1 | Find the average hours of all projects. | SELECT avg(hours) FROM projects | |
1 | scientist_1 | What is the average hours across all projects? | SELECT avg(hours) FROM projects | |
1 | scientist_1 | Find the name of project that continues for the longest time. | SELECT name FROM projects ORDER BY hours DESC LIMIT 1 | |
1 | scientist_1 | What is the name of the project with the most hours? | SELECT name FROM projects ORDER BY hours DESC LIMIT 1 | |
1 | scientist_1 | List the name of all projects that are operated longer than the average working hours of all projects. | SELECT name FROM projects WHERE hours > (SELECT avg(hours) FROM projects) | |
1 | scientist_1 | What are the names of projects that have taken longer than the average number of hours for all projects? | SELECT name FROM projects WHERE hours > (SELECT avg(hours) FROM projects) | |
1 | scientist_1 | Find the name and hours of project that has the most number of scientists. | 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 | |
1 | scientist_1 | What is the name and hours for the project which has the most scientists assigned to it? | 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 | |
1 | scientist_1 | Find the name of the project for which a scientist whose name contains ‘Smith’ is assigned to. | 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%' | |
1 | scientist_1 | What is the name of the project that has a scientist assigned to it whose name contains 'Smith'? | 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%' | |
1 | scientist_1 | Find the total hours of the projects that scientists named Michael Rogers or Carol Smith are assigned to. | 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' | |
1 | scientist_1 | What is the sum of hours for projects that scientists with the name Michael Rogers or Carol Smith are assigned to? | 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' | |
1 | scientist_1 | Find the name of projects that require between 100 and 300 hours of work. | SELECT name FROM projects WHERE hours BETWEEN 100 AND 300 | |
1 | scientist_1 | What are the names of projects that require between 100 and 300 hours? | SELECT name FROM projects WHERE hours BETWEEN 100 AND 300 | |
1 | scientist_1 | Find the name of the scientist who worked on both a project named 'Matter of Time' and a project named 'A Puzzling Parallax'. | 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' | |
1 | scientist_1 | What are the names of any scientists who worked on projects named 'Matter of Time' and 'A Puzzling Pattern'? | 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' | |
1 | scientist_1 | List the names of all scientists sorted in alphabetical order. | SELECT name FROM scientists ORDER BY name | |
1 | scientist_1 | What are the names of all the scientists in alphabetical order? | SELECT name FROM scientists ORDER BY name | |
1 | scientist_1 | Find the number of scientists involved for each project name. | SELECT count(*) , T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T1.name | |
1 | scientist_1 | What are the naems of all the projects, and how many scientists were assigned to each of them? | SELECT count(*) , T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T1.name | |
1 | scientist_1 | Find the number of scientists involved for the projects that require more than 300 hours. | 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 | |
1 | scientist_1 | What are the names of projects that require more than 300 hours, and how many scientists are assigned to each? | 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 | |
1 | scientist_1 | Find the number of projects which each scientist is working on and scientist's name. | SELECT count(*) , T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn = T2.scientist GROUP BY T1.name | |
1 | scientist_1 | What are the names of the scientists, and how many projects are each of them working on? | SELECT count(*) , T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn = T2.scientist GROUP BY T1.name | |
1 | scientist_1 | Find the SSN and name of scientists who are assigned to the project with the longest hours. | 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) | |
1 | scientist_1 | What are the SSN and names of scientists working on the project with the most hours? | 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) | |
1 | scientist_1 | Find the name of scientists who are assigned to some project. | SELECT T2.name FROM assignedto AS T1 JOIN scientists AS T2 ON T1.scientist = T2.ssn | |
1 | scientist_1 | What are the names of scientists who are assigned to any project? | SELECT T2.name FROM assignedto AS T1 JOIN scientists AS T2 ON T1.scientist = T2.ssn | |
1 | scientist_1 | Select the project names which are not assigned yet. | SELECT Name FROM Projects WHERE Code NOT IN (SELECT Project FROM AssignedTo) | |
1 | scientist_1 | What are the names of projects that have not been assigned? | SELECT Name FROM Projects WHERE Code NOT IN (SELECT Project FROM AssignedTo) | |
1 | scientist_1 | Find the name of scientists who are not assigned to any project. | SELECT Name FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo) | |
1 | scientist_1 | What are the names of scientists who have not been assigned a project? | SELECT Name FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo) | |
1 | scientist_1 | Find the number of scientists who are not assigned to any project. | SELECT count(*) FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo) | |
1 | scientist_1 | How many scientists do not have any projects assigned to them? | SELECT count(*) FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo) | |
1 | scientist_1 | Find the names of scientists who are not working on the project with the highest hours. | 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) | |
1 | scientist_1 | What are the names of scientists who are not working on the project with the most hours? | 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) | |
1 | scientist_1 | 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. | 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 | |
1 | scientist_1 | 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. | 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 | |
1 | scientist_1 | Find name of the project that needs the least amount of time to finish and the name of scientists who worked on it. | 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) | |
1 | scientist_1 | What is the name of the project that requires the fewest number of hours, and the names of the scientists assigned to it? | 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) | |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What is the name of the highest rated wine? | SELECT Name FROM WINE ORDER BY Score LIMIT 1 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Give the name of the wine with the highest score. | SELECT Name FROM WINE ORDER BY Score LIMIT 1 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Which winery is the wine that has the highest score from? | SELECT Winery FROM WINE ORDER BY SCORE LIMIT 1 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What is the winery at which the wine with the highest score was made? | SELECT Winery FROM WINE ORDER BY SCORE LIMIT 1 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Find the names of all wines produced in 2008. | SELECT Name FROM WINE WHERE YEAR = "2008" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the names of all wines produced in 2008? | SELECT Name FROM WINE WHERE YEAR = "2008" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | List the grapes and appelations of all wines. | SELECT Grape , Appelation FROM WINE |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the grapes and appelations of each wine? | SELECT Grape , Appelation FROM WINE |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | List the names and scores of all wines. | SELECT Name , Score FROM WINE |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the names and scores of all wines? | SELECT Name , Score FROM WINE |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | List the area and county of all appelations. | SELECT Area , County FROM APPELLATIONS |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the areas and counties for all appelations? | SELECT Area , County FROM APPELLATIONS |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the prices of wines produced before the year of 2010? | SELECT Price FROM WINE WHERE YEAR < 2010 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Return the prices of wines produced before 2010. | SELECT Price FROM WINE WHERE YEAR < 2010 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | List the names of all distinct wines that have scores higher than 90. | SELECT Name FROM WINE WHERE score > 90 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the names of wines with scores higher than 90? | SELECT Name FROM WINE WHERE score > 90 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | List the names of all distinct wines that are made of red color grape. | SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "Red" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the names of wines made from red grapes? | SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "Red" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Find the names of all distinct wines that have appellations in North Coast area. | SELECT DISTINCT T2.Name FROM APPELLATIONs AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = "North Coast" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the distinct names of wines that have appellations in the North Coast area? | SELECT DISTINCT T2.Name FROM APPELLATIONs AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = "North Coast" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | How many wines are produced at Robert Biale winery? | SELECT count(*) FROM WINE WHERE Winery = "Robert Biale" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Count the number of wines produced at Robert Biale winery. | SELECT count(*) FROM WINE WHERE Winery = "Robert Biale" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | How many appelations are in Napa Country? | SELECT count(*) FROM APPELLATIONS WHERE County = "Napa" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Count the number of appelations in Napa County. | SELECT count(*) FROM APPELLATIONS WHERE County = "Napa" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Give me the average prices of wines that are produced by appelations in Sonoma County. | SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Sonoma" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What is the average price of wines produced in appelations in Sonoma County? | SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Sonoma" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the names and scores of wines that are made of white color grapes? | SELECT T2.Name , T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "White" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Give the names and scores of wines made from white grapes. | SELECT T2.Name , T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "White" |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Find the maximum price of wins from the appelations in Central Coast area and produced before the year of 2005. | 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 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What is the maximum price of wines from the appelation in the Central Coast area, which was produced before 2005? | 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 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Find the the grape whose white color grapes are used to produce wines with scores higher than 90. | 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 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Find the white grape used to produce wines with scores above 90. | 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 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the wines that have prices higher than 50 and made of Red color grapes? | SELECT T2.Name FROM Grapes AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "Red" AND T2.price > 50 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the names of wines made from red grapes and with prices above 50? | SELECT T2.Name FROM Grapes AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "Red" AND T2.price > 50 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | What are the wines that have prices lower than 50 and have appelations in Monterey county? | SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Monterey" AND T2.price < 50 |
1 | wine_1 | CREATE TABLE "grapes" (
"ID" INTEGER PRIMARY KEY,
"Grape" TEXT UNIQUE,
"Color" TEXT
);
CREATE TABLE "appellations" (
"No" INTEGER PRIMARY KEY,
"Appelation" TEXT UNIQUE,
"County" TEXT,
"State" TEXT,
"Area" TEXT,
"isAVA" TEXT
);
CREATE TABLE "wine" (
"No" INTEGER,
"Grape" TEXT,
"Winery" TEXT,
"Appelation" TEXT,
"State" TEXT,
"Name" TEXT,
"Year" INTEGER,
"Price" INTEGER,
"Score" INTEGER,
"Cases" INTEGER,
"Drink" TEXT,
FOREIGN KEY (Grape) REFERENCES grapes(Grape),
FOREIGN KEY (Appelation) REFERENCES appellations(Appelation)
) | Give the neames of wines with prices below 50 and with appelations in Monterey county. | SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Monterey" AND T2.price < 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.