Development questions

What does the ALL ROWS keyword do in SOQL, and how do you query records currently in the Recycle Bin (IsDeleted = true ALL ROWS)?

DevelopmentEasyCognizantWiproTCS

ALL ROWS includes deleted records (Recycle Bin) and archived activities in the results. Combine with IsDeleted = true to get only deleted records.

apex
List<Account> deleted = [SELECT Id, Name FROM Account WHERE IsDeleted = true ALL ROWS];

Used to find records to undelete (undelete deleted;) or for audit. Without ALL ROWS, deleted records are not returned.

soqlkeywordsrecycle-bin