Here is my example
My data (table_1)
col_1
foo
foo
bar
bar
My queries:
select col_1, rank() over(order by col_1) as rank from table_1;
returns:
col_1 rank
foo 1
foo 1
bar 3
bar 3
and this query returns
select col_1, rank() over(order by col_1) as rank from table_1 group by col_1
col_1 rank
foo 1
bar 2
So if I understand correctly rank
is executed only after group by
clause and order
next to rank
is also only executed after group by
clause.
Update
In case SQLFiddle does not run, here is query I used to create table:
CREATE TABLE table_1
(
col_1 varchar(30)
);
INSERT INTO table_1
(col_1)
VALUES
('foo'),
('foo'),
('bar'),
('bar')
;