Courseiva
Data for AIhardMultiple ChoiceObjective-mapped

AI Associate Data for AI Practice Question

Exhibit

SELECT AccountId, SUM(Amount) TotalAmount
FROM Opportunity
WHERE CloseDate > LAST_N_DAYS:365
GROUP BY AccountId
HAVING TotalAmount > 100000

Refer to the exhibit. A developer runs this SOQL query to prepare data for Einstein Lead Scoring. The query returns an error. What is the most likely issue?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The alias 'TotalAmount' is not allowed in the HAVING clause.

The HAVING clause references alias TotalAmount, but SOQL does not allow aliases in HAVING; the aggregated expression must be repeated.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The alias 'TotalAmount' is not allowed in the HAVING clause.

    Why this is correct

    In SOQL, HAVING must use the full aggregate expression, not an alias.

  • The query misses a GROUP BY clause.

    Why it's wrong here

    GROUP BY is present.

  • The SUM(Amount) cannot be used in the HAVING clause.

    Why it's wrong here

    Aggregates can be used in HAVING, but the alias is the problem.

  • The WHERE clause condition is invalid.

    Why it's wrong here

    WHERE syntax is correct.

About these practice questions

This AI Associate question is part of Courseiva's 753-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AI Associate practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AI Associate exam.