Concat
Add the text in register P1 onto the end of the text in register P2 and store the result in register P3.
An example
6 of the 178 statements we compiled against the sample database use Concat. This is the one with the shortest program; the rows that use Concat are highlighted.
SELECT name || ' (' || country || ')' FROM artists| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 11 | 0 | 0 | |
| 1 | OpenRead | 0 | 2 | 0 | 3 | 0 |
| 2 | Rewind | 0 | 10 | 0 | 0 | |
| 3 | Column | 0 | 1 | 4 | 0 | |
| 4 | Concat | 5 | 4 | 3 | 0 | |
| 5 | Column | 0 | 2 | 4 | 0 | |
| 6 | Concat | 4 | 3 | 2 | 0 | |
| 7 | Concat | 6 | 2 | 1 | 0 | |
| 8 | ResultRow | 1 | 1 | 0 | 0 | |
| 9 | Next | 0 | 3 | 0 | 1 | |
| 10 | Halt | 0 | 0 | 0 | 0 | |
| 11 | Transaction | 0 | 0 | 1 | 0 | 1 |
| 12 | String8 | 0 | 5 | 0 | ( | 0 |
| 13 | String8 | 0 | 6 | 0 | ) | 0 |
| 14 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Column, Goto, Halt, Init, Next, OpenRead, ResultRow, Rewind, String8, Transaction.
What the SQLite documentation says
Add the text in register P1 onto the end of the text in register P2 and store the result in register P3. If either the P1 or P2 text are NULL then store NULL in P3.
P3 = P2 || P1
It is illegal for P1 and P3 to be the same register. Sometimes, if P3 is the same register as P2, the implementation is able to avoid a memcpy().
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.