Click here to Skip to main content
11,796,774 members (81,264 online)
Click here to Skip to main content

Tagged as

SQL COUNT(*) Vs COUNT(column_name)

, 11 May 2010 CPOL 2.8K 3
Well, another major point is that the two variants serve different purposes by definition. -- Count rows where 'column_name' is NOT NULLSELECT COUNT(column_name) FROM Table_Name-- Count ALL rows in Table_Name SELECT COUNT(*) FROM Table_Name-- ... which you just as well can...


Members may post updates or alternatives to this current article in order to show different approaches or add new features.

30 Apr 2010
Samrat Banerjee
1 alternative  
In many case we need to use COUNT function, but always we prefer COUNT(column_name) in placeof COUNT(*) and reason behind that COUNT(column_name) will perform better or faster than COUNT(*).Is this correct?SQL Server can't read just the contents of a single column without reading the...


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Dennis Ålund
Database Developer Oddbit
Indonesia Indonesia
Oddbit is an IT consultancy company that specialize in databases and software development with a focus on security. The company is located in Stockholm, Sweden and Jakarta, Indonesia.

| | Privacy | Terms of Use | Mobile
Web01 | 2.8.151002.1 | Last Updated 12 May 2010
Article Copyright 2010 by Dennis Ålund
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid