1 of 15

TEXT/STRING FUNCTIONS

3. LOWER( )/LCASE( ) 4. UPPER( )/UCASE( )

5. SUBSTR( ) 6. LTRIM( )

7. RTRIM( ) 8. TRIM( )

9. INSTR( ) 10. LENGTH( )

11. LEFT( ) 12. RIGHT( )

13. MID( )

A function is a special type of predefined command set that performs some operation and returns a single value.

The string functions of MySQL can manipulate the text string in many ways.

Some commonly used string functions are :

2 of 15

SNo

PName

Cost

1

Keyboard

730

2

Mouse

325

3

Projector

45000

4

Monitor

5600

Sample Table: Peripherals

3 of 15

3.LOWER( )/LCASE( )

This function converts a string into lowercase.

4 of 15

4.UPPER( )/UCASE( )

This function converts the given string into upper case.

5 of 15

5.SUBSTR( )

This function extracts a substring from a given string.

6 of 15

6.LTRIM( )

This function removes leading spaces i.e., spaces from the left of given string.

7 of 15

7.RTRIM( )

This function removes trailing spaces i.e., spaces from the right of given string.

8 of 15

8.TRIM( )

This function removes leading and trailing spaces from a given string. It performs combined functions of LTRIM( ) and RTRIM( )

9 of 15

10 of 15

11 of 15

9.INSTR( )

This function searches for given second string into the given first string.

12 of 15

10.LENGTH( )

This function returns the length of a given string in bytes

13 of 15

11.LEFT( )

This function returns the leftmost number of characters as specified

14 of 15

12.RIGHT( )

This function returns the rightmost number of characters as specified

15 of 15

13.MID( )

This function returns a substring from the specified position