Difficulty: Easy
Correct Answer: Incorrect
Explanation:
Introduction / Context:
Pattern matching in standard SQL uses the LIKE operator with specific wildcard symbols. Confusing these symbols (especially across tools and shells) leads to wrong results and puzzling bugs. This question checks whether you know the standard wildcard for “any sequence of characters.”
Given Data / Assumptions:
Concept / Approach:
In SQL-92, LIKE uses the percent sign % to match any sequence of zero or more characters and the underscore _ to match exactly one character. The asterisk * is not the standard wildcard in LIKE. Some tools (for example, legacy Access modes or GUI filters) may accept * as a convenience, but this is not the ANSI standard. Conflating shell globbing (where * matches any sequence) with SQL LIKE is a frequent misconception.
Step-by-Step Solution:
Verification / Alternative check:
Vendor documentation (PostgreSQL, SQL Server, MySQL in SQL mode) confirms % and _ are the LIKE wildcards; * is used in SELECT * to mean “all columns,” not for pattern matching.
Why Other Options Are Wrong:
Common Pitfalls:
Using filesystem instincts in SQL; forgetting to escape % or _ when matching them literally (via ESCAPE clause).
Final Answer:
Incorrect
Discussion & Comments