'' と NULL

mysql> create table b (a varchar(10));
Query OK, 0 rows affected (0.05 sec)

mysql> insert into b values('');
Query OK, 1 row affected (0.08 sec)

mysql> select * from b where a = '' ;
+------+
| a    |
+------+
|      |
+------+
1 row in set (0.00 sec)

mysql> select * from b where a IS NULL ;
Empty set (0.00 sec)

HSQLDBでももちろん同じ扱いだ。

Oracleは違う。納得がいかない動きだな。

SQL> create table b (a varchar(10));

Table created.

SQL> insert into b values('');

1 row created.

SQL> select * from b where a = '' ;

no rows selected

SQL> select * from b where a IS NULL ;

A
----------