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 '登录失败'

sqlserver2012——EXISTS关键字

 

相关文章:

  • 2022-12-23
  • 2021-11-28
  • 2021-12-24
  • 2021-10-11
  • 2021-08-03
  • 2021-05-08
  • 2021-11-18
猜你喜欢
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2018-03-26
相关资源
相似解决方案