是对的。
多看看MYSQL的帮助文档。
多看看MYSQL的帮助文档。
解决方案 »
- 求助:dom4j写好xml文件后输出的xml文件是正确的,但本地文件没有发生改变
- 问下大家,java能否建立驱动器?
- java 鼠标点击事件
- 跪求利用UDP实现可靠连接的java代码
- java 中文件操作问题?????????????
- jFresH_MaN在不?有个关于RowSet的问题
- 如果一个类的特定元素(如方法)为静态方法(static),那么方法调用其它方法时,其它的方法是不是一定要为静态访求(static)?
- 问一个很菜的问题,不要笑我...
- 大家帮我看看,我从一个数据库的表字段类型为text的字段中的数据读入到另一个表中的字段类型为text的字段,居然出现了乱码?
- 【 关于分布式WEB应用的6个问题? 请赐教!!! 】
- 异常啊!来看看啊!
- 怎么就是连不上!!
username字段不为null
当然是对的了
因为大多数的数据库中,对null的判断,都是特出的,用这种方式,而不能用=null的
在MySql中,可以用另一种与法代替:
SELECT COUNT(*) AS nums FROM online WHERE NOT (username <=> NULL)
The NULL value means "no data" and is different from values such as 0 for numeric types or the empty string for string types.The concept of the NULL value is a common source of confusion for newcomers to SQL, who
often think that NULL is the same thing as an empty string ''. This is not the case! For
example, the following statements are completely dierent:
mysql> INSERT INTO my_table (phone) VALUES (NULL);
mysql> INSERT INTO my_table (phone) VALUES ("");
Both statements insert a value into the phone column, but the rst inserts a NULL value
and the second inserts an empty string. The meaning of the rst can be regarded as \phone
number is not known" and the meaning of the second can be regarded as \she has no
phone".
In SQL, the NULL value is always false in comparison to any other value, even NULL. An
expression that contains NULL always produces a NULL value unless otherwise indicated in
the documentation for the operators and functions involved in the expression. All columns
in the following example return NULL:
mysql> SELECT NULL,1+NULL,CONCAT('Invisible',NULL);
If you want to search for column values that are NULL, you cannot use the =NULL test. The
following statement returns no rows, because expr = NULL is FALSE, for any expression: