{"id":16549,"date":"2021-06-23T23:15:27","date_gmt":"2021-06-23T13:15:27","guid":{"rendered":"https:\/\/database.guide\/?p=16549"},"modified":"2021-06-23T23:15:27","modified_gmt":"2021-06-23T13:15:27","slug":"mariadb-string-functions-full-list","status":"publish","type":"post","link":"https:\/\/database.guide\/mariadb-string-functions-full-list\/","title":{"rendered":"MariaDB String Functions (Full List)"},"content":{"rendered":"\n<p>This article contains a full list of built-in MariaDB string functions and operators.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>The following is a list of string functions and operators available in MariaDB. Click on each function or operator name to see an explanation of the function, its syntax, and examples.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Function<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code><a href=\"https:\/\/database.guide\/how-ascii-works-in-mariadb\/\" data-type=\"post\" data-id=\"15723\">ASCII()<\/a><\/code><\/td><td>Returns the numeric ASCII code of the leftmost character of a given string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-bin-works-in-mariadb\/\" data-type=\"post\" data-id=\"15920\">BIN()<\/a><\/code><\/td><td>Returns a string containing the binary representation of a number.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-the-binary-operator-works-in-mariadb\/\" data-type=\"post\" data-id=\"15924\">BINARY<\/a><\/code><\/td><td>Casts the string following it to a binary string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-bit_length-works-in-mariadb\/\" data-type=\"post\" data-id=\"15933\">BIT_LENGTH()<\/a><\/code><\/td><td>Returns the number of bits in a string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-cast-works-in-mariadb\/\" data-type=\"post\" data-id=\"15938\">CAST()<\/a><\/code><\/td><td>Casts a value of one type to another type.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-char-works-in-mariadb\/\" data-type=\"post\" data-id=\"15757\">CHAR()<\/a><\/code><\/td><td>Returns string based on the integer values for the individual characters.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-char_length-works-in-mariadb\/\" data-type=\"post\" data-id=\"15958\">CHAR_LENGTH()<\/a><\/code><\/td><td>Returns the length of a string, measured in characters.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/mariadb-character_length-explained\/\" data-type=\"post\" data-id=\"15965\">CHARACTER_LENGTH()<\/a><\/code><\/td><td>Synonym for&nbsp;<code>CHAR_LENGTH()<\/code>.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-chr-works-in-mariadb\/\" data-type=\"post\" data-id=\"15761\">CHR()<\/a><\/code><\/td><td>Returns a character based on the code values provided as an argument.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-concat-works-in-mariadb\/\" data-type=\"post\" data-id=\"16016\">CONCAT()<\/a><\/code><\/td><td>Enables you to concatenate two or more strings.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-concat_ws-works-in-mariadb\/\" data-type=\"post\" data-id=\"16027\">CONCAT_WS()<\/a><\/code><\/td><td>Allows you to add a separator while concatenating one or more strings.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-convert-works-in-mariadb\/\" data-type=\"post\" data-id=\"15951\">CONVERT()<\/a><\/code><\/td><td>Converts a value to another data type.&nbsp;<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-elt-works-in-mariadb\/\" data-type=\"post\" data-id=\"16035\">ELT()<\/a><\/code><\/td><td>Returns a list item at a given position in the list.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-export_set-works-in-mariadb\/\" data-type=\"post\" data-id=\"16069\">EXPORT_SET()<\/a><\/code><\/td><td>Returns an on string for every bit set, an off string for every bit not set.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-extractvalue-works-in-mariadb\/\" data-type=\"post\" data-id=\"16086\">EXTRACTVALUE()<\/a><\/code><\/td><td>Returns CDATA from an XML fragment.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-field-works-in-mariadb\/\" data-type=\"post\" data-id=\"16047\">FIELD()<\/a><\/code><\/td><td>Returns the position of a given string or number within a list of arguments. The function returns the index (position) of the first argument in the list of subsequent arguments.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-find_in_set-works-in-mariadb\/\" data-type=\"post\" data-id=\"16056\">FIND_IN_SET()<\/a><\/code><\/td><td>Returns the index of a given list item within a string list (for example \u2018item1, item2, item3,\u2026\u2019).<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-format-works-in-mariadb\/\" data-type=\"post\" data-id=\"16108\">FORMAT()<\/a><\/code><\/td><td>Allows you to format a number to a specific format.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-from_base64-works-in-mariadb\/\" data-type=\"post\" data-id=\"16118\">FROM_BASE64()<\/a><\/code><\/td><td>Decodes a base-64 encoded string and returns the result.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-hex-works-in-mariadb\/\" data-type=\"post\" data-id=\"16134\">HEX()<\/a><\/code><\/td><td>Converts a string to its hexadecimal representation.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-the-insert-function-works-in-mariadb\/\" data-type=\"post\" data-id=\"16152\">INSERT()<\/a><\/code><\/td><td>Inserts a string into another string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-instr-works-in-mariadb\/\" data-type=\"post\" data-id=\"16158\">INSTR()<\/a><\/code><\/td><td>Returns the position of the first occurrence of a substring within a string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/mariadb-lcase-explained\/\" data-type=\"post\" data-id=\"16194\">LCASE()<\/a><\/code><\/td><td>Synonym for&nbsp;<code>LOWER()<\/code>&nbsp;(converts a string to lowercase).<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-left-works-in-mariadb\/\" data-type=\"post\" data-id=\"16213\">LEFT()<\/a><\/code><\/td><td>Returns the leftmost characters from a string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-length-works-in-mariadb\/\" data-type=\"post\" data-id=\"15972\">LENGTH()<\/a><\/code><\/td><td>Returns the length of a string, measured in bytes. Behaves differently, depending on whether it&#8217;s in Oracle mode or not. <\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/mariadb-lengthb-explained\/\" data-type=\"post\" data-id=\"15987\">LENGTHB()<\/a><\/code><\/td><td>Returns the length of a string, measured in bytes. Behaves consistently regardless of whether it&#8217;s in Oracle mode or not.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-the-like-operator-works-in-mariadb\/\" data-type=\"post\" data-id=\"16238\">LIKE<\/a><\/code><\/td><td>Performs pattern matching using an SQL pattern.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-load_file-works-in-mariadb\/\" data-type=\"post\" data-id=\"16270\">LOAD_FILE()<\/a><\/code><\/td><td>Reads a file and returns its contents as a string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-locate-works-in-mariadb\/\" data-type=\"post\" data-id=\"16162\">LOCATE()<\/a><\/code><\/td><td>Returns the position of a substring within a string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-lower-works-in-mariadb\/\" data-type=\"post\" data-id=\"16186\">LOWER()<\/a><\/code><\/td><td>Converts a string to lowercase.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-lpad-works-in-mariadb\/\" data-type=\"post\" data-id=\"16284\">LPAD()<\/a><\/code><\/td><td>Allows you to pad the left part of a string with one or more characters.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-ltrim-works-in-mariadb\/\" data-type=\"post\" data-id=\"16307\">LTRIM()<\/a><\/code><\/td><td>Trims whitespace from the beginning of a string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-make_set-works-in-mariadb\/\" data-type=\"post\" data-id=\"16365\">MAKE_SET()<\/a><\/code><\/td><td>Returns a set value (a string containing substrings separated by&nbsp;<code>,<\/code>&nbsp;characters) consisting of the characters specified as arguments when you call the function.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-match-against-works-in-mariadb\/\" data-type=\"post\" data-id=\"16389\">MATCH AGAINST<\/a><\/code><\/td><td>Performs a full-text search.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-mid-works-in-mariadb\/\" data-type=\"post\" data-id=\"16420\">MID()<\/a><\/code><\/td><td>Returns a substring starting from the specified position (synonym for&nbsp;<code>SUBSTRING()<\/code>).<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-not-like-works-in-mariadb\/\" data-type=\"post\" data-id=\"16254\">NOT LIKE<\/a><\/code><\/td><td>Negation of the&nbsp;<code>LIKE<\/code>&nbsp;operator.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-not-regexp-works-in-mariadb\/\" data-type=\"post\" data-id=\"16610\">NOT REGEXP<\/a><\/code><\/td><td>Negation of&nbsp;<code>REGEXP<\/code>.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-not-rlike-works-in-mariadb\/\" data-type=\"post\" data-id=\"16621\">NOT RLIKE<\/a><\/code><\/td><td>Negation of&nbsp;<code>RLIKE<\/code>.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-octet_length-works-in-mariadb\/\" data-type=\"post\" data-id=\"16007\">OCTET_LENGTH()<\/a><\/code><\/td><td>Returns the length of a string, measured in bytes (synonym of&nbsp;<code>LENGTH()<\/code>).<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-ord-works-in-mariadb\/\" data-type=\"post\" data-id=\"15748\">ORD()<\/a><\/code><\/td><td>Returns the numeric value of the leftmost character of a given string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-position-works-in-mariadb\/\" data-type=\"post\" data-id=\"16440\">POSITION()<\/a><\/code><\/td><td>Returns the position of the first occurrence of a substring within the string (synonym for&nbsp;<code>LOCATE()<\/code>, but with a slightly different syntax).<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-quote-works-in-mariadb\/\" data-type=\"post\" data-id=\"16446\">QUOTE()<\/a><\/code><\/td><td>Quotes a string to produce a result that can be used as a properly escaped data value in an SQL statement.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-regexp-works-in-mariadb\/\" data-type=\"post\" data-id=\"16599\">REGEXP<\/a><\/code><\/td><td>Determines whether or not a string matches a regular expression.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-regexp_instr-works-in-mariadb\/\" data-type=\"post\" data-id=\"16630\">REGEXP_INSTR()<\/a><\/code><\/td><td>Returns the starting index of a substring that matches the regular expression pattern.<\/td><\/tr><tr><td><code>REGEXP_LIKE()<\/code><\/td><td>Once implemented, this function will determine whether or not a string matches a regular expression (same as <code>REGEXP<\/code>). <br><br>As of this writing, <code>REGEXP_LIKE()<\/code> is has been requested, but not added to MariaDB. See this <a rel=\"noreferrer noopener\" href=\"https:\/\/jira.mariadb.org\/browse\/MDEV-16599\" target=\"_blank\">JIRA request<\/a> for its latest status.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-regexp_replace-works-in-mariadb\/\" data-type=\"post\" data-id=\"16653\">REGEXP_REPLACE()<\/a><\/code><\/td><td>Replaces occurrences of the substring within a string that matches the given regular expression pattern.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-regexp_substr-works-in-mariadb\/\" data-type=\"post\" data-id=\"16641\">REGEXP_SUBSTR()<\/a><\/code><\/td><td>Returns the substring that matches the given regular expression pattern.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-repeat-works-in-mariadb\/\" data-type=\"post\" data-id=\"16450\">REPEAT()<\/a><\/code><\/td><td>Used to repeat a string as many times as required.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-replace-works-in-mariadb\/\" data-type=\"post\" data-id=\"16461\">REPLACE()<\/a><\/code><\/td><td>Replaces all occurrences of a substring with another string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-reverse-works-in-mariadb\/\" data-type=\"post\" data-id=\"16469\">REVERSE()<\/a><\/code><\/td><td>Returns a string with the order of the characters reversed.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-right-works-in-mariadb\/\" data-type=\"post\" data-id=\"16229\">RIGHT()<\/a><\/code><\/td><td>Returns the rightmost characters from a string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-rlike-works-in-mariadb\/\" data-type=\"post\" data-id=\"16613\">RLIKE<\/a><\/code><\/td><td>Determines whether or not a string matches a regular expression.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-rpad-works-in-mariadb\/\" data-type=\"post\" data-id=\"16295\">RPAD()<\/a><\/code><\/td><td>Allows you to pad the right part of a string with one or more characters.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-rtrim-works-in-mariadb\/\" data-type=\"post\" data-id=\"16314\">RTRIM()<\/a><\/code><\/td><td>Trims whitespace from the right-hand side of a string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-soundex-works-in-mariadb\/\" data-type=\"post\" data-id=\"16474\">SOUNDEX()<\/a><\/code><\/td><td>Returns a Soundex string from a given string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-sounds-like-works-in-mariadb\/\" data-type=\"post\" data-id=\"16485\">SOUNDS LIKE<\/a><\/code><\/td><td>Compares sounds.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-space-works-in-mariadb\/\" data-type=\"post\" data-id=\"16493\">SPACE()<\/a><\/code><\/td><td>Returns a string consisting of a specified number of space characters.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-strcmp-works-in-mariadb\/\" data-type=\"post\" data-id=\"16500\">STRCMP()<\/a><\/code><\/td><td>Compares two strings according to their sort order.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/mariadb-substr-explained\/\" data-type=\"post\" data-id=\"16414\">SUBSTR()<\/a><\/code><\/td><td>Returns a substring starting from the specified position (synonym for&nbsp;<code>SUBSTRING()<\/code>).<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-substring-works-in-mariadb\/\" data-type=\"post\" data-id=\"16403\">SUBSTRING()<\/a><\/code><\/td><td>Returns a substring starting from the specified position.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-substring_index-works-in-mariadb\/\" data-type=\"post\" data-id=\"16428\">SUBSTRING_INDEX()<\/a><\/code><\/td><td>Returns everything before or after a certain character (or characters) in a string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-to_base64-works-in-mariadb\/\" data-type=\"post\" data-id=\"16123\">TO_BASE64()<\/a><\/code><\/td><td>Converts a string to a base-64 encoded string and returns the result.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-to_char-works-in-mariadb\/\" data-type=\"post\" data-id=\"17790\">TO_CHAR()<\/a><\/code><\/td><td>Converts a date\/time\/timestamp expression to a string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-trim-works-in-mariadb\/\" data-type=\"post\" data-id=\"16317\">TRIM()<\/a><\/code><\/td><td>Trims whitespace (or other specified characters) from the start and\/or end of a string.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-trim_oracle-works-in-mariadb\/\" data-type=\"post\" data-id=\"16344\">TRIM_ORACLE()<\/a><\/code><\/td><td>Synonym for the Oracle mode version of the&nbsp;<code>TRIM()<\/code>&nbsp;function.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/mariadb-ucase-explained\/\" data-type=\"post\" data-id=\"16209\">UCASE()<\/a><\/code><\/td><td>Synonym for&nbsp;<code>UPPER()<\/code>&nbsp;(converts a string to uppercase).<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-uncompressed_length-works-in-mariadb\/\" data-type=\"post\" data-id=\"16507\">UNCOMPRESSED_LENGTH()<\/a><\/code><\/td><td>Returns the length of a compressed string before it was compressed with the&nbsp;<code>COMPRESS()<\/code>&nbsp;function.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-unhex-works-in-mariadb\/\" data-type=\"post\" data-id=\"16146\">UNHEX()<\/a><\/code><\/td><td>Interprets each pair of characters in the argument as a hexadecimal number and converts it to the byte represented by the number.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-updatexml-works-in-mariadb\/\" data-type=\"post\" data-id=\"16546\">UPDATEXML()<\/a><\/code><\/td><td>Replaces a single portion of a given fragment of XML markup with a new XML fragment.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-upper-works-in-mariadb\/\" data-type=\"post\" data-id=\"16199\">UPPER()<\/a><\/code><\/td><td>Converts a string to uppercase.<\/td><\/tr><tr><td><code><a href=\"https:\/\/database.guide\/how-weight_string-works-in-mariadb\/\" data-type=\"post\" data-id=\"16540\">WEIGHT_STRING()<\/a><\/code><\/td><td>Returns the weight string for the input string. This function is a debugging function intended for internal use.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article contains a full list of built-in MariaDB string functions and operators.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[101,67],"class_list":["post-16549","post","type-post","status-publish","format-standard","hentry","category-mariadb","tag-reference","tag-string-functions"],"_links":{"self":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts\/16549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/comments?post=16549"}],"version-history":[{"count":33,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts\/16549\/revisions"}],"predecessor-version":[{"id":17847,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts\/16549\/revisions\/17847"}],"wp:attachment":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/media?parent=16549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/categories?post=16549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/tags?post=16549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}