Courseiva
mediumMultiple ChoiceObjective-mapped

FC0-U71 GROUP BY Practice Question

Exhibit

Refer to the exhibit.

```
INSERT INTO Products (ProductID, ProductName, Price) VALUES (1, 'Widget', 10);
INSERT INTO Products (ProductID, ProductName, Price) VALUES (2, 'Gadget', 20);
INSERT INTO Products (ProductID, ProductName, Price) VALUES (3, 'Widget', 15);
SELECT ProductName, COUNT(*) FROM Products GROUP BY ProductName HAVING COUNT(*) > 1;
```

Refer to the exhibit. What is the output of the SELECT statement?

⚠ Common exam trap

The trap is that candidates may overlook the HAVING clause and assume GROUP BY alone determines the output. They might incorrectly include the Gadget group or think the query returns all categories regardless of count.

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

Widget, 2

The SELECT statement uses COUNT(*) with GROUP BY Category and a HAVING clause that filters out groups with a count less than 2. The table has two rows with 'Widget' and one row with 'Gadget'. After grouping, the Widget group has a count of 2, and the Gadget group has a count of 1. The HAVING clause excludes the Gadget group because its count is less than 2. Therefore, the query returns only one row: Widget with count 2. Option A correctly displays 'Widget, 2'. Option B displays 'Gadget, 2' which is incorrect because the Gadget group is filtered out. Options C and D include extra rows that are not in the result.

Answer analysis

Option-by-option breakdown

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

  • Widget, 2

    Why this is correct

    Correct: The HAVING clause retains only the Widget group with count 2.

  • Gadget, 2

    Why it's wrong here

    Incorrect: The Gadget group has count 1 and is excluded by the HAVING clause, so 'Gadget, 2' is not in the output.

  • Widget, 2; Gadget, 1

    Why it's wrong here

    Incorrect: This output includes the Gadget group, which is excluded by the HAVING clause because its count is less than 2.

  • Widget, 2; Gadget, 1; Widget, 1

    Why it's wrong here

    Incorrect: This output includes duplicate rows and the Gadget group, which does not meet the HAVING condition.

About these practice questions

Courseiva writes every FC0-U71 question from scratch — 988 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 FC0-U71 practice question is part of Courseiva's free CompTIA 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 FC0-U71 exam.