Please share your tips about comparing tables :
请分享你比较表格的技巧:
- showing lines that contain the same values for a given set of columns
- 显示为给定列集包含相同值的行
- showing lines not contained in table A but contained in table B & vice-versa
- 显示表A中不包含但表B中包含的行,反之亦然
2 个解决方案
#1
3
I've always been a fan of Redgate tools: SQL Data Compare.
我一直很喜欢Redgate工具:SQL数据比较。
Provides very flexible options to compare tables/database with criteria based on rows, columns, filters, etc. e.g.
提供非常灵活的选项来比较表/数据库和基于行、列、过滤器等的标准。
It's does for database tables what a diff tool does for text files. Especially useful when trying to identify difference between data constellations between dev and production servers for example. It also has a very handy feature to generate SQL statement based on the delta to apply the changes from one server to a second server.
它对数据库表的作用就像diff工具对文本文件的作用一样。例如,在尝试识别开发和生产服务器之间的数据星座之间的差异时特别有用。它还有一个非常方便的特性,即基于delta生成SQL语句,以将更改从一个服务器应用到另一个服务器。
#2
2
Regarding the second part of the question:
关于问题的第二部分:
showing lines not contained in table A but contained in table B & vice-versa
显示表A中不包含但表B中包含的行,反之亦然
If you're using Oracle, you can use the minus keyword:
如果你使用Oracle,你可以使用-关键字:
select field1, field2, . field_n
from tables
MINUS
select field1, field2, . field_n
from tables;
#1
3
I've always been a fan of Redgate tools: SQL Data Compare.
我一直很喜欢Redgate工具:SQL数据比较。
Provides very flexible options to compare tables/database with criteria based on rows, columns, filters, etc. e.g.
提供非常灵活的选项来比较表/数据库和基于行、列、过滤器等的标准。
It's does for database tables what a diff tool does for text files. Especially useful when trying to identify difference between data constellations between dev and production servers for example. It also has a very handy feature to generate SQL statement based on the delta to apply the changes from one server to a second server.
它对数据库表的作用就像diff工具对文本文件的作用一样。例如,在尝试识别开发和生产服务器之间的数据星座之间的差异时特别有用。它还有一个非常方便的特性,即基于delta生成SQL语句,以将更改从一个服务器应用到另一个服务器。
#2
2
Regarding the second part of the question:
关于问题的第二部分:
showing lines not contained in table A but contained in table B & vice-versa
显示表A中不包含但表B中包含的行,反之亦然
If you're using Oracle, you can use the minus keyword:
如果你使用Oracle,你可以使用-关键字:
select field1, field2, . field_n
from tables
MINUS
select field1, field2, . field_n
from tables;