PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔䆹8. Data Types媆誕嬉誕

8.6. 婄儫䌂傋

PostgreSQL櫇毕 SQL 湺庖䔇 boolean 昄扞䌂傋㔗boolean 埻脘橬"true"(䩘)潡"false"(啺)婴婻䪽攕幋婔丸婬䓉"unknown"(橻䘖)䪽攕䫘 NULL 臘䴺㔗

"䩘"唚䔇橬昽桺橸唚滇

TRUE
't'
'true'
'y'
'yes'
'1'
凹庯"啺"嘹埇傖嘪䫘婋麵認底
FALSE
'f'
'false'
'n'
'no'
'0'
嘪䫘 TRUEFALSE 認湙䔇庖䩚懫膄喘(幘滇 SQL 噚垹䔇䫘濘)㔗

冋8-2. 嘪䫘 boolean 䌂傋

CREATE TABLE test1 (a boolean, b text);
INSERT INTO test1 VALUES (TRUE, 'sic est');
INSERT INTO test1 VALUES (FALSE, 'non est');
SELECT * FROM test1;
 a |    b
---+---------
 t | sic est
 f | non est

SELECT * FROM test1 WHERE a;
 a |    b
---+---------
 t | sic est

冋8-2 滆䴺庖嘪䫘庖應 tf 膷庺 boolean 昄唚䔇冋床㔗

boolean 嘪䫘 1 庖誗庻嗘䷺閘㔗


劯锔饡釕嬉誕
斖橘/施閘䌂傋婪婔亓庹嘘䌂傋