Write a SOQL query to fetch all deleted Accounts currently sitting in the Recycle Bin (WHERE IsDeleted = true ALL ROWS).
Answer
Filter on IsDeleted = true and add ALL ROWS so the query includes Recycle Bin records. In Apex only (not Query Editor) use this syntax.
apex
List<Account> deleted = [SELECT Id, Name, DeletedDate FROM Account WHERE IsDeleted = true ALL ROWS];
You can pass the results to undelete to restore them.
soqlscenariorecycle-bin