ROWNUM

Purpose

ROWNUM is a pseudo column that is assigned an incremental unique integer value for records of a table or subselects, beginning with 1.

Usage Notes

Exasol implements ROWNUM adhering to the overall SQL semantics.

  • ROWNUM cannot be combined with other conditions in the WHERE clause. Anything you put into the WHERE clause of a statement filters input data. To avoid confusion and seemingly wrong results, we only allow ROWNUM in situations where the result is in line with Oracle's semantic.
  • ROWNUM cannot be used in combination with the PRIMARY KEY, UNIQUE, and FOREIGN KEY statements.

Example

SELECT SALES_ID, ROWNUM 
FROM SALES 
WHERE ROWNUM <10;
SALES_ID ROWNUM
389577429 1
321740964 2
389577438 3
253762032 4
321740973 5
389577447 6
458941123 7
389577513 8
389577522 9