Posts

Showing posts with the label SQLite

SQLITE DATABASE CONNECTIVITY IN PYTHON

Image
SQLite Database Connectivity : First you need to install SQLite browser. To install SQLite browser click here . As a example here I am using  Users for table name and Id , Name , Age , City for field names. The below program shows CRUD operation in SQLite using python. C - Create (INSERT) R - Read (SELECT) U - Update (UPDATE) D - Delete (DELETE) Program : # SQLITE DATABASE CONNECTIVITY import sqlite3 # connecting the database file to sqlite connection = sqlite3.connect( "Enter exact sqlite database file location" ) # function to INSERT data def insert_data (name , age , city): # INSERT query query = "INSERT INTO Users (Name, Age, City) VALUES (?, ?, ?)" # to execute the query connection.execute(query , (name , age , city)) # to save the executed query connection.commit() print ( "Data inserted successfully" ) # function to READ data def select_data (): # SELECT query query = "SELECT * FROM Users" result ...