Download sqlite.py from Vasu456/SQLGenius: direct link, hf CLI and curl.
- Browser
- Download file 945 Bytes
-
https://huggingface.co/spaces/Vasu456/SQLGenius/resolve/60bc3f1cc256b112d759db5b06fdfcd0ab600828/sqlite.py
- Command line
-
hf download hf://spaces/Vasu456/SQLGenius@60bc3f1cc256b112d759db5b06fdfcd0ab600828/sqlite.py
-
curl -L -o sqlite.py https://huggingface.co/spaces/Vasu456/SQLGenius/resolve/60bc3f1cc256b112d759db5b06fdfcd0ab600828/sqlite.py
945 Bytes
| import sqlite3 | |
| ## Connectt to SQlite | |
| connection=sqlite3.connect("student_marks.db") | |
| # Create a cursor object to insert record,create table | |
| cursor=connection.cursor() | |
| ## create the table | |
| 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('Vasanthi','DSAI','A',90)''') | |
| cursor.execute('''Insert Into STUDENT values('Sameeksha','EE','B',100)''') | |
| cursor.execute('''Insert Into STUDENT values('Lasya','CSE','A',96)''') | |
| cursor.execute('''Insert Into STUDENT values('Kruthi','CSE','A',68)''') | |
| cursor.execute('''Insert Into STUDENT values('Haripriya','EE','A',75)''') | |
| ## Disspaly ALl the records | |
| print("The isnerted records are") | |
| data=cursor.execute('''Select * from STUDENT''') | |
| for row in data: | |
| print(row) | |
| ## Commit your changes int he databse | |
| connection.commit() | |
| connection.close() |