文档说到很多东西 有SQLite的介绍 特点或者测试什么的 我这里挑一些重点的来说
创建一个SQLite数据库
好吧 其实是进入数据库的时候创建 sqlite3 demo.db 然后就会生成一个数据库了
(1) How do I create an AUTOINCREMENT field.(怎么产生一个自动增量的值 我的理解怎么产生一个主键key)
CREATE TABLE t1(
a INTEGER PRIMARY KEY,
b INTEGER
);
With this table, the statement
INSERT INTO t1 VALUES(NULL,123);
is logically equivalent to saying:
INSERT INTO t1 VALUES((SELECT max(a) FROM t1)+1,123);
(2) What datatypes does SQLite support?(有什么数据类型)
SQLite uses dynamic typing. Content can be stored as INTEGER, REAL, TEXT, BLOB, or as NULL.
其中integer不用说了是整型 real是浮点 text文本 blob数据块 null空
(9) What is the maximum size of a VARCHAR in SQLite?(卧槽 varchar的最大值)
SQLite does not enforce the length of a VARCHAR. You can declare a VARCHAR(10) and SQLite will be happy to store a 500-million character string there. And it will keep all 500-million characters intact. Your content is never truncated. SQLite understands the column type of "VARCHAR(N)" to be the same as "TEXT", regardless of the value of N.