Skip to main content

Bundling of related boolean values for an SQLite database or keeping them separate?

I'm writing a reminder application where reminders can be shown or not for each day of the week (similar to Google Calendar). So I'd like to store the following in my SQLite database:

  • Monday: True or False
  • Tuesday: True or False
  • etc. for all seven days of the week

I could simply store one True/False value for each weekday. SQLite doesn't have a boolean datatype, so I'd have to store it as integers in this case.

An alternative would be to store a single integer between 0 and 127 (000 0000 and 111 1111 in binary).

Normally I'd prefer the first solution since it's more direct, but, when there are so many boolean values, wouldn't it be better to bundle them together?

What should I consider when choosing between these approaches? Is there a better alternative?

sunyata
  • 477
  • 1
  • 5
  • 17