Skip to content


For general command line help

Open/attach a database

sqlite3 database.db

Show tables



Select everything from a table and order by desc

SELECT * FROM tweetscapture ORDER BY Date DESC;
SELECT * FROM tweetscapture ORDER BY date DESC LIMIT 1;

Count entries in a table

SELECT Count(*) FROM tweetscapture;

Calculate length of string in a column

SELECT Text, length(Text) FROM tweetscapture;

Python loop to iterate row wise in a database

for row in c.execute('SELECT * FROM stocks ORDER BY price'):