join and PK where and
来源:互联网 发布:淘宝网收藏删除的宝贝 编辑:程序博客网 时间:2024/06/05 10:44
ONE .left join and
left join and也是以A表的记录为基础的,A可以看成左表,B可以看成右表,left join and是以左表为准的。换句话说,左表(A)的记录将会全部表示出来,而右表(B)只会显示符合搜索条件的记录(例子中为: A.ID = B.ID)。B表记录不足的地方均为NULL,加上and条件后,A表记录也将全部被表示出来,而B表只会将符合条件的记录显示出来,B表记录中不符合条件的地方均显示为null。
select a.id,a.name,b.id,b.subject,b.score from tmp_lxq_1 a
left join tmp_lxq_2 b
on a.id=b.id
and b.score>=80;
ID NAME ID SUBJECT SCORE
1 张三 1 语文 80
2 李四 2 数学 90
3 王五
TWO .left join where
left join where条件是在临时表生成好后,再对临时表进行过滤的条件。这时已经没有left join的含义(必须返回左边表的记录)了,条件不为真的就全部过滤掉。
select a.id,a.name,b.id,b.subject,b.score from tmp_lxq_1 a
left join tmp_lxq_2 b
on a.id=b.id
where b.score>=80;
ID NAME ID SUBJECT SCORE
1 张三 1 语文 80
2 李四 2 数学 90
0 0
- join and PK where and
- Join and Where
- join,left join and where的测试
- SQL中join on ...and 和join on ... where
- oracle--left join and 和left join where的区别
- left join on and 与 left join on where
- oracle--left join and 和left join where的区别
- left join on and 与 left join on where
- left join 加and 和 left join 加where
- oracle--left join and 和left join where的区别
- oracle--left join and 和left join where的区别
- 关于SQL Join 中 where和and的区别
- LEFT JOIN后AND与WHERE的异同
- 关于SQL Join 中 where和and的区别
- LEFT JOIN后AND与WHERE的异同
- LEFT JOIN后AND与WHERE的异同
- LEFT JOIN后AND与WHERE的异同
- Mysql关于join on where(and)的区别
- Javascript模块化编程(三):require.js的用法
- Spring事务管理的四种方式(以银行转账为例)
- mysql 存储过程动态执行sql
- Ubuntu双系统
- [深入浅出Cocoa]Block编程值得注意的那些事儿
- join and PK where and
- 相对定位与绝对定位区别用处
- ssh学习笔记二:cxfServlet简单实现
- Awk 简要教程
- 017.View与窗口:AttachInfo
- 汉字转拼音类
- BTY-B1薄膜透气测试
- 浅析Java中的final关键字
- XML序列化和反序列化