Boolean Type

Applies to: ✅ Data 360 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.

TrueFalse
truefalse
yesno
onoff
10
tf
yn

Data 360 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 360 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.

The table test1 is defined as:

ab
truesic est
falsenon est

Column a is a boolean value and column b is a text value.

Results:

ab
truesic est
falsenon est

Results:

ab
truesic est