I am fairly new to SQLITE and I noticed that there are only a 4 datatypes but I see examples online where people are putting in their own datatypes. I don’t really understand this and was wondering if someone could explain that to me. For example I see a column that will hold a date and the datatype that was given was timestamp which does not exist. What does it default to? Does it default to a text when you make your own?
Share
sqlite3uses a dynamic type system. There are only five storage classes:NULL, integer, real, text and blob. (Source: Datatypes In SQLite Version 3.)
And, to quote that page:
Apart from the
integer primary keyexception, SQLite doesn’t enforce types at all. Which means that the type name you put in yourcreate tableis purely informative.is a valid
create tablestatement. You can insert timestamps, text, blobs into both columns (not saying that you should, but you can).Look at the linked reference documentation for the type system for more information.
To answer your question directly: there is no default. A storage type is associated with each value stored in the database, not to columns of a table.