QuestionQ44

VerifiedRestricting and Sorting Data

Review the description of the BOOKS_TRANSACTIONS table:

Question Image

Review this partial SQL statement:

SELECT * FROM books_transactions  

Which two WHERE conditions return the same result?

Choose two
Explanation

Oracle SQL (like standard SQL) evaluates the AND operator with higher precedence than OR, so an unparenthesized expression of the form "a = x AND b = y OR c" is always evaluated as "(a = x AND b = y) OR c". Consequently, a WHERE clause written without parentheses around the AND terms produces a result set that is byte-for-byte identical to an equivalent WHERE clause that adds explicit parentheses around exactly those same AND-joined terms, since the added parentheses only make the default precedence explicit rather than changing it. The other candidate expressions nest the AND/OR terms differently (for example, requiring the RM condition to apply only to one specific member id, or requiring the RM condition itself to be optional alongside a date restriction), so they filter a materially different set of rows.

Community Discussion

No comments yet. Be the first to start the discussion!