开发者

Compare Oracle table columns in SQL

开发者 https://www.devze.com 2022-12-10 18:21 出处:网络
Is it possible through SQL in oracle to compare two tables and list the columns that exist in one but not the other.I have two tables, one (table A) that receives the data from an authoritative source

Is it possible through SQL in oracle to compare two tables and list the columns that exist in one but not the other. I have two tables, one (table A) that receives the data from an authoritative source with a specific code and the second is the rest of the data from that import without 开发者_开发技巧that specific code (Table B). I was hoping there would be a fast way in SQL to compare the two tables and tell me what columns exist specifically in Table A and not in Table B? Thanks.


Use:

SELECT COLUMN_NAME FROM ALL_TAB_COLUMNS WHERE TABLE_NAME='A' AND OWNER='YourSchema'
minus
SELECT COLUMN_NAME FROM ALL_TAB_COLUMNS WHERE TABLE_NAME='B' AND OWNER='YourSchema'
0

精彩评论

暂无评论...
验证码 换一张
取 消