﻿ SQL exercises on movie Database: Find all the years which produced at least one movie and that received a rating of more than 3 stars and the result should come in increasing order or year - w3resource

# SQL exercises on movie Database: Find all the years which produced at least one movie and that received a rating of more than 3 stars and the result should come in increasing order or year

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

6. Write a query in SQL to find all the years which produced at least one movie and that received a rating of more than 3 stars. Show the results in increasing order.

Sample table: movie

Sample table: rating

Sample Solution:

``````SELECT DISTINCT mov_year
FROM movie
WHERE mov_id IN (
SELECT mov_id
FROM rating
WHERE rev_stars>3)
ORDER BY mov_year;
``````

Sample Output:

``` mov_year
----------
1958
1961
1962
1977
1982
1986
1995
1997
1999
2001
2004
2008
2009
(13 rows)
```

## 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?

﻿

New Content: Composer: Dependency manager for PHP, R Programming