Python Compare Strings Lexicographically Sql