File size: 816 Bytes
b334c60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
import sqlite3

connection = sqlite3.connect("test.db")
cursor = connection.cursor()
table_info = """

create table if not exists test(Name varchar(255), class varchar(255),

section varchar(255));

"""
cursor.execute(table_info)

insert = """insert into test(Name, class, section) values ('riswan', 'AIDS', 'B');"""
insert1 = """insert into test  (Name, class, section) values ('aslam', 'AIDS', 'A');"""
insert2 = """insert into  test (Name,class, section) values ('ajmal', 'ECE', 'A');"""
insert3 = """insert into test  (Name, class, section) values ('rayan', 'ECE', 'B');"""


cursor.execute(insert)
cursor.execute(insert1)
cursor.execute(insert2)
cursor.execute(insert3)

print("inserted")

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

for row in data:
    print(row)

connection.close()