Skip to content

平成28年度 秋期 ITパスポート試験 問95

This question's explanation and your answers so far.

問95
頻出度★★★

関係データベースにおける主キーに関する記述のうち, 適切なものはどれか。

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

問 95

  • Incorrectア

    Incorrect. A primary key is subject to the entity integrity constraint, so NULL cannot be set for any row. Because a primary key serves to uniquely identify every row, an empty (NULL) value makes identification impossible, and there is no such thing as “NULL allowed for just one row.”

  • Incorrectイ

    Incorrect. The value of a field set as the primary key can also be updated. As long as the uniqueness of the value is maintained and the referential integrity from other tables is not broken, there is no rule that the primary key value must not be changed. Asserting that it “cannot be updated” is inappropriate.

  • Incorrectウ

    Incorrect. It is actually the opposite: a primary key is exactly what a foreign key in another table references. A foreign key is a mechanism that relates tables to one another by pointing to the primary key (or a unique key) of the referenced table, so “cannot be referenced as a foreign key” is the exact opposite of the primary key's role.

  • エ

    正解 The correct answer is エ. A primary key can be set not only from a single field but also by combining multiple fields; this is called a composite primary key (concatenated key). Even when a single field cannot uniquely identify a row, combining multiple fields makes it possible to uniquely determine each row, so this way of setting a primary key is correctly recognized in relational databases. Therefore the statement is appropriate.

ここがポイント
  • A primary key is an item that uniquely identifies each row of a table; it cannot be NULL and cannot be duplicated (entity integrity). In addition to a single field, a composite primary key that combines multiple fields can also be set.
  • A foreign key references the primary key of another table to relate tables to each other. In other words, the primary key is the side that is referenced by the foreign key, and the two form a pair that supports referential integrity.
用語

Your answers