generate sql expression