Skip to content

平成25年度 春期 ITパスポート試験 問67

This question's explanation and your answers so far.

問67
頻出度★★☆

関係データベースの“商品”表から価格が100円以上の商品の行(レコード)だけを全て抽出する操作を何というか。 商品

商品番号商品名価格(円)
S001はさみ200
S002鉛筆50
S003ノート120
S004消しゴム80
S005定規150
出典 平成25年度 春期 ITパスポート試験 問67
解説

問 67

  • Incorrectア

    Join is an operation that matches two or more tables on the values of a shared item (column) and combines them into a single table. It only holds when there are multiple tables, but this question deals with just one table, the Product table, and does not match it against any other table, so it does not apply.

  • Incorrectイ

    Projection is an operation that takes out of a table only the columns (items) you need; the direction of narrowing down is columns, not rows. For example, taking only the Product Name and Price columns out of the Product table is projection, and in principle all rows are covered (if rows with identical content appear once you look only at the extracted columns, those duplicates are merged into one). The operation in this question narrows down by a condition on rows, “the price is 100 yen or more,” so it is not projection.

  • ウ

    正解 “Selection” is a relational operation that takes out of a table only the rows (records) that meet a condition. This question describes narrowing down by a condition on rows, “the price is 100 yen or more,” so it is selection. Applying it to the Product table in the figure, the three rows S001 Scissors 200 yen, S003 Notebook 120 yen, and S005 Ruler 150 yen remain, while S002 Pencil 50 yen and S004 Eraser 80 yen are removed. At this point all three columns — Product No., Product Name, and Price — remain exactly as they were, and only the number of rows drops from five to three. This shape of the result, “the columns stay the same and only the rows decrease,” is the mark of selection. Therefore the correct answer is ウ.

  • Incorrectエ

    Union is a set operation that overlays two tables with the same column structure (union-compatible tables) and gathers the rows contained in either one of them into a single table. It requires two tables, and rows can only increase rather than being narrowed down by a condition, so it does not fit this question.

ここがポイント
  • There are three basic relational operations in a relational database: selection = take out the “rows” that meet a condition, projection = take out the “columns” you need, and join = link multiple tables on a shared column. You can tell them apart by asking “is it rows or columns that get narrowed down?” and “is there one table or several?”
  • Union, difference, and intersection (the common part) are set operations applied between tables with the same column structure (union-compatible tables). The Cartesian product, on the other hand, is an operation that produces every combination of the rows of two tables; the column structures may differ, and the result has more columns. All of them require two tables to exist in the first place, so they are different from the operation in this question, which narrows down a single table by a condition.
用語

Your answers