Bool 데이터 타입

Bool 데이터 타입

bool 타입은 내부적으로 UInt8로 저장되는 불리언 타입이에요. 가능한 값은 true(1)와 false(0)예요.

출처: 문서

본문

bool 타입은 내부적으로 UInt8로 저장돼요. 가능한 값은 true(1)와 false(0)이에요.

SELECT true AS col, toTypeName(col);
┌─col──┬─toTypeName(true)─┐
│ true │ Bool             │
└──────┴──────────────────┘

select true == 1 as col, toTypeName(col);
┌─col─┬─toTypeName(equals(true, 1))─┐
│   1 │ UInt8                       │
└─────┴─────────────────────────────┘
CREATE TABLE test_bool
(
    `A` Int64,
    `B` Bool
)
ENGINE = Memory;

INSERT INTO test_bool VALUES (1, true),(2,0);

SELECT * FROM test_bool;
┌─A─┬─B─────┐
│ 1 │ true  │
│ 2 │ false │
└───┴───────┘

더 알아보기 (Learn more)