An in-depth overview of INSERT, SELECT, UPDATE, and DELETE statements,
ORDER BY, INNER JOIN, LEFT OUTER JOIN, WHERE, GROUP BY, and HAVING clauses,
and topics such as join tables and sub-queries.
Calculations across objects are ripe for using a map and an inject but frequently, with ActiveRecord, the solution is more elegant and faster if we can have SQL do the work instead.