REVERSE() in MySQL — How It Works
What the MySQL REVERSE() function does, with an example.
Published October 19, 2026
REVERSE() returns a string with its characters in reverse order.
How it works
Often used for suffix searches: REVERSE(col) LIKE REVERSE('%com') and for palindrome checks.
Try it in MySQL
SELECT REVERSE('abc')
cba
SELECT REVERSE('level') = 'level'
1
SELECT REVERSE(NULL)
NULL
Practical examples
Example 1
SELECT REVERSE('abc');
-- cbaExample 2
SELECT REVERSE('level') = 'level';
-- 1Example 3
SELECT REVERSE(NULL);
-- NULLUse it in a real query
SELECT id, REVERSE('abc') AS result
FROM your_table
LIMIT 10;Common mistakes
- Expecting it to work on numbers without casting.
- Using it in WHERE on large tables (no index).
- Multi-byte surprises in some charsets.
Key takeaways
- REVERSE() in one line: REVERSE() returns a string with its characters in reverse order.
- Try queries in a test database first.
- Check NULL handling and data types.
FAQ
Palindrome check?
Compare str = REVERSE(str).
Does REVERSE() work in other databases?
Most have an equivalent, but names and syntax vary between MySQL, PostgreSQL, SQL Server and SQLite.