SQLite:
The main features of lightweight database SQLite: 1. support events, no configuration, no installation, no administrator; 2. Support for most sql92;
3. A complete database is saved as a file on the disk. The same database file can be used on different machines. The maximum size of the database is 2 TB,
The support for characters and blob is only limited to available memory; 4. The entire system is less than 30 thousand lines of code, less than KB of memory (GCC ),
Most applications are faster than common Client/Server databases, with no other dependencies. 5. Open source code. Code 95% has good comments and easy-to-use APIs.
The official version is compiled with TCL.
SQLite is rapidly becoming popular and can be used on various platforms. python2.5 integrates the pysqlite database interface program described earlier,
As a version later than python2.5, The sqlite3 module is integrated. This is the first time that the python standard library has incorporated a database interface program into the standard library,
Maybe this marks a new beginning.
Next we will show you the most basic operations on the SQLite database in Python.
Import sqlite3 <br/> CNX = sqlite3.connect ('d:/database/SQLite. db') <br/> cur = CNX. cursor () <br/> cur.exe cute ('drop table users') <br/> cur.exe cute ('create table users (LOGIN varchar (8), uid integer )') <br/> cur.exe cute ('insert into users values ("John", 100) ') <br/> cur.exe cute ('insert into users values ("Jake", 1120) ') <br/> cur.exe cute ('insert into users values ("Wang", 1120)') <br/> cur.exe cute ('select * From users ') <br/> for eachuser in cur. fetchall (): <br/> Print eachuser
First, reference the sqlite3 module and use connect to create a data connection. Create a cursor through a connection, and then execute common SQL commands through the cursor
Running result:
Here only show the most basic Connection database, and execute SQL, more operations can see the official website http://www.sqlite.org/