一、Null的区别
create database scort use scort create table emp ( empno int primary key, ename nvarchar(10), sal int, comm int ) insert into emp(empno,ename,sal) values (7369,'smith',1800); insert into emp values (7499,'allen',1500,500); insert into emp values (7521,'ward',1600,300); insert into emp(empno,ename,sal) values (7566,'jones',2000); insert into emp values (7654,'martin',1800,600); insert into emp values (7698,'blake',1800,300); select * from emp --1、区别null可以参与 is 和 not is 运算,null不能参与 <> 和 != 和 = 运算。 select * from emp where comm is null --输出comm为空的信息 select * from emp where comm = null --输出comm为空的信息 --2、任何数字与null参与数学运算结果都是null select empno,ename,sal*12+comm "sal*12+comm" from emp