Skip to content

BOOLEAN

CREATE TABLE employees (
id SERIAL PRIMARY KEY,
name VARCHAR (100),
is_manager BOOLEAN
);
INSERT INTO employees (name, is_manager)
VALUES ('John Doe', TRUE),
('Jane Doe', FALSE);
SELECT * FROM employees WHERE is_manager = TRUE;
id | name | is_manager
----+----------+------------
1 | John Doe | t

In the example provided, a table employees is created with a column is_manager of BOOLEAN type. Two rows are then inserted into the table, with ‘John Doe’ having a is_manager value of TRUE and ‘Jane Doe’ having an is_manager value of FALSE. The SELECT statement retrieves all employees for which the is_manager field is TRUE, thus the output includes the record for ‘John Doe’ only.