Skip
Arish's avatar

45. Pattern Matching - Ends With


Ending With a Pattern

Use % at the beginning.

Syntax

sql
1SELECT * FROM students
2WHERE name LIKE '%er';

Returns names ending with 'er': Peter, Oliver...

Examples

sql
1-- Names ending with 'a'
2SELECT * FROM students
3WHERE name LIKE '%a';
4
5-- Courses ending with 'Script'
6SELECT * FROM students
7WHERE course LIKE '%Script';