user
stringlengths
353
426
query
stringlengths
73
738
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Income of last 3 months. ?
SELECT SUM(Deposit_amount) AS Total_Income FROM transactions WHERE Value_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 3 MONTH)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Total expenses/spendings of last 8 months ?
SELECT SUM(Withdrawal_amount) AS Total_Expenses FROM transactions WHERE Value_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 8 MONTH)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Total saving of last month as my account number is 409000493201' ?
SELECT (SUM(Deposit_amount) - SUM(Withdrawal_amount)) AS Savings_Last_Month FROM transactions WHERE Account_No = "409000493201'" AND YEAR(Value_date) = YEAR(CURRENT_DATE() - INTERVAL 1 MONTH) AND MONTH(Value_date) = MONTH(CURRENT_DATE() - INTERVAL 1 MONTH);
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How many transactions did I make in last 2 week
SELECT COUNT(*) AS Total_Transactions FROM transactions WHERE Value_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 2 WEEK)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Amount spent last week
SELECT SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE Value_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 WEEK)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Expenses for each day this month ?
SELECT Date, SUM(Withdrawal_amount) AS Total_Expenses FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) = MONTH(CURRENT_DATE()) GROUP BY Date
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: savings of previous year for each month
SELECT MONTH(Value_date) AS Month, (SUM(Deposit_amount) - SUM(Withdrawal_amount)) AS Total_Savings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE() - INTERVAL 1 YEAR) GROUP BY MONTH(Value_date) ORDER BY MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Amount Saved each year
SELECT YEAR(Value_date) AS Year,SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Savings FROM transactions GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Savings of last 2 year
SELECT YEAR(Value_date) AS Year, SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Net_Savings FROM transactions WHERE Value_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 2 YEAR) GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Expenses of each day of last week
SELECT DATE(Value_date) AS Date, SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE Value_date >= DATE_SUB(CURDATE(), INTERVAL 1 WEEK) GROUP BY DATE(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Amount spent this year ?
SELECT year(Value_date) as Year,sum(Withdrawal_amount) AS Total_Expenses FROM transactions WHERE year(Value_date) = year(curdate()) group by year(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: amount/money saved each month previous year ?
SELECT YEAR(Value_date) AS Year, MONTH(Value_date) AS Month, SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Savings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE - INTERVAL 1 YEAR) GROUP BY YEAR(Value_date), MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: income of the previous year
SELECT SUM(Deposit_amount) AS Total_Income FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE) - 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: income of the first 4 month of previous year
SELECT SUM(Deposit_amount) AS Total_Income FROM transactions WHERE MONTH(Value_date) IN (1,2,3,4) AND YEAR(Value_date) = YEAR(CURRENT_DATE) - 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: amount I lost each year?
SELECT YEAR(Value_date) AS Year,SUM(Withdrawal_amount) - SUM(Deposit_amount) AS Losses FROM transactions GROUP BY YEAR(Value_date);
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is the average of last 5 transactions?
SELECT AVG(CASE WHEN Withdrawal_amount IS NOT NULL THEN Withdrawal_amount ELSE Deposit_amount END) AS Average_Amount FROM (SELECT Withdrawal_amount, Deposit_amount FROM transactions ORDER BY Date DESC LIMIT 5) AS Last5Transactions
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my total income this year?
SELECT SUM(Deposit_amount) AS Total_Income FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my income of the first 3 months of this year?
SELECT SUM(Deposit_amount) AS Total_Income FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) IN (1, 2, 3)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my expenses of the first 4 months of this year?
SELECT SUM(Withdrawal_amount) AS Total_Expenses FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) IN (1, 2, 3, 4)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my income of the last 5 months of this year?
SELECT SUM(Deposit_amount) AS Total_Income FROM transactions WHERE Value_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 5 MONTH)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much amount did I earn each year?
SELECT YEAR(Value_date) AS Year, SUM(Deposit_amount) AS Total_Income FROM transactions GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much amount did I save each year?
SELECT YEAR(Value_date) AS Year, SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Savings FROM transactions GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much amount did I spend each year?
SELECT YEAR(Value_date) AS Year, SUM(Withdrawal_amount) AS Total_Spending FROM transactions GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Give me the breakdown of expenses of each day of this week?
SELECT DATE(Value_date) AS Date, SUM(Withdrawal_amount) AS Total_Expenses FROM transactions WHERE Value_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 WEEK) GROUP BY DATE(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Give me the breakdown of savings of each day of this month?
SELECT DATE(Value_date) AS Date, SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Daily_Savings FROM transactions WHERE MONTH(Value_date) = MONTH(CURRENT_DATE()) AND YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY DATE(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Give me the breakdown of amount I spent each day of this month?
SELECT DATE(Value_date) AS Date, SUM(Withdrawal_amount) AS Daily_Spending FROM transactions WHERE MONTH(Value_date) = MONTH(CURRENT_DATE()) AND YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY DATE(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Give me the breakdown of amount I spent each day of this week?
SELECT DATE(Value_date) AS Date, SUM(Withdrawal_amount) AS Daily_Spending FROM transactions WHERE Value_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 WEEK) GROUP BY DATE(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: On average how much amount I spent each day?
SELECT AVG(Withdrawal_amount) AS Average_Daily_Spending FROM transactions
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: On average how much amount I spent each month?
SELECT YEAR(Value_date) AS Year, MONTH(Value_date) AS Month, AVG(SUM(Withdrawal_amount)) OVER (PARTITION BY YEAR(Value_date), MONTH(Value_date)) AS Average_Monthly_Spending FROM transactions GROUP BY YEAR(Value_date), MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: On average how much amount I spent each year?
SELECT YEAR(Value_date) AS Year, AVG(SUM(Withdrawal_amount)) OVER (PARTITION BY YEAR(Value_date)) AS Average_Yearly_Spending FROM transactions GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How many transactions did I make this year?
SELECT COUNT(*) AS Total_Transactions FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How many transactions did I make each year?
SELECT YEAR(Value_date) AS Year, COUNT(*) AS Total_Transactions FROM transactions GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How many transactions did I make this week?
SELECT COUNT(*) AS Total_Transactions FROM transactions WHERE WEEK(Value_date) = WEEK(CURRENT_DATE()) AND YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How many transactions did I make this month?
SELECT COUNT(*) AS Total_Transactions FROM transactions WHERE MONTH(Value_date) = MONTH(CURRENT_DATE()) AND YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my total savings of last month?
SELECT SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Total_Savings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH) AND MONTH(Value_date) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my total savings of each year?
SELECT YEAR(Value_date) AS Year, SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Total_Savings FROM transactions GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my savings this week?
SELECT SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Total_Savings FROM transactions WHERE WEEK(Value_date) = WEEK(CURRENT_DATE()) AND YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my expenses amount of last month?
SELECT SUM(Withdrawal_amount) AS Total_Expenses FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH) AND MONTH(Value_date) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my expenses amount of this month?
SELECT SUM(Withdrawal_amount) AS Total_Expenses FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) = MONTH(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is the pattern in my last 3 transactions? Are they increasing or decreasing?
SELECT Transaction_details, Withdrawal_amount, Deposit_amount, Value_date FROM transactions ORDER BY Value_date DESC LIMIT 3
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my current net worth?
SELECT Balance_amount AS Current_Net_Worth FROM transactions ORDER BY Value_date DESC LIMIT 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Has my income changed recently?
SELECT DATE(Value_date) AS Date, SUM(Deposit_amount) AS Daily_Income FROM transactions GROUP BY DATE(Value_date) ORDER BY DATE(Value_date) DESC LIMIT 7
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my income of the last 2 years?
SELECT YEAR(Value_date) AS Year, SUM(Deposit_amount) AS Total_Income FROM transactions WHERE Value_date >= DATE_SUB(CURDATE(), INTERVAL 2 YEAR) GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my expenses of the last 1 year?
SELECT YEAR(Value_date) AS Year, SUM(Withdrawal_amount) AS Total_Expenses FROM transactions WHERE Value_date >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my savings of the last 3 years?
SELECT YEAR(Value_date) AS Year, SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Net_Savings FROM transactions WHERE Value_date >= DATE_SUB(CURDATE(), INTERVAL 3 YEAR) GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Give me the income of the first 7 months of this year
SELECT MONTH(Value_date) AS Month, SUM(Deposit_amount) AS Total_Income FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) <= 7 GROUP BY MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Tell me the expenses of the first 9 months of this year
SELECT MONTH(Value_date) AS Month, SUM(Withdrawal_amount) AS Total_Expenses FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) <= 9 GROUP BY MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Tell me the income of the last 8 months of this year
SELECT MONTH(Value_date) AS Month, SUM(Deposit_amount) AS Total_Income FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) >= (MONTH(CURRENT_DATE()) - 7) GROUP BY MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my average spendings each month in this year
SELECT MONTH(Value_date) AS Month, AVG(Withdrawal_amount) AS Average_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Give me the average spendings of mine each month in previous year
SELECT MONTH(Value_date) AS Month, AVG(Withdrawal_amount) AS Average_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) - 1 GROUP BY MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Give me the average spendings of mine each month in year 2022
SELECT MONTH(Value_date) AS Month, AVG(Withdrawal_amount) AS Average_Spending FROM transactions WHERE YEAR(Value_date) = 2022 GROUP BY MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my average spendings each week in this month
SELECT WEEK(Value_date) AS Week, AVG(Withdrawal_amount) AS Average_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) = MONTH(CURRENT_DATE()) GROUP BY WEEK(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my average spendings each week previous month
SELECT WEEK(Value_date) AS Week, AVG(Withdrawal_amount) AS Average_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) = MONTH(CURRENT_DATE()) - 1 GROUP BY WEEK(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my average earning each month in this year?
SELECT MONTH(Value_date) AS Month, AVG(Deposit_amount) AS Average_Earning FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: Tell me the earnings each month in the previous year
SELECT MONTH(Value_date) AS Month, SUM(Deposit_amount) AS Total_Earnings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) - 1 GROUP BY MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my earnings each month in the year 2018?
SELECT MONTH(Value_date) AS Month, SUM(Deposit_amount) AS Total_Earnings FROM transactions WHERE YEAR(Value_date) = 2018 GROUP BY MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my average earning each week in this month?
SELECT WEEK(Value_date) AS Week, AVG(Deposit_amount) AS Average_Earning FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) = MONTH(CURRENT_DATE()) GROUP BY WEEK(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What were my earnings each week in the previous month?
SELECT WEEK(Value_date) AS Week, SUM(Deposit_amount) AS Total_Earnings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) = MONTH(CURRENT_DATE()) - 1 GROUP BY WEEK(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What was my net worth previous year?
SELECT (SUM(Deposit_amount) - SUM(Withdrawal_amount)) AS Net_Worth FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) - 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my net worth this year?
SELECT (SUM(Deposit_amount) - SUM(Withdrawal_amount)) AS Net_Worth FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What was my bank balance in year 2021?
SELECT Balance_amount FROM transactions WHERE YEAR(Value_date) = 2021 ORDER BY Value_date DESC LIMIT 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much money did I spend this year?
SELECT SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much money did I spend till now?
SELECT SUM(Withdrawal_amount) AS Total_Spending FROM transactions
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much money did I spend this week?
SELECT SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE YEARWEEK(Value_date, 1) = YEARWEEK(CURRENT_DATE(), 1)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much money did I spend previous week?
SELECT SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE YEARWEEK(Value_date, 1) = YEARWEEK(CURRENT_DATE(), 1) - 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much money did I spend this month?
SELECT SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) = MONTH(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much money did I spend last month?
SELECT SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND MONTH(Value_date) = MONTH(CURRENT_DATE()) - 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my highest spending month this year?
SELECT MONTH(Value_date) AS Month, SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY MONTH(Value_date) ORDER BY Total_Spending DESC LIMIT 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my highest earning month this year?
SELECT MONTH(Value_date) AS Month, SUM(Deposit_amount) AS Total_Earnings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY MONTH(Value_date) ORDER BY Total_Earnings DESC LIMIT 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my lowest spending month this year?
SELECT MONTH(Value_date) AS Month, SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY MONTH(Value_date) ORDER BY Total_Spending ASC LIMIT 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my lowest earning month this year?
SELECT MONTH(Value_date) AS Month, SUM(Deposit_amount) AS Total_Earnings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY MONTH(Value_date) ORDER BY Total_Earnings ASC LIMIT 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my average monthly income this year?
SELECT AVG(Total_Earnings) AS Average_Income FROM ( SELECT SUM(Deposit_amount) AS Total_Earnings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY MONTH(Value_date) ) AS MonthlyEarnings
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my average monthly spending this year?
SELECT AVG(Total_Spending) AS Average_Spending FROM ( SELECT SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY MONTH(Value_date) ) AS MonthlySpending
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my largest transaction this year?
SELECT * FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) ORDER BY GREATEST(Withdrawal_amount, Deposit_amount) DESC LIMIT 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my smallest transaction this year?
SELECT * FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) ORDER BY LEAST(Withdrawal_amount, Deposit_amount) ASC LIMIT 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How many deposits did I make this year?
SELECT COUNT(*) AS Total_Deposits FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND Deposit_amount IS NOT NULL
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How many withdrawals did I make this year?
SELECT COUNT(*) AS Total_Withdrawals FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND Withdrawal_amount IS NOT NULL
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my total balance at the end of each year?
SELECT YEAR(Value_date) AS Year, Balance_amount FROM transactions WHERE Value_date IN ( SELECT MAX(Value_date) FROM transactions GROUP BY YEAR(Value_date) ) GROUP BY YEAR(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my highest balance this year?
SELECT MAX(Balance_amount) AS Highest_Balance FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my lowest balance this year?
SELECT MIN(Balance_amount) AS Lowest_Balance FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How many transactions were above $1000 this year?
SELECT COUNT(*) AS High_Value_Transactions FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND (Withdrawal_amount > 1000 OR Deposit_amount > 1000)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How many transactions were below $100 this year?
SELECT COUNT(*) AS Low_Value_Transactions FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND (Withdrawal_amount < 100 OR Deposit_amount < 100)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is the average balance in my account this year?
SELECT AVG(Balance_amount) AS Average_Balance FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How many days did I have a balance below $500 this year?
SELECT COUNT(DISTINCT Value_date) AS Days_Below_500 FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND Balance_amount < 500
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How many days did I have a balance above $5000 this year?
SELECT COUNT(DISTINCT Value_date) AS Days_Above_5000 FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND Balance_amount > 5000
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much did I spend on the highest spending day this year?
SELECT MAX(Total_Spending) AS Highest_Spending_Day FROM ( SELECT SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY DATE(Value_date) ) AS DailySpending
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much did I earn on the highest earning day this year?
SELECT MAX(Total_Earnings) AS Highest_Earning_Day FROM ( SELECT SUM(Deposit_amount) AS Total_Earnings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY DATE(Value_date) ) AS DailyEarnings
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my total income from last year?
SELECT SUM(Deposit_amount) AS Total_Income FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) - 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my total spending from last year?
SELECT SUM(Withdrawal_amount) AS Total_Spending FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) - 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is the average daily spending in the last month?
SELECT AVG(Daily_Spending) AS Average_Daily_Spending FROM ( SELECT DATE(Value_date) AS Date, SUM(Withdrawal_amount) AS Daily_Spending FROM transactions WHERE Value_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 MONTH) GROUP BY DATE(Value_date) ) AS DailySpending
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is the average daily income in the last month?
SELECT AVG(Daily_Income) AS Average_Daily_Income FROM ( SELECT DATE(Value_date) AS Date, SUM(Deposit_amount) AS Daily_Income FROM transactions WHERE Value_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 MONTH) GROUP BY DATE(Value_date) ) AS DailyIncome
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my largest withdrawal amount this year?
SELECT MAX(Withdrawal_amount) AS Largest_Withdrawal FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my largest deposit amount this year?
SELECT MAX(Deposit_amount) AS Largest_Deposit FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much did I save in total last year?
SELECT SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Total_Savings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) - 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much did I save in total this year?
SELECT SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Total_Savings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: How much did I save each month this year?
SELECT MONTH(Value_date) AS Month, SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Monthly_Savings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY MONTH(Value_date)
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is the average monthly savings this year?
SELECT AVG(Monthly_Savings) AS Average_Monthly_Savings FROM ( SELECT MONTH(Value_date) AS Month, SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Monthly_Savings FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) GROUP BY MONTH(Value_date) ) AS MonthlySavings
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my net income this year?
SELECT SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Net_Income FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE())
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is my net income last year?
SELECT SUM(Deposit_amount) - SUM(Withdrawal_amount) AS Net_Income FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) - 1
Here is a database schema: CREATE TABLE transactions ( `Account_No` VARCHAR(50) NOT NULL, `Transaction_details` TEXT, `Withdrawal_amount` INTEGER, `Deposit_amount` INTEGER, `Balance_amount` INTEGER, `Value_date` DATE, `Date` DATE ) Please write me a SQL statement that answers the following question: What is the total number of deposits this year?
SELECT COUNT(*) AS Total_Deposits FROM transactions WHERE YEAR(Value_date) = YEAR(CURRENT_DATE()) AND Deposit_amount IS NOT NULL
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
0
Edit dataset card