Page History
...
Converts a string to lowercase.
Example
Code Block |
---|
SELECT LOWER(Fname) FROM Employee |
...
UPPER
Converts a string to uppercase.
Example
Code Block |
---|
SELECT UPPER(Fname) FROM Employee |
...
LEFT
Returns the leftmost number of characters.
Example
Code Block |
---|
SELECT LEFT(Fname, 2) FROM Employee |
RIGHT
Returns the rightmost number of characters.
Example
Code Block |
---|
SELECT RIGHT(Fname, 2) FROM Employee |
...
LOCATE
LOCATE(searchString, string [, start_position])
Returns the location of a search string in a string. If a start position is used, the characters before it are ignored. If position is negative, the rightmost location is returned. 0 is returned if the search string is not found.
Example
Code Block |
---|
SELECT Fname, LOCATE('le',Fname) FROM Employee |
POSITION
POSITION(searchString, string)
Returns the location of a search string in a string. See also LOCATE.
Example
SELECT POSITION('J', Fname) FROM Employee
Code Block |
---|
LPAD, RPAD
LPAD(string, int [, paddingString])
RPAD(string, int [, paddingString])
Left pad the string to the specified length. If the length is shorter than the string, it will be truncated at the end. If the padding string is not set, spaces will be used. The RPAD Right pad the string to the specified length. If the length is shorter than the string, it will be truncated. If the padding string is not set, spaces will be used. Example: RPAD(AMOUNT, 10, '*')
Example
Code Block |
---|
SELECT LPAD(Fname,9,'@') FROM Employee |
Example
Code Block |
---|
SELECT RPAD(Fname,9,'*') FROM Employee |
LTRIM, RTRIM
LTRIM removes all leading spaces from a string. RTRIM removes all trailing spaces from a string.
Example
Code Block |
---|
SELECT LTRIM(Fname),City FROM Employee |
Example
Code Block |
---|
SELECT RTRIM(Fname),City FROM Employee |
TRIM
TRIM([option] [trimString] [FROM] string)
...