There is nothing that will do a good job of generating SQL for complicated outer joins and the like. Class::DBI does a good job of mapping tables to objects and letting you address your data in an OO way. It can generate SQL for simple things like what you show above, and it can take arbitrary SQL and handle to busy-work of fetching the data and turning it into objects that you can work with.