Not Like Operator — SQL Technical Interview Questions & Answers
Not Like Operator
Not Like Operator
- Not Like Operator is pattern matching. LIKE uses % and _. REGEXP / RLIKE uses regular expressions (e.g. name REGEXP '^[A-Z]'). They are not interchangeable.
- REGEXP_LIKE, REGEXP_REPLACE, REGEXP_SUBSTR, REGEXP_INSTR are MySQL 8 helpers. Don’t write Java-style /pattern/g.
- Trap: LIKE with regex stars. Trap: REGEXP on a huge unindexed column.
- On the example next to this theory: Not Like Operator — wHERE combines predicates with AND/OR; LIKE does pattern match.
Technical Interview Tip: LIKE vs REGEXP in one sentence, plus one example.
Code Examples for Not Like Operator
Not Like Operator — sample query
CREATE TABLE products (id INTEGER PRIMARY KEY, name TEXT, price REAL);
INSERT INTO products VALUES (1, 'Pen', 10), (2, 'Book', 200), (3, 'Bag', 50);
SELECT * FROM products
WHERE price BETWEEN 20 AND 150 AND name LIKE 'B%';Not Like Operator — wHERE combines predicates with AND/OR; LIKE does pattern match.
How to Explain Not Like Operator to an Interviewer
LIKE vs REGEXP?
LIKE is % and _ REGEXP is regular expressions