PostgreSQL - How to use the Boolean Data Type. Did you know there are 5 Ways to say TRUE or FALSE?

preview_player
Показать описание
How to use the Boolean Data type.
How to perform insert statement using all 5 values for true.
How to perform insert statement using all 5 values for false.
How to perform SQL statement, where clause explained.

Table of Contents
00:00 - begin
00:10 Create table with bool or boolean data type
00:01 - True ('true', '1', 'yes', 'y', 't')
02:58 - False ('false', '0', 'no', 'n', 'f')
03:56 - how to use the where clause using a boolean expression
05:02 - End message

I'm not sure if this video is for you, but would you happen to know someone who is interested in learning more about PostgreSQL? Please send them a link to this video if you'd like to help me.

Thanks.

#softwarenuggets, #postgresql
Рекомендации по теме
Комментарии
Автор

Source code for Video -

--The Boolean Data Type

create table bool_test
(
letter varchar(10),
is_used bool
--is_us2 boolean
)

insert into bool_test(letter, is_used)
values
('t1', 'true'),
('t2', '1'),
('t3', 'yes'),
('t4', 't'),
('t5', 'y')

insert into bool_test(letter, is_used)
values
('f1', 'false'),
('f2', '0'),
('f3', 'no'),
('f4', 'f'),
('f5', 'n')


select *
from bool_test
where is_used='yes'

SoftwareNuggets
Автор

nice video and the audio was good too. Thanks

abdirahmann
Автор

when creating a table and defining your column data types, for example
CREATE TABLE test (
is_alive BOOLEAN NOT NULL DEFAULT 'true'
)
is that the correct way of defining a default value for a column? Thanks🙂

abdirahmann