Subject Re: [firebird-support] About conditions in SQL query.
Author Martijn Tonies
Hi,

> I have a question about the order in 'WHERE' statement
> in SQL queries. If I have:
>
> 1)
> select * from SOME_TABLE
> where (OBJECT_ID=100)
> and (ACTIVE=1)
>
> FB searchs first for OBJECT_ID matches and then for
> ACTIVE in the results?
>
> 2)
> select * from SOME_TABLE
> where (ACTIVE=1)
> and (OBJECT_ID=100)
>
> FB searchs first for ACTIVE matches and then for
> OBJECT_ID in the results?
> -----------------------
>
> or the order of conditions in WHERE does not matter to
> FB?

Indeed, it doesn't matter. Firebird will decide what to do
first, depending on conditions like "is there an index available
for a column".

Martijn Tonies
Database Workbench - development tool for InterBase and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com