sql number of rows in table code example

Example 1: sql query to get the number of rows in a table

SELECT COUNT(*) FROM tablename

Example 2: sql row number

SELECT 
  ROW_NUMBER() OVER(PARTITION BY recovery_model_desc ORDER BY name ASC) 
    AS Row#,
  name, recovery_model_desc
FROM sys.databases WHERE database_id < 5;

Example 3: To count number of rows in SQL table

SELECT count(*)
FROM information_schema.columns
WHERE table_name = 'Your_table_nale';

Example 4: how to count number of rows in sql

SELECT COUNT(*)
FROM dbo.bigTransactionHistory;