Querying for Data Analyticss
Querying is writing SQL SELECT statements to retrieve and shape data from relational tables. It covers choosing columns, filtering and sorting rows, combining tables with joins and set operations, and summarising with aggregates and GROUP BY. It is the analyst's main tool on the Data Analytics path, since most business data sits in databases.
Stage: SQL · Part of the Data Analytics roadmap · Last reviewed 19 November 2026
What to learn in Querying
- Write a SELECT with WHERE, ORDER BY and LIMIT to answer a narrow question
- Combine two tables with INNER and LEFT JOIN and explain missing rows
- Summarise data with COUNT, SUM and AVG grouped by one or more columns
- Use UNION and UNION ALL appropriately and state the difference
- Handle NULL values correctly in filters and aggregates
Querying interview questions
Why does a LEFT JOIN followed by a WHERE on the right table's column sometimes behave like an INNER JOIN?
Unmatched rows carry NULLs in the right table's columns, and a condition such as right.status = 'active' is not true for NULL, so those rows are removed. Moving the condition into the ON clause keeps the unmatched left rows.
What is the difference between COUNT(*) and COUNT(column)?
COUNT(*) counts every row in the group, while COUNT(column) counts only rows where that column is not NULL. COUNT(DISTINCT column) counts unique non-NULL values. The difference matters when measuring missing data or counting customers rather than orders.
Where Querying fits in the Data Analytics roadmap
Querying belongs to the SQL stage (beginner level), which takes about 8 hours. The analyst's main tool.
Other units in this stage
Back to the full Data Analytics roadmap