We want you to embed a variant of Data Provenance Analysis directly into SQL queries.
The two-step analysis approach to be used has been described in recent publications. In previous research, we first compiled SQL into imperative code and afterwards ran the provenance analysis. Novel to this topic is to omit the compilation step. This means that your implementation will transform an input SQL query into two new SQL queries. While the first query produces execution logs, the second derives the actual data provenance (see Figure 4 in the paper mentioned above).
The execution environment for these generated queries is the DBMS itself.