Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Concatenation
Simple text functions
How to modify Strings
21. The REVERSE() function
Summary

Instruction

Nice! The next text function we'll try is REVERSE(). This takes a string as a parameter and returns its characters in reverse order.

Here we have a query that reverses the order of item names:

SELECT
  REVERSE(Name)
FROM Item;

As you can see, it's a pretty simple function to use.

A13

Exercise

The marketing agency is organizing a costume party for all the copywriters. Each copywriter will be given a name tag with their first name spelled backwards.

Let's reverse the first name of each copywriter whose ID is less than 5. Show the copywriter's real first name and their "reversed" first name. Name the last column Nickname.

Stuck? Here's a hint!

Use REVERSE(FirstName) and Id < 5 in WHERE.