Collections:
SUBSTRING() - Substring at Given Position
How to extract a substring from a string at a given position using the SUBSTRING() functions?
✍: FYIcenter.com
SUBSTRING(str, pos, len) is a MySQL built-in function that
returns a substring from a string starting at a given position
for a given length.
For example:
SET @str = 'dba.FYIcenter.com'; SELECT SUBSTRING(@str, 5, 9); -- +-----------------------+ -- | SUBSTRING(@str, 5, 9) | -- +-----------------------+ -- | FYIcenter | -- +-----------------------+
Reference information of the SUBSTRING() function:
SUBSTRING(str, pos, len): substr Return a substring len characters long from string str, starting at position pos. It returns NULL if any of its arguments are NULL. Arguments, return value and availability: str: Required. The string that will be extracted from. pos: Required. The starting position of the substring to extract. len: Optional. The length of the substring to extract. substr: Return value. The substring extracted. Available since MySQL 4.0.
Related MySQL functions:
⇒ SUBSTRING_INDEX() - Substring in Delimited String
⇐ SUBSTR() - Synonym for SUBSTRING()
2023-11-13, 3436🔥, 0💬
Popular Posts:
What is SQL Server Transact-SQL (T-SQL)? SQL Server Transact-SQL, also called T-SQL, is an extension...
What Are the Differences between BINARY and VARBINARY in MySQL? Both BINARY and VARBINARY are both b...
What Happens to Your Transactions When ERROR 1205 Occurred in MySQL? If your transaction receives th...
How To Revise and Re-Run the Last SQL Command in Oracle? If executed a long SQL statement, found a m...
Is SQL Server Transact-SQL case sensitive? No. Transact-SQL is not case sensitive. Like the standard...