Here is a basic Python script to query a SQL database using the “sqlite3” library. Very useful for data mining.
import sqlite3
conn = sqlite3.connect('database.db')
cursor = conn.cursor()
query = "SELECT * FROM table_name"
result = cursor.execute(query).fetchall()
for row in result:
print(row)
conn.close()
Replace “database.db” with the name of your SQLite database file, and “table_name” with the name of the table you want to query. You can modify the SELECT statement to retrieve specific columns or filter the data as desired.