In SQLite, String - varchar can anyone tell the exact difference between both of this?
SQLite uses dynamic typing; the name of the declared data type does not matter:
CREATE TABLE MyTable (
Col1 TEXT, -- this is stored as a text value
Col2 STRING, -- so is this
Col3 VARCHAR(1), -- and this
Col4 FLUFFY BUNNIES, -- and this
Col5, -- and this
Col6 INTEGER -- and this, if the actual value is not a number
);
The declared length is ignored, too (it's used only by the query planner to estimate the amount of I/O).
To enforce data types or lengths, you would need a separate CHECK constraint:.
CREATE TABLE MyTable (
Col7 TEXT NOT NULL CHECK(typeof(Col7) = 'text')
);