1. 程式人生 > >Idea資料庫操作(Right Join)

Idea資料庫操作(Right Join)

Join右外連線(Right Outer)概述:
右表與左表結合,取右表全部屬性,左表若無則寫null;

1、首先,你還是要有兩個表:
表1:people
表2:students

這裡寫圖片描述

這裡寫圖片描述

2、然後,進行SQL語句操作

SELECT students.s_name,students.s_age,people.p_sex
FROM students
RIGHT JOIN people
ON students.s_name=people.p_name
ORDER BY students.s_name;

3、結果如下:
這裡寫圖片描述

Idea連線資料庫(MySql Workbench)


Idea資料庫操作(Inner Join)
Idea資料庫操作(Left Join)