IPA IP 2021 Question 95

Topic: Databases

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

Same question on ITPEC: Oct 2024 Q26

From a “Product” table and “Sales” table that are managed with a relational database, which of the following contains all and only the products where the total sales for each product in May is at least 20,000 yen?

Product

ProductCodeProductNamePrice (yen)
0001Product A2,000
0002Product B4,000
0003Product C7,000
0004Product D10,000

Sales

SalesNumberProductCodeQuantitySalesDateDeliveryDate
Z00001000434/305/2
Z00002000134/305/3
Z00005000335/155/17
Z00006000155/155/18
Z00003000235/55/18
Z00004000145/105/20
Z00007000235/306/2
Z00008000316/86/10

Explanation

Product B and Product C — total each product's May sales, found by SalesDate, and keep those of at least 20,000 yen.

May sales are the rows with SalesDate in May: Z00003, Z00004, Z00005, Z00006, Z00007. Join each to Product by ProductCode and multiply quantity by price:

  • •A (0001): (5 + 4) × 2,000 = 18,000 yen — below the threshold
  • •B (0002): (3 + 3) × 4,000 = 24,000 yen
  • •C (0003): 3 × 7,000 = 21,000 yen
  • •D (0004): its only sale is on 4/30, so no May sales

Answer (c)

Why not others:

  • •(a) — includes A, whose May total is 18,000 yen; A reaches 24,000 only if the April 30 sale Z00002 is counted by its May delivery date
  • •(b) — includes A and also D, whose only sale Z00001 was made on 4/30; only its delivery falls in May
  • •(d) — omits B, which reaches 24,000 yen with its two May sales, including Z00007 sold on 5/30 and delivered in June

Key rule: Filter rows by the date column the question names (sales, not delivery) before grouping, then compare each group's total to the threshold.

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.