Subject | Re: [firebird-support] Re: The First to select |
---|---|
Author | Ann W. Harrison |
Post date | 2006-02-13T22:49:55Z |
I wrote: >
exists will stop when it finds the first null. Your syntax will
read the whole table, returning a series of 1's. Our "first" syntax
is unique to us. So, for that matter is rdb$database. However
many databases offer some table that is guaranteed to have exactly
one row.
Regards,
Ann
>>A slightly more conventional version would beI meant that it stops if any field is null.
>>
>>select 1
>> from rdb$database
>> where exists (select 1
>>from <table>
>>where <field> is NULL)
>>
>>
>>Either is exactly a full table scan if the field is never null, but
>>less than that if the field can be null.
>Rdb$database is a table known to have exactly one row. The where
> In what way is [that] > any better than just
>
> select 1 from <table> where <field> is NULL
>
exists will stop when it finds the first null. Your syntax will
read the whole table, returning a series of 1's. Our "first" syntax
is unique to us. So, for that matter is rdb$database. However
many databases offer some table that is guaranteed to have exactly
one row.
Regards,
Ann