Development questions

What are the key differences between SOQL and SOSL, and when do you choose one over the other?

SOQLSOSL
PurposeQuery records of one object (plus related)Text search across many objects and fields
ReturnsList of sObjectsList of lists of sObjects
SearchField-based WHERE filtersFull-text search index, word matching
Limits100 queries, 50,000 rows20 SOSL queries, 2,000 rows each
Use whenYou know the object and need filtered/related data, aggregatesYou don't know which object/field holds the text, or need fuzzy text search
apex
List<List<SObject>> r = [FIND 'Acme*' IN ALL FIELDS RETURNING Account(Id, Name), Contact(Id, Name)];
soqlsoslfundamentals