SUBSTRING Function Examples | Teradata Vantage - Example: Searching for Car Serial IDs - Analytics Database - Teradata Vantage

SQL Functions, Expressions, and Predicates

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2024-01-12
dita:mapPath
obm1628111499646.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
kby1472250656485
lifecycle
latest
Product Category
Teradata Vantageā„¢

Suppose sn is a CHARACTER(15) field of Serial IDs for Automobiles and positions 3 to 5 represent the country of origin as three letters.

For example:

   12JAP3764-35421
   37USA9873-26189
   11KOR1221-13145

To search for serial IDs of cars made in the USA:

   SELECT make, sn 
   FROM autos 
   WHERE SUBSTRING (sn FROM 3 FOR 3) = 'USA';