Introduction
Concatenation
Simple text functions
8. Function length – practice
How to modify strings
Revision

Instruction

Okay! That was good. Remember than 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.

Stuck? Here's a hint!

Use length(name) > 8 as the condition.

Console

Code editor

Result

TableConsole