Multiply
Multiply the value in register P1 by the value in register P2 and store the result in register P3.
An example
8 of the 178 statements we compiled against the sample database use Multiply. This is the one with the shortest program; the rows that use Multiply are highlighted.
SELECT total FROM sales
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 12 | 0 | 0 | |
| 1 | OpenRead | 0 | 17 | 0 | 4 | 0 |
| 2 | Rewind | 0 | 11 | 0 | 0 | |
| 3 | IfNullRow | 0 | 9 | 1 | 0 | |
| 4 | Column | 0 | 2 | 2 | 0 | |
| 5 | Column | 0 | 3 | 3 | 0 | |
| 6 | RealAffinity | 3 | 0 | 0 | 0 | |
| 7 | Multiply | 3 | 2 | 1 | 0 | |
| 8 | TypeCheck | 1 | 1 | 6 | sales | 0 |
| 9 | ResultRow | 1 | 1 | 0 | 0 | |
| 10 | Next | 0 | 3 | 0 | 1 | |
| 11 | Halt | 0 | 0 | 0 | 0 | |
| 12 | Transaction | 0 | 0 | 1 | 0 | 1 |
| 13 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Column, Goto, Halt, IfNullRow, Init, Next, OpenRead, RealAffinity, ResultRow, Rewind, Transaction, TypeCheck.
What the SQLite documentation says
Multiply the value in register P1 by the value in register P2 and store the result in register P3. If either input is NULL, the result is NULL.
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.