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
15. Function substring continued
Review

Instruction

Perfect. There is also another, extended version of substring. Take a look:

SELECT substring(name, 2, 3) AS name_substring
FROM item;

In the above example, substring received an additional number (3). In this way, we can specify the length of the substring we want to get. For the name 'TripCare', we'll get 'rip', because we start at letter 2 (which is 'r') and take 3 of them('r', 'I' and 'p').

Again, if you start from a number which exceeds the length of the whole string, you will get an empty string. If the second number you provide is bigger than the length to the end of the string, the database will simply return the string until its end.

However, in Oracle this function is called substr().

Exercise

For each slogan, show its text and the characters from 3 to 8 of that text. Name the second column text_substring.

Stuck? Here's a hint!

If you need characters from 3 to 8, then you need to start at character 3 and take 6 characters altogether.