Summer Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Concatenation
Simple text functions
8. Function length – practice
How to modify strings
Review

Instruction

Okay! That was good. Remember that you don't have to use length() in the SELECT clause. You can use it after WHERE too! By doing so, you can filter columns that have longer or shorter values, for instance.

SELECT id, text
FROM slogan
WHERE length(text) < 20;

The above query will select only those slogans whose length is shorter than 20 characters.

Exercise

Show the IDs of all the items with a name longer than 8 characters. Show the length as the second column, name it name_length.

Stuck? Here's a hint!

Use length(name) > 8 as the condition.