加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sqlserver2012——EXISTS关键字

发布时间:2020-12-12 14:18:13 所属栏目:MsSql教程 来源:网络整理
导读:1、返回TRUE或者FALSE ?如果exists查询存在,则能查询出来 select a. * From 成绩信息 a where exists ( select * from 考试安排 b where b.考试编号 = a.考试编号 and b.考试编号 = ‘ 0801 ’) 2、判断用户登录 declare @username varchar ( 16 ) declare

1、返回TRUE或者FALSE

?如果exists查询存在,则能查询出来

select a.*  From 成绩信息 a
where exists(select *  from 考试安排 b where b.考试编号=a.考试编号 and b.考试编号=0801’)

2、判断用户登录

declare @username varchar(16)
declare @pwd varchar(32)
set @username =201905132
set @pwd=xxxxxxx
if exists (select * from 学生信息 where 学号=@username and 姓名=@pwd)
print 登录成功
else
print 登录失败

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读