SQLite Substring Functions

Substring

 
select 
       firstname,
       SUBSTR(firstname, 1, 1),
       lastname,
       SUBSTR(lastname, 1, 3)  
from person
;

Length

 
select 
       firstname,
       LENGTH(firstname),
       lastname,
       LENGTH(lastname)  
from person
;

Get the Last N Characters in a String

 
select 
       lastname,
       LENGTH(lastname),
       SUBSTR(lastname,(LENGTH(lastname)-3),4)  
from person
;


Schema and Data use on this page