What is Database ?
-A database is an organized collection of data.
-Database handlers create database in such a way that only one set of software program provide access of data to all the users.
-The main purpose of database is to operate large amount of information by storing, retrieving and managing.
Database in Python:
To maintain a database, python provide many modules and supports wide range of database servers :
What is sqlite3 ?
-sqlite3 is a python module written by Gerhard Haring for managing the database in the simplest way.
How install the sqlite3 ?
open command promt in your system and write the following command
pip install sqlite3
How use sqlite3 in your programming-
write above line to use the sqlite3 in your program.
Steps to deals with the database :
-Create or open a database and establish the connection.
-Create or open a tables
-Close the connection
Create a database :
print("Database is successfully created")
Database is successfully created
-In this program, we firstly import the sqlite2 module by import sqlite3
, then using connect()
function we connect or open the database.
-Here if the database of such name is not exist then connect() fucntion create a database with that name otherwise it open the old database.
-conn is database object that are used further to perform other task on the database.
function are used to close the database.