IBM interview question

Coding: using queue for faster computation speed. SQL: using SELECT, ORDER BY, LIMIT