Are boolean expressions in SQL WHERE clauses short-circuit evaluated
?
For example:
SELECT *
FROM Table t
WHERE @key IS NULL OR (@key IS NOT NULL AND @key = t.Key)
If @key IS NULL evaluates to true, is @key IS NOT NULL AND @key = t.Key evaluated?
If No, why not?
If Yes, is it guaranteed? Is it part of ANSI SQL or is it database specific?
If database specific, SqlServer? Oracle? MySQL?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…