如何比较两个表的区别 [英] how to compare two tables difference
问题描述
我们在windows上使用db2 udb v8.1,我想知道我们是否有
有工具或方法比较同一数据库中的两个表数据
区别。谢谢。 (相同的ddl,不同的数据,尝试比较测试输出是否与正确的数据一起运行
we are using db2 udb v8.1 on windows, i would like to know whether we
have tool or way to compare two tables on same database for data
difference. thanks. (same ddl, different data, try to compare whether
the test output run with right data)
推荐答案
"西溪" <哒**** @ yahoo.com>在消息中写道
news:c0 ************************** @ posting.google.c om ...
"xixi" <da****@yahoo.com> wrote in message
news:c0**************************@posting.google.c om...
我们在windows上使用db2 udb v8.1,我想知道我们是否有工具或方法比较同一数据库上的两个表的数据差异。谢谢。 (相同的ddl,不同的数据,尝试比较测试输出是否与正确的数据一起运行)
we are using db2 udb v8.1 on windows, i would like to know whether we
have tool or way to compare two tables on same database for data
difference. thanks. (same ddl, different data, try to compare whether
the test output run with right data)
这些表是否具有主键或唯一索引(没有空值)?
Do the tables have a primary key or unique index (with no null values)?
2004年6月30日星期三21:39:08 UTC, da **** @ yahoo.com (xixi)写道:
On Wed, 30 Jun 2004 21:39:08 UTC, da****@yahoo.com (xixi) wrote:
我们在windows上使用db2 udb v8.1,我想知道我们是否
有工具或方法来比较同一数据库中的两个表的数据差异。谢谢。 (相同的ddl,不同的数据,尝试比较测试输出是否与正确的数据一起运行)
we are using db2 udb v8.1 on windows, i would like to know whether we
have tool or way to compare two tables on same database for data
difference. thanks. (same ddl, different data, try to compare whether
the test output run with right data)
怎么样的
选择
*
来自table_test a
哪里不存在(
从original_table中选择1 b其中a.col1 = b.col1和a.col2 =
b.col2和a.col3 = b.col3)
-
Lorne Sunley
how about something like
select
*
from table_test a
where not exists (
select 1 from original_table b where a.col1 = b.col1 and a.col2 =
b.col2 and a.col3 = b.col3)
--
Lorne Sunley
我通常这样做:
T1除了T2
UNION ALL
T2 EXCEXT T1
干杯
Serge
-
Serge Rielau
DB2 SQL编译器开发
IBM多伦多实验室
I usually do:
T1 EXCEPT T2
UNION ALL
T2 EXCEXT T1
Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
这篇关于如何比较两个表的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!