Search code examples
sqlitesqldatatypes

What if you don't specify the datatype of new column in SQLite?


What if you don't specify the datatype of new column

ALTER TABLE celebs 
ADD COLUMN twitter_handle TEXT;  #what if we don't specify it's datatype TEXT?

SELECT * FROM celebs; 

Solution

  • For sqlite, the type is not required. If no type is specified, the default type affinity will be BLOB. See official documentation for more detail including a table of examples.