Difficulty: Easy
Correct Answer: Does not apply — LIKE performs pattern matching on text
Explanation:
Introduction / Context:
This clarifies the distinct purposes of LIKE and BETWEEN in SQL filtering. LIKE is about pattern matching; BETWEEN is about numeric/date (or ordered) ranges.
Given Data / Assumptions:
Concept / Approach:
LIKE compares strings according to patterns. It is not a numeric comparator and does not interpret ranges. To select numeric/date ranges, use comparison operators (<, <=, >, >=) or BETWEEN. For more complex string sets, consider regular expressions if supported.
Step-by-Step Solution:
Recognize the question conflates pattern matching with range checks.Recall: LIKE 'A%' finds strings beginning with A; BETWEEN 5 AND 10 finds numbers 5 through 10.Conclude LIKE is not a range operator.
Verification / Alternative check:
Test WHERE col LIKE '1%' versus WHERE col BETWEEN 10 AND 19; these produce different results, especially for multi-digit values.
Why Other Options Are Wrong:
Wildcards do not convert LIKE into numeric/date range logic. ORDER BY does not change predicate semantics.
Common Pitfalls:
Lexicographic string comparisons can appear to mimic numeric ranges but break for differing lengths (e.g., '100' < '20' lexicographically). Always use numeric types for numeric ranges.
Final Answer:
Does not apply — LIKE performs pattern matching on text
Discussion & Comments