LIKE and Wildcards

LIKE matches a whole string against a pattern where % is any run of characters (even none) and _ exactly one. Backslash escapes a literal % or _, and ESCAPE picks another escape character. Case sensitivity follows the collation.

Wildcards, escapes and case sensitivity with LIKESQL
SELECT sku, title FROM products
WHERE title LIKE '%sql%' OR sku LIKE 'AC-___-01';
SELECT 'Mug' LIKE 'mug' AS ci, 'Mug' LIKE 'mug' COLLATE utf8mb4_0900_as_cs AS cs,
       '50% off' LIKE '50\% %' AS esc, '50% off' LIKE '50!%%' ESCAPE '!' AS esc2,
       'abc ' LIKE 'abc' AS trail, 'BK-PHP-01' NOT LIKE 'BK-%' AS nl;
Output
+-----------+------------------------+
| sku       | title                  |
+-----------+------------------------+
| BK-SQL-01 | SQL Queries That Scale |
| AC-MUG-01 | Semicolon Coffee Mug   |
| AC-STK-01 | Stack Sticker Pack     |
+-----------+------------------------+
+----+------+-----+------+-------+----+
| ci | cs   | esc | esc2 | trail | nl |
+----+------+-----+------+-------+----+
|  1 |    0 |   1 |    1 |     0 |  0 |
+----+------+-----+------+-------+----+

LIKE never pads, so 'abc ' does not match 'abc'. A fixed prefix such as sku LIKE 'BK-%' becomes a range on the sku index (EXPLAIN shows a range scan), but '%-01' forces a scan of every entry, the usual cause of a slow search box; use a full-text index (Full-Text Indexes). Escape %, _ and \ in user input before binding it (Placeholder Limits), or a lone % matches every row.