Writing queries task #13


#1


https://www.codecademy.com/en/courses/learn-sql/projects/learn_sql_query_table


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;


#2

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
LIMIT 10;

#3

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.


#4

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