0

I have a schema (Main schema) with a list of available tables. Each table has a column which I want to check if it is there.

For example:

TheMainSchema:
    table1
    table2
    table3
    table4
    table5

Sample of tables:

table1:

Id    Row    i_am_important 
____  _____  ______________
1     row1   row1
2     row2   row2

table2:

Id    Row    i_am_important 
____  _____  ______________
1     row1   row1
2     row2   row2

table3:

Id    Row    else
____  _____  ______________
1     row1   row1
2     row2   row2

The query looks for the important column, if it is there it means the results should be returned.

In this case the query's output would be: table1,table2

Nidal Barada
  • 373
  • 2
  • 14
  • I removed the conflicting DBMS tags. Please add only one tag for the database product you are really using. –  Sep 28 '22 at 14:19
  • Use system tables to check for existing of column in table. the issue is we don't know what RDBMS and thus how the system tables are accessed. For example: Oracle might use `ALL_TAB_COLS`, while in another RDBMS , you may access `INFORMATION_SCHEMA.COLUMNS` See: https://stackoverflow.com/questions/420741/getting-list-of-tables-and-fields-in-each-in-a-database for more info – xQbert Sep 28 '22 at 14:22

0 Answers0