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 :
SNo | PName | Cost |
1 | Keyboard | 730 |
2 | Mouse | 325 |
3 | Projector | 45000 |
4 | Monitor | 5600 |
Sample Table: Peripherals
3.LOWER( )/LCASE( )
This function converts a string into lowercase.
4.UPPER( )/UCASE( )
This function converts the given string into upper case.
5.SUBSTR( )
This function extracts a substring from a given string.
6.LTRIM( )
This function removes leading spaces i.e., spaces from the left of given string.
7.RTRIM( )
This function removes trailing spaces i.e., spaces from the right of given string.
8.TRIM( )
This function removes leading and trailing spaces from a given string. It performs combined functions of LTRIM( ) and RTRIM( )
9.INSTR( )
This function searches for given second string into the given first string.
10.LENGTH( )
This function returns the length of a given string in bytes
11.LEFT( )
This function returns the leftmost number of characters as specified
12.RIGHT( )
This function returns the rightmost number of characters as specified
13.MID( )
This function returns a substring from the specified position