Hard1 markMultiple Choice
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?
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
Q01A CPA is performing a risk assessment for a client that uses a public cloud provider for its core...HardQ02During a walkthrough of a client's change management process, the auditor notes that developers h...HardQ03A service organization provides a real-time transaction processing platform. The service level ag...HardQ04An auditor is reviewing a SQL query used by the finance team to generate a report of all sales tr...HardQ05A healthcare clearinghouse is preparing for a SOC 2® engagement. They utilize a private cloud dep...Hard
Expert