Answers for "insert data in sqlite database in python"

0

insert data in sqlite database in python

import sqlite3
# it will create a databse with name sqlite.db
connection= sqlite3.connect('sqlite.db') 
cursor= connection.cursor()
table_query = '''CREATE TABLE Student
               (Name text, Course text, Age real)'''
               
cursor.execute(table_query)
# you need to commit changes as well
connection.commit()
# you also need to close  the connection
connection.close()
Posted by: Guest on April-22-2022

Code answers related to "insert data in sqlite database in python"

Python Answers by Framework

Browse Popular Code Answers by Language