Finding rows where a text column fits a particular pattern is done using LIKE. Two wildcards are used in its operation:
Meaning of the Symbol: % Any character, including zero; _Exactly one character
For example, names that begin with A:
FROM customers
WHERE name LIKE ‘A%’;
Finds: Anybody whose name begins with A, including Aman, Akash, Anita, and Abhishek.
For example, only Gmail users:
SELECT *
FROM customers
WHERE email LIKE ‘%gmail.com’;
This is used by a company to target people on a certain email platform through customer segmentation.
For example, a product search
SELECT *
FROM products
WHERE product_name LIKE ‘%phone%’;
finds any product—smartphone, headphones, phone cases, etc.—that has the word “phone” in its name.