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

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


Qualify the * with the name of the table:

select rownum, table.* from table


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.


Dave's answer did not work for me on Oracle 11g (table.* without alias). The following worked:

select rownum, t.* from table t