Boolean Type
Applies to: ✅ Data Cloud SQL ✅ Tableau Hyper API
The boolean
type can have three states: true, false, and unknown. The SQL NULL
value represents unknown. You can represent boolean constants in SQL queries with the SQL key words TRUE
, FALSE
, and NULL
.
A comparison or a similar function call can result in a boolean value. You can also use logical operators to combine boolean values.
To parse a boolean
from a string, use one of these strings.
True | False |
---|---|
true | false |
yes | no |
on | off |
1 | 0 |
t | f |
y | n |
Data Cloud SQL ignores leading or trailing whitespace and isn’t case-sensitive. To use the string representations, provide the generic string-literal constant syntax. For example, 'yes'::boolean.
Data Cloud SQL can’t automatically infer the type of NULL
literals. To prevent errors, explicitly cast NULL
to boolean
. For example, NULL::boolean
.
Converting a boolean
to a string always emits either true
or false
, as shown in this example. CREATE
and INSERT
are only supported in Tableau Hyper API.