Skip to content

平成21年度 春期 ITパスポート試験 問93

This question's explanation and your answers so far.

問93
頻出度★★☆

フィットネスジムに勤める A さんは,会員管理システムのデータを基に,PC のデータベースソフトを利用して,利用状況の分析を行うことにした。図 1 に示す構造をもつ会員管理システムの会員表及び入館表から,20 代 ~ 50 代の会員についてのデータを 1 か月分取得した。 図1 会員表及び入館表のデータ構造 - 会員表:会員番号,会員名,性別,年齢 - 入館表:会員番号,日付,入館時刻 利用状況の分析を始めるために,取得した会員表及び入館表から図 2 に示す構造をもつ会員利用分析表を作成した。 図2 会員利用分析表のデータ構造 - 会員利用分析表:会員番号,会員名,性別,年齢,日付,入館時刻 作成した会員利用分析表のデータを基に,表に示す性別年代別利用者数一覧を作成した。人数は延べ人数であり,1 か月間の利用回数を表している。 表 性別年代別利用者数一覧

性別年代人数(人)
男性20 代56
男性30 代114
男性40 代227
男性50 代295
男性小計692
女性20 代100
女性30 代215
女性40 代348
女性50 代227
女性小計890

図2に示す会員利用分析表の作成方法について,適切なものはどれか。

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

問 93

  • ア

    正解 The correct answer is ア. The items of the member usage analysis table to be created are “member number, member name, gender, age, date, entry time”. Of these, member name, gender, and age exist only in the member table, while date and entry time exist only in the entry table. In other words, items that span two tables must be brought together into a single row. The operation that does this in a relational database is the join, and if the member number, which exists in both tables, is used as the join key, each single entry record in the entry table gets a row to which the member name, gender, and age from the member table for that member number are attached. Only then can “who (gender and age group)” and “when they entered” be handled in the same row, which makes it possible to count the cumulative number of users by gender and age group shown in the table. Note that one member may enter many times in a month, so the number of rows in the join result equals the number of entry records, and this leads directly to totaling the cumulative number of people.

  • Incorrectイ

    Sorting only changes the order of the rows in a table and does not add any items (columns), while projection is the operation of taking only the needed columns out of a single table. Even if the member table is sorted by member number and columns are taken from the entry table, the two remain separate tables and are not merged into a single row. Member name, gender, and age cannot be lined up in the same row as date and entry time.

  • Incorrectウ

    Selection is the operation of taking the rows that meet a condition out of a single table, and the only columns it can return are the columns that the table itself has. Even if the member table is selected using the member number of the entry table as the condition, the result contains only “member number, member name, gender, age” of the member table, and the date and entry time needed for the analysis are not obtained. This confuses the operation that narrows down rows with the join that links columns together.

  • Incorrectエ

    Sorting the entry table by member number only changes the order of the rows, and performing a selection on the member table after that still yields only the columns of the member table. As with ウ, the date and entry time do not line up in the same row as the member attributes, so the structure of Figure 2 cannot be created. Sorting can serve as preprocessing for analysis, but it is not an operation that links tables to each other.

ここがポイント
  • There are three basic relational database operations: selection = take out the “rows” that meet a condition, projection = take out the “columns” that are needed, and join = combine several tables into one table using a common item as the key. When the needed items span several tables, the operation to use is the join.
  • For the join key, choose an item that exists in both tables. In this question the member number, which is in both the member table and the entry table, is the key; since several entry records correspond to one member record, the join result has as many rows as there are entry records, and it can be used to total the cumulative number of uses.
用語

Your answers