- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we use MySQL REVERSE() function on column’s data along with WHERE clause?
MySQL REVERSE() function can have the column name as an argument to invert its value. If we want to apply some condition/s then it can be used along with WHERE clause as follows:
Example
mysql> Select Name, REVERSE(Name) from Student; +---------+---------------+ | Name | REVERSE(Name) | +---------+---------------+ | Aarav | varaA | | Gaurav | varuaG | | Gaurav | varuaG | | Harshit | tihsraH | | Yashraj | jarhsaY | +---------+---------------+ 5 rows in set (0.00 sec)
The above query inverts the values of ‘Name’ column from ‘Student’ table. Now, the query below will use the REPLACE() function with WHERE clause:
mysql> Select Name, REVERSE(Name) from Student WHERE Subject = 'History'; +-------+---------------+ | Name | REVERSE(Name) | +-------+---------------+ | Aarav | varaA | +-------+---------------+ 1 row in set (0.00 sec)
- Related Articles
- How can we use ASCII() function with MySQL WHERE clause?
- How can we use CHAR_LENGTH() function with MySQL WHERE clause?
- How can we use BIN() function with MySQL WHERE clause?
- How can we use FIND_IN_SET() function with MySQL WHERE clause?
- How can we use MySQL INSTR() function with WHERE clause?
- How can we use MySQL POWER() function with the column’s data values?
- How Can we use MySQL DISTINCT clause with WHERE and LIMIT clause?
- How can we use two columns with MySQL WHERE clause?
- How can I use SPACE() function with MySQL WHERE clause?
- How can we use WHERE clause with MySQL INSERT INTO command?
- How can we use MySQL SUM() function with HAVING clause?
- How to use REPLACE() function with column’s data of MySQL table?
- Can we use the result of a SUM() function in MySQL WHERE clause
- Can we use WHERE clause inside MySQL CASE statement?
- How can MySQL REPLACE() function be used with WHERE clause?

Advertisements