Non-Brand Data

Non-Brand Data

Module 12: Checking whether your result is right

Let's learn how to check a SQL result before we use it in a report or recommendation.

Cornellius Yudha Wijaya's avatar
Cornellius Yudha Wijaya
Oct 02, 2026
∙ Paid

Previous module: Module 11, Using window functions without changing the row count.

A SQL query could run without an error, but the result could still be wrong for the question we want to answer.

For example, a weekly report shows delivered revenue of 520.00, while a monthly report shows 700.00. Both queries are valid. The difference happens because the weekly query starts on 4 March and the monthly query starts on 1 March. Each query counts a different group of orders.

For me, checking the population is the first thing to do when two numbers don’t match. Don’t change the query until the numbers happen to agree. Instead, compare the filters, find the rows that only appear in one result, and check whether the join changes the row count.

We will use those steps to compare weekly and monthly revenue. After that, we will check duplicate payment IDs and unmatched records.


User's avatar

Continue reading this post for free, courtesy of Cornellius Yudha Wijaya.

Or purchase a paid subscription.
© 2026 Cornellius Yudha Wijaya · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture