Anand Kumar
Anand Kumar

Reputation: 165

Does PostgreSQL have any column which maintains uniqueness between table rows like as oracle has rowId and rowNum?

In oracle DB we can display rowid & rownum with table column, but in PostgreSQL does anything can we display along with table column?

Ex: select rowid, rownum,id_mytable from mytable;

Upvotes: 1

Views: 69

Answers (1)

Jan Michálek
Jan Michálek

Reputation: 56

You can use the ctid column:

SELECT ctid, * 
FROM some_table 
LIMIT 10;

There is window function row_number() over(), but it doesn't return row identifier, it is only numbers of rows in query results.

Upvotes: 3

Related Questions