What’s the difference between Conditionals and Predicates

terminology

I am having difficulties finding what the actual difference between "conditionals" and "predicates" are in the context of SQL and Relational Database Management Systems. Do they mean the same thing?

For example, is a WHERE clause a conditional statement or a predicate? Or both?

Best Answer

A predicate is something that has a boolean (true/false) value. A WHERE clause contains a predicate, simple or compound.

A conditional [statement or expression], such as if <predicate> then ... or case when <predicate> then ..., also necessarily contains a predicate. In its turn, a conditional expression itself can be a part of a predicate, as in this arguably contrived example:

...WHERE CASE WHEN DAYOFWEEK(NOW()) < 5 THEN 'weekday' ELSE 'weekend' END = some_column ...