开户时存入1000元到账户。并在每年末加存1000元。如果利息是5%,那么至账户里有至少100万元时需要多长时间?
用T-SQL实现。
------解决方案--------------------
- SQL code
declare @year int=0,@money numeric(18,2)=1000while @money<1000000begin set @[email protected][email protected]*0.05+1000 set @[email protected]+1endprint @year