8 SQL Functions You need to Deal With Strings

Here are eight top SQL string functions. These are Length, TRIM, Concatenate, Trailing, CHAR, LPAD, RPAD and Soundex.

SQL Built-in String functions

  1. Length Function
  2. TRIM functions
  3. Concatenate function
  4. Trailing Function
  5. CHAR function
  6. LPAD
  7. RPAD
  8. Soundex

How to Use Built-in String Functions

1). Length

Select LENGTH (first_name) 
from my_employee;

The above query counts the first_name all characters that including spaces.

2). TRIM

Explained with examples about TRIM functions.

3). Concatenate

Select first_name 
|| last_name 
from my_employee;

4). Trailing Functions

Select Trim (trailing 
'y' from first_name) 
from my_employee;

Trailing is a case sensitive.

5). CHAR Function

Best examples of CHAR function you can find here.

6). and 7). LPAD and RPAD

You can find here examples for RPAD and LPAD

8). Soundex

Select Soundex(first_name) 
from my_employee;

The above example converts ‘Srinimf’ into a Alpha-numeric value.

Audio Post

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.