File size: 938 Bytes
0eaf528
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sqlite3
## COnnect to SQlite

connection=sqlite3.connect("student.db")

# Create a cursor object to insert record, create table
cursor=connection.cursor()

## create the table
table_info="""

Create table STUDENT(NAME VARCHAR(25),CLASS VARCHAR(25), SECTION VARCHAR(25));

"""
cursor.execute(table_info)
##Insert Some Records
cursor.execute("""Insert into STUDENT values('Ramu','Data Science','A')""")
cursor.execute("""Insert into STUDENT values('Alex','GenAI','B')""")
cursor.execute("""Insert into STUDENT values('Shaan','NASA','A')""")
cursor.execute("""Insert into STUDENT values('Tanvika','DevOps','A')""")
cursor.execute("""Insert into STUDENT values('Teja','NASA','B')""")
cursor.execute("""Insert into STUDENT values('Kishore','CIVIL','B')""")

## Display Records
connection.commit()
print("The Inserted records are")
data = cursor.execute('''select *from STUDENT''')
for row in data:
    print(row)