Tracing WHERE and HAVING together

A table sales records individual sales in dollars:


sale_id

region

amount

1

North

120

2

North

80

3

North

150

4

South

90

5

South

200

6

East

110

7

East

130

8

East

60

9

West

300


The following query is run:


SQL
SELECT   region, COUNT(*) AS big_sales, SUM(amount) AS big_total
FROM     sales
WHERE    amount >= 100
GROUP BY region
HAVING   COUNT(*) >= 2;


How many rows does the query return, and what are the highest and lowest values of big_total among the returned rows? Give each answer as a whole number, with the totals in dollars.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Advanced Queries Questions: