Any equivalent pseudo columns in TD like ROWNUM in Oracle

Analytics

Any equivalent pseudo columns in TD like ROWNUM in Oracle

Hi Guys,
Is there any pseducolumn concept in TD like ROWNUM in Oracle or, is there any way to get first 100 rows of a table ?
Suggestions appreciated.
Thanks,
3 REPLIES
Enthusiast

Re: Any equivalent pseudo columns in TD like ROWNUM in Oracle

The below query will return 100 rows in increasing order of col1.

select col1
, col2
.
.
, row_number() over (order by col1) as row_num
from tablename
qualify row_num <= 100
;

There are many additional functions like row_number() over (partition by col1 order by col2) etc.

Hope this helps.

Re: Any equivalent pseudo columns in TD like ROWNUM in Oracle

Thanks for reply. I guess that would help.
Enthusiast

Re: Any equivalent pseudo columns in TD like ROWNUM in Oracle

It is difficult to apply the concept of "the first N columns" to a parallel environment (like TeraData is), where data is uniformly distributed through the amps (in a normal situation).
In general, with Teradata you'd query a sample of data (using the "sample" SQL clause).

E.g.:
select * from table sample 100;


My two cents...