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';
- 27
- 45
- 72
- 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
- Table Innings: inn_id | batter | team | runs 1 | Kunal | Tigers | 45 2 | Kunal…
- Table Sales: sale_id | rep | region | amount 1 | Asif | North | 400 2 | Bina |…
- A table Sales(sale_id, rep, region, amount) is given. Which query returns the…
- Table Sales: sale_id | rep | region | amount 1 | Asif | North | 400 2 | Bina |…
- Table Tickets: ticket_id | agent | priority 1 | Sana | High 2 | NULL | Low 3 |…
- Table Attendance: student | subject | month_name | days Pooja | Maths | Jan |…
- Table Sales: sale_id | rep | region | amount 1 | Asif | North | 400 2 | Bina |…
- Table Innings: inn_id | batter | team | runs 1 | Kunal | Tigers | 45 2 | Kunal…
- A table Sales(sale_id, rep, region, amount) is given. Which query lists the…
- Table Sales: sale_id | rep | region | amount 1 | Asif | North | 400 2 | Bina |…
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