SQLite RETURNING Clause
The RETURNING Clause
RETURNING is added at the end of an INSERT, UPDATE or DELETE statement. It returns the rows that the statement changed, like a SELECT.
This is very useful after an INSERT, to get the id that SQLite gave the new record:
Example
INSERT INTO Shippers (ShipperName, Phone)
VALUES ('Fast Bikes', '(503) 555-1234')
RETURNING ShipperID;
Try it Yourself »
Note: RETURNING works in SQLite 3.35.0 and later.
RETURNING With UPDATE
Return the new prices of the products you changed:
Example
UPDATE Products
SET Price = Price * 1.1
WHERE CategoryID = 2
RETURNING ProductName, Price;
Try it Yourself »
RETURNING With DELETE
Use RETURNING * to see all the columns of the records you deleted: