Skip to content

平成21年度 秋期 ITパスポート試験 問98

This question's explanation and your answers so far.

問98
頻出度★★★

I社は,企業に対してPC関連機器の販売を行っており,販売管理業務の情報をデータベースによって管理している。図1に示すデータベースとデータベース管理システムの印刷機能を使って,販売時に図2の請求書を発行する。 各商品の販売単価は適宜変更され,新たな販売単価とその更新日時が販売単価表の該当レコードに上書きされる。また,取引を行う企業(以下,取引先という)の担当者は原則1人であるが,取引先によっては部署ごとに1人存在することがある。取引先コードは,取引先ごとに採番する。 **図1 販売管理業務に関するデータベースの構造** 商品表

商品コード商品名分類コードメーカコード仕入先コード

販売単価表

商品コード販売単価更新日時

取引先表

取引先コード取引先名

取引先担当者表

取引先コード部署名所在地名前役職電話番号

**図2 請求書の様式** - 表題: 請求書 - 右上: 平成YY年MM月DD日 - 宛先欄 (左側): - [取引先名] [部署名] - [役職] [名前]様 - [所在地] [電話番号] - 本文: 下記のとおりご請求申し上げます。 - 発行者欄 (右側): 東京都文京区本駒込×丁目××番×号/株式会社 I - 右側: 伝票番号 XXXXXXXXXX - 明細表 (見出し行のみ。データ行は空欄):

商品コード商品名数量単価金額

- 合計欄 (明細表の下部。「合計」の行に「税抜」「消費税」「総額」の見出しがあり,その下の値セルは空欄):

合計税抜消費税総額

図1の取引先担当者表のレコードを一意に特定するための主キーとして,適切なものはどれか。

出典 平成21年度 秋期 ITパスポート試験 問98
解説

問 98

  • Incorrectア

    The business partner code alone is not unique. For a business partner that has a contact person in each department, there are as many records with the same business partner code as there are departments, so it cannot be narrowed down to one record.

  • Incorrectイ

    Names of contact persons can be duplicated, so a name gives no guarantee as an identifier for business data. Moreover, because the structure places one contact person in each department, the column that essentially distinguishes the records is the department name; making the name part of the primary key is not appropriate.

  • ウ

    正解 A primary key is the smallest combination of columns that can distinguish one record in a table from all the others and identify it uniquely. In this question the preamble states that a business partner has, in principle, one contact person, but depending on the business partner there may be one contact person per department. In other words, several contact-person records can share the same business partner code, one for each department. Therefore the business partner code alone is not enough, and the department name must be added as the column that tells those records apart. Conversely, different business partners have different business partner codes, and within the same business partner each department has exactly one contact person, so the combination of business partner code and department name always narrows the result down to a single record. The primary key is therefore business partner code plus department name, and ウ is correct.

  • Incorrectエ

    Because the business partner code is not included, a conflict occurs if a different business partner has a contact person with the same name and the same job title (for example, a sales manager named Tanaka). The column showing which business partner the record belongs to is missing, so uniqueness cannot be guaranteed.

ここがポイント
  • A primary key is the column, or the smallest combination of columns, that uniquely identifies a record. When one column is not enough, combine several columns into a composite key.
  • A primary key is decided not only by the table definition but also by the business rules given in the preamble, such as whether there is one contact person per business partner or one per department. The trick is to find the unit at which duplicates can occur and add the column that distinguishes it.
用語

Your answers