FIND THE COLUMN COMMON TO TWO TABLES SQL SERVER code example
Example: sql common columns
-- NB: Applicable for Oracle and PL/SQL only
select *
from all_tab_cols A
where
A.COLUMN_NAME in
(
select B.column_name
from all_tab_cols B
where B.table_name = 'YourFirstTable'
)
and A.table_name != 'YourFirstTable'
and A.TABLE_NAME = 'YourSecondTable';