String Functions
Learn about string functions in MariaDB Server. This section details SQL functions for manipulating, searching, and formatting text strings, essential for data cleansing and presentation.
Return the ASCII value of the first character. This function returns the numeric ASCII code for the leftmost character of the input string.
Return the binary representation of a number. This function converts a number to its binary string equivalent.
Cast a string to a binary string. This operator converts a character string to a binary string, often used for case-sensitive comparisons.
Return the length of a string in bits. This function calculates the size of the string in bits (length in bytes multiplied by 8).
Complete CAST reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples with comprehensive examples and best.
Return the character for each integer passed. This function interprets arguments as integer ASCII values and returns a string of those characters.
Return the length of a string in characters. This function counts the number of characters in the string, treating multi-byte characters as single units.
Synonym for CHAR_LENGTH(). Returns the number of characters in the string.
Return the character for a specific ASCII value. This function is similar to CHAR() but accepts a single integer argument.
Complete CONCAT reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples with comprehensive examples and.
Concatenate with separator. This function joins strings with a specified separator. It skips NULL values during concatenation.
Complete CONVERT() reference: CONVERT(expr,type) and CONVERT(expr USING charset) syntax, SIGNED/UNSIGNED/BINARY/CHAR types, and CAST() differences.
Return the string at a specific index. This function returns the N-th string from a list of arguments.
Return a string representation of bits. This function generates a string based on the bits set in a number, using specified 'on' and 'off' strings.
Extract a value from XML. This function returns the text content of an XML fragment matching a given XPath expression.
Return the index of a string in a list. This function returns the position of the first argument within the subsequent list of arguments.
Return the index of a string in a comma-separated list. This function finds the position of a string within a list of strings separated by commas.
Format a number. This function formats a number to a format like '#,###,###.##', rounded to a specified number of decimal places.
Decode a base-64 encoded string. This function takes a base-64 string and returns the decoded binary result.
Return the hexadecimal representation. This function converts a number or string to its hexadecimal string equivalent.
Insert a substring into a string. This function inserts a string within another string at a specified position and length, replacing existing characters.
Return the position of the first occurrence of a substring. This function locates a substring within a string and returns its index.
Synonym for LOWER(). Converts a string to lowercase characters.
Return the leftmost characters. This function returns the specified number of characters from the beginning (left) of a string.
Return the length of a string in bytes. This function counts the number of bytes in the string, which may differ from character count for multi-byte strings.
Return the length of a string in bytes. This function is a synonym for LENGTH() in default mode, returning the byte count.
Complete LIKE operator reference: LIKE/NOT LIKE pattern matching syntax, % and _ wildcards, ESCAPE clause, NULL behavior, and collation case-sensitivity.
Read a file from the server. This function reads the content of a file located on the server host and returns it as a string.
Return the position of the first occurrence of a substring. This function finds the starting position of a substring within a string.
Convert a string to lowercase. This function returns the string with all characters converted to lowercase.
Left-pad a string. This function pads a string on the left side with a specified string until it reaches a certain length.
Remove leading spaces. This function returns the string with any leading whitespace characters removed.
Return a set of comma-separated strings. This function returns a string consisting of substrings corresponding to the set bits in a given number.
Perform a full-text search. This construct searches for a text query against a set of columns indexed with a FULLTEXT index.
Synonym for SUBSTRING(). Returns a substring starting at a specified position for a given length.
Generate a sort key for natural ordering. This function produces a key that allows strings containing numbers to be sorted in a human-readable order.
Negated pattern matching. This operator tests whether a string does NOT match a specified SQL pattern.
Negated regular expression matching. This operator tests whether a string does NOT match a specified regular expression pattern.
Return the length of a string in bytes. This function is a synonym for LENGTH() and returns the number of bytes in the string.
Return the numeric value of the first character. This function returns the code for the leftmost character, supporting multi-byte characters.
Synonym for LOCATE(). Returns the position of the first occurrence of a substring within a string.
Quote a string for SQL usage. This function produces a string ready for use as a data value in an SQL statement, escaping special characters.
Repeat a string. This function returns a string consisting of the input string repeated a specified number of times.
Complete REPLACE Function reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples for production use.
Reverse a string. This function returns the string with the order of its characters reversed.
Return the rightmost characters. This function returns the specified number of characters from the end (right) of a string.
Right-pad a string. This function pads a string on the right side with a specified string until it reaches a certain length.
Remove trailing spaces. This function returns the string with any trailing whitespace characters removed.
Format strings with arbitrary patterns. This function allows complex string formatting using a pattern string and arguments.
Return the Soundex string. This function calculates the Soundex key for a string, allowing comparison of words that sound similar.
Compare strings by sound. This operator tests if two strings have the same Soundex value, useful for fuzzy matching.
Return a string of spaces. This function returns a string consisting of a specified number of space characters.
Compare two strings. This function returns 0 if strings are equal, -1 if the first is smaller, and 1 if the first is larger.
SUBSTR() is a synonym for SUBSTRING(), returning a substring from a string.
Complete SUBSTRING() reference: syntax forms (pos,len, FROM/FOR), negative position from end, NULL handling, and Oracle sql_mode position 0 behavior.
Complete SUBSTRING_INDEX() reference: SUBSTRING_INDEX(str,delim,count) syntax, positive/negative count, case-sensitive delimiter, NULL rules.
Encode a string to base-64. This function converts a string argument to its base-64 encoded form.
Convert to string. This function converts a value (often date/time) to a string, potentially using a format mask.
Remove spaces from both ends. This function removes leading and trailing whitespace (or other specified characters) from a string.
Oracle-compatible TRIM function. This version of TRIM provides compatibility with Oracle's syntax for removing characters from a string.
Understand Type Conversion in MariaDB. Learn the rules for implicit conversion during comparisons and arithmetic, and how to use CAST for predictable results.
Synonym for UPPER(). Converts a string to uppercase characters.
Convert hexadecimal to string. This function interprets pairs of hexadecimal digits as numbers and converts them to the characters they represent.
Replace a portion of XML. This function replaces a section of XML markup matching an XPath expression with a new XML fragment.
Convert a string to uppercase. This function returns the string with all characters converted to uppercase.
Return the weight string. This function returns the binary string that represents the sorting and comparison value of the input string.
Learn about regular expression functions in MariaDB Server. This section details SQL functions for powerful pattern matching and manipulation of string data using regular expressions.
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?

