Record rank in sqlite db