Are there any functions in MySQL like dense_rank() and row_number() like Oracle?

前端 未结 6 1993
别那么骄傲
别那么骄傲 2020-12-06 02:40

Are there any functions in MySQL like dense_rank() and row_number() like those provided by Oracle and other DBMS?

I want to generate an id

6条回答
  •  再見小時候
    2020-12-06 03:22

    DENSE_RANK() function is available in MySQL version 8.0. So if you're using MySQL version 8.0 you can run this command,

    SELECT name, DENSE_RANK() OVER ( ORDER BY value ) my_rank FROM table_name;
    

提交回复
热议问题