Select substrings
To select part of the value of a character column, include
a substring in the projection list. Suppose your marketing
department is planning a mailing to your customers and wants their
geographical distribution based on zip codes. You could write a query
similar to the following.
The query uses a substring to select the
first three characters of the zipcode column (which identify
the state) and the full customer_num, and lists them in ascending
order by zip code, as the result shows.