Writing the query is only half of the work, and it's the easiest since SQL is perfectly fine as a query language (duh... who would have guessed ?). There's also a M in ORM. Good ORMs will give you nice abstractions for querying but will also let you do the query yourself if you ever need it while still mapping these queries to your objects.