Writing queries task #13



I don't understand the task. Normal code will return 10 action movies.

select * from movies
where imdb_rating > 8
order by genre asc
limit 10;


Return 10 movies with an IMDb rating greater than 8 sorted by their genre.

The only columns we need are, name, genre and imdb_rating.

Give this a try...

SELECT name, genre, imdb_rating FROM movies
WHERE imdb_rating > 8
ORDER by 2


Can you please explain why you've used "ORDER BY 2"? And this code gives me the same result i.e. list of 10 action movies.


There will three columns in the report. Sort order will determined by the second column.