How do I select all the columns from a table, plus additional columns like ROWNUM?

前端 未结 3 1401
日久生厌
日久生厌 2020-11-28 06:19

In Oracle, it\'s possible to do a SELECT statement that returns the row number as a column in your result set.

For example,

SELECT rownu         


        
3条回答
  •  渐次进展
    2020-11-28 07:05

    Dave's answer is great, i'd just like to add that it's also possible to do that by placing the wildcard as the first column:

    select *,rownum from table
    

    Works, but the following won't:

    select rownum,* from table
    

    I've tested on MySQL.

提交回复
热议问题