0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【MySQL】JOIN句

Last updated at Posted at 2020-03-22

##INNER JOIN
複数のテーブルを結合し、指定したカラムで一致するデータのみ取得する

SELECT * FROM ginkou.user A
INNER JOIN ginkou.member b
ON A.status = B.status;

取得結果
WS000001.JPG

##LEFT OUTER JOIN
左のテーブルの全データを取得し、右のテーブルのデータを結合する
右のテーブルにマッチするデータがない場合≪NULL≫となる

SELECT * FROM ginkou.user A
LEFT OUTER JOIN ginkou.member b
ON A.status = B.status;

取得結果
WS000000.JPG

##RIGHT OUTER JOIN
右のテーブルの全データを取得し、左のテーブルのデータを結合する
左のテーブルにマッチするデータがない場合≪NULL≫となる

SELECT * FROM ginkou.user A
RIGHT OUTER JOIN ginkou.member b
ON A.status = B.status;

WS000000.JPG

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?