Hi. This is just a conceptual question.
In SQL, let's say you're checking multiple conditions in a WHERE statement.
Something like WHERE (Datefield > 12/1/10) AND (DollarAmount > $100.00) AND (REGION = 'NY')
Are every one of those conditions checked for each record? Or is there some sort of 'efficiency' for lack of a better term built into the system that doesn't bother to check the remaining conditions if a given condition is not met.
For example, let's say for a given record, the Datefield is NOT greater than 12/1/10, are DollarAmount and REGION still checked? Since all AND clauses are being used in my example, that means all conditions must be met. I'm trying to find out if all conditions for each record are checked regardless.
In old school programming (say COBOL), I would set up something like this:
If Datefield > 12/1/10 then
If DollarAmount > $100.00 then
If REGION = 'NY' then
In the IF THEN ELSE example, for efficiency, if the first condition is not met, I don't bother to check the others. Just wondering how it actually works behind the scenes in SQL so that I can possibly set up some queries to run quicker. Thanks.