SQLiteA database is a lightweight, self-contained DBMS,It is portable, easy to use, small, efficient, and reliable.
SQLite is embedded into applications that use it.ProgramThey share the same process space, rather than a separate process. From the external perspective, it is not like an RDBMS, but inside the process, it is complete, self-contained database engine.
One of the major advantages of an embedded database is that you do not need network configuration or management in your program.Because the client and server run in the same process space.
SQLite database permissions only depend on the file system, without the concept of user accounts. SQLite has database-level locking and no network server. It requires memory usage, but other expenses are very small. It is suitable for embedded devices. All you need to do is compile it correctly into your program.
Create a database using SQLite
SQLite is very convenient to use. You only need to enter the name of the SQLite database"Sqlite3"Command. If the file does not exist, a new (database) file is created. ThenSqlite3The program prompts you to enter SQL. The SQL statement is ended with a semicolon (;). After you press the Enter key, the SQL statement is executed. For example, create an SQLite database that contains the "user" table "TBL.
CREATE command:
Create Database User
Sqlite3 user
Create Table TBL
Create Table TBL (name char (10), age smallint, score float );
Query a table
. Table
Insert data
Insert into TBL values ('hangzhou', 24, 98 );
Insert into TBL values ('sunboys', 20, 78.5 );
Query data
Select * From TBL;
Modify Display Mode
. Mode Column
Procedure:
Its operations are not much different from common relational databases, so it is convenient to add, delete, modify, and query data.
SQLite can display the query results in eight ways, which greatly facilitates data processing. The sqlite3 program can display the query results in eight different formats:
. Mode mode? Table? Set output mode where mode is one of:
CSV comma-separated values
Column left-aligned columns. (See. width)
HTML
Code insert SQL insert statements for table line one value per line list values delimited. separator string tabs tab-separated values
TCL list elements
Usage:. Mode column (switch the output format to row mode, for example)
Sqlite3 Import and Export Database
Export Database
SQLite>. Databases(Display database)
SQLite>. Backup main. User. SQL(Backup database main)
SQLite>. Backup. user2. SQL(Backup default database main)
Export table
SQLite>. Output user_tbl. SQL
SQLite>. Dump TBL
Procedure:
Import Database
Yanggang @ doodlemobile :~ $Sqlite3 user2. SQL
Recommendation reference:
Official SQLite website
SQLite Data Type
Sqlite3 Embedded Database
Http://blog.csdn.net/xing_hao/article/details/6660589