How can I add a Rownum id to a set of data, I want this id to be unique and when I make a new insert this Rownum will increase. SQL, PL/SQL
For example I have this data:
Name Age
Anne 26
Mary 45
I want to add a Rownum id that starts from 1 and increase for each row. The result expected is
Id Name Age
1 Anne 26
2 Mary 45
When I insert a new row the id will be 3
Id Name Age
1 Anne 26
2 Mary 45
3 Jhon 41
I think I need to do the maximum of Rownum for that but I can't find the perfect SQL/ PL/SQL code.
SELECT NVL(MAX(ID),0) FROM TABLE;