Aggregates & GROUP BY · Question 7 · Easy

Aggregates & GROUP BY question 7

Table Innings:
inn_id | batter | team | runs
1 | Kunal | Tigers | 45
2 | Kunal | Tigers | 0
3 | Lalit | Tigers | 72
4 | Mohan | Lions | 30
5 | Mohan | Lions | NULL
6 | Naveen | Lions | 58
7 | Naveen | Lions | 62

What does this query return?

SELECT MAX(runs) - MIN(runs)
FROM Innings
WHERE team = 'Tigers';
  1. 27
  2. 45
  3. 72
  4. NULL
Answer and explanation

Answer: C. 72

Explanation: WHERE keeps the three Tigers innings: 45, 0 and 72. A score of 0 is a real value (unlike NULL), so MIN is 0 and the answer is 72 - 0 = 72.

Previous: A table Sales(sale_id, rep, region, amount) is given. Which query returns the… · 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