Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 351 Bytes

expression-evaluation-rule.md

File metadata and controls

13 lines (9 loc) · 351 Bytes

Expression Evaluation Rules

When it is essential to force evaluation order, a CASE construct can be used. For example, this is an untrustworthy way of trying to avoid division by zero in a WHERE clause:

SELECT ... WHERE x > 0 AND y/x > 1.5;

But this is safe:

SELECT ... WHERE CASE WHEN x > 0 THEN y/x > 1.5 ELSE false END;