generate sql strings from relational expressions