thecaligarmo
05-29-2009, 06:04 PM
So I was wondering if MySQL/SQL followed the following principle as other languages:
Say you have a small if statement in PHP:
if($true && $true_too){
execute();
}
In this instance if $true is false, then $true_too is not evaluated and the code moves on.
I was wondering if the same thing happened in MySQL. I.E. Say we have the following mini query:
SELECT * FROM people WHERE person='M' AND height<66;
As MySQL is processing each row, does it always do all WHERE requirements or does it only do one at a time? (so if person!='M' then it moves on to the next row automatically without checking if height<66... or would it check height<66 anyway?)
(I'm also assuming this is going to be the same for all SQL, but it could not... I'm using MyISAM if that helps too)
Thanks!
Say you have a small if statement in PHP:
if($true && $true_too){
execute();
}
In this instance if $true is false, then $true_too is not evaluated and the code moves on.
I was wondering if the same thing happened in MySQL. I.E. Say we have the following mini query:
SELECT * FROM people WHERE person='M' AND height<66;
As MySQL is processing each row, does it always do all WHERE requirements or does it only do one at a time? (so if person!='M' then it moves on to the next row automatically without checking if height<66... or would it check height<66 anyway?)
(I'm also assuming this is going to be the same for all SQL, but it could not... I'm using MyISAM if that helps too)
Thanks!