中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

查詢最近10天開戶的銀行卡的信息,利用datediff()函數(shù),計算開戶日期和當(dāng)前日期相差的天數(shù)

2018-07-20    來源:open-open

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用

if exists(select * from sysobjects where name = 'accountInfo')
 drop table accountInfo
go

create table accountInfo
(
 custId int identity(1,1) primary key,   --賬戶編號
 custName varchar(20) not null,          --賬戶名稱
 idcard varchar(18) not null,            --身份證號
 tel varchar(13) not null,               --電話
 custaddress varchar(50)                 --家庭住址
)
go
--插入數(shù)據(jù)
insert into accountInfo values('李明博','423625198003253695','13035642815','武漢')
insert into accountInfo values('張小璐','424625198111253695','13035642816','南京')
insert into accountInfo values('王明山','425625197903223695','13035642817','北京')
go

----------------------------------卡片信息表------------------------------------

if exists(select * from sysobjects where name = 'cardInfo')
 drop table cardInfo
go

create table cardInfo
(
 cardId varchar(19) primary key,                 ---卡片編號
 cardpwd varchar(6) default('888888') not null,  ---密碼
 custId int references accountInfo(custId),      --賬戶編號(外鍵)
 saveType varchar(10) not null,                  --儲蓄類型
 openDate datetime default(getdate()) not null,  --開戶時間
 openmoney money not null check(openmoney>=1),   --開戶余額
 leftmoney money not null check(leftmoney>=1),   --賬戶余額
 isloss varchar(2) default('否') not null        --是否掛失

go
--插入數(shù)據(jù)

insert into cardInfo values('9559 3652 8425 1234',default,1,'定期',default,500,500,default)
insert into cardInfo values('9559 3652 8425 1245',default,2,'定期',default,1300,1300,default)
insert into cardInfo values('9559 3652 8425 1268',default,3,'定期',default,8500,8500,default)
go

---------------------------------------------交易信息表----------------------------------

if exists(select * from sysobjects where name = 'transInfo')
 drop table transInfo
go

create table transInfo
(
 cardId varchar(19)  references cardInfo(cardId),                                  --卡片編號(外鍵)
 transType varchar(4) not null check(transType = '支取' or transType = '存入'),    --交易類型
 transmoney money not null,                                                        --交易金額
 transDate datetime default(getdate()) not null                                    --交易時間
)
go

 


select * from transInfo

 

--查詢表
select * from accountInfo
select * from cardInfo
select * from transInfo



怎么寫?求幫助

標(biāo)簽: idc

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:C++ 簡單SOCKET 通信

下一篇: HTML5之文件拖拽