IPA IP 2020 Question 73

Topic: Databases

A question IPA Japan published in 令和2年度 10月 ITパスポート試験 公開問題 問73, translated into English. ITPEC is based on the same exams.

In a relational database, which of the following is the result of executing an intersection operation on table A and table B?

Table A

Product namePrice
Gum100
Rice cracker250
Chocolate150

Table B

Product namePrice
Rice cracker250
Chocolate150
Dorayaki100
OptionProduct namePrice

Explanation

Rice cracker 250 and Chocolate 150 — an intersection keeps only the rows that appear in both tables, exactly as they are.

Compare the rows of the two tables, each row as a whole (product name and price together):

  • •Gum 100: in table A only
  • •Rice cracker 250: in both
  • •Chocolate 150: in both
  • •Dorayaki 100: in table B only

The intersection is the two rows found in both tables, Rice cracker 250 and Chocolate 150. A set operation only selects rows; it never adds up or changes their values.

Answer (d)

Why not others:

  • •(a) — the union: every row that is in either table, each listed once
  • •(b) — the union with the prices of the shared rows added together, a calculation no set operation performs
  • •(c) — the right two rows, but with each price doubled (250 + 250, 150 + 150) by adding the two tables' values

Key rule: Union = rows in either table, intersection = rows in both, difference = rows in one but not the other; all three select whole rows and leave their values unchanged.

Databases · AI-written, may contain errors

This question comes from the past questions IPA Japan publishes, translated into English by ITPEC Practice. ITPEC Practice is an independent study tool and is not affiliated with IPA or ITPEC. See the original paper (PDF) or Report an issue.