Re: MySQL syntax error - don't get it!
Hello,
Henrique's right, RANK became a reserved keyword starting in MySQL 8.0, part of the window function additions (RANK(), ROW_NUMBER(), DENSE_RANK()), so the parser reads rank as that keyword instead of your column name. Wrapping it in backticks fixes it since that tells MySQL to treat it as an identifier.
One thing worth keeping in mind: you'll need those backticks everywhere you reference that column, not just in ORDER BY, so any WHERE clause, SELECT list, or JOIN condition using rank will need the same treatment.
If it's easy to do, renaming the column to something like rank_order avoids this coming back to bite you every time you write a new query against the table.
Herrick
DevOps Engineer @accuweb.cloud
Subject
Written By
Posted
Re: MySQL syntax error - don't get it!
September 10, 2026 02:58PM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.