HomeCode HereSummarising data quiz Summarising data quiz Admin 1 min read Updated November 16, 2026 Nine questions on DISTINCT, aggregates, GROUP BY and HAVING. SQL Summarising data quiz 9 questions, instant feedback Question 1 of 9 Which keyword removes duplicate rows from a result? A UNIQUE B DISTINCT C GROUP D ONLY SELECT DISTINCT compares the whole selected row and keeps one copy of each distinct combination. Question 2 of 9 What does COUNT(*) count? A Non-null values in one column B Rows, including those with NULLs C Distinct values D Tables COUNT(*) counts rows. COUNT(column) counts only rows where that column is not null, which is why the two can differ. Question 3 of 9 What does AVG ignore? A Zero values B NULL values C Text columns D The first row Aggregate functions skip NULLs. AVG divides the sum by the number of non-null values, not by the row count. Question 4 of 9 Which clause groups rows that share a value? A GROUP BY B ORDER BY C PARTITION D MERGE GROUP BY collapses rows with equal values in the listed columns into one row per group. Question 5 of 9 Which clause filters groups after aggregation? A WHERE B HAVING C LIMIT D DISTINCT HAVING applies to aggregated results, so it can test COUNT(*) or SUM(amount). WHERE cannot. Question 6 of 9 A query selects category and COUNT(*) with no GROUP BY. What happens in most engines? A It groups by category automatically B It returns one row with an arbitrary category C It raises an error or requires every selected column to be aggregated D It returns every row Without GROUP BY, mixing a plain column with an aggregate is invalid in standard SQL. SQLite allows it and picks an arbitrary value, which hides the mistake. Question 7 of 9 What does SUM return when every value is NULL? A 0 B NULL C An error D The row count SUM of no values is NULL, not zero. Wrap it in COALESCE(SUM(x), 0) when a report needs a number. Question 8 of 9 Which expression rounds an average to two decimals? A ROUND(AVG(price), 2) B AVG(ROUND(price, 2)) C CAST(AVG(price)) D TRUNC(AVG(price)) Round the finished average. Rounding each price first changes the value being averaged. Question 9 of 9 Where does HAVING belong in a query? A Before WHERE B After GROUP BY and before ORDER BY C After ORDER BY D Before SELECT The written order is SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT. HAVING follows the grouping it filters. Check my answers Try again Your answers stay in this browser. Nothing is sent to a server. More quizzes Joins and changes quiz 9 questions Design and safety quiz 9 questions SQL final quiz 10 questions All quizzes