|
import sqlite3 |
|
|
|
connection = sqlite3.connect("test.db") |
|
|
|
|
|
|
|
|
|
cursor = connection.cursor() |
|
|
|
|
|
|
|
table_info = """ |
|
Create table STUDENT(NAME VARCHAR(25),CLASS VARCHAR(25), |
|
SECTION VARCHAR(25) |
|
); |
|
""" |
|
cursor.execute(table_info) |
|
|
|
cursor.execute('''Insert Into STUDENT values('sushil','data science','A')''') |
|
cursor.execute('''Insert Into STUDENT values('ravi','data science','B')''') |
|
cursor.execute('''Insert Into STUDENT values('sumit','data science','A')''') |
|
cursor.execute('''Insert Into STUDENT values('rahul','devops','A')''') |
|
cursor.execute('''Insert Into STUDENT values('vikram','devops','A')''') |
|
|
|
print("the inserted records are") |
|
|
|
data = cursor.execute('''Select * from student''') |
|
for row in data: |
|
print(row) |
|
|
|
connection.commit() |
|
connection.close() |