How to find the number of records in a table without using COUNT() function?

It is possible by using MAX value of ROW_NUMBER() in a table and from Rows column of sysindexes. ————————————————————————————— USE [ADVENTUREWORKS2012] GO ————————————————————————————— — Finding Row Count using Max function. -– Returns 19614 ————————————————————————————— SELECT MAX(Rnum) AS [Row_Count] FROM ( SELECT ROW_NUMBER()

Read More

What are SQL aggregate functions and explain few aggregate functions which you have used real time?

SQL Aggregate functions are the functions which perform calculations on the group of data and returns a single value. Except COUNT() function, all other aggregate functions ignore NULL values. When we are using aggregate functions in SELECT list, it is mandatory to

Read More

What is the difference between COUNT (*) and COUNT(Column Name)?

Count COUNT(*) – Returns the total number of records in a table (Including NULL valued records). COUNT(Column Name) – Returns the total number of Non-NULL records. It means that, it ignores counting NULL valued records in that particular column. Example: In the

Read More