Difference Between Count() and Count(fieldName) in SOQL Query

The COUNT() method in SOQL (Salesforce Object Query Language) is used to count the number of records that meet specified criteria. It’s similar to the COUNT() function in SQL and is useful when you need to know the total number of records without retrieving all of them.

In SOQL (Salesforce Object Query Language), the COUNT(fieldName) function is used to count the number of non-null (non-empty) values in a specific field across a set of records. This function differs from the COUNT() function, which simply counts the total number of records.

Read More