【Mysql报错】You have an error in your SQL syntax:rank

Mysql 5.7 rank报错

场景:
在mysql5.7版本执行rank函数时报错,报错如下:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select id,salary,rank() over(order by salary desc) from employee' at line 8

解决:
经查询Mysql5.7版本并没有支持该rank函数,但在8版本测试已经可以使用,说明mysql8以后的版本已经支持该rank函数。

你可能感兴趣的:(mysql报错)