question
stringlengths
19
191
query
stringlengths
26
371
schema
stringclasses
14 values
List names for drivers from Hartford city and younger than 40.
SELECT name FROM driver WHERE home_city = 'Hartford' AND age < 40
driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT) school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT) school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL)
find the name of driver who is driving the school bus with the longest working history.
SELECT t1.name FROM driver AS t1 JOIN school_bus AS t2 ON t1.driver_id = t2.driver_id ORDER BY years_working DESC LIMIT 1
driver: Driver_ID (INT), Name (TEXT), Party (TEXT), Home_city (TEXT), Age (INT) school: School_ID (INT), Grade (TEXT), School (TEXT), Location (TEXT), Type (TEXT) school_bus: School_ID (INT), Driver_ID (INT), Years_Working (INT), If_full_time (BOOL)
How many flights have a velocity larger than 200?
SELECT count(*) FROM flight WHERE velocity > 200
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
List the vehicle flight number, date and pilot of all the flights, ordered by altitude.
SELECT vehicle_flight_number , date , pilot FROM flight ORDER BY altitude ASC
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
List the id, country, city and name of the airports ordered alphabetically by the name.
SELECT id , country , city , name FROM airport ORDER BY name
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
What is maximum group equity shareholding of the companies?
SELECT max(group_equity_shareholding) FROM operate_company
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
What is the velocity of the pilot named 'Thompson'?
SELECT avg(velocity) FROM flight WHERE pilot = 'Thompson'
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
What are the names and types of the companies that have ever operated a flight?
SELECT T1.name , T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
What are the names of the airports which are not in the country 'Iceland'?
SELECT name FROM airport WHERE country != 'Iceland'
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
What are the distinct types of the companies that have operated any flights with velocity less than 200?
SELECT DISTINCT T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T2.velocity < 200
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
What are the ids and names of the companies that operated more than one flight?
SELECT T1.id , T1.name FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP BY T1.id HAVING count(*) > 1
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
What is the id, name and IATA code of the airport that had most number of flights?
SELECT T1.id , T1.name , T1.IATA FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'?
SELECT DISTINCT T2.pilot FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id WHERE T1.country = 'United States' OR T1.name = 'Billund Airport'
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
What is the most common company type, and how many are there?
SELECT TYPE , count(*) FROM operate_company GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
How many airports haven't the pilot 'Thompson' driven an aircraft?
SELECT count(*) FROM airport WHERE id NOT IN ( SELECT airport_id FROM flight WHERE pilot = 'Thompson' );
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
List the name of the pilots who have flied for both a company that mainly provide 'Cargo' services and a company that runs 'Catering services' activities.
SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Cargo' INTERSECT SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Catering services'
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
Which of the airport names contains the word 'international'?
SELECT name FROM airport WHERE name LIKE '%international%'
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
How many companies operates airlines in each airport?
SELECT T3.id , count(*) FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id JOIN airport AS T3 ON T2.airport_id = T3.id GROUP BY T3.id
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
how many airports are there in each country?
SELECT count(*) , country FROM airport GROUP BY country
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
which countries have more than 2 airports?
SELECT country FROM airport GROUP BY country HAVING count(*) > 2
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
which pilot is in charge of the most number of flights?
SELECT pilot FROM flight GROUP BY pilot ORDER BY count(*) DESC LIMIT 1
airport: id (INT), City (TEXT), Country (TEXT), IATA (TEXT), ICAO (TEXT), name (TEXT) operate_company: id (INT), name (TEXT), Type (TEXT), Principal_activities (TEXT), Incorporated_in (TEXT), Group_Equity_Shareholding (REAL) flight: id (INT), Vehicle_Flight_number (TEXT), Date (TEXT), Pilot (TEXT), Velocity (REAL), Altitude (REAL), airport_id (INT), company_id (INT)
How many accounts do we have?
SELECT count(*) FROM Accounts
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Count the number of accounts.
SELECT count(*) FROM Accounts
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show all account ids and account details.
SELECT account_id , account_details FROM Accounts
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the ids and details of all accounts?
SELECT account_id , account_details FROM Accounts
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
How many statements do we have?
SELECT count(*) FROM Statements
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Count the number of statements.
SELECT count(*) FROM Statements
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
List all statement ids and statement details.
SELECT STATEMENT_ID , statement_details FROM Statements
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the ids and details of all statements?
SELECT STATEMENT_ID , statement_details FROM Statements
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show statement id, statement detail, account detail for accounts.
SELECT T1.statement_id , T2.statement_details , T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the statement ids, statement details, and account details, for all accounts?
SELECT T1.statement_id , T2.statement_details , T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show all statement id and the number of accounts for each statement.
SELECT STATEMENT_ID , count(*) FROM Accounts GROUP BY STATEMENT_ID
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the different statement ids on accounts, and the number of accounts for each?
SELECT STATEMENT_ID , count(*) FROM Accounts GROUP BY STATEMENT_ID
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show the statement id and the statement detail for the statement with most number of accounts.
SELECT T1.statement_id , T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the statement id and statement detail for the statement that has the most corresponding accounts?
SELECT T1.statement_id , T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show the number of documents.
SELECT count(*) FROM Documents
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Count the number of documents.
SELECT count(*) FROM Documents
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
List the document type code, document name, and document description for the document with name 'Noel CV' or name 'King Book'.
SELECT document_type_code , document_name , document_description FROM Documents WHERE document_name = 'Noel CV' OR document_name = 'King Book'
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the type come, name, and description of the document that has either the name 'Noel CV' or 'King Book'?
SELECT document_type_code , document_name , document_description FROM Documents WHERE document_name = 'Noel CV' OR document_name = 'King Book'
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show the ids and names of all documents.
SELECT document_id , document_name FROM Documents
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the ids and names for each of the documents?
SELECT document_id , document_name FROM Documents
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Find names and ids of all documents with document type code BK.
SELECT document_name , document_id FROM Documents WHERE document_type_code = "BK"
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the names and ids of documents that have the type code BK?
SELECT document_name , document_id FROM Documents WHERE document_type_code = "BK"
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
How many documents are with document type code BK for each product id?
SELECT count(*) , project_id FROM Documents WHERE document_type_code = "BK" GROUP BY project_id
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Count the number of documents with the type code BK that correspond to each product id.
SELECT count(*) , project_id FROM Documents WHERE document_type_code = "BK" GROUP BY project_id
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show the document name and the document date for all documents on project with details 'Graph Database project'.
SELECT document_name , document_date FROM Documents AS T1 JOIN projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'Graph Database project'
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the names and dates for documents corresponding to project that has the details 'Graph Database project'?
SELECT document_name , document_date FROM Documents AS T1 JOIN projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'Graph Database project'
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show project ids and the number of documents in each project.
SELECT project_id , count(*) FROM Documents GROUP BY project_id
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
How many documents correspond with each project id?
SELECT project_id , count(*) FROM Documents GROUP BY project_id
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What is the id of the project with least number of documents?
SELECT project_id FROM Documents GROUP BY project_id ORDER BY count(*) ASC LIMIT 1
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Return the id of the project that has the fewest corresponding documents.
SELECT project_id FROM Documents GROUP BY project_id ORDER BY count(*) ASC LIMIT 1
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show the ids for projects with at least 2 documents.
SELECT project_id FROM Documents GROUP BY project_id HAVING count(*) >= 2
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are project ids of projects that have 2 or more corresponding documents?
SELECT project_id FROM Documents GROUP BY project_id HAVING count(*) >= 2
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
List document type codes and the number of documents in each code.
SELECT document_type_code , count(*) FROM Documents GROUP BY document_type_code
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
How many documents are there of each type?
SELECT document_type_code , count(*) FROM Documents GROUP BY document_type_code
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What is the document type code with most number of documents?
SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Return the code of the document type that is most common.
SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show the document type code with fewer than 3 documents.
SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING count(*) < 3
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the codes corresponding to document types for which there are less than 3 documents?
SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING count(*) < 3
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show the statement detail and the corresponding document name for the statement with detail 'Private Project'.
SELECT T1.statement_details , T2.document_name FROM Statements AS T1 JOIN Documents AS T2 ON T1.statement_id = T2.document_id WHERE T1.statement_details = 'Private Project'
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the details for statements with the details 'Private Project', and what are the names of the corresponding documents?
SELECT T1.statement_details , T2.document_name FROM Statements AS T1 JOIN Documents AS T2 ON T1.statement_id = T2.document_id WHERE T1.statement_details = 'Private Project'
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show all document type codes, document type names, document type descriptions.
SELECT document_type_code , document_type_name , document_type_description FROM Ref_document_types
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the codes, names, and descriptions of the different document types?
SELECT document_type_code , document_type_name , document_type_description FROM Ref_document_types
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What is the document type description for document type named Film?
SELECT document_type_description FROM Ref_document_types WHERE document_type_name = "Film"
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Return the description of the document type name 'Film'.
SELECT document_type_description FROM Ref_document_types WHERE document_type_name = "Film"
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What is the document type name and the document type description and creation date for all the documents?
SELECT T1.document_type_name , T1.document_type_description , T2.Document_date FROM Ref_document_types AS T1 JOIN Documents AS T2 ON T1.document_type_code = T2.document_type_code
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Return the type name, type description, and date of creation for each document.
SELECT T1.document_type_name , T1.document_type_description , T2.Document_date FROM Ref_document_types AS T1 JOIN Documents AS T2 ON T1.document_type_code = T2.document_type_code
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show the number of projects.
SELECT count(*) FROM Projects
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
How many projects are there?
SELECT count(*) FROM Projects
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
List ids and details for all projects.
SELECT project_id , project_details FROM Projects
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the ids and details for each project?
SELECT project_id , project_details FROM Projects
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What is the project id and detail for the project with at least two documents?
SELECT T1.project_id , T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id HAVING count(*) > 2
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Return the ids and details corresponding to projects for which there are more than two documents.
SELECT T1.project_id , T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id HAVING count(*) > 2
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What is the project detail for the project with document "King Book"?
SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id WHERE T2.document_name = "King Book"
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Give the details of the project with the document name 'King Book'.
SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id WHERE T2.document_name = "King Book"
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
How many budget types do we have?
SELECT count(*) FROM Ref_budget_codes
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Count the number of budget codes.
SELECT count(*) FROM Ref_budget_codes
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
List all budget type codes and descriptions.
SELECT budget_type_code , budget_type_description FROM Ref_budget_codes
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the type codes and descriptions of each budget type?
SELECT budget_type_code , budget_type_description FROM Ref_budget_codes
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What is the description for the budget type with code ORG?
SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code = "ORG"
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Return the description of the budget type that has the code ORG.
SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code = "ORG"
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
How many documents have expenses?
SELECT count(*) FROM Documents_with_expenses
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Count the number of documents with expenses.
SELECT count(*) FROM Documents_with_expenses
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
What are the document ids for the budget type code 'SF'?
SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF'
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Give the ids of documents with expenses that have the budget code 'SF'.
SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF'
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show the budget type code and description and the corresponding document id.
SELECT T2.budget_type_code , T2.budget_type_description , T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_budget_codes AS T2 ON T1.budget_type_code = T2.budget_type_code
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Return the budget type codes, budget type descriptions and document ids for documents with expenses.
SELECT T2.budget_type_code , T2.budget_type_description , T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_budget_codes AS T2 ON T1.budget_type_code = T2.budget_type_code
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Show ids for all documents with budget types described as 'Government'.
SELECT T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_code = T2.Budget_Type_code WHERE T2.budget_type_Description = "Government"
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Give the ids for documents that have the budget description 'Government'.
SELECT T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_code = T2.Budget_Type_code WHERE T2.budget_type_Description = "Government"
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
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
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
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
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
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
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
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
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
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
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
Return the ids of documents that do not have expenses.
SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
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
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
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
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
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%'
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
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%'
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))
How many documents do not have any expense?
SELECT count(*) FROM Documents WHERE document_id NOT IN ( SELECT document_id FROM Documents_with_expenses )
Ref_Document_Types: Document_Type_Code (CHAR(15)), Document_Type_Name (VARCHAR(255)), Document_Type_Description (VARCHAR(255)) Ref_Budget_Codes: Budget_Type_Code (CHAR(15)), Budget_Type_Description (VARCHAR(255)) Projects: Project_ID (INTEGER), Project_Details (VARCHAR(255)) Documents: Document_ID (INTEGER), Document_Type_Code (CHAR(15)), Project_ID (INTEGER), Document_Date (DATETIME), Document_Name (VARCHAR(255)), Document_Description (VARCHAR(255)), Other_Details (VARCHAR(255)) Statements: Statement_ID (INTEGER), Statement_Details (VARCHAR(255)) Documents_with_Expenses: Document_ID (INTEGER), Budget_Type_Code (CHAR(15)), Document_Details (VARCHAR(255)) Accounts: Account_ID (INTEGER), Statement_ID (INTEGER), Account_Details (VARCHAR(255))