SQLite
SQLite is a simple relational database system,
which saves its data in regular data files or even in the internal memory of
the computer. It is designed to be embedded in applications, instead of using a
separate database server program such as MySQLor Oracle. SQLite is fast,
rigorously tested, and flexible, making it easier to work. Python has a native
library for SQLite. To use SQLite,
·
Connecting to a database in step2 means passing the name of the
database to be accessed. If the database already exists the connection will
open the same. Otherwise, Python will open a new database file with the
specified name.
·
Cursor in step 3: is a control structure used to traverse and fetch
the records of the database.
·
Cursor has a major role in working with Python. All the commands
will be executed using cursor object only.
To create a table in the database, create an
object and write the SQL command in it.
Example:- sql_comm = "SQL statement"
For executing the command use the cursor method
and pass the required sql command as a parameter. Many number of commands can
be stored in the sql_comm and can be executed one after other. Any changes made
in the values of the record should be saved by the commend "Commit"
before closing the "Table connection".
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.