Development questions

Write a SOQL query to count the number of Contacts associated with each Account (SELECT AccountId, COUNT(Id) FROM Contact GROUP BY AccountId).

DevelopmentEasyTCSInfosysCognizant

Aggregate Contacts grouped by AccountId.

soql
SELECT AccountId, COUNT(Id) total FROM Contact
WHERE AccountId != null
GROUP BY AccountId

In Apex: (Id) ar.get('AccountId') and (Integer) ar.get('total').

soqlscenarioaggregategroup-by