Hard1 markMultiple Choice
Area I: Information SystemsData ManagementSQLAudit Analytics

CPA · Question 40 · Area I: Information Systems

Which of the following SQL statements would an auditor use to identify duplicate invoice numbers in the 'Sales' table?

Answer options:

A.

SELECT InvoiceNum FROM Sales WHERE InvoiceNum > 1

B.

SELECT DISTINCT InvoiceNum FROM Sales

C.

SELECT InvoiceNum, COUNT() FROM Sales GROUP BY InvoiceNum HAVING COUNT() > 1

D.

SELECT * FROM Sales ORDER BY InvoiceNum

How to approach this question

To find duplicates: Group By the field + Count > 1.

Full Answer

C.SELECT InvoiceNum, COUNT(*) FROM Sales GROUP BY InvoiceNum HAVING COUNT(*) > 1✓ Correct
C
The GROUP BY clause groups rows that have the same values. The HAVING clause filters these groups. COUNT(*) > 1 specifically identifies groups where the invoice number appears more than once.

Common mistakes

Using WHERE instead of HAVING with aggregate functions (COUNT).

Practice the full CPA ISC Practice Exam

82 questions · hints · full answers · grading

More questions from this exam