Skip to article frontmatterSkip to article content

構造記述

法政大学

千里之行,始于足下.

老子

学習目標

データモデルの要素

A data model is a combination of at least three components:

  1. A collection of data structure types (the database building, blocks);
  2. A collection of operators or rules of inference, which can be applied to any valid instances of the data types listed in (1), to retrieve, derive, or modify data from any parts of those structures in any combinations desired;
  3. A collection of general integrity rules, which implicitly or explicitly define the set of consistent database states or changes of state or both--these rules are general in the sense that they apply to any database using this model (incidentally, they may sometimes be expressed as insert-update-delete rules).

E. F. Codd. 1982. Relational database: a practical foundation for productivity. Commun. ACM 25, 2 (Feb 1982), 109–117. Codd (1982)

リレーションとは

ドメイン

直積

リレーション

濃度と次数

テーブルとリレーション

リレーションをテーブル(table)として表すことができる.テーブルの行はリレーションのタプルであり,テーブルの列はリレーションのドメインに対応する.

リレーションスキーマとインスタンス

属性名(attribute name)はテーブルの列の名前であり,リレーション名(relation name)はテーブルの名前である.

ドメイン関数を用いたリレーションの定義

リレーションスキーマとインスタンス

第1正規形

非第1正規形

ドメインを複数のドメインの直積として定義する入れ子型リレーションは非第1正規形である.

べき集合(power set)として定義されるドメインも非第1正規形である.

練習問題

問題1:非第1正規形からの正規化

以下のようなリレーションがある:

注文ID顧客名商品一覧
1001佐藤{りんご, バナナ, オレンジ}
1002鈴木{バナナ, パイナップル}
  1. 上記リレーションが 非第1正規形 である理由を説明せよ。
  2. このリレーションを 第1正規形 に正規化せよ。
  3. 正規化後のリレーションに対し、リレーションスキーマを明記し、そのインスタンスをテーブル形式で記述せよ。

問題2:リレーションスキーマとインスタンス

リレーションスキーマ R(A1,A2,A3,A4)\boldsymbol{R}(A_1, A_2, A_3, A_4) について、各属性は以下のように定義される。

以下の問いに答えよ。

  1. R\boldsymbol{R} の具体的なインスタンスを 3件分、テーブル形式で作成せよ。
  2. そのインスタンスをリレーション RR として 集合表記 で表せ。
  3. RR濃度次数 を求めよ。
  4. dom(A4)\text{dom}(A_4)(所属)の ドメイン を定義せよ。
References
  1. Codd, E. F. (1982). Relational database: a practical foundation for productivity. Communications of the ACM, 25(2), 109–117. 10.1145/358396.358400