Beginner

324. REVERSE Function

Learn how to reverse the characters in a string.

📘 Lesson 324 of 728 ⏱ 8 min 🎯 Beginner

The REVERSE function returns a string with its characters arranged in reverse order.

Reversing strings can be useful for text analysis, pattern processing, and extracting information from the end of values.

Reverse an employee code for a text-processing operation.

SQL
SELECT
    EmployeeCode,
    REVERSE(EmployeeCode) AS ReversedCode
FROM Employees;

REVERSE can support text analysis, suffix processing, data transformation, and string manipulation.

  • REVERSE changes the character order.
  • The first character becomes the last.
  • It is useful for string manipulation.
  • It can support suffix analysis.
  • The original value is not changed.
What does REVERSE do?

REVERSE returns the characters of a string in reverse order.

Does REVERSE permanently change the stored value?

No. Unless the result is explicitly stored through an update operation, REVERSE only returns a transformed value.

Have you finished this lesson?

Introduction to SQL – All Lessons