AVG with NULL ratings

A table reviews stores product ratings in a NUMERIC column rating; a rating is NULL when the reviewer left a comment but no score.


review_id

product_id

rating

1

7

4.0

2

7

NULL

3

9

5.0

4

7

5.0

5

7

3.0

6

9

1.0

7

7

NULL

8

7

3.0


What value does SELECT AVG(rating) FROM reviews WHERE product_id = 7; return? Give your answer to two decimal places.

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: