As I was going through the documentation of SQLite DB I found two things that don’t digest to me:
-
I saw it got a data type
BLOB. So any one please explain what is the real use of this data type? -
Then I found out it got Date And Time Functions , But i was not able use this in a successful way. i didn’t grab it’s main purpose also SQLITE doesn’t got a datatype for date so how this will work with SQlite ??
So please somebody help to understand this.
BLOBs are designed to store binary data.
They behave much like strings, but can store any data, such as zero bytes, or byte sequences that would not be valid UTF-8 data.
You use BLOBs to store images, audio data, or just any kind of data that isn’t a valid string.
As explained on the data types page, SQLite indeed does not have a separate date/time data type, but instead stores date/time values as strings or numbers.
The data/time functions accept any string or number in such a format.
To store a date in a SQLite database, use some SQLite function that returns a date (such as
date('now')orcurrent_timestamp), or just construct a string in the correctyyyy-mm-dd...format (or a day or seconds number).Such values can then be used with these date/time functions.
If you don’t ever want to use SQLite’s built-in date/time functions, you also could use any other format to store dates/times.