![]() ![]() The table named book_details has been created successfully. ![]() We will set the data type of book_id as INT, book_name as TEXT, and is_available as BOOLEAN: CREATE TABLE book_details ( Let’s create a table named book_details that includes three columns: book_id, book_name, and is_available. Let’s consider different examples to understand the working of BOOLEAN data type in a better way.Įxample #1: How to Create a Column With BOOLEAN Data Type? ![]() The valid literal values for the BOOLEAN false include false, ‘f’, ‘false’, ‘n’, ‘no’, and ‘0’. The valid literal values for the BOOLEAN true include true, ‘t’, ‘true’, ‘y’, ‘yes’, and ‘1’. However, the constant values True and False work fine with or without single quotes. These values must be enclosed in single quotations. In PostgreSQL, there are some valid literal values for BOOLEAN true and false. How Does the BOOLEAN Data Type Work in PostgreSQL? This write-up will teach you how to use the BOOLEAN data type using some examples. Some popular use cases of BOOLEAN data type include “checking the availability of something”, “age restriction approval”, and so on. The BOOLEAN data type is used when you have to get some sort of approval, like YES or NO. In Postgres, the BOOLEAN data type is abbreviated as BOOL. It requires only 1 byte to store a value in a database, and it returns one of two probable values: True or False. PostgreSQL offers a BOOLEAN data type with three states: TRUE, FALSE, or NULL. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |