Using Functions to Modify the Appearance of Character Values

Many implementations of SQL provide functions to manipulate characters and strings of characters. This section covers the most common character functions. The examples in this section use the table CHARACTERS.

SQL> SELECT * FROM CHARACTERS;

LASTNAME        FIRSTNAME       M      CODE
--------------- --------------- - ---------
PURVIS          KELLY           A        32
TAYLOR          CHUCK           J        67
CHRISTINE       LAURA           C        65
ADAMS           FESTER          M        87
COSTALES        ARMANDO         A        77
KONG            MAJOR           G        52

6 rows selected.

The MySQL equivalent is

 mysql> select * from characters; +-----------+-----------+------+------+ | lastname | firstname | m | code | +-----------+-----------+------+------+ | PURVIS | KELLY | A | 32 | | TAYLOR | CHUCK | J | 67 | | CHRISTINE | LAURA ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.