I work on Presto SQL tables that don't have unique row identifiers. The only way to identify a specific record is to query all of its fields.
Is there in Presto some kind of hidden field, say ROW_PRIMARY_KEY, that would allow me to uniquely identify records in my tables?
To extend and simplify the answer by JNevill, if you just want a row number:
SELECT row_number() OVER () AS row_num
Note that OVER () may function the same as OVER (PARTITION BY 1), implying that all rows are assigned to the same partition. In this way, all rows will have unique row numbers.
Short of a primary key, you could just toss in a
ROW_NUMBER() OVER (PARTITION BY some, columns ORDER BY some_other_column) as rn
This will define a row number where some, columns would be a psuedo-primary key.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With