一、删除数据库

use master
go
if exists (select * from sysdatabases where name = 'Demo')
drop database Demo
go

 

二、删除表

use PhoneList
go
if exists (select * from sysobjects where name = 'PCategory')
drop table PCategory
go

 

三、子查询

有如下一张学员成绩表:

SQLServer —— EXISTS子查询

 

现在,有这么个需求,查询 C# 考试成绩,如果存在不及格的学员,则显示本次考试较难,否则显示本次考试内容适中,解决方案如下:

(1)、使用 exists

SQLServer —— EXISTS子查询

 

(2)、使用 not exists

SQLServer —— EXISTS子查询

 

 

 

 

相关文章:

  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
  • 2022-02-04
猜你喜欢
  • 2021-12-12
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案