-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSql.py
More file actions
45 lines (23 loc) · 841 Bytes
/
Sql.py
File metadata and controls
45 lines (23 loc) · 841 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import sqlite3
# connect to sql
connection = sqlite3.connect("STUDENT.db")
#3 creation of curosr
cursor = connection.cursor()
# create Table
table_info="""
create table STUDENT (NAME VARCAHR(25), CLASS VARCHAR(25),
SECTION VARCHAR(25), MARKS INT);
"""
cursor.execute(table_info)
## Inster Some records
cursor.execute(''' Insert Into STUDENT values ('Gan','Data Science','A',90)''')
cursor.execute(''' Insert Into STUDENT values ('jan','Math','c',80)''')
cursor.execute(''' Insert Into STUDENT values ('Jack','Social','B',30)''')
cursor.execute(''' Insert Into STUDENT values ('Nada','Ai Ml','A',90)''')
cursor.execute(''' Insert Into STUDENT values ('Vish','Ml','A',60)''')
print("records are ")
data=cursor.execute(''' select * From STUDENT''')
for row in data:
print(row)
connection.commit()
connection.close()