what does count(1) do?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RaviRajhulk
    New Member
    • Feb 2008
    • 12

    what does count(1) do?

    If there is a code like
    SELECT count(1) from TABLE Where condition1=cond ition2;
    Is count(1) same as count(*)?
    Does count(1) counts the first column of the table?
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    COUNT(1) improves the query performance compared to COUNT(*). So in case if you have any primary key column then using that for the COUNT will improve the performance.

    Comment

    Working...