Sql, Sql Queries, Big Data, Data Analytics, Data Science.
Function, dataset will be like below : ROW_NUMBER() OVER (PARTITION BY department_id) Here, each department is grouped into one partition, this is the beauty of PARTITION BY in analytical function. Please note, we have not added any ORDER BY here, so row_number is assigned within partition