Professional Documents
Culture Documents
UPPER(str):-
UCASE() is a synonym for UPPER().
Returns the string str with all characters changed to uppercase .
Query Example:-
(i) Write SQL Query to display all names of employees in upper case from emp table.
LOWER(str)
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
Page 1
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
Query Example:-
(i) Write SQL Query to display all names of employees in lower case from emp table.
If negative value for pos. , the beginning of the substring is pos characters from the end
of the string, rather than the beginning.
If len is less than 1, the result is the empty string.
Extract substring always from left to right.
Position starts from 1.
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
Page 2
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
Query Example 1:- display first 5 character of empoyees name from emp table.
LENGTH(str)
Returns the length of the string str, measured in bytes.
SELECT LENGTH('text'); 4
SELECT length('computer'); 8
SELECT length('informatic practices'); 20
Query Example 1:- display number of digit of salary for each employee from emp table.
LEFT(str,len)
Returns the leftmost len characters from the string str.
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
Page 3
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
RIGHT(str,len)
Returns the rightmost len characters from the string str.
Character extract from left to right always
INSTR(str,substr)
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
Page 4
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
Returns the position of the first occurrence of substring substr in string str.
Returns 0 if substring substr is not found in str.
It is not case sensitive.
LTRIM(str)
Returns the string str with leading space characters removed.
SELECT LTRIM(' barbar'); 'barbar'
SELECT ltrim(' informatic practices'); 'informatic practices'
Query Example 1:- display name of employees by removing any leading space in their name from emp table.
RTRIM(str)
Returns the string str with trailing space characters removed.
Query Example 1:- display name of employees by removing any trailing space in their name from emp table.
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
Page 5
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
Returns the string str with all remstr prefixes or suffixes removed. If none of the
specifiers BOTH, LEADING, or TRAILING is given, BOTH is assumed. remstr is optional and, if not
specified, spaces are removed.
it is Case Sensitive
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
Page 6
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
ASCII(str) Returns the numeric value of the leftmost character of the string str.
CHAR(str) returns a string consisting of the characters given by the code values of
those integers.
CONCAT(str1,str Returns the string that results from concatenating the arguments.
2,...) mysql> SELECT CONCAT('My', 'S', 'QL'); -> 'MySQL'
mysql> SELECT CONCAT('My', NULL, 'QL'); -> NULL
mysql> SELECT CONCAT(14.3); -> '14.3'
REPEAT(str,coun Returns a string consisting of the string str repeated count times.
t)
mysql> SELECT REPEAT('MySQL', 3); -> 'MySQLMySQLMySQL'
REVERSE(str) Returns the string str with the order of the characters reversed.
Video of this topic uploaded in YouTube Channel “Learn with AKJoshi” Watch,Subscribe and Like
Page 7