SlideShare a Scribd company logo
Usage-Driven Database
Design
Chapter5-3
今回学ぶこと
• 物理データモデラーの考えと切り離すこと
主キーと識別子の必要性
nullを受け入れるかどうか
• 継承とリレーションシップの誤解
Null属性
• null属性に関して論理データモデルでは考慮しなくてよい
• 気にされる理由:物理データモデルの問題
NullはRDBにおける問題であるため
Optional Value
Customer Product
エンティティがないパターンある
の?主キーの制約どうしよ
物理データモデラー 論理データモデラーの
気にすることではない
Subject Areas
Subject Areas
モデルをカテゴリ別に分割し、分析しやすくする方法
分割したモデルをそのまま物理データモデルに適用するのは危険
• データモデルはエンティティ間の関連を示す
• モデルは見直しや修正が行われる
• 実際の格納方法やデータベースの分割を示すものではない
復習:継承が必要とされる理由
Wholesale Retail
Customer
小売りの属性
卸売りの属性
カスタマーにそれぞれの属性を
設ける
問題:使わない属性が生まれる
それぞれエンティティを用意する
問題:共通している属性の重複
継承
Customer
Wholesale Retail
スーパータイプ customer
サブタイプ wholesale Retail
メリット
属性の重複の回避
エンティティの属性を可視化
Credit History
スーパータイプとサブタイプの誤解
Customer
Product Orders
Commercial Goverment Retail
Is a
Is a
Is a
CustomerがProductとOrders
と関連がある
誤解
親エンティティとサブタイプを分
けて考える
正解
CusomerがProductと関係をもつ
Commercial,Government,Reatailも
関連を持つ
識別子と主キー
識別子
一つのエンティティを特定するための文字列や数値
例. 主キー,UUID
*論理データモデルで主キーを用意する必要はない
すべてのエンティティが識別子を持つ必要はない
例
• Invoiceは明細番号で特定->識別子が必要
• LineItemは明細番号を外部キーに製品番号で一意に特定可能
->識別子はいらない
Vendor
Invoice
LineItem
明細番号
製品番号
明細番号
モデル作成例と識別子
Good Health
Insurance Co
アンケート対象者
匿名希望
アンケート
身長
体重
誕生日
匿名性が求められる
識別子は必要ない
部署ごとの身長体重のテーブルの作成
識別子に関するまとめ
識別子を使うなというわけではない
• 無理やりIDなどの属性を用意して固有にする必要はない
顧客番号のように特定のための属性を用意するのはあり
• ビジネス上で求められるなら使うべき
明細番号や学籍番号など結果的に一意になり必要とされるもの

More Related Content

PPTX
Usage-Driven Database Design Chapter4
PPTX
A Framework for integrating software design patterns with game design framework
PPTX
Access control
PPTX
Lectures in turn detecting privacy information abuse by android apps from api...
PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
PDF
Storytelling For The Web: Integrate Storytelling in your Design Process
PDF
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
PDF
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
Usage-Driven Database Design Chapter4
A Framework for integrating software design patterns with game design framework
Access control
Lectures in turn detecting privacy information abuse by android apps from api...
2024 Trend Updates: What Really Works In SEO & Content Marketing
Storytelling For The Web: Integrate Storytelling in your Design Process
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
Ad

Usage-Driven Database Design Chapter5 3