Ask Salesforce for the records you need with SOQL: filter with WHERE, order with ORDER BY, count with COUNT(), and walk relationships to related objects
Write your first SOQL queries: SELECT the fields you need, FROM the right sObject, and filter with WHERE to get exactly the records you want
Walk the links between records in SOQL: pull the children of a parent with a subquery, reach a parent from a child, and filter one side by the other