Home>Article>Database> mysql null和‘ ’

mysql null和‘ ’

黄舟
黄舟 Original
2017-01-16 13:07:18 1479browse

null
'' is an empty character, which is equivalent to having an account in the bank, but no money.
null is empty, which is equivalent to not having an account in the bank.

To compare null, you need to use is null or is not Null judgment

When null encounters an operator, it will always return null. =null or!=null, etc. will all return null, and the efficiency is not high, so when creating a table, there will usually be not null default '';

mysql> select goods_name from goods where goods_name is not null limit 3; +--------------------+ | goods_name | +--------------------+ | KD876 | | htcN85原装充电器 | | 诺基亚原装5800耳机 | +--------------------+

3 rows in set (0.00 sec)

mysql> select goods_name from goods where goods_name is null ; Empty set (0.00 sec)

null will return null when encountering the operator

mysql> select goods_name from goods where goods_name=null ; Empty set (0.00 sec)
mysql> select goods_name from goods where goods_name!=null ; Empty set (0.00 sec)

The above is mysql null and ' ' content, please pay attention to the PHP Chinese website (m.sbmmt.com) for more related content!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn