プリンキピア

第8章データ管理

Relational Database Design関係データベースの設計
Modeling data into a set of tables with rows and columns is called relational database design (RDD). Each row represents a record, and each column represents an attribute. RDD includes five phases:
行と列を持つ表の集合へ、データをモデル化することを、関係データベース設計(RDD)という。各行はレコードを、各列は属性を表す。RDDには、五つの段階がある。
1. Requirements analysis phase to assess the informational needs of an organization.
英語のヒント
1. 要求分析の段階:組織が必要とする情報を評価する。
2. Logical design phase to create a conceptual model (entity-relationship [ER]) based on phase 1. ER describes interrelated attributes in a specific domain of knowledge.
英語のヒント
2. 論理設計の段階:第1段階に基づき、概念モデル(実体関連モデル、ER)を作る。ERは、特定の知識領域で互いに関連する属性を記述する。
3. Physical design phase to maximize database efficiency (Unified Modeling Language [UML]). UML helps developers visualize the relationships between the different pieces.
3. 物理設計の段階:データベースの効率を最大にする(統一モデリング言語、UML)。UMLは、開発者が各部分の間の関係を視覚化するのに役立つ。
4. Implementation phase to convert the tables developed in the ER diagram into SQL.
4. 実装の段階:ER図で作成した表を、SQLへ変換する。
5. Monitoring and maintenance phase to ensure that RDBMS is functioning properly.
5. 監視と保守の段階:RDBMSが適切に機能していることを確認する。
INDUSTRY SPOTLIGHT産業の現場から
RDBMS and BankingRDBMSと銀行業務
RDBMs are ideal in banking applications for tracking and storing account numbers, orders, and payments. Most banks run Oracle applications because of the powerful integration of technology and business applications. Oracle includes built-in functionality that is designed specifically for banks such as Oracle banking platform, which is the leading choice for banks looking to change their core systems for customer-centric retail banking.
英語のヒント
RDBMSは、口座番号、注文、支払いを追跡して保存する、銀行業務のアプリケーションに適している。多くの銀行は、技術と業務アプリケーションが強力に統合されているため、Oracleのアプリケーションを動かしている。Oracleには、銀行向けに特別に設計された機能が組み込まれている。たとえばOracle Banking Platformは、顧客を中心に据えた個人向け銀行業務のために、基幹システムを変更しようとする銀行が選ぶ、主要な製品である。
Mapping a Conceptual EER Model to a Relational Model概念的なEERモデルを関係モデルへ対応させる
After designing the ER diagram, we need to convert it to relational models that can be directly implemented by any RDBMS. ER modeling helps create a conceptual model that relies on entities and their interrelationships. The degree of a relationship establishes how many entities it interrelates. Therefore, relationships can be unary, binary, ternary, and more generally n-ary.
英語のヒント
ER図を設計した後は、どのRDBMSでも直接実装できる関係モデルへ変換する必要がある。ERモデル化は、実体とその相互関係に基づく概念モデルを作るのに役立つ。関連の次数は、いくつの実体を結び付けるかを定める。そのため、関連には、単項、二項、三項、より一般にはn項がある。
Cardinality ratios are used to specify how many tuples are interrelated as part of a binary relationship (i.e., 1-1, 1-N, N-1, M-N).
英語のヒント
カーディナリティー比は、二項関連の一部として、いくつのタプルが相互に関連するかを指定するために使う。1-1、1-N、N-1、M-Nがある。
Multivalued attributes are allowed in ER models. They are used to represent an attribute that contains a list of values. For example, a car entity may have a color attribute that is multivalued and include a list of all the car colors.
英語のヒント
ERモデルでは、多値属性を使える。これは、値の一覧を含む属性を表すために使う。たとえば、車の実体に多値の色属性を設け、その車のすべての色の一覧を含めることができる。
In ER modeling, a weak entity is a type of entity that cannot be uniquely identified based on its attributes alone and must rely on a strong entity to provide the context necessary for identification. For example, an employee in a company may have dependents for health insurance purposes. In this case, a dependent entity is a weak entity and the ID of the employee, who is the strong entity, needs to be used to fully identify a dependent.
英語のヒント
ERモデル化において、弱実体は、自分の属性だけでは一意に識別できず、識別に必要な文脈を、強実体に与えてもらわなければならない実体である。たとえば、企業の従業員には、健康保険上の扶養家族がいる場合がある。この場合、扶養家族の実体は弱実体であり、一人の扶養家族を完全に識別するために、強実体である従業員のIDを使う必要がある。
The following steps must be followed to map an EER model to a relational model:
EERモデルを関係モデルへ対応させるには、次の手順に従う必要がある。
1. Mapping of Regular Entity Types. Create a table that includes all of its simple attributes and select one of the key attributes as the primary key. If the key chosen is from a composite attribute in the EER model, the corresponding set of simple attributes will together form the primary key.
英語のヒント
1. 通常の実体型の対応付け。すべての単純属性を含む表を作り、キーとなる属性の一つを主キーとして選ぶ。選んだキーがEERモデルの複合属性である場合、対応する単純属性の組が、一緒に主キーを構成する。
2. Mapping of Weak Entity Types. For each weak entity, create a table that includes all of its simple attributes, and include the attributes that make up the key of the associated strong entity. The primary key in this case is the combination of the primary key of the associated strong entity and the partial key of the weak entity if any.
英語のヒント
2. 弱実体型の対応付け。弱実体ごとに、すべての単純属性を含む表を作り、関連する強実体のキーを構成する属性も含める。この場合の主キーは、関連する強実体の主キーと、弱実体に部分キーがあればそれとを、組み合わせたものである。
3. Mapping of Binary 1:1 Relation Types. One solution is to create a relation for each participating entity, choose a primary key in one of the two relations, and make a foreign key referencing the primary key in the second relation. In some cases, it is more appropriate to merge both relations (from the participating entities) into one, or create a cross-reference (i.e., relationship relation) between the two relations.
英語のヒント
3. 二項の1:1関連型の対応付け。一つの方法は、関与する実体ごとに関係を作り、二つの関係の一方で主キーを選び、その主キーを参照する外部キーを、もう一方の関係に作ることである。場合によっては、関与する実体の二つの関係を一つへ統合したり、その二つの間に相互参照、すなわち関連を表す関係を作ったりするほうが適切である。
4. Mapping of Binary 1:N Relationship Types. Create a relation for each participating entity. The primary key from the “one” side of the relationship is added to the “many” side as a foreign key. An alternative approach is to use a relationship relation, but it is rarely done.
英語のヒント
4. 二項の1:N関連型の対応付け。関与する実体ごとに関係を作る。関連の「1」側の主キーを、「多」側に外部キーとして加える。別の方法として、関連を表す関係を使うこともできるが、ほとんど行われない。
5. Mapping of Binary M:N Relationship Types. Create a relation for each participating entity. Also create a relationship relation and include as foreign keys attributes the primary keys of the relations that represent the participating entity types. Their combination will form the primary key of the relationship relation.
5. 二項のM:N関連型の対応付け。関与する実体ごとに関係を作る。さらに、関連を表す関係も作り、関与する実体型を表す関係の主キーを、外部キー属性として含める。それらの組み合わせが、関連を表す関係の主キーになる。
6. Mapping of Multivalued Attributes. For each multivalued attribute, create a new relation that includes an attribute corresponding to the multivalued attribute (in the original entity type) and include as a foreign key the primary key of the relation that represents the entity that includes the multivalued attribute. The primary key in the new relation created is the combination of the attribute that corresponds to the multivalued attribute (in the original entity type) and the foreign key.
6. 多値属性の対応付け。多値属性ごとに、その属性(元の実体型にあるもの)に対応する属性を持つ、新しい関係を作る。さらに、その多値属性を持つ実体を表す関係の主キーを、外部キーとして含める。新しく作る関係の主キーは、元の実体型の多値属性に対応する属性と、その外部キーとの組み合わせである。
7. Mapping of n-ary Relationship Types. Create relationship relations for each n-ary relationship and include as foreign keys attributes the primary keys of the relations that represent the participating entity types.
7. n項関連型の対応付け。n項関連ごとに、関連を表す関係を作り、関与する実体型を表す関係の主キーを、外部キー属性として含める。
8. Mapping Specialization or Generalization. Convert each specialization with m subclasses {S1, S2, . . . , Sm} and generalized superclass C, where the attributes of C are {k, a1, . . . an} and k is the (primary) key, into relational schemas using one of the four following options: Option 8A: Multiple relations-Superclass and subclasses; Option 8B: Multiple relations-Subclass relations only; Option 8C: Single relation with one type attribute; Option 8D: Single relation with multiple type attributes.
英語のヒント
8. 特殊化または汎化の対応付け。m個のサブクラス{S1, S2, . . . , Sm}と、汎化したスーパークラスCを持つ各特殊化を、次の四つの方法のいずれかで、関係スキーマへ変換する。ここでCの属性は{k, a1, . . . an}で、kが(主)キーである。方法8A:複数の関係を使い、スーパークラスとサブクラスを表す。方法8B:複数の関係を使い、サブクラスの関係だけを作る。方法8C:一つの関係に、一つの型属性を持たせる。方法8D:一つの関係に、複数の型属性を持たせる。
9. Mapping of Union Types. For mapping a category whose defining superclass has different keys, it is customary to specify a new key attribute, called a surrogate key, when creating a relation to correspond to the category.
英語のヒント
9. 和集合型の対応付け。定義元のスーパークラスが異なるキーを持つカテゴリーを対応付ける場合、通常は、そのカテゴリーに対応する関係を作るときに、代理キーと呼ばれる新しいキー属性を指定する。