Sql common columns

This article is tagged with: Sql common columns and mysql

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';

This article is tagged with: Sql common columns and mysql