Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Concatenation
Simple text functions
9. The LOWER() and UPPER() functions
Modifying strings
Summary

Instruction

Right! Let's move on to another text function: LOWER().

Whatever is passed as an argument to LOWER() will be written in small (lowercase) letters:

SELECT LOWER(last_name) AS lower_name
FROM copywriter;

LOWER() returns 'turner' for 'Turner'.

If there is a function for lowercase letters, there must be a function for capital (uppercase) letters too. There is! It's called UPPER() and works in a similar way:

SELECT UPPER(last_name) AS upper_name
FROM copywriter;

UPPER() returns 'TURNER' for the last name 'Turner'.

Let's try this in an exercise!

Exercise

The boss of the marketing agency said that it's very trendy to write Internet and newspaper ads in all lowercase letters. We don't want to reenter all of our slogans; let's use LOWER() instead.

For every slogan of the type 'newspaper ad' or 'Internet ad', show the slogan ID and its text in all lowercase. Name the last column trendy_slogan.

Stuck? Here's a hint!

To show only the correct types of advertisements, you may either use an IN operator:

WHERE type IN ('Internet ad', 'newspaper ad')

or the OR operator, like so:

WHERE type = 'Internet ad'
   OR type = 'newspaper ad';