MySQL SQLLesson 24Free preview
MySQL Wildcards
This lesson is part of MySQL · All levels
Summary
Wildcard is a special character that represents one or more other characters in a search pattern, and is most often used with the LIKE operator. The two main wildcards in MySQL are the percentage (%) for zero or more characters, and the bottom line (_) for exactly one character. Using wildcards as large as a %-initiated pattern can cause MySQL to perform a full scan, making searches slower on large tables.
Key points
- The percentage (%) represents zero, one, or more characters at a time
- The bottom line (_) represents exactly one character at that position
- Wildcard only means as a pattern when used in LIKE, not a comparison =
- The pattern that the wildcard initiates tends not to use the index so it's slower on big data.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.