which data type is best suited to store boolean value in postgresql 9.2 in compare of memory. please i am confusing that should i use bit or TINYINT or boolean to store boolean values. And which one is supported by ms sql server,oracle and postgresql databases. Please suggest me. Thanks
Asked
Active
Viewed 472 times
0
-
I usually use a `some_flag number(1) not null check (some_flag in (0,1))` in Oracle. If you want something portable you can do that in other DBMS as well (not in MySQL though - it still does not support check constraint – Apr 09 '14 at 11:56
-
Frankly I don't think anything other than "int2" / "smallint" will be portable. Way better off using DB-specific datatypes. – Craig Ringer Apr 09 '14 at 12:46
1 Answers
1
Postgresql supports the boolean
type: http://www.postgresql.org/docs/current/static/datatype-boolean.html
In MS SQL Server bit
type uses for storing boolean: http://msdn.microsoft.com/en-us/library/ms177603.aspx
Oracle doesn't support boolean
type, but it possible to store boolean values in CHAR(1)
as Y/N
or in NUMBER(1)
as 0/1
: Is there a boolean type in oracle databases?
-
1Hi MikkaRin, thanks for responding fast but oracle doesn't support for boolean type. – KRISHNA Apr 09 '14 at 11:50