One of the challenges in the Information Age is the management of the enormous data available in the World Wide Web. This amount of data demands a new generation of algorithms to retrieve information in an effective way. This talk addresses the Top-k retrieval task, that is, the procedure of obtaining the best k answers associated to one query according with one given ranking or preference criteria. Specifically we present a Top-k algorithm on relational databases (SQL) associated to an arbitrary ranking function.