Team Ai
Apppublic

sibasispradhan/Text-To-SQL-Generative-AI

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
1likes
sqlite.py36 linesDownload Raw Back to root
1import sqlite32 3## connect to sqlite4connection=sqlite3.connect("student.db")5 6## create a cursor object to inset record,create table7 8cursor = connection.cursor()9 10## create the table11table_info="""12create table Student(13    Name varchar(50),14    Class varchar(25),15    Section varchar(25),16    Mark int17    );18"""19cursor.execute(table_info)20 21## insert some records22 23cursor.execute('''insert into Student values('Test1','DS','A',99)''')24cursor.execute('''insert into Student values('Test2','DS','B',95)''')25cursor.execute('''insert into Student values('Test3','DS','C',90)''')26cursor.execute('''insert into Student values('Test4','DO','A',80)''')27cursor.execute('''insert into Student values('Test5','DO','B',85)''')28 29## Display all the records30 31print("The inserted records are")32data = cursor.execute('''Select * from Student''')33for row in data:34    print(row)35connection.commit()36connection.close()