The following query results in 2,698 rows of data being retrieved, but the auditor_report table only has 1,620 rows. Analyse the query and select the reason why this discrepancy occurs.
Loading
The following query results in 2,698 rows of data being retrieved, but the auditor_report table only has 1,620 rows. Analyse the query and select the reason why this discrepancy occurs.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sandhiya PriyaPosted Oct 14, 2025, 6:26 AM
Question:
Answer:
The discrepancy occurs because the query uses a JOIN (most likely an
INNER JOINorLEFT JOIN) that matches multiple rows from another table for each record inauditor_report.When a join condition is not unique — for example, if the joined table has duplicate matching keys — the result set will multiply rows.
Each matching combination between the two tables will create a new row in the output, leading to more rows than exist in the base table.
Example:
If:
auditor_reporthas 1,620 rows,auditor_detailshas multiple rows for eachreport_id,then the result may expand to 2,698 rows or more, depending on how many matches exist per report.
In short:
Tip:
To verify, you can run:
This will show which
report_ids cause duplicates in the join.