Delete sqlite.py
Browse files
sqlite.py
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
import sqlite3
|
2 |
-
|
3 |
-
## connect to sqllite
|
4 |
-
connection=sqlite3.connect("STUDENT.db")
|
5 |
-
|
6 |
-
##create a cursor object to insert record,create table
|
7 |
-
cursor=connection.cursor()
|
8 |
-
|
9 |
-
## create the table
|
10 |
-
table_info="""
|
11 |
-
create table STUDENT(NAME VARCHAR(25),CLASS VARCHAR(25),
|
12 |
-
SECTION VARCHAR(25),MARKS INT)
|
13 |
-
"""
|
14 |
-
|
15 |
-
cursor.execute(table_info)
|
16 |
-
|
17 |
-
## Insert some more records
|
18 |
-
cursor.execute('''Insert Into STUDENT values('Jainam','Data Science','A',90)''')
|
19 |
-
cursor.execute('''Insert Into STUDENT values('Jackie','Data Science','B',100)''')
|
20 |
-
cursor.execute('''Insert Into STUDENT values('Gadot','Data Science','A',86)''')
|
21 |
-
cursor.execute('''Insert Into STUDENT values('Jacob','DEVOPS','A',50)''')
|
22 |
-
cursor.execute('''Insert Into STUDENT values('Dikshita','DEVOPS','A',35)''')
|
23 |
-
|
24 |
-
## Display all the records
|
25 |
-
print("The inserted records are")
|
26 |
-
data=cursor.execute('''Select * from STUDENT''')
|
27 |
-
for row in data:
|
28 |
-
print(row)
|
29 |
-
|
30 |
-
## Commit your changes in the database
|
31 |
-
connection.commit()
|
32 |
-
connection.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|