Generate sql statements from expressions