mysql 运算符 <=>,:=,@,@@的含义
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1、<=> 安全比较运算符,用来做 NULL 值的关系运算。 因为 mysql 的 NULL 值的特性,任何值和其比较的结果都是 NULL, 1 = NULL,1 <> NULL / 1 != NULL 得到的结果都是 NULL。 SELECT 1 = NULL, 1 <> NULL, 1 != NULL; +----------+-----------+-----------+ | 1 = NULL | 1 <> NULL | 1 != NULL | +----------+-----------+-----------+ | NULL | NULL | NULL | +----------+-----------+-----------+ 1 row in set (0.00 sec) 当然我们可以用 IS NULL 去判断,即 SELECT 1 IS NULL, 1 IS NOT NULL, NOT (1 IS NULL), !(1 IS NULL); +-----------+---------------+-----------------+--------------+ | 1 IS NULL | 1 IS NOT NULL | NOT (1 IS NULL) | !(1 IS NULL) | +-