我看到有内连接,外连接,交叉连接。大体也明白了是怎么一会事。还看到有迫切左外连接和迫切内连接,请问这两个都是什么含义?是SQL标准里的吗?还是只是Hibernate里才有这两个东西?另外,如果我在oracle9i中执行以下的语句:select stu.*,gra.* from Student stu,Grade gra where stu.id=gra.stu_id
不写连接方式,默认会按cross join连接吗?等价与 select stu.*,gra.* from Student stu cross join Grade gra where stu.id=gra.stu_id ?

解决方案 »

  1.   

    》select stu.*,gra.* from Student stu,Grade gra where stu.id=gra.stu_id 
    默认是inner join>迫切左外连接和迫切内连接
    我熟愁oracle,sqlserver. 但未见到有这2个术语。因此这个东东可能是hiberate里面的
      

  2.   

    SQL左外连接 
    在结果表中包含第一个表中满足的所有纪录,如果是在连接条件上匹配纪录,则第二个表返回相应的值,否则第二个表返回空值。 
    如: 
    select hx.name,hx.age,hxhome.home from hx left join hxhome on hx.id=hxhome.hxid SQL右外连接 
    在结果表中包含第二个表中满足的所有纪录,如果是在连接条件上匹配纪录,则第一个表返回相应的值,否则第一个表返回空值。 
    如: 
    select hx.name,hx.age,hxhome.home from hx right outer join hxhome on hx.id=hxhome.hxid 迫切左外连接 
    以下两种检索方式是等价的,它们都能同时迫切左外连接类B和类C: 
    //HQL迫切左外连接检索方式 
    from A a left join fetch a.b b left join fetch a.c c where b is not 
    null and c is not null //QBC迫切左外连接检索方式 
    List result=session.createCriteria(A.class) 
    .setFetchMode("this.b",FetchMode.EAGER) 
    .setFetchMode("this.c",FetchMode.EAGER) 
    .add(Expression.isNotNull("this.b")) 
    .add(Expression.isNotNull("this.c")) 
    .list(); 
    FYI: http://blog.chinaunix.net/u2/73798/showart_1096353.html