# SQL Functions

- [Functions & Operators](https://mariadb.com/docs/server/reference/sql-functions/function-and-operator-reference.md): Comprehensive reference of all SQL functions and operators. This index lists built-in functions for string manipulation, math, date/time, and more.
- [Aggregate Functions](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions.md): Perform calculations on multiple rows to return a single value. Includes standard SQL functions like SUM, AVG, COUNT, MIN, and MAX, often used with GROUP BY.
- [AVG](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/avg.md): Calculate the average value. This function computes the arithmetic mean of a numeric expression, ignoring NULL values.
- [BIT\_AND](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/bit_and.md): Perform a bitwise AND operation. This function returns the result of performing a bitwise AND on all values in a given expression.
- [BIT\_OR](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/bit_or.md): Perform a bitwise OR operation. This function returns the result of performing a bitwise OR on all values in a given expression.
- [BIT\_XOR](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/bit_xor.md): Perform a bitwise XOR operation. This function returns the result of performing a bitwise XOR on all values in a given expression.
- [COUNT DISTINCT](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/count-distinct.md): Count unique values. This function returns the number of distinct, non-NULL values found in the specified column or expression.
- [COUNT](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/count.md): Complete COUNT() function reference: COUNT(\*) and COUNT(expr) syntax, COUNT(DISTINCT) usage, GROUP BY aggregation, and OVER(PARTITION BY) window syntax.
- [GROUP\_CONCAT](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/group_concat.md): Complete GROUP\_CONCAT reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples for production use.
- [JSON\_ARRAYAGG](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/json_arrayagg.md): Aggregate values into a JSON array. This function aggregates a result set column into a single JSON array.
- [JSON\_OBJECTAGG](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/json_objectagg.md): Aggregate key-value pairs into a JSON object. This function aggregates two columns or expressions into a single JSON object.
- [MAX](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/max.md): Find the maximum value. This function returns the highest value in a set of values, applicable to numbers, strings, and dates.
- [MIN](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/min.md): Find the minimum value. This function returns the lowest value in a set of values, applicable to numbers, strings, and dates.
- [STD](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/std.md): Calculate population standard deviation. This function returns the square root of the population variance. It is a synonym for STDDEV\_POP().
- [STDDEV](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/stddev.md): Calculate population standard deviation. This function is a synonym for STD() and STDDEV\_POP(), returning the square root of the population variance.
- [STDDEV\_POP](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/stddev_pop.md): Calculate population standard deviation. This function computes the standard deviation assuming the set of values represents the entire population.
- [STDDEV\_SAMP](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/stddev_samp.md): Calculate sample standard deviation. This function computes the standard deviation assuming the set of values represents a sample of the population.
- [SUM](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/sum.md): Calculate the total sum. This function returns the sum of all values in a numeric expression, ignoring NULL values.
- [VAR\_POP](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/var_pop.md): Calculate population variance. This function computes the statistical variance for a set of values assumed to be the entire population.
- [VAR\_SAMP](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/var_samp.md): Calculate sample variance. This function computes the statistical variance for a set of values assumed to be a sample of the population.
- [VARIANCE](https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/variance.md): Calculate population variance. This function is a synonym for VAR\_POP() and returns the variance of a set of values.
- [Control Flow Functions](https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions.md): Learn about control flow functions in MariaDB Server. This section details SQL functions like IF, CASE, and NULLIF, which enable conditional logic within your queries and stored routines.
- [CASE OPERATOR](https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/case-operator.md): Implement conditional logic in SQL queries. This operator evaluates conditions and returns a specific value when the first true condition is met.
- [DECODE\_ORACLE](https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/decode_oracle.md): Compare a value against a list of conditions. This Oracle-compatible function returns a corresponding result when a match is found, or a default value otherwise.
- [IF Function](https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/if-function.md): Complete IF() function reference: IF(expr1,expr2,expr3) conditional syntax, TRUE/NULL evaluation rules, return type context (numeric/string), and examples.
- [IFNULL](https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/ifnull.md): Replace NULL values with a fallback. This function returns the first argument if it's not NULL; otherwise, it returns the specified replacement value.
- [NULLIF](https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/nullif.md): Compare two expressions and return NULL if they are equal. If the expressions differ, the function returns the first expression.
- [NVL](https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/nvl.md): Synonym for IFNULL. This Oracle-compatible function returns the first argument if it is not NULL, or the second argument if the first is NULL.
- [NVL2](https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/nvl2.md): Return values based on NULL status. This function returns the second argument if the first is not NULL, and the third argument if the first is NULL.
- [Date & Time Functions](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions.md): Complete MariaDB date and time functions guide. Complete reference for formatting, calculations, conversions, time zones, and operations for production use.
- [Date and Time Units](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date-and-time-units.md): Reference keywords for date arithmetic. These units, such as DAY, HOUR, and MINUTE, specify the interval type used in functions like DATE\_ADD and EXTRACT.
- [ADD\_MONTHS](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/add_months.md): Add a specific number of months to a date. This Oracle-compatible function simplifies date calculations involving monthly intervals.
- [ADDDATE](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/adddate.md): Add a time interval to a date. This function performs date arithmetic, adding a specified value like days or hours to a starting date.
- [ADDTIME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/addtime.md): Add a time value to a date or time expression. This function sums two time arguments, returning a new time or datetime result.
- [CONVERT\_TZ](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/convert_tz.md): Convert a datetime value between time zones. This function shifts a timestamp from a source time zone to a target time zone.
- [CURDATE](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/curdate.md): Return the current date. This function outputs today's date as a value in 'YYYY-MM-DD' or YYYYMMDD format, depending on the context.
- [CURRENT\_DATE](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/current_date.md): Synonym for CURDATE(). Returns the current date as a value in 'YYYY-MM-DD' or YYYYMMDD format.
- [CURRENT\_TIME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/current_time.md): Synonym for CURTIME(). Returns the current time as a value in 'HH:MM:SS' or HHMMSS format.
- [CURRENT\_TIMESTAMP](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/current_timestamp.md): Synonym for NOW(). Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format.
- [CURTIME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/curtime.md): Return the current time. This function outputs the current time of day as a value in 'HH:MM:SS' or HHMMSS format.
- [DATE FUNCTION](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date-function.md): Extract the date part from a datetime expression. This function returns the year, month, and day portions, discarding the time component.
- [DATE\_ADD](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date_add.md): Complete DATE\_ADD() reference: DATE\_ADD(date, INTERVAL expr unit) syntax, negative interval support, unit keywords (DAY/MONTH/YEAR), and return types.
- [DATE\_FORMAT](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date_format.md): Complete DATE\_FORMAT reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples with comprehensive examples.
- [DATE\_SUB](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date_sub.md): Subtract a time interval from a date. This function calculates a past date by subtracting a specified unit, such as days, from a starting value.
- [DATEDIFF](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/datediff.md): Complete DATEDIFF() reference: DATEDIFF(expr1,expr2) syntax, date vs datetime expression handling, time component ignore, and positive/negative results.
- [DAY](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/day.md): Synonym for DAYOFMONTH(). Returns the day of the month (1-31) for a given date.
- [DAYNAME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayname.md): Return the name of the weekday. This function returns the full name of the day, such as 'Monday' or 'Sunday', for a given date.
- [DAYOFMONTH](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayofmonth.md): Return the day of the month. This function extracts the day portion of a date, returning a number from 1 to 31.
- [DAYOFWEEK](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayofweek.md): Return the weekday index. This function returns a number from 1 (Sunday) to 7 (Saturday) representing the day of the week.
- [DAYOFYEAR](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayofyear.md): Return the day of the year. This function returns a number from 1 to 366 indicating the day's position within the year.
- [EXTRACT](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/extract.md): Extract a specific part of a date. This function retrieves components like YEAR, MONTH, DAY, or HOUR from a date or datetime expression.
- [FORMAT\_PICO\_TIME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/format_pico_time.md): Format a time in picoseconds. This function converts a numeric picosecond value into a human-readable string with units like ps, ns, us, ms, s, m, h, or d.
- [FROM\_DAYS](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/from_days.md): Convert a day number to a date. This function returns a DATE value corresponding to the number of days since year 0.
- [FROM\_UNIXTIME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/from_unixtime.md): Convert a Unix timestamp to a datetime. This function formats a Unix timestamp as a date string or number in the current time zone.
- [GET\_FORMAT](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/get_format.md): Return a format string. This function provides standard format strings for DATE\_FORMAT and STR\_TO\_DATE based on regions like 'USA' or 'EUR'.
- [HOUR](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/hour.md): Extract the hour. This function returns the hour portion of a time or datetime value as a number from 0 to 23.
- [LAST\_DAY](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/last_day.md): Return the last day of the month. This function calculates the date of the final day for the month containing the given date.
- [LOCALTIME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/localtime.md): Synonym for NOW(). Returns the current date and time in the session time zone.
- [LOCALTIMESTAMP](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/localtimestamp.md): Synonym for NOW(). Returns the current date and time in the session time zone as a datetime value.
- [MAKEDATE](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/makedate.md): Create a date from a year and day of year. This function constructs a DATE value given a year and the day number within that year.
- [MAKETIME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/maketime.md): Create a time from hour, minute, and second. This function constructs a TIME value from three numeric arguments.
- [MICROSECOND](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/microsecond.md): Extract microseconds. This function returns the microsecond part of a time or datetime expression as a number from 0 to 999999.
- [Microseconds in MariaDB](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/microseconds-in-mariadb.md): Understand microsecond precision. This concept page explains how MariaDB stores and handles fractional seconds in time data types.
- [MINUTE](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/minute.md): Extract the minute. This function returns the minute portion of a time or datetime value as a number from 0 to 59.
- [MONTH](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/month.md): Extract the month. This function returns the month portion of a date as a number from 1 (January) to 12 (December).
- [MONTHNAME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/monthname.md): Return the name of the month. This function returns the full name of the month, such as 'January' or 'December', for a given date.
- [MONTHS\_BETWEEN](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/months_between.md): Calculate the difference between two months.
- [NOW](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/now.md): Complete NOW() function reference: NOW(\[precision]) and CURRENT\_TIMESTAMP synonyms, TIMESTAMP vs DATETIME types, timezone/DST handling, and fractional seconds.
- [PERIOD\_ADD](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/period_add.md): Add months to a period. This function adds a specified number of months to a period formatted as YYMM or YYYYMM.
- [PERIOD\_DIFF](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/period_diff.md): Calculate the difference between periods. This function returns the number of months between two periods formatted as YYMM or YYYYMM.
- [QUARTER](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/quarter.md): Return the quarter of the year. This function returns a number from 1 to 4 indicating the quarter for a given date.
- [SEC\_TO\_TIME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/sec_to_time.md): Convert seconds to time. This function returns a TIME value corresponding to the number of seconds elapsed from the start of the day.
- [SECOND](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/second.md): Extract the second. This function returns the second portion of a time or datetime value as a number from 0 to 59.
- [STR\_TO\_DATE](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/str_to_date.md): Complete STR\_TO\_DATE() reference: parse strings to DATE/TIME/DATETIME, format specifiers (%Y %m %d %H %i %s), invalid input handling, and SQL\_MODE errors.
- [SUBDATE](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/subdate.md): Subtract a time interval from a date. This synonym for DATE\_SUB calculates a past date by subtracting a specified unit from a starting value.
- [SUBTIME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/subtime.md): Subtract a time value. This function subtracts one time or datetime expression from another and returns the result.
- [SYSDATE](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/sysdate.md): Return the time of execution. Unlike NOW(), which returns the start time of the statement, SYSDATE() returns the time it executes.
- [TIME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/time-function.md): Extract the time portion. This function returns the time part of a time or datetime expression.
- [TIME\_FORMAT](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/time_format.md): Format a time. This function formats a time value according to a format string, similar to DATE\_FORMAT but for time values.
- [TIME\_TO\_SEC](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/time_to_sec.md)
- [TIMEDIFF](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/timediff.md): Subtract two time values. This function calculates the difference between two time or datetime expressions.
- [TIMESTAMP](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/timestamp-function.md): Convert to datetime or add time. With one argument, it returns a datetime; with two, it adds a time expression to a date or datetime.
- [TIMESTAMPADD](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/timestampadd.md): Add an interval to a timestamp. This function adds a specified integer number of units (like MONTH or SECOND) to a datetime expression.
- [TIMESTAMPDIFF](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/timestampdiff.md): Calculate the difference between timestamps. This function returns the difference between two datetime expressions in the specified unit.
- [TO\_DATE](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/to_date.md)
- [TO\_DAYS](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/to_days.md): Convert a date to a day number. This function returns the number of days between year 0 and the given date.
- [TO\_SECONDS](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/to_seconds.md): Convert a date to seconds. This function returns the number of seconds from year 0 to the given date or datetime.
- [TRUNC](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/trunc.md): Truncate a date. In Oracle mode, this function truncates a date value to a specified unit of measure.
- [UNIX\_TIMESTAMP](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/unix_timestamp.md): Return a Unix timestamp. This function returns the number of seconds since the Unix Epoch ('1970-01-01 00:00:00' UTC).
- [UTC\_DATE](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/utc_date.md): Return the current UTC date. This function returns the current Coordinated Universal Time date in 'YYYY-MM-DD' or YYYYMMDD format.
- [UTC\_TIME](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/utc_time.md): Return the current UTC time. This function returns the current Coordinated Universal Time in 'HH:MM:SS' or HHMMSS format.
- [UTC\_TIMESTAMP](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/utc_timestamp.md): Return the current UTC timestamp. This function returns the current Coordinated Universal Time date and time.
- [WEEK](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/week.md): Return the week number. This function returns the week number for a date, with an optional mode to define the start of the week.
- [WEEKDAY](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/weekday.md): Return the weekday index. This function returns the index of the day of the week (0=Monday, 6=Sunday).
- [WEEKOFYEAR](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/weekofyear.md): Return the calendar week. This function returns the week number of the date (1-53), equivalent to WEEK(date, 3).
- [YEAR](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/year.md): Extract the year. This function returns the year portion of a date as a number from 1000 to 9999.
- [YEARWEEK](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/yearweek.md): Return the year and week. This function returns the year and week number for a date, useful for grouping results by week.
- [Numeric Functions](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions.md): Learn about numeric functions in MariaDB Server. This section details SQL functions for performing mathematical calculations, rounding, and manipulating numeric values in your queries.
- [ABS](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/abs.md): Calculate absolute value. This function returns the non-negative value of a number, removing any negative sign.
- [ACOS](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/acos.md): Calculate arc cosine. This function returns the angle in radians whose cosine is the given number.
- [ASIN](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/asin.md): Calculate arc cosine. This function returns the angle in radians whose cosine is the given number.
- [ATAN](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/atan.md): Calculate arc tangent. This function returns the angle in radians whose tangent is the given number.
- [ATAN2](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/atan2.md): Calculate arc tangent of two variables. This function returns the angle in radians between the positive x-axis and the point (X, Y).
- [CEIL](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/ceil.md): Synonym for CEILING(). Rounds a number up to the nearest integer.
- [CEILING](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/ceiling.md): Round up to the nearest integer. This function returns the smallest integer value that is greater than or equal to the argument.
- [CONV](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/conv.md): Convert numbers between bases. This function transforms a number from one numeric base system to another.
- [COS](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/cos.md): Calculate cosine. This function returns the cosine of an angle given in radians.
- [COT](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/cot.md): Calculate cotangent. This function returns the cotangent of an angle given in radians.
- [CRC32](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/crc32.md): Compute cyclic redundancy check. This function returns a 32-bit unsigned integer representing the CRC32 checksum of a string.
- [CRC32C](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/crc32c.md): Compute CRC32C checksum. This function calculates a cyclic redundancy check value using the Castagnoli polynomial.
- [DEGREES](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/degrees.md): Convert radians to degrees. This function transforms an angle measured in radians to its equivalent in degrees.
- [DIV](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/div.md): Perform integer division. This operator divides one number by another and returns the integer result, discarding any remainder.
- [EXP](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/exp.md): Calculate exponential value. This function returns the value of e (the base of natural logarithms) raised to the power of the argument.
- [FLOOR](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/floor.md): Round down to the nearest integer. This function returns the largest integer value that is less than or equal to the argument.
- [LN](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/ln.md): Calculate natural logarithm. This function returns the logarithm of a number to the base e.
- [LOG](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/log.md): Calculate logarithm. This function returns the natural logarithm of a number, or the logarithm to a specified base if two arguments are provided.
- [LOG10](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/log10.md): Calculate base-10 logarithm. This function returns the logarithm of a number to the base 10.
- [LOG2](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/log2.md): Calculate base-2 logarithm. This function returns the logarithm of a number to the base 2.
- [MOD](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/mod.md): Calculate modulo. This function returns the remainder of a number divided by another number.
- [OCT](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/oct.md): Convert to octal. This function returns the octal string representation of a numeric argument.
- [PI](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/pi.md): Return the value of pi. This function returns the mathematical constant π (approximately 3.141593).
- [POW](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/pow.md): Synonym for POWER(). Returns the value of a number raised to the power of another number.
- [POWER](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/power.md): Calculate power. This function returns the value of a number raised to the specified exponent.
- [RADIANS](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/radians.md): Convert degrees to radians. This function transforms an angle measured in degrees to its equivalent in radians.
- [RAND](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/rand.md): Generate a random number. This function returns a random floating-point value between 0 and 1.
- [ROUND](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/round.md): Round a number. This function rounds a number to a specified number of decimal places.
- [SIGN](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/sign.md): Return the sign of a number. This function returns -1, 0, or 1 depending on whether the argument is negative, zero, or positive.
- [SIN](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/sin.md): Calculate sine. This function returns the sine of an angle given in radians.
- [SQRT](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/sqrt.md): Calculate square root. This function returns the non-negative square root of a number.
- [TAN](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/tan.md): Calculate tangent. This function returns the tangent of an angle given in radians.
- [TO\_NUMBER](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/to_number.md): Convert a string to a number. This Oracle-compatible function parses a string using a specified format and returns a numeric value.
- [TRUNCATE](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/truncate.md): Truncate a number. This function truncates a number to a specified number of decimal places.
- [Pseudo Columns](https://mariadb.com/docs/server/reference/sql-functions/pseudo-columns.md): MariaDB has pseudo columns that can be used for different purposes.
- [\_rowid](https://mariadb.com/docs/server/reference/sql-functions/pseudo-columns/_rowid.md): Access the unique row identifier. This pseudo column often aliases the primary key, allowing direct row access even if the primary key column name is unknown.
- [Secondary Functions](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions.md): Explore secondary functions in MariaDB Server. This section details various SQL functions that support specialized operations, enhancing data manipulation and analysis beyond core functionalities.
- [Bit Functions and Operators](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators.md): Perform bitwise logic and manipulation. This section covers operators like AND, OR, XOR, and functions for shifting bits or counting set bits in binary data.
- [BIT\_COUNT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bit_count.md): Count the set bits. This function returns the number of bits that are set to 1 in the binary representation of a number.
- [~](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-not.md): Invert all bits. This unary operator flips every bit in the operand, changing 1s to 0s and 0s to 1s.
- [|](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-or.md): Perform bitwise OR. This operator compares bits and returns 1 if at least one of the corresponding bits is 1.
- [^](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-xor.md): Perform bitwise exclusive OR. This operator returns 1 only if the corresponding bits of the operands are different.
- [&](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise_and.md): Perform bitwise AND. This operator compares bits of two operands and returns 1 only if both corresponding bits are 1.
- [Parentheses](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/parentheses.md): Control operator precedence. Parentheses are used to group expressions and enforce the order of evaluation in complex operations.
- [<<](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/shift-left.md): Shift bits to the left. This operator shifts the binary representation of a number to the left by a specified number of positions, filling with zeros.
- [>>](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/shift-right.md): Shift bits to the right. This operator shifts the binary representation of a number to the right by a specified number of positions.
- [TRUE FALSE](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/true-false.md): Boolean literal for 1 = TRUE or 0 = FALSE, respectively.
- [Encryption, Hashing and Compression Functions](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions.md): Learn about encryption, hashing, and compression functions. This section details SQL functions for securing data, generating hashes, and compressing/decompressing information within your database.
- [AES\_DECRYPT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/aes_decrypt.md): Decrypt data using AES. This function decrypts a string that was encrypted using the Advanced Encryption Standard (AES) algorithm.
- [AES\_ENCRYPT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/aes_encrypt.md): Encrypt data using AES. This function encrypts a string using the Advanced Encryption Standard (AES) algorithm and returns a binary string.
- [COMPRESS](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/compress.md): Compress a string. This function compresses a string argument and returns the result as a binary string, useful for saving storage space.
- [DECODE](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/decode.md): Decrypt a string. This function decrypts an encrypted string using a password. It is the reverse of the ENCODE function.
- [DES\_DECRYPT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/des_decrypt.md): Decrypt data using DES. This function decrypts a string that was encrypted using the Data Encryption Standard (DES) algorithm.
- [DES\_ENCRYPT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/des_encrypt.md): Encrypt data using DES. This function encrypts a string using the Data Encryption Standard (DES) algorithm.
- [ENCODE](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/encode.md): Encrypt a string. This function encrypts a string using a password, returning a binary string. It is the reverse of the DECODE function.
- [ENCRYPT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/encrypt.md): Encrypt a string using Unix crypt(). This function encrypts a string using the Unix crypt() system call, typically used for password hashing.
- [KDF](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/kdf.md): Derive a key. This function derives a key from a password using a Key Derivation Function (KDF), enhancing security for password storage.
- [MD5](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/md5.md): Calculate MD5 checksum. This function returns the MD5 hash of a string as a 32-character hexadecimal number.
- [OLD\_PASSWORD](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/old_password.md): Generate pre-4.1 password hash. This function creates a password hash compatible with the hashing method used in MySQL versions prior to 4.1.
- [PASSWORD](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/password.md): Calculate password hash. This function calculates a password hash string for a plaintext password.
- [RANDOM\_BYTES](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/random_bytes.md): Generate random bytes. This function returns a binary string of random bytes of a specified length, suitable for cryptographic use.
- [SHA1](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/sha1.md): Calculate SHA-1 checksum. This function computes the SHA-1 160-bit checksum for a string, returning a 40-character hexadecimal string.
- [SHA2](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/sha2.md): Calculate SHA-2 checksum. This function computes the SHA-2 family of hash functions (SHA-224, SHA-256, SHA-384, and SHA-512).
- [UNCOMPRESS](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/uncompress.md): Uncompress a compressed string. This function uncompresses a binary string compressed by the COMPRESS function.
- [UNCOMPRESSED\_LENGTH](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/uncompressed_length.md): Return length of uncompressed string. This function returns the length of a compressed string before it was compressed.
- [Information Functions](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions.md): Retrieve system and session metadata. This section details functions to access database names, user details, version info, and query statistics like row counts.
- [BENCHMARK](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/benchmark.md): Execute an expression repeatedly. This function runs a scalar expression a specified number of times, primarily for measuring query execution speed.
- [BINLOG\_GTID\_POS](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/binlog_gtid_pos.md): Retrieve GTID position from a binary log file. This function returns the Global Transaction ID corresponding to a specific file and position in the binlog.
- [CHARSET](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/charset.md): Return the character set of a string. This function identifies the character set encoding used by the argument.
- [COERCIBILITY](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/coercibility.md): Determine collation coercibility. This function returns a numeric value indicating the priority of the argument's collation in comparison operations.
- [COLLATION](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/collation.md): Return the collation of a string. This function outputs the name of the collation rule used for sorting and comparing the string argument.
- [CONNECTION\_ID](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/connection_id.md): Return the connection ID. This function retrieves the unique thread identifier for the current client connection.
- [CURRENT\_ROLE](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/current_role.md): Returns the current role. The current role can be set with SET ROLE or SET DEFAULT ROLE.
- [CURRENT\_USER](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/current_user.md): Return the authenticated user name. This function displays the user name and host name combination used by the server to authenticate the current client.
- [DATABASE](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/database.md): Return the default database name. This function outputs the name of the currently selected database for the session.
- [DECODE\_HISTOGRAM](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/decode_histogram.md): Inspect histogram data. This function allows viewing the distribution statistics stored in a histogram for query optimization analysis.
- [DEFAULT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/default.md): Return the default value for a column. This function retrieves the value assigned to a column if no explicit value is provided during insertion.
- [FOUND\_ROWS](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/found_rows.md): Count rows found by the last SELECT statement. This function returns the total number of rows matching the query, disregarding any LIMIT clause.
- [LAST\_INSERT\_ID](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/last_insert_id.md): Return the last automatically generated value. This function retrieves the most recent AUTO\_INCREMENT value generated by an INSERT statement.
- [LAST\_VALUE](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/last_value.md): Return the last value from a sequence. This function retrieves the most recently generated value from a sequence object.
- [PROCEDURE ANALYSE](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/procedure-analyse.md): Analyze query results. This procedure examines the result set and suggests optimal data types for columns based on the data.
- [ROW\_COUNT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/row_count.md): Count rows affected by the last statement. This function returns the number of rows inserted, updated, or deleted by the previous DML operation.
- [ROWNUM](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/rownum.md)
- [SCHEMA](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/schema.md): Synonym for DATABASE(). Returns the name of the default database currently in use.
- [SESSION\_USER](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/session_user.md): Return the current user name. This function returns the user name and host name as provided by the client when connecting.
- [SYSTEM\_USER](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/system_user.md): Synonym for USER(). Returns the MariaDB user name and host name associated with the current session.
- [USER](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/user.md): Return the current MariaDB user. This function returns the user name and host name provided by the client upon connection.
- [VERSION](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/version.md): Complete VERSION reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples with comprehensive examples and.
- [Miscellaneous Functions](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions.md): Explore specialized utilities. This category includes functions for benchmarking, managing UUIDs, converting IP addresses, and handling binary data formats.
- [FORMAT\_BYTES](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/miscellaneous-functions-format_bytes.md): Convert bytes to a human-readable string. This function formats a numeric byte count into units like KiB, MiB, GiB, up to EiB.
- [GET\_LOCK](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/get_lock.md): Acquire a named user-level lock. This function attempts to obtain a lock with a specified name and timeout, returning 1 on success or 0 on timeout.
- [INET6\_ATON](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet6_aton.md): Convert an IPv6 address to binary. This function takes an IPv6 (or IPv4) address string and returns it as a VARBINARY(16) string.
- [INET6\_NTOA](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet6_ntoa.md): Convert a binary IPv6 address to string. This function takes a binary IPv6 address (like from INET6\_ATON) and returns its human-readable string representation.
- [INET\_ATON](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet_aton.md): Convert an IPv4 address to an integer. This function takes a dotted-quad IP string (e.g., '1.2.3.4') and returns its numeric representation.
- [INET\_NTOA](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet_ntoa.md): Convert an integer to an IPv4 address. This function takes a numeric IP value and returns its dotted-quad string representation.
- [IS\_FREE\_LOCK](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_free_lock.md): Check if a named lock is free. This function returns 1 if the specified lock is available (not currently held), and 0 if it is in use.
- [IS\_IPV4](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv4.md): Check validity of an IPv4 address. This function returns 1 if the argument is a valid IPv4 address string, and 0 otherwise.
- [IS\_IPV4\_COMPAT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv4_compat.md): Check if an IPv6 address is IPv4-compatible. This function returns 1 if the binary IPv6 address represents an IPv4-compatible address.
- [IS\_IPV4\_MAPPED](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv4_mapped.md): Check if an IPv6 address is IPv4-mapped. This function returns 1 if the binary IPv6 address represents an IPv4-mapped address.
- [IS\_IPV6](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv6.md): Check validity of an IPv6 address. This function returns 1 if the argument is a valid IPv6 address string, and 0 otherwise.
- [IS\_USED\_LOCK](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_used_lock.md): Check who holds a named lock. This function returns the connection identifier of the client holding the lock, or NULL if the lock is free.
- [MASTER\_GTID\_WAIT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/master_gtid_wait.md): Wait for a replica to apply a GTID. This function blocks until the replica has executed transactions up to the specified Global Transaction ID.
- [MASTER\_POS\_WAIT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/master_pos_wait.md): Wait for a replica to reach a log position. This function blocks until the replica has read and applied updates up to a specified position in the master's binary log.
- [NAME\_CONST](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/name_const.md): Force a column name for an expression. This function is primarily used internally for replication to ensure consistent column naming.
- [OLD\_VALUE](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/old-value.md): Access values in ON DUPLICATE KEY UPDATE. This function retrieves the value that would have been inserted into a column if no key conflict occurred.
- [RELEASE\_ALL\_LOCKS](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/release_all_locks.md): Release all named locks held by the session. This function frees all user-level locks acquired with GET\_LOCK() in the current connection.
- [RELEASE\_LOCK](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/release_lock.md): Release a specific named lock. This function frees a user-level lock previously obtained with GET\_LOCK(), allowing others to acquire it.
- [SLEEP](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/sleep.md): Pause query execution. This function pauses the script for a specified number of seconds, returning 0 if successful or 1 if interrupted.
- [SYS\_GUID](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/sys_guid.md): Generate a UUID without hyphens. This Oracle-compatible function returns a globally unique identifier as a 32-character hexadecimal string.
- [UUID](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid.md): Official UUID() function reference: generate UUIDv1 values, 128-bit 36-character format (aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee), and replication safety.
- [UUID\_SHORT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid_short.md): Generate a short 64-bit UUID. This function returns a unique, monotonically increasing integer suitable for use as a compact identifier.
- [UUID\_v4](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid_v4.md): Generate a random UUID (v4). This function returns a version 4 UUID, which is generated using random numbers.
- [UUID\_v7](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid_v7.md): Generate a time-ordered UUID (v7). This function returns a version 7 UUID, which is sortable by creation time.
- [VALUES / VALUE](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/values-value.md): Access values in ON DUPLICATE KEY UPDATE. This function retrieves the value that would have been inserted into a column if no key conflict occurred.
- [Special Functions](https://mariadb.com/docs/server/reference/sql-functions/special-functions.md): Explore special functions in MariaDB Server. This section details unique SQL functions that provide specialized capabilities, often related to server internals, diagnostics, or specific data handling.
- [Dynamic Columns Functions](https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions.md): Manage schema-less data within relational tables. These functions, such as COLUMN\_CREATE and COLUMN\_GET, allow you to store and retrieve variable sets of columns in a single BLOB field.
- [COLUMN\_ADD](https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_add.md): Update dynamic columns. This function adds or updates values within a dynamic column blob, returning the new blob content.
- [COLUMN\_CHECK](https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_check.md): Verify dynamic column integrity. This function checks if a blob containing dynamic columns is valid and returns 1 if it is, 0 otherwise.
- [COLUMN\_CREATE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_create.md): Create a dynamic column blob. This function generates a binary string containing specified column names and values for storage in a BLOB.
- [COLUMN\_DELETE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_delete.md): Remove dynamic columns. This function deletes specified columns from a dynamic column blob and returns the updated blob.
- [COLUMN\_EXISTS](https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_exists.md): Check for a dynamic column. This function returns 1 if a specified column exists within a dynamic column blob, and 0 otherwise.
- [COLUMN\_GET](https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_get.md): Retrieve a dynamic column value. This function extracts a specific column's value from a dynamic column blob, casting it to a specified type.
- [COLUMN\_JSON](https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_json.md): Convert dynamic columns to JSON. This function returns a JSON string representation of the data stored in a dynamic column blob.
- [COLUMN\_LIST](https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_list.md): List dynamic column names. This function returns a comma-separated list of all column names contained within a dynamic column blob.
- [Galera Functions](https://mariadb.com/docs/server/reference/sql-functions/special-functions/galera-functions.md): Interact with the Galera Cluster plugin. These functions provide internal status information and control mechanisms specific to synchronous multi-master replication nodes.
- [WSREP\_LAST\_SEEN\_GTID](https://mariadb.com/docs/server/reference/sql-functions/special-functions/galera-functions/wsrep_last_seen_gtid.md): Return the GTID of the most recent write transaction. This function helps determine the transaction ID to use for synchronization waiting.
- [WSREP\_LAST\_WRITTEN\_GTID](https://mariadb.com/docs/server/reference/sql-functions/special-functions/galera-functions/wsrep_last_written_gtid.md): Return the GTID of the client's last write. This function identifies the specific transaction ID generated by the current client's most recent write operation.
- [WSREP\_SYNC\_WAIT\_UPTO\_GTID](https://mariadb.com/docs/server/reference/sql-functions/special-functions/galera-functions/wsrep_sync_wait_upto_gtid.md): Wait for a specific GTID to be applied. This function blocks the client until the node has committed the transaction with the specified Global Transaction ID.
- [Geographic Functions](https://mariadb.com/docs/server/reference/sql-functions/special-functions/geographic-functions.md): Process geospatial data. This collection of functions allows you to create, analyze, and manipulate geometric shapes like points, lines, and polygons within your database.
- [JSON Functions](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions.md): Complete JSON Functions reference: JSON\_EXTRACT(), JSON\_SET(), JSON\_REPLACE(), JSON\_SEARCH() syntax for path queries, document updates, and value retrieval.
- [JSONPath Expressions](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/jsonpath-expressions.md): Understand JSONPath syntax. This guide explains how to use JSONPath to select and extract specific elements, objects, or arrays from JSON documents.
- [Differences between JSON\_QUERY and JSON\_VALUE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/differences-between-json_query-and-json_value.md): Learn the difference between JSON\_QUERY and JSON\_VALUE in MariaDB. JSON\_QUERY returns objects or arrays, while JSON\_VALUE extracts scalar values.
- [JSON\_ARRAY](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array.md): Create a JSON array. This function evaluates a list of values and returns a JSON array containing those values.
- [JSON\_ARRAY\_APPEND](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array_append.md): Explore JSON\_ARRAY\_APPEND in MariaDB. This function appends values to the end of specified arrays within a JSON document, returning the modified result.
- [JSON\_ARRAY\_INSERT](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array_insert.md): This function inserts values into a JSON document at a specified path, returning the modified document, and supports evaluating multiple path-value pairs sequentially.
- [JSON\_ARRAY\_INTERSECT](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array_intersect.md): Available from version 11.2, this function compares two JSON arrays and returns a new array containing only the items present in both.
- [JSON\_COMPACT](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_compact.md): Learn about the JSON\_COMPACT function in MariaDB. This function removes all unnecessary whitespace from a JSON document, minimizing its size for efficient storage and transmission.
- [JSON\_CONTAINS](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_contains.md): Check for JSON containment. This function returns 1 if a candidate JSON document is contained within a target JSON document, or 0 otherwise.
- [JSON\_CONTAINS\_PATH](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_contains_path.md): Check for a JSON path. This function returns 1 if a specified path exists within a JSON document, or 0 if it does not.
- [JSON\_DEPTH](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_depth.md): Discover JSON\_DEPTH in MariaDB. This function returns the maximum depth of a JSON document, assigning a depth of 1 to scalars and empty structures, and higher values for nested data.
- [JSON\_DETAILED](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_detailed.md): Explore JSON\_DETAILED in MariaDB. Also known as JSON\_PRETTY, this function formats JSON documents with indentation and newlines to emphasize nested structures for readability.
- [JSON\_EQUALS](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_equals.md): Discover JSON\_EQUALS in MariaDB. This function checks for equality between two JSON objects, returning 1 if they are equal, 0 if not, handling key order and data types intelligently.
- [JSON\_EXISTS](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_exists.md): Explore JSON\_EXISTS in MariaDB. This function checks whether a specified JSON document contains an element at a given path, returning 1 for existence and 0 otherwise.
- [JSON\_EXTRACT](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_extract.md): Complete JSON\_EXTRACT() reference: JSON\_EXTRACT(json\_doc, path\[, path]...) syntax, JSONPath arguments, NULL/error behavior, and multi-match array autowrap.
- [JSON\_INSERT](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_insert.md): Learn about the JSON\_INSERT function in MariaDB. This function inserts new data into a JSON document without replacing existing values, returning the updated document or NULL.
- [JSON\_KEY\_VALUE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_key_value.md): Explore JSON\_KEY\_VALUE in MariaDB. Available from version 11.2, this function extracts key/value pairs from a JSON object, enabling easier data transformation and usage with JSON\_TABLE.
- [JSON\_KEYS](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_keys.md): Return keys from a JSON object. This function returns the keys from the top-level value of a JSON object as a JSON array.
- [JSON\_LENGTH](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_length.md): Return the length of a JSON document. This function returns the length of a JSON document or, if a path is given, the length of the value within the path.
- [JSON\_LOOSE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_loose.md): Discover JSON\_LOOSE in MariaDB. This function adds spaces to a JSON document to improve its readability, providing a format that is easier for humans to scan than compact JSON.
- [JSON\_MERGE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_merge.md): Merge JSON documents. This function merges two or more JSON documents into a single JSON document, preserving all keys and values.
- [JSON\_MERGE\_PATCH](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_merge_patch.md): Learn about JSON\_MERGE\_PATCH in MariaDB. This RFC 7396-compliant function merges JSON documents by overwriting duplicate keys, serving as a modern replacement for the deprecated JSON\_MERGE.
- [JSON\_MERGE\_PRESERVE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_merge_preserve.md): Explore JSON\_MERGE\_PRESERVE in MariaDB. This function merges JSON documents while keeping all members, including those with duplicate keys, effectively acting as a synonym for the legacy JSON\_MERGE.
- [JSON\_NORMALIZE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_normalize.md): Discover JSON\_NORMALIZE in MariaDB. This function recursively sorts keys and removes spaces from a JSON document, enabling reliable equality comparisons and unique constraints on JSON data.
- [JSON\_OBJECT](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_object.md): Create a JSON object. This function evaluates a list of key-value pairs and returns a JSON object containing those pairs.
- [JSON\_OBJECT\_FILTER\_KEYS](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_object_filter_keys.md): Discover JSON\_OBJECT\_FILTER\_KEYS in MariaDB. Available from version 11.2, this function returns a new JSON object containing only the key-value pairs where the keys match those provided in a specified
- [JSON\_OBJECT\_TO\_ARRAY](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_object_to_array.md): Explore JSON\_OBJECT\_TO\_ARRAY in MariaDB. Available from version 11.2, this function converts JSON objects into arrays of key-value pairs, facilitating operations like finding common values when used w
- [JSON\_OVERLAPS](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_overlaps.md): Discover JSON\_OVERLAPS in MariaDB. Available from version 10.9, this function compares two JSON documents, returning true if they share at least one common key-value pair, array element, or scalar val
- [JSON\_PRETTY](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_pretty.md): Learn about JSON\_PRETTY in MariaDB. This function is an alias for JSON\_DETAILED, serving to format JSON documents in a human-readable way by adding indentation and newlines.
- [JSON\_QUERY](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_query.md): Extract a JSON object or array. This function extracts data from a JSON document at a given path, returning a JSON object or array.
- [JSON\_QUOTE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_quote.md): Quote a string as a JSON value. This function wraps a string with double quotes and escapes special characters to create a valid JSON string literal.
- [JSON\_REMOVE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_remove.md): Remove data from a JSON document. This function removes data from a JSON document at a specified path and returns the result.
- [JSON\_REPLACE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_replace.md): Replace values in a JSON document. This function replaces existing values in a JSON document and returns the result.
- [JSON\_SCHEMA\_VALID](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_schema_valid.md): Discover JSON\_SCHEMA\_VALID in MariaDB. Available from version 11.1, this function validates a JSON document against a specified JSON Schema (Draft 2020), returning true if valid.
- [JSON\_SEARCH](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_search.md): Search for a value in a JSON document. This function returns the path to the given string within a JSON document.
- [JSON\_SET](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_set.md): Insert or update data in a JSON document. This function inserts or updates data in a JSON document at a specified path and returns the result.
- [JSON\_TABLE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_table.md): Convert JSON data to a relational table. This table function extracts data from a JSON document and returns it as a relational table with columns.
- [JSON\_TYPE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_type.md): Return the type of a JSON value. This function returns a string indicating the type of a JSON value (e.g., OBJECT, ARRAY, INTEGER).
- [JSON\_UNQUOTE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_unquote.md): Unquote a JSON value. This function removes the quotes from a JSON string and unescapes special characters.
- [JSON\_VALID](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_valid.md): Check if a value is valid JSON. This function returns 1 if the argument is a valid JSON document, and 0 otherwise.
- [JSON\_VALUE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_value.md): Extract a scalar value from a JSON document. This function extracts a value from a JSON document at a given path and returns it as a scalar.
- [JSON Validation Function](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json-validation-function.md)
- [Window Functions](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions.md): Explore window functions in MariaDB Server. This section details SQL functions that perform calculations across a set of table rows related to the current row, enabling advanced analytical queries.
- [Window Functions Overview](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/window-functions-overview.md): Understand window function concepts. These functions operate on a set of rows (window) defined by an OVER clause, returning a value for each row without collapsing results.
- [Window Frames](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/window-frames.md): Define subsets of rows for calculation. Window frames specify which rows relative to the current row are included in the window function's calculation.
- [ColumnStore Window Functions](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/window-functions-columnstore-window-functions.md): Review window function support in ColumnStore. This page details the specific window functions and limitations applicable when using the ColumnStore storage engine.
- [CUME\_DIST](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/cume_dist.md): Calculate cumulative distribution. This function returns the relative rank of the current row within its partition, calculated as the percentage of rows preceding or peer to it.
- [DENSE\_RANK](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/dense_rank.md): Calculate rank without gaps. This function assigns a rank to each row within a partition, with tied values receiving the same rank and no numbers skipped.
- [FIRST\_VALUE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/first_value.md): Return the value from the first row in the window frame. This function retrieves the value of an expression from the first row of the defined window.
- [LAG](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/lag.md): Access data from a preceding row. This function returns the value of an expression from a row at a specified physical offset prior to the current row.
- [LEAD](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/lead.md): Access data from a following row. This function returns the value of an expression from a row at a specified physical offset after the current row.
- [MEDIAN](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/median.md): Calculate the median value. This window function returns the middle value (50th percentile) of an ordered set of values within the window.
- [NTH\_VALUE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/nth_value.md): Return the value from the N-th row. This function retrieves the value of an expression from the N-th row within the window frame.
- [NTILE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/ntile.md): Distribute rows into buckets. This function divides the rows in an ordered partition into a specified number of approximately equal groups.
- [PERCENT\_RANK](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percent_rank.md): Calculate relative rank. This function returns the percentage rank of the current row within its partition, ranging from 0 to 1.
- [PERCENTILE\_CONT](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percentile_cont.md): Calculate a continuous percentile. This inverse distribution function returns an interpolated value that corresponds to the specified percentile.
- [PERCENTILE\_DISC](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percentile_disc.md): Calculate a discrete percentile. This inverse distribution function returns an actual value from the dataset that corresponds to the specified percentile.
- [RANK](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/rank.md): Calculate rank with gaps. This function assigns a rank to each row, with tied values receiving the same rank and subsequent ranks skipped.
- [ROW\_NUMBER](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/row_number.md): Complete ROW\_NUMBER() reference: ROW\_NUMBER() OVER() window syntax, PARTITION BY clauses, ORDER BY ordering, and RANK()/DENSE\_RANK() comparisons.
- [String Functions](https://mariadb.com/docs/server/reference/sql-functions/string-functions.md): 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.
- [ASCII](https://mariadb.com/docs/server/reference/sql-functions/string-functions/ascii.md): Return the ASCII value of the first character. This function returns the numeric ASCII code for the leftmost character of the input string.
- [BIN](https://mariadb.com/docs/server/reference/sql-functions/string-functions/bin.md): Return the binary representation of a number. This function converts a number to its binary string equivalent.
- [BINARY Operator](https://mariadb.com/docs/server/reference/sql-functions/string-functions/binary-operator.md): Cast a string to a binary string. This operator converts a character string to a binary string, often used for case-sensitive comparisons.
- [BIT\_LENGTH](https://mariadb.com/docs/server/reference/sql-functions/string-functions/bit_length.md): Return the length of a string in bits. This function calculates the size of the string in bits (length in bytes multiplied by 8).
- [CAST](https://mariadb.com/docs/server/reference/sql-functions/string-functions/cast.md): Complete CAST reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples with comprehensive examples and best.
- [CHAR Function](https://mariadb.com/docs/server/reference/sql-functions/string-functions/char-function.md): Return the character for each integer passed. This function interprets arguments as integer ASCII values and returns a string of those characters.
- [CHAR\_LENGTH](https://mariadb.com/docs/server/reference/sql-functions/string-functions/char_length.md): 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.
- [CHARACTER\_LENGTH](https://mariadb.com/docs/server/reference/sql-functions/string-functions/character_length.md): Synonym for CHAR\_LENGTH(). Returns the number of characters in the string.
- [CHR](https://mariadb.com/docs/server/reference/sql-functions/string-functions/chr.md): Return the character for a specific ASCII value. This function is similar to CHAR() but accepts a single integer argument.
- [CONCAT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/concat.md): Complete CONCAT reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples with comprehensive examples and.
- [CONCAT\_WS](https://mariadb.com/docs/server/reference/sql-functions/string-functions/concat_ws.md): Concatenate with separator. This function joins strings with a specified separator. It skips NULL values during concatenation.
- [CONVERT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/convert.md): Complete CONVERT() reference: CONVERT(expr,type) and CONVERT(expr USING charset) syntax, SIGNED/UNSIGNED/BINARY/CHAR types, and CAST() differences.
- [ELT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/elt.md): Return the string at a specific index. This function returns the N-th string from a list of arguments.
- [EXPORT\_SET](https://mariadb.com/docs/server/reference/sql-functions/string-functions/export_set.md): 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.
- [EXTRACTVALUE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/extractvalue.md): Extract a value from XML. This function returns the text content of an XML fragment matching a given XPath expression.
- [FIELD](https://mariadb.com/docs/server/reference/sql-functions/string-functions/field.md): Return the index of a string in a list. This function returns the position of the first argument within the subsequent list of arguments.
- [FIND\_IN\_SET](https://mariadb.com/docs/server/reference/sql-functions/string-functions/find_in_set.md): 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](https://mariadb.com/docs/server/reference/sql-functions/string-functions/format.md): Format a number. This function formats a number to a format like '#,###,###.##', rounded to a specified number of decimal places.
- [FROM\_BASE64](https://mariadb.com/docs/server/reference/sql-functions/string-functions/from_base64.md): Decode a base-64 encoded string. This function takes a base-64 string and returns the decoded binary result.
- [HEX](https://mariadb.com/docs/server/reference/sql-functions/string-functions/hex.md): Return the hexadecimal representation. This function converts a number or string to its hexadecimal string equivalent.
- [INSERT Function](https://mariadb.com/docs/server/reference/sql-functions/string-functions/insert-function.md): Insert a substring into a string. This function inserts a string within another string at a specified position and length, replacing existing characters.
- [INSTR](https://mariadb.com/docs/server/reference/sql-functions/string-functions/instr.md): Return the position of the first occurrence of a substring. This function locates a substring within a string and returns its index.
- [LCASE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/lcase.md): Synonym for LOWER(). Converts a string to lowercase characters.
- [LEFT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/left.md): Return the leftmost characters. This function returns the specified number of characters from the beginning (left) of a string.
- [LENGTH](https://mariadb.com/docs/server/reference/sql-functions/string-functions/length.md): 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.
- [LENGTHB](https://mariadb.com/docs/server/reference/sql-functions/string-functions/lengthb.md): Return the length of a string in bytes. This function is a synonym for LENGTH() in default mode, returning the byte count.
- [LIKE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/like.md): Complete LIKE operator reference: LIKE/NOT LIKE pattern matching syntax, % and \_ wildcards, ESCAPE clause, NULL behavior, and collation case-sensitivity.
- [LOAD\_FILE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/load_file.md): 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.
- [LOCATE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/locate.md): Return the position of the first occurrence of a substring. This function finds the starting position of a substring within a string.
- [LOWER](https://mariadb.com/docs/server/reference/sql-functions/string-functions/lower.md): Convert a string to lowercase. This function returns the string with all characters converted to lowercase.
- [LPAD](https://mariadb.com/docs/server/reference/sql-functions/string-functions/lpad.md): Left-pad a string. This function pads a string on the left side with a specified string until it reaches a certain length.
- [LTRIM](https://mariadb.com/docs/server/reference/sql-functions/string-functions/ltrim.md): Remove leading spaces. This function returns the string with any leading whitespace characters removed.
- [MAKE\_SET](https://mariadb.com/docs/server/reference/sql-functions/string-functions/make_set.md): Return a set of comma-separated strings. This function returns a string consisting of substrings corresponding to the set bits in a given number.
- [MATCH AGAINST](https://mariadb.com/docs/server/reference/sql-functions/string-functions/match-against.md): Perform a full-text search. This construct searches for a text query against a set of columns indexed with a FULLTEXT index.
- [MID](https://mariadb.com/docs/server/reference/sql-functions/string-functions/mid.md): Synonym for SUBSTRING(). Returns a substring starting at a specified position for a given length.
- [NATURAL\_SORT\_KEY](https://mariadb.com/docs/server/reference/sql-functions/string-functions/natural_sort_key.md): 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.
- [NOT LIKE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/not-like.md): Negated pattern matching. This operator tests whether a string does NOT match a specified SQL pattern.
- [NOT REGEXP](https://mariadb.com/docs/server/reference/sql-functions/string-functions/not-regexp.md): Negated regular expression matching. This operator tests whether a string does NOT match a specified regular expression pattern.
- [OCTET\_LENGTH](https://mariadb.com/docs/server/reference/sql-functions/string-functions/octet_length.md): Return the length of a string in bytes. This function is a synonym for LENGTH() and returns the number of bytes in the string.
- [ORD](https://mariadb.com/docs/server/reference/sql-functions/string-functions/ord.md): Return the numeric value of the first character. This function returns the code for the leftmost character, supporting multi-byte characters.
- [POSITION](https://mariadb.com/docs/server/reference/sql-functions/string-functions/position.md): Synonym for LOCATE(). Returns the position of the first occurrence of a substring within a string.
- [QUOTE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/quote.md): 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 Function](https://mariadb.com/docs/server/reference/sql-functions/string-functions/repeat-function.md): Repeat a string. This function returns a string consisting of the input string repeated a specified number of times.
- [REPLACE Function](https://mariadb.com/docs/server/reference/sql-functions/string-functions/replace-function.md): Complete REPLACE Function reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples for production use.
- [REVERSE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/reverse.md): Reverse a string. This function returns the string with the order of its characters reversed.
- [RIGHT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/right.md): Return the rightmost characters. This function returns the specified number of characters from the end (right) of a string.
- [RPAD](https://mariadb.com/docs/server/reference/sql-functions/string-functions/rpad.md): Right-pad a string. This function pads a string on the right side with a specified string until it reaches a certain length.
- [RTRIM](https://mariadb.com/docs/server/reference/sql-functions/string-functions/rtrim.md): Remove trailing spaces. This function returns the string with any trailing whitespace characters removed.
- [SFORMAT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/sformat.md): Format strings with arbitrary patterns. This function allows complex string formatting using a pattern string and arguments.
- [SOUNDEX](https://mariadb.com/docs/server/reference/sql-functions/string-functions/soundex.md): Return the Soundex string. This function calculates the Soundex key for a string, allowing comparison of words that sound similar.
- [SOUNDS LIKE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/sounds-like.md): Compare strings by sound. This operator tests if two strings have the same Soundex value, useful for fuzzy matching.
- [SPACE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/space.md): Return a string of spaces. This function returns a string consisting of a specified number of space characters.
- [STRCMP](https://mariadb.com/docs/server/reference/sql-functions/string-functions/strcmp.md): 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](https://mariadb.com/docs/server/reference/sql-functions/string-functions/substr.md)
- [SUBSTRING](https://mariadb.com/docs/server/reference/sql-functions/string-functions/substring.md): Complete SUBSTRING() reference: syntax forms (pos,len, FROM/FOR), negative position from end, NULL handling, and Oracle sql\_mode position 0 behavior.
- [SUBSTRING\_INDEX](https://mariadb.com/docs/server/reference/sql-functions/string-functions/substring_index.md): Complete SUBSTRING\_INDEX() reference: SUBSTRING\_INDEX(str,delim,count) syntax, positive/negative count, case-sensitive delimiter, NULL rules.
- [TO\_BASE64](https://mariadb.com/docs/server/reference/sql-functions/string-functions/to_base64.md): Encode a string to base-64. This function converts a string argument to its base-64 encoded form.
- [TO\_CHAR](https://mariadb.com/docs/server/reference/sql-functions/string-functions/to_char.md): Convert to string. This function converts a value (often date/time) to a string, potentially using a format mask.
- [TRIM](https://mariadb.com/docs/server/reference/sql-functions/string-functions/trim.md): Remove spaces from both ends. This function removes leading and trailing whitespace (or other specified characters) from a string.
- [TRIM\_ORACLE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/trim_oracle.md): Oracle-compatible TRIM function. This version of TRIM provides compatibility with Oracle's syntax for removing characters from a string.
- [Type Conversion](https://mariadb.com/docs/server/reference/sql-functions/string-functions/type-conversion.md): Understand Type Conversion in MariaDB. Learn the rules for implicit conversion during comparisons and arithmetic, and how to use CAST for predictable results.
- [UCASE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/ucase.md): Synonym for UPPER(). Converts a string to uppercase characters.
- [UNHEX](https://mariadb.com/docs/server/reference/sql-functions/string-functions/unhex.md): Convert hexadecimal to string. This function interprets pairs of hexadecimal digits as numbers and converts them to the characters they represent.
- [UPDATEXML](https://mariadb.com/docs/server/reference/sql-functions/string-functions/updatexml.md): Replace a portion of XML. This function replaces a section of XML markup matching an XPath expression with a new XML fragment.
- [UPPER](https://mariadb.com/docs/server/reference/sql-functions/string-functions/upper.md): Convert a string to uppercase. This function returns the string with all characters converted to uppercase.
- [WEIGHT\_STRING](https://mariadb.com/docs/server/reference/sql-functions/string-functions/weight_string.md): Return the weight string. This function returns the binary string that represents the sorting and comparison value of the input string.
- [Regular Expressions Functions](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions.md): 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.
- [Regular Expressions Overview](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regular-expressions-overview.md): Get an overview of regex usage. This page introduces the pattern matching capabilities and common metacharacters used in MariaDB regular expressions.
- [PCRE - Perl Compatible Regular Expressions](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/pcre.md): Understand MariaDB's regex support. This concept page explains the PCRE library integration, detailing supported syntax, character classes, and special characters.
- [REGEXP](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp.md): Complete REGEXP operator reference: expr REGEXP/RLIKE pat syntax, 1/0/NULL return values, NOT REGEXP aliases, BINARY case-sensitivity, default\_regex\_flags.
- [REGEXP\_INSTR](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_instr.md): Return the index of a regex match. This function finds the starting position of the first substring that matches the given pattern.
- [REGEXP\_REPLACE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_replace.md): Replace regex matches in a string. This function substitutes occurrences of a pattern with a specified replacement string.
- [REGEXP\_SUBSTR](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_substr.md): Return the substring matching a regex. This function extracts the actual part of the string that matches the given pattern.
- [RLIKE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/rlike.md): Synonym for REGEXP. This operator performs a regular expression match against a string argument.
- [Vector Functions](https://mariadb.com/docs/server/reference/sql-functions/vector-functions.md): Explore vector functions. This section details SQL functions for manipulating and querying vector data types, enabling efficient similarity search and AI/ML applications within your  database.
- [VEC\_DISTANCE](https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vector-functions-vec_distance.md): Calculate distance between vectors. This function computes the distance between two vectors using either Euclidean or Cosine metric, depending on the index.
- [VEC\_DISTANCE\_COSINE](https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_distance_cosine.md): Calculate Cosine distance. This function computes the Cosine distance between two vectors, measuring the cosine of the angle between them.
- [VEC\_DISTANCE\_EUCLIDEAN](https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_distance_euclidean.md): Calculate Euclidean distance. This function computes the Euclidean (L2) distance between two vectors, representing the straight-line distance.
- [VEC\_FromText](https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_fromtext.md): Convert text to vector. This function parses a JSON array string representation of a vector and converts it into the binary VECTOR data type.
- [VEC\_ToText](https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_totext.md): Convert vector to text. This function takes a binary VECTOR data type and returns its JSON array string representation.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
