标签:set use weight col 比较 focus rom ble code
1 CREATE DATABASE mahaiwuji; 2 USE mahaiwuji; 3 4 CREATE TABLE emp 5 ( 6 empno INT PRIMARY KEY, 7 ename VARCHAR(10), 8 sal INT 9 ) ENGINE = INNODB DEFAULT CHARSET = utf8; 10 11 INSERT INTO emp VALUES (1,‘smith‘,2800); 12 INSERT INTO emp VALUES (2,‘allen‘,NULL); 13 INSERT INTO emp VALUES (3,‘ward‘,NULL); 14 INSERT INTO emp VALUES (4,‘jones‘,1300); 15 INSERT INTO emp VALUES (5,‘martin‘,NULL); 16 INSERT INTO emp VALUES (6,‘blake‘,3000);
比较一个数据是否是NULL
1 -- 查找sal为NULL的数据 2 SELECT * FROM emp WHERE sal <=> NULL; 3 -- 等价于 4 SELECT * FROM emp WHERE sal IS NULL;
比较一个数据是否不是NULL
1 -- 查找sal不为NULL的数据 2 SELECT * FROM emp WHERE sal IS NOT NULL;
17.MySQL中的IS NULL 和 IS NOT NULL
标签:set use weight col 比较 focus rom ble code
原文地址:https://www.cnblogs.com/mahaiwuji/p/12657776.html