File size: 711 Bytes
301bca1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 as sq

connection = sq.connect("student.db")
cursor = connection.cursor()

table_info="""
create table if not exists STUDENT(
    NAME VARCHAR(25), 
    CLASS VARCHAR(25),
    SECTION VARCHAR(25)
);
"""

cursor.execute(table_info)
cursor.executescript(
    """insert into STUDENT values('Paul','Data Science', 'A');
    insert into STUDENT values('Alex','Data Science', 'B');
    insert into STUDENT values('Joshua','Data Science', 'A');
    insert into STUDENT values('Derik','History', 'A');
    insert into STUDENT values('Jason','History', 'A');
    insert into STUDENT values('Maya','History', 'A');"""
)

data = cursor.execute(
    """select * from STUDENT"""
)
for i in data:
    print(i)