-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlite.py
More file actions
28 lines (19 loc) · 908 Bytes
/
sqlite.py
File metadata and controls
28 lines (19 loc) · 908 Bytes
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
import sqlite3
connection = sqlite3.connect('student.db')
cursor = connection.cursor()
table_info = """
create Table STUDENT (NAME VARCHAR(25),CLASS VARCHAR(25),SECTION VARCHAR(25),MARKS INT)"""
cursor.execute(table_info)
## Insert some more records
cursor.execute('''Insert Into STUDENT values('Monish','Data Science','A+',90)''')
cursor.execute('''Insert Into STUDENT values('Krish','Data Science','A',90)''')
cursor.execute('''Insert Into STUDENT values('John','Data Science','B',100)''')
cursor.execute('''Insert Into STUDENT values('Mukesh','Data Science','A',86)''')
cursor.execute('''Insert Into STUDENT values('Jacob','DEVOPS','A',50)''')
cursor.execute('''Insert Into STUDENT values('Dipesh','DEVOPS','A',35)''')
print("the inserted recors are")
data = cursor.execute("""select * from STUDENT""")
for row in data:
print(row)
connection.commit()
connection.close()