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.

SQL テーブルの結合

Posted at

テーブルの正規化
テーブルを分けて情報の重複をなくす

メリット
データ管理が容易になる
データ容量の削減

主キー
1つの行を特定できる列のこと

外部キー
他のテーブルとの関連付けに使う列のこと
外部キーは関連付けされたテーブルでは主キーとなる

関係性
一対多
多対多
一対一

内部結合
select テーブル名.カラム名 from テーブル名
inner join 結合するテーブル名
on テーブル名.カラム名 = 結合するテーブル名.カラム名;

記述順序
select from 結合処理 where group by having order by limit
実行順序
from 結合処理 where group by having select order by limit

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?