Skip to content
Aabha AI Academy
Skip to reading

SQL · Module 1

Answers and explanations · Start with a question and a safe lab

Compare these references after your own attempt. You can read them at any time; they do not record a live model or vendor run.

Exercise 01a

Both counts are 14. This supports unique non-null order identifiers in the observed table. It does not prove that every real-world order was loaded or that the selected population is correct.

SELECT COUNT(*) AS rows,COUNT(DISTINCT order_id) AS distinct_orders FROM aabha_sql.orders;

Expected output:

rows distinct_orders
14 14

Runnable answer: sql/solutions/01a.sql

Exercise 01b

There are 19 lines for 14 orders because some baskets contain two product lines. A count at line grain is not an order count.

SELECT COUNT(*) AS order_lines FROM aabha_sql.order_items;

Expected output:

order_lines
19

Runnable answer: sql/solutions/01b.sql

Return to this module