Updated on 2026-07-02 GMT+08:00

Boolean Type

Table 1 Boolean type

Name

Description

Storage Space

Value

BOOLEAN

Boolean type

1 byte

  • true
  • false
  • null (unknown)

Valid literal values for the "true" state are:

TRUE, 't', 'true', 'y', 'yes', '1'

Valid literal values for the "false" state include:

FALSE, 'f', 'false', 'n', 'no', '0'

TRUE and FALSE are standard expressions, compatible with SQL statements.

Examples

Data type boolean is displayed with letters t and f.

  1. Create a table.

    1
    2
    3
    4
    5
    6
    DROP TABLE IF EXISTS bool_type_t1;
    CREATE TABLE bool_type_t1  
    (
        BT_COL1 BOOLEAN,
        BT_COL2 TEXT
    ) DISTRIBUTE BY HASH(BT_COL2);
    

  2. Insert data.

    1
    2
    INSERT INTO bool_type_t1 VALUES (TRUE, 'sic est');
    INSERT INTO bool_type_t1 VALUES (FALSE, 'non est');
    

  3. Query data.

    1
    SELECT * FROM bool_type_t1;
    

    1
    SELECT * FROM bool_type_t1 WHERE bt_col1 = 't';
    

  4. Drop the table.

    1
    DROP TABLE bool_type_t1;