zoukankan      html  css  js  c++  java
  • mysql <=> null 问题

    SELECT * FROM cms_user WHERE age=NULL;
    Empty set (0.03 sec)

    查询表中记录age值为null

    mysql> SELECT * FROM cms_user WHERE age<=>NULL;
    +----+----------+----------+-------------+------------+----------+-------+------+
    | id | username | password | email       | regTime    | face     | proId | age  |
    +----+----------+----------+-------------+------------+----------+-------+------+
    | 12 | test1    | test1    |sui@qq.com | 1419811708 | user.jpg |     1 | NULL |
    +----+----------+----------+-------------+------------+----------+-------+------+
    1 row in set (0.03 sec)

    查询表中的 null 值使用 <=>


    使用: is null 和 is not null
    ELECT * FROM cms_user WHERE age IS NULL;
    +----+----------+----------+-------------+------------+----------+-------+------+
    | id | username | password | email       | regTime    | face     | proId | age  |
    +----+----------+----------+-------------+------------+----------+-------+------+
    | 12 | test1    | test1    | user@qq.com | 1419811708 | user.jpg |     1 | NULL |
    +----+----------+----------+-------------+------------+----------+-------+------+
    1 row in set (0.00 sec)
    IS NOT NULL
    mysql> SELECT * FROM cms_user WHERE age IS NOT NULL;
     
  • 相关阅读:
    选校总结
    位运算
    剑指
    机器学习之梯度下降法
    leetcode1348 Tweet Counts Per Frequency
    UVA10308 Roads in the North 树的最长路径
    负数的处理POJ1179Polygon
    Roadblocks
    Bus Stop
    蒜头君的城堡之旅(动态规划)
  • 原文地址:https://www.cnblogs.com/boundless-sky/p/10792176.html
Copyright © 2011-2022 走看看