SELECT *, COUNT(*) in SQLite

SELECT *, COUNT(*) FROM my_table is not what you want, and it's not really valid SQL, you have to group by all the columns that's not an aggregate.

You'd want something like

SELECT somecolumn,someothercolumn, COUNT(*) 
   FROM my_table 
GROUP BY somecolumn,someothercolumn

count(*) is an aggregate function. Aggregate functions need to be grouped for a meaningful results. You can read: count columns group by


If you want to count the number of records in your table, simply run:

    SELECT COUNT(*) FROM your_table;

Tags:

Sql

Sqlite