Aggregates & GROUP BY · Question 1 · Easy

Aggregates & GROUP BY question 1

Table Sales:
sale_id | rep | region | amount
1 | Asif | North | 400
2 | Bina | South | 250
3 | Asif | North | NULL
4 | Chirag | South | 550
5 | Bina | West | 300
6 | Deepa | North | 600
7 | Chirag | South | 250

What does this query return?

SELECT MIN(amount), MAX(amount)
FROM Sales;
  1. NULL, 600
  2. 0, 600
  3. 250, 600
  4. 250, 550
Answer and explanation

Answer: C. 250, 600

Explanation: MIN and MAX ignore NULL, so the missing amount in sale 3 is neither the smallest value nor treated as 0. The smallest real amount is 250 and the largest is 600.

Next: Table Sales: sale_id | rep | region | amount 1 | Asif | North | 400 2 | Bina |…

Practise aggregates & group by

Try a fresh set of aggregates & group by questions with an explanation after every answer, free and without signing up: Aggregates & GROUP BY practice. Or sit a full placement mock test.

More aggregates & group by questions

More sql practice

Subqueries & CTEs · Window Functions · NULL Handling · SQL Functions & CASE · UNION, INTERSECT & EXCEPT · Tables, Keys & Constraints · DML & Transactions · SELECT, WHERE & ORDER BY

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge