Add 'stats' command

With SQLite3 powered filtering and ordering.