Skip to main content

Querying for MySQLs

MySQL joins and aggregation combine data from several tables and summarise it. INNER JOIN and LEFT JOIN match rows by key, while GROUP BY with COUNT, SUM and AVG builds summaries, and HAVING filters the groups. This unit is in the Relating Data stage and uses the schemas created during design.

Stage: Relating Data · Part of the MySQL roadmap · Last reviewed 19 November 2026

What to learn in Querying

Querying interview questions

When do you use HAVING instead of WHERE in a MySQL query?

WHERE filters individual rows before grouping, so it cannot use aggregate functions. HAVING filters groups after GROUP BY and can use aggregates such as COUNT(*) > 5. Filtering early with WHERE is faster because fewer rows reach the grouping step.

What is the difference between INNER JOIN and LEFT JOIN?

INNER JOIN returns only rows that have a match in both tables. LEFT JOIN returns every row from the left table and fills the right-side columns with NULL when there is no match. Use LEFT JOIN to keep customers who have no orders.

Where Querying fits in the MySQL roadmap

Querying belongs to the Relating Data stage (beginner level). Joins and design.

Back to the full MySQL roadmap