MySQL + SQL · Lesson 48
LIKE, BETWEEN and IN Operators
LIKE — Pattern Matching
LIKE searches text patterns using wildcards: % (any characters) and _ (one character).
SELECT * FROM students WHERE name LIKE 'A%'; -- starts with A
SELECT * FROM students WHERE name LIKE '%kumar'; -- ends with kumar
SELECT * FROM students WHERE name LIKE '_a%'; -- 2nd letter a
BETWEEN — Range
SELECT * FROM students WHERE marks BETWEEN 60 AND 80;Includes both 60 and 80 (inclusive range).
IN — Match a List
SELECT * FROM students WHERE class IN ('9', '10', '11');Shorter than writing many OR conditions.
Summary
- LIKE = pattern match (
%many,_one). - BETWEEN = inclusive range; IN = match any value in a list.
💻 Live Code Editor
This page's programs are ready here — run them, edit them, and learn. No installation needed.
Powered by OneCompiler. The code loads into the editor automatically — press Run to see the output. If the editor does not open, open it in a new tab.