Sql query to get the number of rows in a table