Skip to content
Advertisement

SQL that also gives the table names from which the columns were derived

There is a need in the SQL code below will also get the table name from which the column was fetched to maintain a lineage for analysis at later point. I need suggestion to implement such a SQL:

In the result, I need to get an output similar to this:

in the above result, the last 3 columns should provide the table names from which the first 3 columns were fetched from.

Advertisement

Answer

You can do this:

I’m not saying it’s elegant. On the contrary, combining data and metadata in a single query inevitably results in clunkiness.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement