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.
Figure 1. Query
SELECT zipcode[1,3], customer_num 
   FROM customer
   ORDER BY zipcode;
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.
Figure 2. Query result
zipcode customer_num 

021              125
080              119
085              122
198              121
322              123
⋮
943              103
943              107
946              118