What is the difference between the following two sql
statements
select count(*) from <tablename>
select count(col_name) from <tablename>

Answer Posted / sql2000

There seem to be a problem with the solutions provided by
the above.

Both the counts should provide the same result which is the
no of rows in the table.
count (*) will result in a bigger table scan than count
(col_name) hence its advisable to use count(1) while
calculating the count for a table.

Correct me if I am wrong...:)

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many replicas are maintained for each sql azure db?

106


how can you check the level of fragmentation on a table? : Sql server administration

548


How to enter comments in transact-sql statements?

561


Explain transaction server implicit?

530


What is BCP? When does it used in sql server 2012?

586






What do you understand by a view?

564


What is difference between inner join and full join?

562


What is the function of inner join?

567


What are character string data types in ms sql server?

646


How do I edit a stored procedure in sql server?

516


How to convert a unicode strings to non-unicode strings?

573


What is the maximum number of index per table?

572


If no size is defined while creating the database, what size will the database have?

556


Define left outer join in sql server joins?

570


How to get the definition of a view out of the sql server?

513