What is a canonical expression for the following:
NULL -> false
false -> false
true -> true
What I am using is:
select (foo is not null and foo)
which seems to work fine, but I'm wondering if there is a standard convention for this.
select coalesce(foo, false) from table
I just looked it up. COALESCE()
is ansi SQL. So SELECT (foo, false)
would give foo or false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With