Sequel was created to solve some the problems in previous approaches.
As I've shown, it lets you write your SQL code in ruby, and translates the ruby code into SQL code that will work on your database, leading to more database independent code.