Skip to content

平成27年度 秋期 ITパスポート試験 問64

This question's explanation and your answers so far.

問64
頻出度★★☆

関係データベースで管理している“入館履歴”表と“建物”表から,建物名が‘東館’を条件に抽出した結果を日付の降順でソートしたとき,2番目のレコードの社員番号はどれか。 入館履歴

社員番号建物コード日付
S0001B00110/12
S0001B00210/30
S0002B00210/10
S0003B00210/12
S0003B00310/29
S0004B00110/01
S0004B00210/20
S0005B00110/05

建物

建物コード建物名
B001中央館
B002東館
B003西館
出典 平成27年度 秋期 ITパスポート試験 問64
解説

問 64

  • Incorrectア

    For S0001, the entry date at the East Building (B002) is 10/30, which is the newest, so it is the 1st record in descending order — not the 2nd record the question asks for.

  • Incorrectイ

    For S0002, the entry date at the East Building (B002) is 10/10, which is the oldest, so it is the last (4th) record in descending order — not the 2nd.

  • Incorrectウ

    For S0003, the entry date at the East Building (B002) is 10/12, making it the 3rd record in descending order — off by one, so it is not the 2nd. Note that S0003 also has a West Building (B003) record dated 10/29, but that is excluded under the East Building extraction condition.

  • エ

    正解 First, look up the building code for the building name “East Building” in the “Building” table, which gives B002. Next, from the “Entry History” table, extract only the records whose building code is B002, giving 4 records: S0001 (10/30), S0002 (10/10), S0003 (10/12), and S0004 (10/20). Sorting them in descending order by date (newest first) gives 10/30→S0001, 10/20→S0004, 10/12→S0003, 10/10→S0002. Therefore the 2nd record is S0004 dated 10/20, and the correct answer is エ.

ここがポイント
  • Conditional extraction across two tables: first convert the building name “East Building” into the building code B002 (join), then select from the Entry History — grasp this flow.
  • Sort in descending order (newer dates on top), count from the top, and correctly identify the “2nd record.”
用語

Your answers