sql - Finding list of all the tables those use a common column -


I have a requirement where I need to find all the tables with a common column.


My requirement is as follows: Example: A school teacher has been entrusted with many tasks for many divisions. Each partition is placed as a table. Therefore all the partition tables should have a column that can point to teacher ID. But the name of the column may be different. For East: Diva-educator ed, deviab-teacher id ...., Devon-teacher id


There is also a table named Teacher which includes details of teachers. - Column Teacher ID (Primary Key)

The teacher leaves school and the new teacher takes the place and takes the same role and responsibilities of the old teacher, so here we have all the dependencies with the new teacher The tables need to be updated.

We may have a number of 100 tables. Therefore it is difficult to find all these tables manually.

Do you have any queries, we can find all the tables that are dependent on this column, so that they can be updated with the new teacher ID. (Please note, a common surname may naming of this column is not the same in all dependent tables. But the names of all the columns is "teacher may ED")

Please suggest That any query can be used to solve the solution given above.

Understand this with an example.

  SQL & gt; Choose a.owner, 2 a.table_name, 3 b.owner primary_owner, 4 b.table_name primary_table 5 of user_constraints a, 6 user_constraints b 7 WHERE a.table_name = 'EMP' 8 and a.r_constraint_name = b.constraint_name 9 / OWNER TABLE_NAME PRIMARY_OWNER PRIMARY_TABLE ---------- ---------- --------------- ------------ --- Scott EMP Scott's Department SQL & gt;  

Uses the above query referenced integrity . Table DEPT reference table EMP . The column name is nothing to do with reference to the table.

In your case, let EMP with your table name and the query will provide a list of all tables referenced in your table.

You can read the documentation for the

.

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -