Tutorial Gateway

  • C Language
  • Java
  • R
  • SQL
  • MySQL
  • Python
  • BI Tools
    • Informatica
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • QlikView
  • Js

MySQL REVERSE Function

by suresh

MySQL Reverse is one of the String Function, which is used to reverse the user specified expression (or column value). In this article we will show you, How to write MySQL String reverse Function using Command Prompt, and Workbench with example.

MySQL Reverse Syntax

The basic syntax of Reverse in MySQL is as shown below:

SELECT REVERSE (String_Expression)
FROM Source

For this, we are going to use the below shown data

MySQL Reverse Function Example 1

MySQL Reverse Example 1

The MySQL string Reverse function is used to reverse the given string. The following query will show multiple ways to use this Reverse function.

-- MySQL String Reverse Example
SELECT REVERSE('Learn MySQL Server') AS `Reversed String`;

SELECT REVERSE('Tutorial Gateway') AS `Reversed String`;

OUTPUT

SQL REVERSE Example 1

MySQL Reverse Example 2

The string reverse function in MySQL also allows you to reverse the data inside the columns. In this example, we are going to reverse the length string data present in: Department Name, and Email column.

-- MySQL String Reverse Example
USE mysqltutorial;
SELECT  FirstName, LastName, 
		DepartmentName, 
        REVERSE(DepartmentName) AS `Department in Reverse`,
        Email,
        REVERSE(Email) AS `Email in Reverse`
FROM employe
ORDER BY FirstName, LastName;

OUTPUT
SQL REVERSE Example 2

Thank You for Visiting Our Blog

Placed Under: MySQL

Stay in Touch!

Sign Up to receive Email updates on Latest Tutorials

  • C Programs
  • Java Programs
  • SQL FAQ’s
  • Python Programs
  • SSIS
  • Tableau
  • JavaScript

Copyright © 2019 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy