LoginSignup
0
0

More than 3 years have passed since last update.

DB 直積 innerjoin outerjoin 使い分け

Last updated at Posted at 2020-12-04

直積
https://wa3.i-3-i.info/word15315.html

全ての組み合わせが出る!!!

テーブルA テーブルB
a d
b e
c f

3*3
テーブルA.a= テーブルB.dで繋いだら、両者が持つ属性にはヒットするが、お互いに同じ属性を持っていないと該当しない。

innerjoin outerjoin
https://zenn.dev/naoki_mochizuki/articles/60603b2cdc273cd51c59

テーブルA テーブルB
a d
b e
c

テーブルAは持っているが、テーブルBは持っていないため、テーブルを連結させた時に、テーブルBが持っていない属性に対して、あえてテーブルAの属性と一致しないテーブルを空白にしたい時

ex)絵のテーブルと作者のテーブル
実は、作者が不明な属性を持つときはあえて、innerjoinで空白にする

テーブルA テーブルB
a d
b e
c

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