IPA FE Subject A 2025 Question 6
A question IPA Japan published in 令和7年度 基本情報技術者試験 科目A 公開問題 問6, translated into English. ITPEC is based on the same exams.
Which of the following is the SELECT statement that gives the same result as the SQL statement for the “Product” table?
Product
Explanation
SupplierID = 'M002' OR SupplierID = 'M004' — IN with a list is true when the column equals any one of the listed values, which is the same as joining the equalities with OR.
WHERE SupplierID IN ('M002', 'M004') selects the rows whose SupplierID is M002 or M004: S002 (Dishwasher, M002), S005 (Coffee maker, M004) and S006 (Hot plate, M004). The condition with OR selects exactly the same three rows.
Answer (c)
Why not others:
- •(a) — no row can have SupplierID equal to M002 and to M004 at the same time, so the
ANDcondition returns no rows - •(b) —
INTERSECTkeeps only rows that appear in both results; the M002 row and the M004 rows have nothing in common, so the result is empty (UNIONwould give the three rows) - •(d) —
BETWEEN 'M002' AND 'M004'is a range including both ends, so it also returns M003's rows, S003 and S004
Key rule: col IN (x, y) equals col = x OR col = y; a range needs BETWEEN, two values of one column joined by AND are never both true, and the OR of two queries is UNION, not INTERSECT.
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.