官网https://www.sqlite.orghtml
SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. sql
SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite reads and writes directly to ordinary disk files. 数据库
所以,SQLite的安装很简单,最新的Linux和Mac上都自带sqlite3(早期版本能够下载源码make),windows上下载sqlite文件便可(绿色)。若是下载了Android SDK,在platform-tools目录中,你会找到sqlite3。windows
(Windows)cd到sqlite3目录,输入sqlite3后,便可执行SQLite命令——包括Create、drop等命令。app
Linux、Mac终端下,直接输入sqlite3,而后是命令。less
.help: 显示命令列表ide
.quit: 退出工具
.open 文件名:打开数据库 —— 还能够直接sqlite3 文件名打开数据库。ui
.tables: 列出全部的数据表spa
注:命令输入;以后才会执行。
https://www.sqlite.org/lang.html
数据类型: https://www.sqlite.org/datatype3.html
SQLiteSpy,SQLiteStudio,SQLiteExpert等
https://www.sqlite.org/autoinc.html
The AUTOINCREMENT keyword imposes extra CPU, memory, disk space, and disk I/O overhead and should be avoided if not strictly needed. It is usually not needed.
In SQLite, a column with type INTEGER PRIMARY KEY is an alias for the ROWID (except in WITHOUT ROWID tables) which is always a 64-bit signed integer.
On an INSERT, if the ROWID or INTEGER PRIMARY KEY column is not explicitly given a value, then it will be filled automatically with an unused integer, usually one more than the largest ROWID currently in use. This is true regardless of whether or not the AUTOINCREMENT keyword is used.
If the AUTOINCREMENT keyword appears after INTEGER PRIMARY KEY, that changes the automatic ROWID assignment algorithm to prevent the reuse of ROWIDs over the lifetime of the database. In other words, the purpose of AUTOINCREMENT is to prevent the reuse of ROWIDs from previously deleted rows.
建立without rowid的表:https://www.sqlite.org/withoutrowid.html
有三种创建自增加的字段:rawid,INTEGER PRIMARY KEY和INTEGER PRIMARY KEY AUTOINCREMENT。