SQL for mcRank command