Atharva-28's picture
Upload 4 files
ee000bc verified
import sqlite3
## Connecting to sqlite
connection = sqlite3.connect("student.db")
# Cursor will be responsible to insert record, create table, retrive
cursor = connection.cursor()
##Creating Table
table_info="""
Create table STUDENT(NAME VARCHAR(25), CLASS VARCHAR(25), SECTION VARCHAR(25),MARKS INT);
"""
cursor.execute(table_info)
## Inserting some records
cursor.execute('''Insert Into STUDENT values('Atharva','AI/ML','A','95')''')
cursor.execute('''Insert Into STUDENT values('Ashutosh','SWE','B','80')''')
cursor.execute('''Insert Into STUDENT values('Samarth','Data Science','B','35')''')
cursor.execute('''Insert Into STUDENT values('Yash','Data Science','A','76')''')
cursor.execute('''Insert Into STUDENT values('Asnee','AI/ML','B','100')''')
cursor.execute('''Insert Into STUDENT values('Sam','AI/ML','A','98')''')
cursor.execute('''Insert Into STUDENT values('Emily','DEVOPS','A','50')''')
cursor.execute('''Insert Into STUDENT values('Manasi','DEVOPS','B','97')''')
## Display all records
data = cursor.execute('''select * From STUDENT''')
for row in data:
print(row)
## Closing the connection
connection.commit()
connection.close()