In SQL Server, you can convert any uppercase string to lowercase by using the LOWER()
function.
Simply provide the string as an argument when you call the function, and it will be returned in lowercase form.
In SQL Server, you can convert any uppercase string to lowercase by using the LOWER()
function.
Simply provide the string as an argument when you call the function, and it will be returned in lowercase form.
In MySQL, you can use the LOWER()
function to convert any uppercase characters to lowercase. Alternatively, you can use the LCASE()
function, which is a synonym for LOWER()
.
The syntax goes like this:
LOWER(str)
Or…
LCASE(str)
Where str
is the string you want converted to lowercase.
In MySQL, you can use the UPPER()
function to convert any lowercase characters to uppercase. Alternatively, you can use the UCASE()
function, which is a synonym for UPPER()
.
The syntax goes like this:
UPPER(str)
Or…
UCASE(str)
Where str
is the string you want converted to uppercase.
When working with MySQL databases, you might occasionally find yourself needing to select only a certain number of characters from the left or right of a string. In such cases, you can use the LEFT()
and RIGHT()
functions to do just that.
Here’s the syntax for both of these functions:
LEFT(str,len) RIGHT(str,len)
Where str
is the string that contains the substring you need to return, and len
is the number of characters from the left you want returned.
If you ever need to reverse the order of a string value in MySQL – that is, return a string with the order of the characters reversed – the REVERSE()
function is what you need.
Starting from SQL Server 2008, the REVERSE()
function can be used to reverse the order of a string. That is, it returns the characters in the string in reverse order.
Here’s the syntax:
REVERSE ( string_expression )
Where string_expression
is an expression of a string or binary data type. It can be a constant, variable, or column of either character or binary data.
Occasionally when working with MySQL databases, you might find yourself needing to add multiple space characters to a string.
Maybe you need to pad a string by adding leading or trailing spaces. Or maybe you need to replace a single space within the string with many spaces. Either way, MySQL has the SPACE()
function to help you.
The SPACE()
function is an easy way for you to return as many space characters as you need.
When working with databases and the associated data, sometimes you need to insert a space when joining two strings together, or sometimes you need to replace a character with a space.
And then sometimes you need to insert multiple spaces. Here are 3 ways to return a string of multiple spaces in SQL Server using T-SQL.
MySQL has a TRIM()
function that enables you to remove leading and/or trailing whitespace from a string.
You can also use it to remove other specified characters from either side (or both sides) of the string.
This article explains how to remove specified leading/trailing characters from the string.
MySQL has a TRIM()
function that enables you to remove leading and/or trailing whitespace from a string.
You can also use it to remove other specified characters from either side (or both sides) of the string.
This article focuses on removing whitespace from both sides of the string.