The function substring(string [from integer] [for integer]) extracts a substring from a given
string. The optional argument from specifies the starting position (the first character has
position 1). If omitted, extraction will always start from position 1. Parameter for specifies
the length of the extracted substring. If omitted, the whole substring starting at from and
goint to the end of string will be extracted.
The following query returns the first character of city names in cities:
SELECT SUBSTRING(name FOR 1) FROM cities;
The following query will return cisco:
SELECT SUBSTRING(name FROM 9) FROM cities WHERE name LIKE 'San%';
The following query will return burg:
SELECT SUBSTRING('Edinburgh' FROM 5 FOR 4);
Question: Find out what happens when from is greater that the length of
string? What happens when from + for is greater than the length of string.
Note: Function substr(string, from [, count]) does the same as substring(string from from for count)).