I am new to PostgreSQL. I have doubt while creating table in the database. Can anyone clarify me the difference between bit
and boolean
datatypes?
相关问题
- Django distinct is not working
- PostgreSQL: left outer join syntax
- Connecting Python to a Heroku PostgreSQL DB?
- PostgreSQL - Deleting data that are older than an
- Does PLV8 support making http calls to other serve
相关文章
- postgresql 关于使用between and 中是字符串的问题
- postgresql 月份差计算问题
- Using boolean expression in order by clause
- Table valued Parameter Equivalent in Postgresql
- in redshift postgresql can I skip columns with the
- Oracle equivalent of PostgreSQL INSERT…RETURNING *
- PostgreSQL field data type for IPv4 addresses
- Using prepared statement in stored function
A
bit
only stores the numbers0
and1
(ornull
).A
boolean
only storestrue
andfalse
(ornull
). A number (0, 1) is not a boolean. A boolean value can be used anywhere a boolean expression is expected. So you can e.g. do this:A bit column needs to be compared to something:
(the result of
a_bit_column = 0
is a boolean)Contrary to the what some DBMS think, the expression
where 0
orwhere 1
is not valid boolean expression.