Rowid
Store in register P2 an integer which is the key of the table entry that P1 is currently point to.
An example
59 of the 178 statements we compiled against the sample database use Rowid. This is the one with the shortest program; the rows that use Rowid are highlighted.
SELECT * FROM artists
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 9 | 0 | 0 | |
| 1 | OpenRead | 0 | 2 | 0 | 3 | 0 |
| 2 | Rewind | 0 | 8 | 0 | 0 | |
| 3 | Rowid | 0 | 1 | 0 | 0 | |
| 4 | Column | 0 | 1 | 2 | 0 | |
| 5 | Column | 0 | 2 | 3 | 0 | |
| 6 | ResultRow | 1 | 3 | 0 | 0 | |
| 7 | Next | 0 | 3 | 0 | 1 | |
| 8 | Halt | 0 | 0 | 0 | 0 | |
| 9 | Transaction | 0 | 0 | 1 | 0 | 1 |
| 10 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Column, Goto, Halt, Init, Next, OpenRead, ResultRow, Rewind, Transaction.
What the SQLite documentation says
Store in register P2 an integer which is the key of the table entry that P1 is currently point to.
P1 can be either an ordinary table or a virtual table. There used to be a separate OP_VRowid opcode for use with virtual tables, but this one opcode now works for both table types.
From sqlite.org's list of opcodes for SQLite 3.54.1, in the public domain. Opcodes are not a stable interface and change between releases.