ORDER BY criterion
Lesson 4 of 13 in Coddy's SQL for advanced course.
One of the OVER () options are the ORDER BY
For example:
ROW_NUMBER() OVER (ORDER BY year DESC) as row_numThis will generate a column that will number the rows following the descending year order.
Challenge
EasyFetch all plants with a hue greater than 0.34 and add two numbering columns:
row_num_hue that will number the rows according to hue in ascending order
row_num_score that will number the rows by the following formula: (rough*hue) / hue in descending order
Order the result by the plant id in ascending order
Try it yourself
All lessons in SQL for advanced
4Summary
Final challenge #12Window Functions part 1
ROW_NUMBER functionORDER BY criterionPARTITION BY criterionLEAD & LAG functionsRecap challenge #1Recap challenge #23Window Functions part 2
RANK & DENSE_RANK functionsNTILE functionAggregation functionsROWS & RANGE criterion