不知道为啥事务代码被删了,找不到了。
视图
--(1)显示卡号,身份证,姓名,余额
select CardNo 卡号,AccountCode 身份证,RealName 姓名,CardMoney 余额 from BankCard
inner join AccountInfo on BankCard.AccountId=AccountInfo.AccountId
drop view View_Account_Card
--创建视图实现卡号,身份证,姓名,余额
create view View_Account_Card
as
select CardNo 卡号,AccountCode 身份证,RealName 姓名,CardMoney 余额 from BankCard
inner join AccountInfo on BankCard.AccountId=AccountInfo.AccountId
go
select * from View_Account_Card
索引
select * from AccountInfo where AccountCode='6225547854125656'
--给AccountInfo表中的AccountCode字段添加索引
create index index_code
on AccountInfo(AccountCode)
--索引查看
select * from sys.indexes where name='index_code'
--删除索引
drop index index_code on AccountInfo
--查询
select * from AccountInfo with(index=index_code)
where AccountCode='6225547854125656'