Translation

The oldest posts, are written in Italian. If you are interested and you want read the post in English, please use Google Translator. You can find it on the right side. If the translation is wrong, please email me: I'll try to translate for you.

lunedì, luglio 19, 2021

Analytic Functions preserve the "PARTITION BY" clause (Part 3)

<< Part02     Part04 >>

In order to understand why, I use the ROW_NUMBER analytic function

SELECT
    elaboration_day,
    row_number() over (partition by machine_id, location_type order by elaboration_day) rn,
    location_type,
    commercial_id,
    warehouse_id
FROM
    awp_machine
    where elaboration_day >= to_date('01/01/2020', 'dd/mm/yyyy')
    order by elaboration_day;


How you can see, the ROW_NUMBER, preserve the PARTITIONING and numerate in ordered way the days inside the partition.

It could be strange, but it's the (right) way the analytic function works.

<< Part02     Part04 >>

 

Nessun commento: