ITPub博客

首页 > 数据库 > Oracle > SQL中的Filter, join, semi-join等概念的释义

SQL中的Filter, join, semi-join等概念的释义

Oracle 作者:chenfeng 时间:2016-03-29 16:17:18 0 删除 编辑

1、semi-join(半连接)(来自:http://wiki.answers.com/Q/What_is_semi_join_in_SQL)
半连接返回表中能够与另一表中连接的记录(并不执行一次全连接),它并没有一个明确的语法格式。
A semi-join returns rows from one table that would join with another table without performing a complete join. It doesn't have explicit syntax. 

例子,从表Customers中选择其ID出现在表Sales中的客户的ID和Name:
select * 
from Customers C 
where exists ( 
select * 
from Sales S 
where S.Cust_Id = C.Cust_Id 
) 


Cust_Id Cust_Name 
----------- ---------- 
2 John Doe 
3 Jane Doe
来看看这篇文章:http://blog.csdn.net/tiwen818/article/details/7103711,比较详细的介绍了Oracle中的半连接。惭愧啊,话说这个帖子里面的这个语句我就没看懂:
create table table_1
as select
cast(rownum as int) a,
cast(rownum+10 as int) b,
cast(dbms_random.string('i',10) as varchar2(10)) c
from dual connect by level<=500000
看了这篇文章http://yesican.blog.51cto.com/700694/269814和这篇http://www.360doc.com/content/13/0422/16/11947209_280153192.shtml才明白。


2、join(连接)(来自:http://www.w3schools.com/sql/sql_join.asp)
总共有四种连接类型:
内连接:http://www.w3schools.com/sql/sql_join_inner.asp
全连接:http://www.w3schools.com/sql/sql_join_full.asp
左连接:http://www.w3schools.com/sql/sql_join_left.asp
右连接:http://www.w3schools.com/sql/sql_join_right.asp


3、aggregation(聚合)(来自:http://msdn.microsoft.com/zh-cn/library/ms173454.aspx)
聚合函数对一组值执行计算,并返回单个值。 除了 COUNT 以外,聚合函数都会忽略空值。 聚合函数经常与 SELECT 语句的 GROUP BY 子句一起使用。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15498/viewspace-2071785/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: MongoDB的日志系统
请登录后发表评论 登录
全部评论
交流MySQL,PolarDB/PolarDB-X,PostgreSQL,MongoDB和Redis技术。

注册时间:2015-12-07

  • 博文量
    784
  • 访问量
    2690230