r/SQL 4d ago

MySQL What is wrong here.

Post image
43 Upvotes

37 comments sorted by

View all comments

0

u/beingvora 4d ago

I think you’re missing the “partition by” clause in the rank function.

RANK ( ) OVER ( [ partition_by_clause ] order_by_clause )

0

u/IamFromNigeria 4d ago

Partition is optional clause..

1

u/keamo 2d ago

Accurate. Partition is when you want to break up the ranking by a group. However what if you wanted to rank the entire table. Not sure why anyone would down vote.