I want to have a better solution than mine, for getting the first row of an SQLite database using Python.
import sqlite3
con = sqlite3.connect('emails.db')
cur = con.cursor()
cur.execute('SELECT * FROM my_table LIMIT 1')
print(cur.fetchall())
con.close()
outputs the correct row, but I think SELECT *
iterates through my entire table, which is inefficient. I tried COUNT(*) but couldn't succeed.