Skip to content

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

This question's explanation and your answers so far.

問74
頻出度★★☆

“気温”表の2011年の7月1日から8月31日までの間で,最高気温が35度以上のレコードを全て抽出したい。抽出条件として,適切なものはどれか。 気温

年月日最高気温
20111112
20111211
2011139
::::
201173134
20118136
::::
2011123110
20121111
出典 平成28年度 秋期 ITパスポート試験 問74
解説

問 74

  • Incorrectア

    The month condition is (Month = 7 and Month = 8), but a single record's month can never be both 7 and 8 at the same time, so the parentheses are always false and not a single record is extracted. In addition, Max temperature ≦ 35 means “35 degrees or lower”, the opposite of the required “35 degrees or higher”. Wrong on two counts.

  • Incorrectイ

    Max temperature ≧ 35 is correct, but the month condition (Month = 7 and Month = 8) uses and, and no record is both July and August at once, so the result is empty. To collect both July and August, or is required.

  • Incorrectウ

    The month condition (Month = 7 or Month = 8) is correct, but Max temperature ≦ 35 means “35 degrees or lower”, the opposite of the required “35 degrees or higher”, so it picks up records on the low-temperature side.

  • エ

    正解 The records to extract are those satisfying all three conditions: “2011”, “July 1 to August 31”, and “max temperature 35 degrees or higher”. Choice エ is Year = 2011 and (Month = 7 or Month = 8) and Max temperature ≧ 35, which correctly expresses these three conditions. The key point is how the month is specified: since each record has only one month value, to collect both the July and August records you must join them with or as “Month = 7 or Month = 8”. Also, “35 degrees or higher” includes 35 and extends upward, so Max temperature ≧ 35 is correct. Therefore エ is appropriate.

ここがポイント
  • When a range is specified as “matches any one of them”, use or; when “both must hold at the same time”, use and. Since one field of a single record can never hold multiple values at once, joining mutually exclusive values such as Month = 7 and Month = 8 with and always yields an empty set.
  • “Or higher (以上)” includes the boundary value and extends upward (≧); “or lower (以下)” includes the boundary value and extends downward (≦). Map the wording of the condition correctly to the comparison operator.
用語

Your answers