不好意思,我想问下大家,为什么
select count(*) from data_clean.content_all_raw as a
where exists(
select * from crawler.ag03_songs as b
where a.content=b.name and a.performer=b.artist
);
和
select count(*) from data_clean.content_all_raw as a
join crawler.ag03_songs as b
on a.content=b.name and a.performer=b.artist;
的结果不同呢?想请大家指点一下,我只知道join是用来显示两个表的数据,exists是用来显示一个表的数据的,
select count(*) from data_clean.content_all_raw as a
where exists(
select * from crawler.ag03_songs as b
where a.content=b.name and a.performer=b.artist
);
和
select count(*) from data_clean.content_all_raw as a
join crawler.ag03_songs as b
on a.content=b.name and a.performer=b.artist;
的结果不同呢?想请大家指点一下,我只知道join是用来显示两个表的数据,exists是用来显示一个表的数据的,
解决方案 »
- 接近百万数据联表查询
- postgresql的表数据存储方式
- PostgreSQL主键是serial类型,但无法建立外键?
- 靠!见了鬼了,Mysql Varchar(500) 放了700个字符
- 菜鸟求救!MySQL安装不了,请各位大侠帮帮忙!
- mysql恢复数据库
- 大大来帮我看看这个带索引的插入语句该怎样写~~
- MySql 3.23.59版怎么安装?
- 关于mysql的安装问题,请大家帮个忙啊!!
- 删除数据出问题?
- MySql数据恢复
- 我用postgres数据库,创建了一个表,create table networkstat (cur_time time,s1 char(8),s2 char(8),s3 char(8)),
from data_clean.content_all_raw as a
where exists(
select * from crawler.ag03_songs as b
where a.content=b.name and a.performer=b.artist
); select count(*)
from data_clean.content_all_raw as a join crawler.ag03_songs as b
on a.content=b.name and a.performer=b.artist; 第二种 做了JOIN,如果 (content performer)对应的(name ,artist)为1 对 N,对会针对同一条 content_all_raw 中的记录产生多条JOIN后的记录。自然此时的count(*)会大于第一种
2、JOIN中多出的记录有什么特征