【Download and installation】
Download address: https://www.sqlite.org/download.html
Take the 64-bit Windows environment as an example, download:
sqlite-dll-win64-x64-xxx.zip file, get sqlite3.def and sqlite3.dll after decompression
sqlite-tools-win32-x86-xxx.zip file, get sqlite3.exe after decompression
Just put them in the same directory.
【Create/connect to database】
sqlite3.exe is the client, directly execute sqlite3.exe + database file name, you can create/connect a database, and enter the command line mode.
For example: sqlite3.exe D:\doc\db\test.db
【Management operation】
View all tables: .table [table_name]
View the structure of a table: .schema [table_name]
【Common data types】
SQLite columns can store any type of data, so be careful when checking the database. For example, a string can be found in an integer column.
INTEGER integer
VARCHAR string
BLOB binary object
DECIMAL(10,2) Number with 2 decimal places
DATE
DATETIME date and time
[Primary key self-increment]
The primary key column type uses INTEGER, and the primary key can grow automatically without specifying the value of the column when inserting records.
【Backup and restore】
.dump ?TABLE? Dumps the database in SQL text format. If TABLE tables are specified, only TABLE tables matching the LIKE pattern are dumped.
.import FILE TABLE imports data from a FILE file into the TABLE table.