When using ExecuteSQL processor to do CRUD actions on database tables, we should prepare the SQL statement by ourselves.
There could be plenties of ways to do such thing. One way as you mentioned is to use the raw json data to insert/update a DB table, you might try to use PutDatabaseRecord processor, in such way, the json's structure must be flat as the avro-schema you fetched from the corresponding DB table.