By Carsten | April 14, 2008
Function name: REVERSE()
Function type: String function
Purpose: Return a string with characters in reverse order
Description: REVERSE(’bitbybit.dk’) does what you expect: returns ‘kd.tibybtib’.
The most prominent place you can use REVERSE is when storing host names for email addresses, web services, etc. where you expect that you’ll want to look up addresses based on the domain name only. Obviously, you could do that as well by using …LIKE ‘%bitbybit.dk’. In that case, however, MySQL would not be able to use any index on the column as that is always based on the left-most part of the column value. By storing (and searching on) the reversed string, you can utilize an index.
Topics: MySQL Function of the day |