计算Null记录不起作用

时间:2012-04-13 08:46:23

标签: sql tsql

create table scoda(product varchar(25),price int,sale varchar(23))
insert into scoda values('watch',10,6)
insert into scoda values('socks',8,'NULL')

SELECT COUNT(*) AS GK FROM scoda WHERE sale IS NULL

Expected output:1
Actual output:0

需要帮助才能继续我在sql初学者

2 个答案:

答案 0 :(得分:4)

USE

insert into scoda values('socks',8,NULL)

(不含引号)。

答案 1 :(得分:1)

问题在于插入语句:

insert into scoda values('socks',8,NULL)