简体   繁体   English

比较SQL中的Oracle表列

[英]Compare Oracle table columns in SQL

Is it possible through SQL in oracle to compare two tables and list the columns that exist in one but not the other. 是否可以通过oracle中的SQL比较两个表并列出其中一个而不是另一个中存在的列。 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). 我有两个表,一个表(表A)从具有特定代码的权威来源接收数据,第二个表是该导入中的其余数据而没有该特定代码(表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? 我希望SQL中有一种比较两个表的快速方法,告诉我表A中有哪些列而不是表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'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM