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
What are the types of subscriptions in SQL Server replication?
What is table valued function and scalar valued functions?
How to create new tables with "select ... Into" statements in ms sql server?
What happens if an integer is too big for int date type?
What are the types of stored procedures in an sql server?
Why use “pivot” in sql server?
What is surrogate key? : sql server analysis services, ssas
What Are the Main Features of SQL Azure?
What is the stuff and how does it differ from the replace function?
What are the different types of normalization?
What does it mean to invest in the index?
When multiple after triggers are attached to sql table, how to control the order of execution?
What are 3 ways to get a count of the number of records in a table?
Which are the two editions in which SQL Azure database available?
What is a primary key?