Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Postgresql Boolean Data Type Examples

Boolean Type:

  • PostgreSQL provides the standard SQL type boolean; 
  • The boolean type can have several states: "true", "false", and a third state, "unknown", which is represented by the SQL null value.

Name
Storage Size
Description
boolean
1 byte
state of true or false

Valid literal values for the "true" state are:

TRUE
't'
'true'
'y'
'yes'
'on'
'1'
For the "false" state, the following values can be used:
FALSE
'f'
'false'
'n'
'no'
'off'
'0'



Leading or trailing whitespace is ignored, and case does not matter. The key words TRUE and FALSE are the preferred (SQL-compliant) usage.
Using the boolean Type:

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

Comments

Popular posts from this blog

Top 40 Highest Paying URL Shortener Companies - Best URL Shorteners To Earn Fast

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

PostgreSQL ALTER TABLE ... SET LOGGED / UNLOGGED

How To Configure pglogical | streaming replication for PostgreSQL