is calculated in one query without cursor
requires MSSQL 2012+
Simple banking account with accrual of interest on account amount.
Client may deposit some money and withdraw it at any time.
We need to calculate how many days the money was on deposit account before they have been withdrawn.