File size: 637 Bytes
b4b8960
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import sqlite3

connection=sqlite3.connect('student.db')
cursor=connection.cursor()
table_info="""



CREATE TABLE student(name TEXT,roll TEXT,section TEXT,marks INT)



"""

cursor.execute(table_info)

cursor.execute("INSERT INTO student VALUES('Rahul','10','A',90)")
cursor.execute("INSERT INTO student VALUES('MOHIT','19','B',80)")
cursor.execute("INSERT INTO student VALUES('RAJ','13','C',70)")
cursor.execute("INSERT INTO student VALUES('POHIT','18','D',60)")

print("Data inserted successfully")

data=cursor.execute("SELECT * FROM student")

for i in data:
    print(i)

connection.commit()
connection.close()