Introduction
The DELETE statement removes rows from a table. The RETURNING clause lets you see which rows were deleted right away.
You want to delete old records but also keep a copy of what was removed.
You need to delete a user but want to log their details immediately.
You want to remove expired sessions and see their IDs for cleanup.
You want to delete orders but return the order numbers for confirmation.