Consider a bank database with only one relation
transaction (transno, acctno, date, amount)
The amount attribute value is positive for deposits and negative for withdrawals.
Create view TP(T1.acctno, T1.date, T2.amount)
as (Select T1.acctno, T1.date, T2.amount
from Transaction T1, Transaction T2
where T1.acctno = T2.acctno
and T2.date <= T1.date);
Create view V(acctno, date, balance)
as (select acctno, date, sum(amount)
group by acctno, date);
select acctno, min(balance)
group by acctno;
@Anmol 300 books will be dispatched this month...