﻿ SQL exercises on movie Database: Identify those reviewers who have not given a rating to certain films - w3resource

# SQL exercises on movie Database: Find the names of all reviewers who have ratings with a NULL value

## SQL movie Database: Subquery Exercise-8 with Solution

8. From the following table, write a SQL query to find those reviewers who have not given a rating to certain films. Return reviewer name.

Sample table: reviewer

Sample table: rating

Sample Solution:

``````SELECT DISTINCT rev_name
FROM reviewer
WHERE rev_id IN (
SELECT rev_id
FROM rating
WHERE rev_stars IS NULL);
``````

Sample Output:

```            rev_name
--------------------------------
Neal Wruck
Scott LeBrun
(2 rows)
```

Code Explanation:

The said query in SQL which selects distinct reviewer names from the 'reviewer' table where the corresponding reviewer IDs have at least one review with a null rating in the 'Rating' table. The results are ordered by reviewer name in ascending order.
The query uses a subquery to find the reviewer IDs with null ratings, and then selects the distinct reviewer names corresponding to those IDs. The "DISTINCT" keyword ensures that only unique reviewer names are returned.

## Query Visualization:

Duration:

Rows:

Cost:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

﻿

## SQL: Tips of the Day

What is the best way to paginate results in SQL Server?

```SELECT  *
FROM    ( SELECT    ROW_NUMBER() OVER ( ORDER BY OrderDate ) AS RowNum, *
FROM      Orders
WHERE     OrderDate >= '1980-01-01'
) AS RowConstrainedResult
WHERE   RowNum >= 1
AND RowNum < 20
ORDER BY RowNum
```

Database: SQL Server

Ref: https://bit.ly/3MGrNlk

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook