SQL JOIN 圖
SQL JOIN 圖
資料來源: https://vector.cool/mysql-%E5%9C%96%E8%A7%A3-left-join-inner-joinright-join-%E7%9A%84%E5%B7%AE%E7%95%B0%E5%8F%8A%E7%AF%84%E4%BE%8B/
SQL JOIN 圖
資料來源: https://vector.cool/mysql-%E5%9C%96%E8%A7%A3-left-join-inner-joinright-join-%E7%9A%84%E5%B7%AE%E7%95%B0%E5%8F%8A%E7%AF%84%E4%BE%8B/
3 thoughts on “SQL JOIN 圖”
SELECT FROM Table_A A LEFT JOIN Table_B B ON A.Key = B.Key
SELECT FROM Table_A A RIGHT JOIN Table_B B ON A.Key = B.Key
https://www.runoob.com/sqlite/sqlite-joins.html
INNER JOIN 簡寫 可以省去 INNER
SELECT … FROM table1 [INNER] JOIN table2 ON conditional_expression …
超過 2個資料表 (多個表資料/多表/多資料表) SQL JOIN 實際範例:
SELECT DISTINCT a.set_sid,a.attribute_sid,a.category_sid,c.category_code,c.category_name,c.sort
FROM product_set_relation a JOIN product_data b
ON b.SID=a.product_sid AND b.del_flag='N' AND b.stop_flag='N'
JOIN product_category c ON c.SID=a.category_sid AND c.del_flag='N' AND c.stop_flag='N'
WHERE a.set_sid='{0}' ORDER BY c.sort;