MySQL_Table_Join_Query
2016-05-04 00:00
211 查看
摘要: Internal connection -- No connection -- Where = -- Abbreviation -- External connection -- Multi condition (and)
1. Internal connection
i. No connection
ii. Where =
iii. Abbreviation
2. External connection
Be careful: left join --> all information of first table
right join --> all information of second table
3. Multi condition --> and
1. Internal connection
i. No connection
select * from t_book, t_bookType;
ii. Where =
select bookName, author, bookTypeName from t_book, t_bookType where t_book.bookTypeId = t_bookType.id;
iii. Abbreviation
select tb.bookName, tb.author, tbt.bookTypeName from t_book tb, t_bookType tbt where tb.bookTypeId = tbt.id;
2. External connection
Be careful: left join --> all information of first table
right join --> all information of second table
select * from t_book tb left join t_bookType tbt on tb.bookTypeId = tbt.id; select * from t_book tb right join t_bookType tbt on tb.bookTypeId = tbt.id;
3. Multi condition --> and
select tb.bookName, tb.author, tb.price, tbt.bookTypeName from t_book tb, t_bookType tbt where tb.bookTypeId = tbt.id and tb.price>70;
相关文章推荐
- array_unique 二维数组去重 二维数组排序 去空白
- iOS中的UIDatePicker (日期滚轮)
- 队列的使用
- UE4:Localization(本地化:中文)
- LeetCode 347. Top K Frequent Elements
- 验证StringBuilder是非线程安全的Java小程序
- Android中Build Target,minSdkVersitarget,targetSdkversion概念
- Html中value和name属性的作用及其使用介绍
- Could not calculate build plan
- 自定义UIButton
- SPOJ GSS1 Can you answer these queries I
- SPOJ GSS1 Can you answer these queries I
- UISenior —— 数据存储之沙盒路径
- ionic生成apk使用build命令下载gradle-2.2.1-all.zip卡,解决方案
- UIImageView 的contentMode属性应用
- 83_自定义FastJsonRequest
- android 用户登陆注册UI设计之 edittext (就是输入用户名和密码的文本框)
- 知识梳理:Android子线程中更新UI的3种方法
- POJ 3498 —— March of the Penguins (枚举+最大流)
- poj 1458 Common Subsequence -- 最长公共子序列