Answers for "table in sqlite python"

0

table in sqlite python

import sqlite3

# it will create a databse with name sqlite.db
connection= sqlite3.connect('sqlite.db')

cursor = connection.cursor()

# table name = Website 
# Table fields are 
# Post: Text type
# Autor: Text type
# Views: Real type

cursor.execute('''CREATE TABLE Website
               (Post text, Autor text, Views real)''')

# Save (commit) the changes
connection.commit()

# close connection
connection.close()
Posted by: Guest on April-22-2022

Python Answers by Framework

Browse Popular Code Answers by Language