mssql sqlserver where关键字应用举例说明


摘要:
下文主要使用where 关键字对表数据进行检索过滤操作,如下所示:


  create table A(keyId int identity,name varchar(30))
go
insert into A(name)values('a'),('b'),('c'),('D'),(null)
go

---1 获取keyId等于指定值 
select * from A where keyId=3
go
---2 获取keyId不等于某值
select * from A where keyId <>3 
select * from A where keyId !=3 
---3 获取keyId between
select * from A where keyId between 1 and 2

---3 获取name为null的行
select * from A where name is null 

go
drop table A
mssql_sqlserver_where关键字应用

mssql_sqlserver_where关键字应用