[Rails] ActiveRecord: It's not only quoting

Stefan Arentz stefan.arentz at norad.org
Fri Dec 17 09:25:30 GMT 2004


On Dec 17, 2004, at 9:34 AM, Michael Koziarski wrote:

> On Fri, 17 Dec 2004 10:25:42 +0200, Jarkko Laine <jarkko at jlaine.net> 
> wrote:
>>
>> On 17.12.2004, at 10:06, <contact at maik-schmidt.de> wrote:
>>>
>>> Additionally, most of the "SELECT" statements will not work with NULL
>>> values. In DB2 it's not possible to run a statement like "SELECT * 
>>> FROM
>>> x WHERE y = NULL". It has to be "SELECT * FROM x WHERE y IS NULL".
>>
>> I think the latter is the SQL standard and works for sure in Oracle 
>> and
>> PostgreSQL.
>
> Yes,  is null is the standard, it works with mysql too.

Not only that, it is a different statement:

mysql> select count(*) from X where SignoffDate = null;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.03 sec)

mysql> select count(*) from X where SignoffDate is null;
+----------+
| count(*) |
+----------+
|      108 |
+----------+
1 row in set (0.00 sec)

As you can see the results are completely different.

  S.



More information about the Rails mailing list