According to the SQL-92 standard, which two wildcard characters are used with the LIKE operator?
Database
Introduction to SQL
Difficulty: Easy
Choose an option
-
Aasterisk (); percent sign (%)
-
Bpercent sign (%); underscore ()
-
Cunderscore (); question mark (?)
-
Dquestion mark (?); asterisk ()
Answer
Correct Answer: percent sign (%); underscore (_)
Explanation
Introduction / Context:SQL-92 standardized wildcard characters for pattern matching in the LIKE operator. These differ from the wildcards in Microsoft Access.
Given Data / Assumptions:
- We are working with ANSI SQL-92 standard syntax.
- We must identify the correct wildcard characters.
Concept / Approach:In SQL-92, % matches any sequence of characters and _ matches exactly one character. These are the only wildcards defined for LIKE.
Step-by-Step Solution:
Check ANSI SQL spec: pattern 'Sm_th%' matches Smith, Smythe, etc.Therefore, the wildcards are % and _.Verification / Alternative check:Database documentation (Oracle, SQL Server, PostgreSQL, MySQL) confirms % and .
Why Other Options Are Wrong:, ?: Access syntax, not SQL-92. with %: Mixed set, incorrect.
Common Pitfalls:Confusing Access and SQL-92 wildcards.
Final Answer:percent sign (%); underscore ()