Migration Gotcha: MySQL does not support INSERT ... RETURNING (use LAST_INSERT_ID() on the same connection); Oracle, PostgreSQL, and SQLite 3.35+ all support atomic RETURNING.

Oracle Database

INSERT INTO orders (customer_id, total)
VALUES (:cid, :amt)
RETURNING id INTO :v_new_id;

PostgreSQL

INSERT INTO orders (customer_id, total)
VALUES ($1, $2)
RETURNING id, created_at;

MySQL 8+

INSERT INTO orders (customer_id, total) VALUES (?, ?);
SELECT LAST_INSERT_ID();

SQLite 3

INSERT INTO orders (customer_id, total)
VALUES (?1, ?2)
RETURNING id;