Development questions

Write a SOQL query to get the sum, average, minimum, and maximum Opportunity Amount grouped by StageName.

DevelopmentEasyInfosysCapgeminiPwC

Group Opportunities by StageName and apply all four aggregate functions.

soql
SELECT StageName, SUM(Amount) total, AVG(Amount) average, MIN(Amount) smallest, MAX(Amount) largest
FROM Opportunity
GROUP BY StageName

Each row is an AggregateResult; read values with ar.get('total') and so on.

soqlscenarioaggregategroup-by