由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - SQL check likeness between two large tables
相关主题
SQL combine two tables into one table and add a new column (转载)问个SAS PROC CORR的问题
请教一个SQL 的问题SAS DATA PROCESSING 问题
如何在PROC SQL里面象SQL 一样设置index使join更快?[SAS]问个简单的data manipulation
sort two same tables SQL but different results (转载)help. txt 读入问题
SQL copy a table into a new table and add a new column (转载)晕菜了, logistic regression with time-dependent covariates
急需高人指点!!如何在用SAS给多个data step 和proc step 做循环语句呢?
请教个SAS问题问个merge的问题
怎样用R除掉DUPLICATED RECORDsas data set 求助
相关话题的讨论汇总
话题: table2话题: sql话题: table1话题: rows话题: tables
进入Statistics版参与讨论
1 (共1页)
l******9
发帖数: 579
1
I need to check the likeness between two data tables on SQL. I am working on
Aginity Workbench for Netezza on Win 7.
The tables are very large. One of them has 100 million rows and 4 columns;
another one has 1500 million rows and 3 columns.
Example, table1
ID1 ID2 ID3 Value
xxxx xxxxxx xxxxxxxx xxx.xxxxxx // here x is 0-9 int
table2:
ID1 ID2 Value
xxxx xxxxxx xxx.xxxxxx
the ID1 and ID2 may be duplicated but Values are not duplicated in the same
table.
I need to check whether table1 is a subset of table2 and find the rows that
are avaialble in table1 but not in table2 and vice versa.
I am new to SQL. How to design the efficient SQL queries ? I need to do the
same tasks frequently, so en efficient query may be more helpful.
I use this method :
SELECT * FROM table1 a
WHERE NOT EXISTS (
SELECT table2.ID1
FROM table2 b
WHERE b.ID1 = a.ID1
AND b.ID2 = a.ID2)
But, the results are 0 rows. I also checked that there are no duplicated
rows in the two tables. Why table2 is much larger than table1 ?
Are there other ways to find their differences ?
Thanks
k***n
发帖数: 997
2
outer join can display difference
select t1id , t2id from
(select table1.id1 t1id , table2.id1 t2id from table1
full join table2 on (table1.id1=table2.id1) )
where t1id is null ;
1 (共1页)
进入Statistics版参与讨论
相关主题
sas data set 求助SQL copy a table into a new table and add a new column (转载)
问个比较具体的算法问题急需高人指点!!
reporting analyst面试的问题回答请教个SAS问题
关于统计研究生选修计算机系课的建议怎样用R除掉DUPLICATED RECORD
SQL combine two tables into one table and add a new column (转载)问个SAS PROC CORR的问题
请教一个SQL 的问题SAS DATA PROCESSING 问题
如何在PROC SQL里面象SQL 一样设置index使join更快?[SAS]问个简单的data manipulation
sort two same tables SQL but different results (转载)help. txt 读入问题
相关话题的讨论汇总
话题: table2话题: sql话题: table1话题: rows话题: tables