I have seen people talk about expressions and statements in T-SQL, but I don't understand the difference. Can the two be used interchangeably?
An expression can be evaluated, and as such returns a single value. It is only one possible part of a statement.
A statement is a collection of elements such as identifiers, reserved keywords, data types, functions, expressions, operators and comments, to make the smallest possible unit of code. A statement can be executed.
An expression returns a single value. A statement defines control of flow, data manipulation, or data definition operations. Column names, variables, constants, functions and formulas using any of the preceding are all expressions. Certain subqueries that return only a single value may also be considered expressions.
It's worth mentioning that one of the difficulties newcomers to SQL experience when working with a CASE expression is that they confuse it with an IF statement. The key to understanding which is which is the realization that CASE, unlike IF, does no flow control: it simply returns a single value. CASE (or ISNULL or COALESCE) is really more like a function with embedded IF logic.
No one has followed this question yet.