空值处理:IS NULL、IS NOT NULL
create table studentff
(
stu_name nvarchar(20),
phone varchar(11)
);
insert into studentff
values
(N'张三','13864668825'),
(N'李四',null), --手机号为空
(N'王五',''),
(N'赵六','13964668858');
select *
from studentff
where phone is null;
select *
from studentff
where phone is not null;
select *
from studentff
where phone =''; --空字符串
——————————————————————————————————————————————————
空值判断禁止使用 =、<>
为空 → IS NULL
不为空 → IS NOT NULL
NULL 和 空字符串 '' 是两回事

浙公网安备 33010602011771号