[Rails] ActiveRecord: It's not only quoting
Shyam Gopale
sgopale at gmail.com
Fri Dec 17 09:49:53 GMT 2004
That is because the SQL standard says that two NULLs
are not equal. So if you did a comparison with NULL
you would not get a result. So 'is NULL' is the right way
to do it.
Shyam
On Fri, 17 Dec 2004 10:25:30 +0100, Stefan Arentz
<stefan.arentz at norad.org> wrote:
>
> 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.
>
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
"The best way to predict the future is to invent it"
-- Alan Kay
More information about the Rails
mailing list