Store very long text: BLOB or TEXT

大兔子大兔子 提交于 2019-12-02 00:24:06

In SQLite's database file format, TEXT and BLOB values are stored in exactly the same way. The only difference is that the bytes of a TEXT value are assumed to be valid UTF-8.

Answer: TEXT

BLOB is good only for binary files and generally storing any binary data (images, songs, etc) in a database is not a good idea and is to be done only as a last resort.

Here is list of data types in SQLite and which data type from SQL are their corresponding ones:

  • INTEGER – INT, INTEGER, TINYINT, SMALLINT, MEDIUMINT, BIGINT, UNSIGNED BIG INT, INT2, INT8
  • TEXT – CHARACTER(20), VARCHAR(255), VARYING CHARACTER(255),NCHAR(55), NATIVE CHARACTER(70), VARCHAR(100), TEXT, CLOB
  • BLOB (no datatype specified) – NONE
  • REAL – REAL, DOUBLE, DOUBLE PRECISION, FLOAT
  • NUMERIC – NUMERIC, DECIMAL(10,5), BOOLEAN, DATE, DATETIME

For a really good guide about SQLite refer to this guide.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!