做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

解析sql語句中left_join、inner_join中的on與where的區別_MySQL

來源:懂視網 責編:小采 時間:2020-11-09 18:54:00
文檔

解析sql語句中left_join、inner_join中的on與where的區別_MySQL

解析sql語句中left_join、inner_join中的on與where的區別_MySQL:bitsCN.com table a(id, type):id type ----------------------------------1 1 2 1 3 2 table b(id, class):id class ---------------------------------1 12 2sql語句1:select a.*, b.* from a left join b on a.id = b.id and a.type = 1;sql語句2:select a.*,
推薦度:
導讀解析sql語句中left_join、inner_join中的on與where的區別_MySQL:bitsCN.com table a(id, type):id type ----------------------------------1 1 2 1 3 2 table b(id, class):id class ---------------------------------1 12 2sql語句1:select a.*, b.* from a left join b on a.id = b.id and a.type = 1;sql語句2:select a.*,

bitsCN.com table a(id, type):
id type
----------------------------------
1 1
2 1
3 2
table b(id, class):
id class
---------------------------------
1 1
2 2
sql語句1:select a.*, b.* from a left join b on a.id = b.id and a.type = 1;
sql語句2:select a.*, b.* from a left join b on a.id = b.id where a.type = 1;
sql語句3:select a.*, b.* from a left join b on a.id = b.id and b.class = 1;

sql語句1的執行結果為:
a.id a.type b.id b.class
----------------------------------------
1 1 1 1
2 1 2 2
3 2

sql語句2的執行結果為:
a.id a.type b.id b.class
----------------------------------------
1 1 1 1
2 1 2 2

sql語句3的執行結果為:
a.id a.type b.id b.class
----------------------------------------
1 1 1 1
2 1
3 2
由sql語句1可見,left join 中左表的全部記錄將全部被查詢顯示,on 后面的條件對它不起作用,除非再后面再加上where來進行篩選,這就是sql語句2了;由sql語句3可見,on后面的條件中,右表的限制條件將會起作用。
**************************************************************************
sql語句4:select a.*, b.* from a inner join b on a.id = b.id and a.type = 1;
sql語句5:select a.*, b.* from a inner join b on a.id = b.id where a.type = 1;
sql語句6:select a.*, b.* from a, b where a.id = b.id and a.type = 1;
sql語句7:select a.*, b.* from a, b where a.type = 1 and a.id = b.id;

這四條語句的執行結果一樣,如下:
a.id a.type b.id b.class
----------------------------------------
1 1 1 1
2 1 2 2
由此可見,inner join 中on后面的限制條件將全部起作用,這與where的執行結果是一樣的。另外,where語句與inner join確實能得到相同的結果,只是效率不同(這個我沒有測試過,不過我相信這個結論)。
但是sql語句6是否比sql語句7的效率要低一些,我沒有足夠的數據量來測試,不過我也相信是如此的。
bitsCN.com

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

解析sql語句中left_join、inner_join中的on與where的區別_MySQL

解析sql語句中left_join、inner_join中的on與where的區別_MySQL:bitsCN.com table a(id, type):id type ----------------------------------1 1 2 1 3 2 table b(id, class):id class ---------------------------------1 12 2sql語句1:select a.*, b.* from a left join b on a.id = b.id and a.type = 1;sql語句2:select a.*,
推薦度:
標簽: sql on left
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 武胜县| 呼伦贝尔市| 呼图壁县| 武夷山市| 和平县| 奎屯市| 鞍山市| 大名县| 淮南市| 紫金县| 苍山县| 湄潭县| 松江区| 南丹县| 承德市| 茌平县| 桃园市| 图们市| 罗平县| 汾阳市| 托克逊县| 宽甸| 贡嘎县| 华阴市| 简阳市| 十堰市| 泰顺县| 乌兰浩特市| 虎林市| 寻甸| 施秉县| 田阳县| 长沙市| 滦平县| 凌海市| 荣昌县| 定南县| 阳原县| 武宣县| 图片| 灌阳县|