前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >查询最近10天开户的银行卡的信息,利用datediff()函数

查询最近10天开户的银行卡的信息,利用datediff()函数

原创
作者头像
好派笔记
修改2021-11-02 10:54:54
4800
修改2021-11-02 10:54:54
举报
文章被收录于专栏:好派笔记好派笔记

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 --插入数据 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 --插入数据

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

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档