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:
Recall the rules: % = any sequence; _ = single character.Construct an example: WHERE name LIKE 'Jo%' matches John, Jose, Jo.Test with : WHERE name LIKE 'Jo' will not behave as intended under ANSI SQL (it may error or treat * literally).Therefore, the statement that * is the SQL-92 wildcard for sequences is false.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