How to create tables in sqlite 3?
I just downloaded sqlite3.exe. It opens up as a command prompt. I created a table test & inserted a few entries in it. I used .backup test just in case. After I exit the program using .exit and reopened it I don't find the table listed under .tables nor can I run any query on it.
I need to quickly run an open source python program that makes use of this table & although I have worked with MySQL, I have no clue about sqlite. I need the minimal basics of sqlite. Can someone guide me through this or at least tell me how to permanently store my tables.
I have put this sqlite3.exe in Python folder assuming that python would then be able to read the sqlite files. Any ideas on this?
sqlite is built in to Python. You should be able to access your table like this:
import sqlite3 conn = sqlite3.connect('/path/to/my.db') curs = conn.cursor() curs.execute("SELECT a_column FROM my_table;").fetchone() curs.close() conn.close()
You can execute your DDL statements from Python as well. Make sure to commit the changes.
curs.execute("CREATE TABLE my_table (a_column text);") conn.commit()