I wanted to check my queries one by one as I am doing them, my 1.sql works fine but how I find out how many rows I am getting?

2 Answers 2


You can redirect the output to a file and then open that and go to the bottom.

$ cat 1.sql | sqlite3 movies.db > 1.txt

alternatively, if you only want the number of rows

$ cat 1.sql | sqlite3 movies.db | wc -l

The wc -l counts the lines, that would include the header, so you would have to subtract 1 to get the number of data rows.


You can also count the number of rows using


instead of

SELECT title

in the query.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .