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
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
SELECT COUNT(title)
instead of
SELECT title
in the query.