Tell me why the request works so strangely?
with a as ( select 1 as id, 'a' as type from dual union select 2 as id, 'a' as type from dual union select 3 as id, 'b' as type from dual union select 4 as id, 'b' as type from dual union select 5 as id, 'b' as type from dual ) select type, count(1) over (partition by type order by id) from a; Received:
a | 1 a | 2 b | 1 b | 2 b | 3 Expected:
a | 2 a | 2 b | 3 b | 3 b | 3 I thought that the number should be considered for the whole group, and not on the line. Why count line by line?

order bybecause if you print the same value (total), then there is no difference in what order to do it. Carefully read the item onorder byin theover()clause in the docs.oracle.com/cd/B19306_01/server.102/b14200/… documentation - Mike