Multiple choice

The Like operator uses some special symbols called wildcards for pattern matching. Which of the following are valid wildcard characters in SQL?

  1. & and *

  2. % and *

  3. % and _ (underscore)

  4. $ and _ (underscore)
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The Like operator is used for pattern matching in VARCHAR columns. It is useful in conditions where we do not to compare a value exactly with another. For example, if we want to search for all the persons whose names start with  A, we can use the Like operator with the wildcard character. % is used for substituting a string. For conducting a character replacement we can use the _ (underscore) operator. It is used for matching values that are of a particular length.