sqlserver2012——EXISTS關鍵字


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 '登錄失敗'

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM