9

Sounds like a basic question but I couldn't seem to find it. Is there a way to define in SQLite a column which will be a single bit?

user1908466
  • 503
  • 1
  • 8
  • 17

2 Answers2

15

No.

SQLite does not have a separate Boolean storage class. Instead, Boolean values are stored as integers 0 (false) and 1 (true).

Source

Community
  • 1
  • 1
juergen d
  • 201,996
  • 37
  • 293
  • 362
  • I guess it is because, internally sqlite takes only required amount of memory and it is optimized in that way, So, an Integer field holding value 0 or 1 will only take 1 byte. – Akoder Aug 09 '17 at 06:36
  • They could save space by joining the result of 8 rows boolean values and saving them as a byte... but looks like nobody cared – Alphas Supremum Jan 01 '20 at 22:12
0

AS at 2021-01-20, I should say YES, you can define bit datatype in SQLite and it's working.

Roland
  • 11
  • Your answer is incorrect, sqlite contains boolean, but boolean is not true/false, it is any boolean number. OP is asking for a single bit. – Ruli Jan 20 '21 at 07:47