How to insert a boolean value to a table in postgresql?

Member

by deron , in category: MySQL , 8 days ago

How to insert a boolean value to a table in postgresql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by lindsey.homenick , 7 days ago

@deron 

To insert a boolean value into a table in PostgreSQL, you can use the following syntax:

1
INSERT INTO table_name (boolean_column) VALUES (true); 


In this syntax:

  • Replace table_name with the name of your table.
  • Replace boolean_column with the name of the column in your table that has a boolean data type.
  • Use true for inserting a true boolean value, and false for inserting a false boolean value.


For example, if you have a table named "users" with a column named "active" that has a boolean data type, you can insert a true boolean value like this:

1
INSERT INTO users (active) VALUES (true);


This will insert a row into the "users" table with the "active" column set to true.