DS0-001 · Question #118
Which of the following best describes the function of a wildcard in the WHERE clause?
The correct answer is C. An exact match is not possible in a SELECT statement. Option C is correct because wildcards (% and _ in SQL) are used with the LIKE operator in the WHERE clause of SELECT statements precisely when an exact match isn't possible or known - for example, WHERE last_name LIKE 'Sm%' retrieves any name starting with "Sm" without knowing…
Question
Which of the following best describes the function of a wildcard in the WHERE clause?
Options
- AAn exact match is not possible in a CREATE statement.
- BAn exact match is necessary in a statement.
- CAn exact match is not possible in a SELECT statement.
- DAn exact match is necessary in a CREATE statement.
How the community answered
(49 responses)- A2% (1)
- B6% (3)
- C90% (44)
- D2% (1)
Explanation
Option C is correct because wildcards (% and _ in SQL) are used with the LIKE operator in the WHERE clause of SELECT statements precisely when an exact match isn't possible or known - for example, WHERE last_name LIKE 'Sm%' retrieves any name starting with "Sm" without knowing the full value.
Why the distractors are wrong:
- A & D both mention
CREATEstatements, which are DDL commands used to define database objects (tables, indexes, etc.) - wildcards in aWHEREclause have no relationship toCREATE. - B states an exact match is necessary, which is the opposite of the truth - wildcards exist specifically to handle imprecise, partial-match scenarios.
Memory tip: Associate wildcards with SELECT + LIKE = "I don't know exactly". Whenever you're searching (SELECT) but can only describe part of the value, that's your cue to use a wildcard. CREATE never searches data, so it never needs one.
Topics
Community Discussion
No community discussion yet for this question.