INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (120, 5, 'Audit Plugin Options and System Variables', 'Description\n-----------\n\nThere are a several options and system variables related to the MariaDB Audit Plugin, once it has been installed. System variables can be displayed using the SHOW VARIABLES statement like so:\n\n``sql\nSHOW GLOBAL VARIABLES LIKE ''server_audit%'';\n+-------------------------------+-----------------------+\n| Variable_name                 | Value                 |\n+-------------------------------+-----------------------+\n| server_audit_events           |                       |\n| server_audit_excl_users       |                       |\n| server_audit_file_buffer_size | 0                     |\n| ...                           | ...                   |\n| server_audit_syslog_priority  | LOG_INFO              |\n| server_audit_timestamp_format | %Y%m%d %H:%i:%s       |\n+-------------------------------+-----------------------+\n`\n\nTo change the value of one of these variables, you can use the SET statement, or set them at the command-line when starting MariaDB. It''s recommended that you set them in the MariaDB configuration for the server like so:\n\n`ini\n[mariadb]\n...\nserver_audit_excl_users=''bob,ted''\n...\n`\n\nSystem Variables\n\nBelow is a list of all system variables related to the Audit Plugin. See Server System Variables for a complete list of system variables and instructions on setting them. See also the full list of MariaDB options, system and status variables.\n\nserver_audit_events\n\n Description: If set, this restricts audit logging to certain event types. If not set, every event type is logged to the audit log.\n Command line: --server-audit-events=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: Empty string\n Valid values:\n   CONNECT, QUERY, TABLE (MariaDB Audit Plugin < 1.2.0)\n   CONNECT, QUERY, TABLE, QUERY_DDL, QUERY_DML (MariaDB Audit Plugin >= 1.2.0)\n   CONNECT, QUERY, TABLE, QUERY_DDL, QUERY_DML, QUERY_DCL (MariaDB Audit Plugin >=1.3.0)\n   CONNECT, QUERY, TABLE, QUERY_DDL, QUERY_DML, QUERY_DCL, QUERY_DML_NO_SELECT (MariaDB Audit Plugin >= 1.4.4)\n   Consult MariaDB Audit Plugin - Versions for a list of MariaDB releases and their corresponding Audit Plugin versions.\n\nserver_audit_excl_users\n\n Description: If not empty, it contains the list of users whose activity will NOT be logged: SET GLOBAL server_audit_excl_users=''user_foo, user_bar''. CONNECT records aren''t affected by this variable - they are always logged. The user is still logged if it''s specified in server_audit_incl_users.\n Command line: --server-audit-excl-users=_value_\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: Empty string\n Size limit: 1024 characters\n\nserver_audit_file_buffer_size\n\n Description: Size (in bytes) of file buffer to make logging faster. Values > 0 are adjusted in increments of 8192. (For instance, a value of 100 would be adjusted to 8192.)\n Command line: --server-audit-file-buffer-size=_#_\n Scope: Global\n Dynamic: Yes\n Data type: numeric\n Value range: 0 to 65536\n Default value: 0 (no buffering)\n Introduced: MariaDB 12.1\n Usage: See description\n\nserver_audit_file_path\n\n Description: When server_audit_output_type=file, sets the path and the filename to the log file. If the specified path exists as a directory, then the log will be created inside that directory with the name ''server_audit.log''. Otherwise the value is treated as a filename. The default value is ''server_audit.log'', which means this file will be created in the database directory.\n Command line: --server-audit-file-path=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: server_audit.log\n\nserver_audit_file_rotate_now\n\n Description: When server_audit_output_type=file, the user can force the log file rotation by setting this variable to ON or 1.\n Command line: --server-audit-rotate-now[={0|1}]\n Scope: Global\n Dynamic: Yes\n Data type: boolean\n Default value: OFF\n\nserver_audit_file_rotate_size\n\n Description: When server_audit_output_type=file, it limits the size of the log file to the given amount of bytes. Reaching that limit turns on the rotation - the current log file is renamed as ''file_path.1''. The empty log file is created as ''file_path'' to log into it. The default value is 1000000.\n Command line: --server-audit-rotate-size=#\n Scope: Global\n Dynamic: Yes\n Data Type: numeric\n Default Value: 1000000\n Range: 100 to 9223372036854775807\n\nserver_audit_file_rotations\n\n Description: When server_audit_output_type=file'', this specifies the number of rotations to save. If set to 0 then the log never rotates. The default value is 9.\n Command line: --server-audit-rotations=#\n Scope: Global\n Dynamic: Yes\n Data type: numeric\n Default value: 9\n Range: 0 to 999\n\nserver_audit_incl_users\n\n Description: If not empty, it contains a comma-delimited list of users whose activity will be logged: SET GLOBAL server_audit_incl_users=''user_foo, user_bar''. CONNECT records aren''t affected by this variable - they are always logged. This setting has higher priority than server_audit_excl_users. So if the same user is specified both in incl_ and excl_ lists, they will still be logged.\n Command line: --server-audit-incl-users=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: Empty string\n Size limit: 1024 characters\n\nserver_audit_loc_info\n\n Description: Used by plugin internals. It has no useful meaning to users.\n   In earlier versions, users see it as a read-only variable.\n   In later versions, it is hidden from the user.\n Command line: N/A\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: Empty string\n\nserver_audit_logging\n\n Description: Enables/disables the logging. Expected values are ON/OFF: SET GLOBAL server_audit_logging=on If the server_audit_output_type is FILE, this will actually create/open the logfile so the server_audit_file_path should be properly specified beforehand. Same about the SYSLOG-related parameters. The logging is turned off by default.\n Command line: --server-audit-logging[={0|1}]\n Scope: Global\n Dynamic: Yes\n Data type: boolean\n Default value: OFF\n\nserver_audit_mode\n\n Description: This variable doesn''t have any distinctive meaning for a user. Its value mostly reflects the server version with which the plugin was started and is intended to be used by developers for testing.\n Command line: --server-audit-mode[=#]\n Scope: Global\n Dynamic: Yes\n Data type: numeric\n Default value: 0\n Range: 0 to 1\n\nserver_audit_output_type\n\n Description: Specifies the desired output type. Can be SYSLOG, FILE or null as no output: SET GLOBAL server_audit_output_type=file file: log records will be saved into the rotating log file. The name of the file set by server_audit_file_path variable. syslog: log records will be sent to the local syslogd daemon with the standard \\<syslog.h> API. The default value is ''file''.\n Command line: --server-audit-output-type=value\n Scope: Global\n Dynamic: Yes\n Data type: enum\n Default value: file\n Valid values: SYSLOG, FILE\n\nserver_audit_query_log_limit\n\n Description: Limit on the length of the query string in a record.\n Command line: --server-audit-query-log-limit=#\n Scope: Global\n Dynamic: Yes\n Data type: numeric\n Default value: 1024\n Range: 0 to 2147483647\n\nserver_audit_sync_log_file\n\n Description: Flushes the buffer to the log file.\\\n  While log records are in the buffer, they don''t appear in the log file. To write them out from the buffer, issue this statement:\\\n  SET GLOBAL server_audit_sync_log_file=1\n Command line: --server-audit-sync-log-file\n Scope: Global\n Dynamic: Yes\n Data type: N/A\n Default value: OFF\n Valid values: ON (or 1), OFF (or 0)\n Introduced: MariaDB 12.1\n Usage: See description\n\nserver_audit_syslog_facility\n\n Description: SYSLOG-mode variable. It defines the ''facility'' of the records that will be sent to the syslog. Later the log can be filtered by this parameter.\n Command line: --server-audit-syslog-facility=value\n Scope: Global\n Dynamic: Yes\n Data type: enum\n Default value: LOG_USER\n Valid values: LOG_USER, LOG_MAIL, LOG_DAEMON, LOG_AUTH, LOG_SYSLOG, LOG_LPR, LOG_NEWS, LOG_UUCP, LOG_CRON, LOG_AUTHPRIV, LOG_FTP, and LOG_LOCAL0–LOG_LOCAL7.\n\nserver_audit_syslog_ident\n\n Description: SYSLOG-mode variable. String value for the ''ident'' part of each syslog record. Default value is ''mysql-server_auditing''. New value becomes effective only after restarting the logging.\n Command line: --server-audit-syslog-ident=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: mysql-server_auditing\n\nserver_audit_syslog_info\n\n Description: SYSLOG-mode variable. The ''info'' string to be added to the syslog records. Can be changed any time.\n Command line: --server-audit-syslog-info=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: Empty string\n\nserver_audit_syslog_priority\n\n Description: SYSLOG-mode variable. Defines the priority of the log records for the syslogd.\n Command line: --server-audit-syslog-priority=value\n Scope: Global\n Dynamic: Yes\n Data type: enum\n Default value: LOG_INFO\n Valid values:LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG\n\nserver_audit_timestamp_format\n\n Description: A format string used to print the timestamp into the audit log messages. The format used is the same as DATE_FORMAT.\n Command line: --server-audit-timestamp-format=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: %Y%m%d %H:%i:%s\n\nNotes on System Variables\n\naudit_file_buffer_size and server_audit_sync_log_file\n\nThe server audit plugin typically employs synchronous, per-event logging, causing performance bottlenecks. Individual file writes for each log entry can result in significant I/O overhead, especially in large database environments. As of MariaDB 12.1, two new variables were introduced to allow asynchronous logging, and more fine grained control over how audit log writes are handled. Using the server_audit_file_buffer_size setting (buffer size in bytes), you can configure an additional in-memory audit log buffer. When the size of the buffer exceeds the server_audit_file_buffer_size setting, the audit log is written to disk. Additionally, a manual on-demand audit log disk sync can be triggered by setting server_audit_sync_log_file to ON or 1.\n\nOptions\n\nserver_audit\n\n Description: Controls how the server should treat the plugin when the server starts up.\n   Valid values are:\n     OFF - Disables the plugin without removing it from the mysql.plugins table.\n     ON - Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled.\n     FORCE - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error.\n     FORCE_PLUS_PERMANENT - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. In addition, the plugin cannot be uninstalled with UNINSTALL SONAME or UNINSTALL PLUGIN while the server is running.\n   See MariaDB Audit Plugin - Installation: Prohibiting Uninstallation for more information.\n   See Plugin Overview: Configuring Plugin Activation at Server Startup for more information.\n Command line: --server-audit=val\n Data Type: enumerated\n Default Value: ON\n* Valid Values: OFF, ON, FORCE, FORCE_PLUS_PERMANENT`\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-options-and-system-variables', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-options-and-system-variables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (121, 5, 'Audit Plugin Overview', 'Description\n-----------\n\nMariaDB and MySQL are used in a broad range of environments, but if you needed to record user access to be in compliance with auditing regulations for your organization, you would previously have had to use other database solutions. To meet this need, though, MariaDB has developed the MariaDB Audit Plugin. Although the MariaDB Audit Plugin has some unique features available only for MariaDB, it can be used also with MySQL.\n\nBasically, the purpose of the MariaDB Audit Plugin is to log the server''s activity. For each client session, it records who connected to the server (i.e., user name and host), what queries were executed, and which tables were accessed and server variables that were changed. This information is stored in a rotating log file or it may be sent to the local syslogd.\n\nReview these pages for detailed documentation:\n\n Installation\n Configuration\n Log Settings\n Log Location & Rotation\n Log Format\n Status Variables\n System Variables\n\nTutorials\n\n Activating MariaDB Audit Log\\\n  by Jaykishan Mutkawoa, May 30, 2016\n Installing MariaDB Audit Plugin on Amazon RDS\\\n  Amazon RDS supports using the MariaDB Audit Plugin on MySQL and MariaDB database instances.\n\nBlog Posts\n\n MySQL Auditing with MariaDB Auditing Plugin\\\n  by Peter Zaitsev, February 15, 2016\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-overview', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (122, 5, 'Audit Plugin Status Variables', 'Description\n-----------\n\nThere are a few status variables related to the MariaDB Audit Plugin, once it has been installed. These variables can be displayed using the SHOW STATUS statement like so:\n\n``sql\nSHOW STATUS LIKE ''server_audit%'';\n\n+----------------------------+------------------+\n| Variable_name              | Value            |\n+----------------------------+------------------+\n| Server_audit_active        | ON               |\n| Server_audit_current_log   | server_audit.log |\n| Server_audit_last_error    |                  |\n| Server_audit_writes_failed | 0                |\n+----------------------------+------------------+\n`\n\nStatus Variables\n\nBelow is a list of all status variables related to the Audit Plugin. These cannot be set: These are not to be confused with system variables, which can be set. See Server Status Variables for a complete list of status variables that can be viewed with the SHOW STATUS statement. See also the Full list of MariaDB options, system and status variables.\n\nServer_audit_active\n\n Description: If the auditing is actually working. It gets the ON value when the logging is successfully started. Then it can get the OFF value if the logging was stopped or log records can''t be properly stored due to file or syslog errors.\n Data Type: boolean\n\nServer_audit_current_log\n\n Description: The name of the logfile or the SYSLOG parameters that are in current use.\n Data Type: string\n\nServer_audit_last_error\n\n Description: If something went wrong with the logging here you can see the message.\n Data Type: string\n\nServer_audit_writes_failed\n\n Description: The number of log records since last logging-start that weren''t properly stored because of errors of any kind. The global value can be flushed by FLUSH STATUS.\n Data Type: numeric\n* Default Value: 0`\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-status-variables', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-status-variables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (123, 5, 'Audit Plugin Versions', 'Description\n-----------\n\nBelow is a list of the releases of the MariaDB Audit Plugin, the most recent version first, and in which versions of MariaDB each plugin version was included.\n\n| MariaDB Community Audit Plugin Version                                                                                   | Introduced in MariaDB Community Server                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |\n| ------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| 1.5.0                                                                                                                    | MariaDB 12.0.1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |\n| 1.4.14                                                                                                                   | MariaDB 10.3.35, MariaDB 10.4.25, MariaDB 10.5.16, MariaDB 10.6.8, MariaDB 10.7.4                                                                                                                         |\n| 1.4.13                                                                                                                   | MariaDB 10.2.38, MariaDB 10.3.29, MariaDB 10.4.19, MariaDB 10.5.10                                                                                                                                                                                                                      |\n| 1.4.10                                                                                                                   | MariaDB 10.2.35, MariaDB 10.3.26, MariaDB 10.5.7                                                                                                                                                                                                                                                                                                                                      |\n| 1.4.7                                                                                                                    | MariaDB 10.1.41, MariaDB 10.2.26, MariaDB 10.3.17, MariaDB 10.4.7                                                                                                                                                                                                                        |\n| 1.4.5                                                                                                                    | MariaDB 10.2.24, MariaDB 10.3.15, MariaDB 10.4.5                                                                                                                                                                                                                                                                                                                                      |\n| 1.4.4                                                                                                                    | MariaDB 5.5.61, MariaDB 10.0.36, MariaDB 10.1.34, MariaDB 10.2.15, MariaDB 10.3.7, MariaDB 10.4.0 |\n| 1.4.0                                                                                                                    | MariaDB 5.5.48, MariaDB 10.0.24, MariaDB 10.1.11                                                                                                                                                                                                                                                                                                                                       |\n| 1.3.0                                                                                                                    | MariaDB 5.5.43, MariaDB 10.0.18, MariaDB 10.1.5                                                                                                                                                                                                                                                                                                                                         |\n| 1.2.0                                                                                                                    | MariaDB 5.5.42, MariaDB 10.0.17, MariaDB 10.1.4                                                                                                                                                                                                                                                                                                                                         |\n| 1.1.7 | MariaDB 5.5.38, MariaDB 10.0.11, MariaDB 10.1.0                                                                                                                                                                                                                                                                                                                                         |\n| 1.1.6 | MariaDB 5.5.37, MariaDB 10.0.10                                                                                                                                                                                                                                                                                                                                                                                                                                                     |\n| 1.1.5 | MariaDB 10.0.09                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |\n| 1.1.4 | MariaDB 5.5.36                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |\n| 1.1.3 | MariaDB 5.5.34, MariaDB 10.0.7                                                                                                                                                                                                                                                                                                                                                                                                                                                       |\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-versions', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-versions');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (124, 5, 'MariaDB Enterprise Audit', 'Description\n-----------\n\nWhile application design specifications and database configurations may intend specific limitations to be placed around access to data, audit mechanisms help confirm the effectiveness of these controls.\n\nMariaDB Enterprise Audit is a plugin that logs data access and database operations.\n\nAudit mechanisms are most effective when they produce a manageable quantity of output. MariaDB Enterprise Audit includes advanced filtering features to enable narrowly defining which information is logged.\n\nWhere audit mechanisms may only be effective when control parameters can also be audited, MariaDB Enterprise Audit implements logging of configuration changes.\n\nPlugin Conflict (MENT-316)\n\nThe MariaDB Enterprise Audit plugin (server_audit2.so) is incompatible with the older server_audit.so (v1) plugin. Running both can cause server instability or deadlocks.\n\n_If you are a new user: You can continue reading._\n\n_If you are migrating: You must remove the old v1 plugin. Please go directly to the_ _Upgrades_ _section for complete instructions._\n\nConfiguration Overview\n\nMariaDB Enterprise Audit is installed and loaded by default. If you are unsure whether it is loaded on your system, you can confirm that the plugin is loaded.\n\nTo use MariaDB Enterprise Audit, the plugin must be configured: Administrators must define Audit Filters to configure what MariaDB Enterprise Audit writes to the audit log.\n\nMariaDB Enterprise Audit supports two types of Audit Filters:\n\n| Audit Filter Type                                                        | Used For                                                                                         |\n| ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |\n| Default Audit Filter | The Default Audit Filter is used for any user account that is not assigned a Named Audit Filter. |\n| Named Audit Filters   | Named Audit Filters are assigned to specific user accounts.                                      |\n\nAdministrators can define Audit Filters to audit log activity using multiple types of filters:\n\n| Filter Type                                                   | Used For                                                                                                                                                                                                                                                                                                     |\n| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| Event Filters    | Event Filters are used to enable or disable audit logging for specific types of operations performed by the user accounts assigned to the Audit Filter.                                                                                                                                                      |\n| Logging Filters | Logging Filters are used to enable or disable audit logging for the user accounts assigned to the Audit Filter.                                                                                                                                                                                              |\n| Object Filters  | Object Filters are used to enable or disable audit logging for specific databases or tables accessed by the user accounts assigned to the Audit Filter. Support for Object Filters was added in MariaDB Enterprise Server 10.6. Support for Object Filters was backported to ES 10.4.21-13 and ES 10.5.12-8. |\n\nAdministrators must start audit logging.\n\nGeneral Operation\n\nMariaDB Enterprise Audit performs audit logging during typical operations of MariaDB Enterprise Server:\n\n When a user connects, fails to connect, or disconnects, MariaDB Enterprise Audit will write a message to the audit log if the Audit Filter specifies the specific type of Connect Event.\n When a user executes a query, MariaDB Enterprise Audit will write a message to the audit log if the Audit Filter specifies the specific type of Query Event and if the queried objects are not excluded by Object Filters.\n When a query accesses a table, MariaDB Enterprise Audit will write a message to the audit log if the Audit Filter specifies the specific type of Table Event and if the table is not excluded by Object Filters.\n When a query modifies the MariaDB Enterprise Audit configuration, MariaDB Enterprise Audit will write a message to the audit log if the Audit Filter specifies the Audit Config Event.\n When a user''s Audit Filter contains a Logging Filter that disables audit logging, all audit logging for the user''s activity will be skipped.\n\nMariaDB Enterprise Audit writes audit log messages either to a dedicated audit log file or to the system log (syslog), depending on configuration.\n\nAudit log messages that correspond to a query are logged when the query completes. If a query is executed in a transaction, the audit log messages that correspond to the query are logged when the individual query completes, not when the transaction completes. If the query fails, the audit log message is logged at time of failure.\n\nAudit Log Considerations\n\nCare must be taken when logging data for audit to maintain alignment to business requirements. Concerns include:\n\n Queries should not be logged for tables containing Personally Identifiable Information (PII) or Sensitive PII (SPII) such as passwords, since audit log data is written unencrypted. Consider using Object Filters to exclude sensitive information from the audit log.\n Backup of audit data should be performed at least as frequently as database backups.\n Audit log data on database servers could be tampered with if the database server is compromised. Consider secure transmission of log data to a hardened and remote logging server.\n Where audit data is mission-critical, it should be subject to controls, data protection, data retention, and highly-available storage as are used for other mission-critical data.\n\nInstall the Audit Plugin\n\nMariaDB Enterprise Audit comes preinstalled with MariaDB Enterprise Server, so no manual installation is required.\n\nTo verify that the plugin is installed:\n\n1. Locate your server’s plugin directory.\n    When MariaDB Enterprise Server is running, you can find the directory by checking the value of the plugin_dir system variable.\n\n``sql\nSHOW GLOBAL VARIABLES\n   LIKE ''plugin_dir'';\n`\n\n`sql\n+---------------+--------------------------+\n| Variable_name | Value                    |\n+---------------+--------------------------+\n| plugin_dir    | /usr/lib64/mysql/plugin/ |\n+---------------+--------------------------+\n`\n\n2. Verify the server_audit2.so file—the shared library used by MariaDB Enterprise Audit—is present in your server’s plugin directory.\n\n`bash\n$ ls -l /usr/lib64/mysql/plugin/server_audit2.so\n`\n\n`bash\n-rwxr-xr-x. 1 root root 70432 Jul 15 19:03 /usr/lib64/mysql/plugin/server_audit2.so\n`\n\nMariaDB Enterprise Audit is bundled with all MariaDB Enterprise Server distributions (binary tarball, DEB/RPM package tarball, and DEB/RPM packages). If you do not see the server_audit2.so file, verify that MariaDB Enterprise Server has been installed correctly.\n\nLoad the Audit Plugin\n\nMariaDB Enterprise Audit is enabled through the mariadb-enterprise.cnf configuration file, which is included by default with MariaDB Enterprise Server. This means manual loading is usually not required.\n\nThe mariadb-enterprise.cnf file activates MariaDB Enterprise Audit by configuring the plugin-load-add and server-audit options.\n\n`ini\n-- Auditing - pre-load Plugin\nplugin-load-add=server_audit\nserver_audit=FORCE_PLUS_PERMANENT\n`\n\nIf your environment does not use mariadb-enterprise.cnf, you can enable MariaDB Enterprise Audit by adding the same options to your own configuration file.\n\nConfirm the Audit Plugin is Loaded\n\nTo verify that MariaDB Enterprise Audit is installed, check the information_schema.PLUGINS table.\n\n`sql\nSELECT PLUGIN_STATUS, PLUGIN_LIBRARY, PLUGIN_DESCRIPTION, LOAD_OPTION\nFROM information_schema.PLUGINS\nWHERE PLUGIN_NAME=''SERVER_AUDIT''\\G\n`\n\n`sql\n************************ 1. row ***********************\n     PLUGIN_STATUS: ACTIVE\n    PLUGIN_LIBRARY: server_audit2.so\nPLUGIN_DESCRIPTION: MariaDB Enterprise Audit\n       LOAD_OPTION: FORCE_PLUS_PERMANENT\n`\n\nMariaDB Enterprise Audit is enabled through the mariadb-enterprise.cnf configuration file, which is included by default in MariaDB Enterprise Server. If your results differ from the example output above, verify that the mariadb-enterprise.cnf file specifies the plugin-load-add and server-audit options.\n\nStart Audit Logging\n\nWhen MariaDB Enterprise Audit is installed and loaded, audit logging does not begin automatically. You must explicitly start it, either from the shell or through SQL.\n\n<table><thead><tr><th width="111">Interface</th><th width="207">Method</th><th>Benefits</th></tr></thead><tbody><tr><td>Shell</td><td><a href="mariadb-enterprise-audit.md#start-audit-logging-in-configuration-file">Configuration File</a></td><td>SQL access is not required SUPER privilege is not required Configuration file can be version controlled.</td></tr><tr><td>SQL</td><td><a href="mariadb-enterprise-audit.md#start-audit-logging-with-set-global">SET GLOBAL Statement</a></td><td>Server restart is not required.</td></tr></tbody></table>\n\nStart Audit Logging in Configuration File\n\nEnable audit logging with MariaDB Enterprise Audit by setting the server_audit_logging system variable in a configuration file. Alternatively, enable it dynamically with SET GLOBAL, which does not require a server restart.\n\nTo configure in a file:\n\n1\\. Set the server_audit_logging system variable in the configuration file.\n\n`ini\n[mariadb]\nserver_audit_logging = ON\n`\n\n2. Restart MariaDB Enterprise Server:\n\n`bash\n$ sudo systemctl restart mariadb\n`\n\nIf the server does not start, review the error log for details.\n\n3. To confirm that audit logging is running, check the value of the Server_audit_active status variable using the SHOW GLOBAL STATUS statement.\n\n`sql\nSHOW GLOBAL STATUS\n   LIKE ''Server_audit_active'';\n`\n\n`sql\n+---------------------+-------+\n| Variable_name       | Value |\n+---------------------+-------+\n| Server_audit_active | ON    |\n+---------------------+-------+\n`\n\nStart Audit Logging with SET GLOBAL\n\nAudit logging with MariaDB Enterprise Audit can be started by setting the server_audit_logging system variable with the SET GLOBAL statement, which requires the SUPER privilege.\n\n1. Set the server_audit_logging system variable with the SET GLOBAL statement:\n\n`sql\nSET GLOBAL server_audit_logging=ON;\n`\n\n2. Confirm that audit logging is started by querying the Server_audit_active status variable with the SHOW GLOBAL STATUS statement:\n\n`sql\nSHOW GLOBAL STATUS\n   LIKE ''Server_audit_active'';\n`\n\n`sql\n+---------------------+-------+\n| Variable_name       | Value |\n+---------------------+-------+\n| Server_audit_active | ON    |\n+---------------------+-------+\n`\n\nWhen you modify a system variable dynamically using the SET GLOBAL statement, the change is not preserved after a server restart. To ensure audit logging automatically starts with the server, also configure the server_audit_logging system variable in a configuration file.\n\n`ini\n[mariadb]\nserver_audit_logging = ON\n`\n\nConfirm Audit Logging is Started\n\nConfirm that audit logging is started by querying the Server_audit_active status variable with the SHOW GLOBAL STATUS statement:\n\n`sql\nSHOW GLOBAL STATUS\n   LIKE ''Server_audit_active'';\n`\n\n`sql\n+---------------------+-------+\n| Variable_name       | Value |\n+---------------------+-------+\n| Server_audit_active | ON    |\n+---------------------+-------+\n`\n\nAudit Logging Buffer Writes\n\nBuffer writes are available from MariaDB Enterprise Server 11.8.\n\nAudit log buffering is controlled by these variables:\n\n server_audit_file_buffer_size — This defines the size of the buffer. The default value is 0, meaning there''s no buffering at all. Setting non-zero value enables the buffering with the buffer of the specified size aligned by 8192. The maximum value is 65536.\n server_audit_sync_log_file — This flushes the buffer to the log file. While the log record is in the buffer, it cannot be seen in the log file. If there aren''t many events to log, the time before records can be observed can be significant. You can issue this statement to force writing the buffer to the file, making sure not to miss recent records:\n\n`sql\nSET GLOBAL server_audit_log_file=1\n`\n\nForbid Uninstallation\n\nIn a secure environment, MariaDB Enterprise Audit provides administrators with an audit trail of actions performed by users on the MariaDB Enterprise Server node. To protect the integrity of the audit trail, users should not be able to uninstall MariaDB Enterprise Audit. If the server-audit option is set to FORCE_PLUS_PERMANENT, MariaDB Enterprise Server will prevent MariaDB Enterprise Audit from being uninstalled:\n\n`ini\nserver_audit=FORCE_PLUS_PERMANENT\n`\n\nWhen a user tries to uninstall MariaDB Enterprise Audit with the server-audit option set to FORCE_PLUS_PERMANENT, the operation fails with the ER_PLUGIN_IS_PERMANENT error code:\n\n`sql\nUNINSTALL SONAME ''server_audit2'';\n`\n\n`sql\nERROR 1702 (HY000): Plugin ''SERVER_AUDIT'' is force_plus_permanent and can not be unloaded\n`\n\nThe mariadb-enterprise.cnf configuration file included by default in MariaDB Enterprise Server sets the server-audit option to FORCE_PLUS_PERMANENT. As a consequence, MariaDB Enterprise Server forbids MariaDB Enterprise Audit from being uninstalled by default.\n\nIf you do not use mariadb-enterprise.cnf in your environment, you can configure MariaDB Enterprise Audit to forbid uninstallation by setting the server-audit option in your configuration file.\n\nConfirm that Uninstallation is Forbidden\n\nTo confirm that MariaDB Enterprise Audit is configured to forbid uninstallation, query the information_schema.PLUGINS table:\n\n`sql\nSELECT PLUGIN_STATUS, PLUGIN_LIBRARY, PLUGIN_DESCRIPTION, LOAD_OPTION\nFROM information_schema.PLUGINS\nWHERE PLUGIN_NAME=''SERVER_AUDIT''\\G\n`\n\n`sql\n*********************** 1. row ***********************\n     PLUGIN_STATUS: ACTIVE\n    PLUGIN_LIBRARY: server_audit2.so\nPLUGIN_DESCRIPTION: MariaDB Enterprise Audit\n       LOAD_OPTION: FORCE_PLUS_PERMANENT\n`\n\nIf your output does not match the example output shown above, confirm that the mariadb-enterprise.cnf configuration file sets the server-audit option to FORCE_PLUS_PERMANENT.\n\nServer Startup Behavior\n\nSome specific server startup behavior is described in the sections below.\n\nFor examples of error messages that can appear in the MariaDB error log during server startup, see Messages\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-enterprise-audit');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (125, 5, 'WSREP\\_INFO Plugin', 'Description\n-----------\n\nThe WSREP_INFO plugin library contains the following plugins:\n\n WSREP_MEMBERSHIP\n WSREP_STATUS\n\nThe WSREP_MEMBERSHIP plugin creates the WSREP_MEMBERSHIP table in the INFORMATION_SCHEMA database. The plugin also adds the SHOW WSREP_MEMBERSHIP statement.\n\nThe WSREP_STATUS plugin creates the WSREP_STATUS table in the INFORMATION_SCHEMA database. The plugin also adds the SHOW WSREP_STATUS statement.\n\nThese tables and statements provide information about Galera. Only users with the SUPER privilege can access this information.\n\nInstalling the Plugin\n\niAlthough the plugin''s shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n``sql\nINSTALL SONAME ''wsrep_info'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mysqld or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = wsrep_info\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''wsrep_info'';\n``\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nExamples\n--------\n\nSHOW TABLES FROM information_schema LIKE ''WSREP%'';\n+---------------------------------------+\n| Tables_in_information_schema (WSREP%) |\n+---------------------------------------+\n| WSREP_STATUS                          |\n| WSREP_MEMBERSHIP                      |\n+---------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-replication-cluster-plugins/wsrep_info-plugin', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-replication-cluster-plugins/wsrep_info-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (126, 5, 'wsrep\\_provider', 'Description\n-----------\n\nThis plugin is for Galera Cluster. It splits up the wsrep_provider_options setting into individual configuration variables.\n\nThe plugin is available from MariaDB 11.4, and built in to the server, but not enabled by default.\n\nWithout that plugin, options are grouped together, like this:\n\n``ini\nwsrep_provider_options="base_dir = /var/lib/mysql/; base_host = node-1;..."\n`\n\nWith this plugin loaded, you can configure individual variables, like this:\n\n`ini\nwsrep_provider_base_dir  = /var/lib/mysql/\nwsrep_provider_base_host = node-1\n...\n`\n\nThis makes managing provider options easier, and helps avoid the problem of wsrep_provider_options exceeding the maximum length of 2048 characters for an individual variable.\n\nTo enable the plugin, add the following line to the [mariadbd], [server], or [galera] sections of your server option file:\n\n`ini\nplugin-wsrep-provider=ON\n`\n\nAlternatively, start the server with the --plugin-wsrep-provider` option.\n\nSee the wsrep_provider_options page for what you can configure for Galera Cluster.\n\nFor plugin version and maturity level, see this page.\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-replication-cluster-plugins/wsrep_provider', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-replication-cluster-plugins/wsrep_provider');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (127, 5, 'Disks Plugin', 'Description\n-----------\n\nThe DISKS plugin creates the DISKS table in the INFORMATION_SCHEMA database. This table shows metadata about disks on the system, enabling monitoring of the disk space status. Accessing the INFORMATION_SCHEMA.DISKS table requires the FILE privilege.\n\nThe plugin is supported on Linux systems only.\n\nInstalling the Plugin\n\nAlthough the plugin''s shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB automatically. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n``sql\nINSTALL SONAME ''disks'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be provided as a command-line argument to mysqld or specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = disks\n``\n\nExamples\n--------\n\n  +-----------+-----------------------+-----------+----------+-----------+\n  | Disk      | Path                  | Total     | Used     | Available |\n  +-----------+-----------------------+-----------+----------+-----------+\n  | /dev/sda3 | /                     |  47929956 | 30666304 |  14805864 |\n  | /dev/sda1 | /boot/efi             |    191551 |     3461 |    188090 |\n  | /dev/sda4 | /home                 | 174679768 | 80335392 |  85448120 |\n  | /dev/sdb1 | /mnt/hdd              | 961301832 |    83764 | 912363644 |\n  | /dev/sdb1 | /home/wikman/Music    | 961301832 |    83764 | 912363644 |\n  | /dev/sdb1 | /home/wikman/Videos   | 961301832 |    83764 | 912363644 |\n  | /dev/sdb1 | /home/wikman/hdd      | 961301832 |    83764 | 912363644 |\n  | /dev/sdb1 | /home/wikman/Pictures | 961301832 |    83764 | 912363644 |\n  | /dev/sda3 | /var/lib/docker/aufs  |  47929956 | 30666304 |  14805864 |\n  +-----------+-----------------------+-----------+----------+-----------+\n  9 rows in set (0.00 sec)\n\nURL: https://mariadb.com/docs/server/reference/plugins/other-plugins/disks-plugin', '', 'https://mariadb.com/docs/server/reference/plugins/other-plugins/disks-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (128, 5, 'Feedback Plugin', 'Description\n-----------\n\nThe feedback plugin is designed to collect and, optionally, upload\\\nconfiguration and usage information to MariaDB.org or to any other configured URL.\n\nSee the MariaDB User Feedback page on MariaDB.org to see collected MariaDB usage statistics.\n\nMariaDB is usually distributed with this plugin included, but it is not enabled by default.\\\nOn Windows, this plugin is part of the server and has a special checkbox in the installer window. Either way, you need to explicitly install and enable it in order for feedback data to be sent.\n\nVerifying the Plugin''s Status\n\nTo verify whether the feedback plugin is installed and enabled, execute the SHOW PLUGINS statement or query the information_schema.plugins table:\n\n``sql\nSELECT plugin_status FROM information_schema.plugins \n  WHERE plugin_name = ''feedback'';\n+---------------+\n| plugin_status |\n+---------------+\n| DISABLED      |\n+---------------+\n`\n\nIf that SELECT returns no rows, then you still need to install the plugin.\n\nWhen the plugin is installed and enabled, you will see:\n\n`sql\nSELECT plugin_status FROM information_schema.plugins \n  WHERE plugin_name = ''feedback'';\n+---------------+\n| plugin_status |\n+---------------+\n| ACTIVE        |\n+---------------+\n`\n\nInstalling the Plugin\n\nIn some releases, the plugin''s shared library is distributed with MariaDB by default, but the plugin is not actually installed by MariaDB. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n`\nINSTALL SONAME ''feedback'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mariadbd, or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = feedback\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''feedback'';\n`\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nEnabling the Plugin\n\nYou can enable the plugin by setting the feedback option to ON in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nfeedback=ON\n`\n\nIn Windows, the plugin can also be enabled during a new MSI installation. The MSI GUI installation provides the "Enable feedback plugin" checkbox to enable the plugin. The MSI command-line installation provides the FEEDBACK=1 command-line option to enable the plugin.\n\nSee the next section for how to verify the plugin is installed and active and (if needed) install the plugin.\n\nCollecting Data\n\nThe feedback plugin collects the following data:\n\n Certain rows from SHOW STATUS and SHOW VARIABLES.\n All installed plugins and their versions.\n System information such as CPU count, memory, architecture, and OS/linux distribution.\n The feedback_server_uid, which is a SHA1 hash of the MAC address of the first network interface and the TCP port that the server listens on.\n\nThe feedback plugin creates the FEEDBACK table in the INFORMATION_SCHEMA database. To see the data that has been collected by the plugin, you can execute:\n\n`sql\nSELECT  FROM information_schema.feedback;\n`\n\nOnly the contents of this table are sent to the feedback_url.\n\nMariaDB stores collation usage statistics. Each collation that has been used by the server\\\nwill have a record in output of SELECT  FROM information_schema.feedback , for example:\n\n`\n+----------------------------------------+---------------------+\n| VARIABLE_NAME                          | VARIABLE_VALUE      |\n+----------------------------------------+---------------------+\n| Collation used utf8_unicode_ci         | 10                  |\n| Collation used latin1_general_ci       | 20                  |\n+----------------------------------------+---------------------+\n`\n\nCollations that have not been used will not be included in the result.\n\nSending Data\n\nThe feedback plugin sends the data using a POST request to any URL or a list of URLs\\\nthat you specify by setting the feedback_url system variable. By default, this is set to the following URL:\n\n https://feedback.mariadb.org/rest/v1/post\n\nBoth HTTP and HTTPS protocols are supported.\n\nIf HTTP traffic requires a proxy in your environment, then you can specify the proxy by setting the feedback_http_proxy system variable.\n\nIf the feedback_url system variable is not set to an empty string, then the\\\nplugin will automatically send a report to all URLs in the list a few minutes after the server starts up and then once a week after that.\n\nIf the feedback_url system variable is set to an empty string, then the\\\nplugin will not automatically send any data. This may be necessary if outbound HTTP communication from your database server is not permitted. In this case, you can still upload the data manually, if you''d like.\n\nFirst, generate the report file with the MariaDB command-line mariadb client:\n\n`bash\n$ mariadb -e ''select  from information_schema.feedback'' > report.txt\n`\n\nThen, you can upload the generated report.txt here from the command line with tools such as curl:\n\n`bash\n$ curl -F data=@report.txt https://feedback.mariadb.org/rest/v1/post\n`\n\nManual uploading allows you to be absolutely sure that we receive only the data shown in the INFORMATION_SCHEMA.FEEDBACK table and that no private or sensitive information is being sent.\n\nSystem Variables\n\nfeedback_http_proxy\n\n Description: Proxy server for use when http calls cannot be made, such as in a firewall environment. The format is host:port.\n Command line: --feedback-http=proxy=value\n Read-only: Yes\n Data Type: string\n Default Value: '''' (empty)\n\nfeedback_send_retry_wait\n\n Description: Time in seconds before retrying if the plugin failed to send the data for any reason.\n Command line: --feedback-send-retry-wait=#\n Scope: Global\n Dynamic: Yes\n Data Type: numeric\n Default Value: 60\n Valid Values: 1 to 86400\n\nfeedback_send_timeout\n\n Description: An attempt to send the data times out and fails after this many seconds.\n Command line: --feedback-send-timeout=#\n Scope: Global\n Dynamic: Yes\n Data Type: numeric\n Default Value: 60\n Valid Values: 1 to 86400\n\nfeedback_server_uid\n\n Description: Automatically calculated server unique id hash.\n Scope: Global\n Dynamic: No\n Data Type: string\n\nfeedback_url\n\n Description: URL to which the data is sent. More than one URL, separated by spaces, can be specified. Set it to an empty string to disable data sending.\n Command line: --feedback-url=url\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: https://feedback.mariadb.org/rest/v1/post\n\nfeedback_user_info\n\n Description: The value of this option is not used by the plugin, but it is included in the feedback data. It can be used to add any user-specified string to the report. This could be used to help to identify it. For example, a support contract number, or a computer name (if you collect reports internally by specifying your own feedback-url).\n Command line: --feedback-user-info=string\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: Empty string\n\nOptions\n\nfeedback\n\n Description: Controls how the server should treat the plugin when the server starts up.\n   Valid values are:\n     OFF - Disables the plugin without removing it from the mysql.plugins table.\n     ON - Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled.\n     FORCE - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error.\n     FORCE_PLUS_PERMANENT - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. In addition, the plugin cannot be uninstalled with UNINSTALL SONAME or UNINSTALL PLUGIN while the server is running.\n   See Plugin Overview: Configuring Plugin Activation at Server Startup for more information.\n Command line: --feedback=value\n Data Type: enumerated\n Default Value: ON\n Valid Values: OFF, ON, FORCE, FORCE_PLUS_PERMANENT`\n\nURL: https://mariadb.com/docs/server/reference/plugins/other-plugins/feedback-plugin', '', 'https://mariadb.com/docs/server/reference/plugins/other-plugins/feedback-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (129, 5, 'METADATA\\_LOCK\\_INFO Plugin', 'Description\n-----------\n\nThe METADATA_LOCK_INFO plugin creates the METADATA_LOCK_INFO table in the INFORMATION_SCHEMA database. This table shows active metadata locks. The table is empty if there are no active metadata locks.\n\nInstalling the Plugin\n\nAlthough the plugin''s shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n``sql\nINSTALL SONAME ''metadata_lock_info'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mysqld or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = metadata_lock_info\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''metadata_lock_info'';\n``\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nExamples\n--------\n\nSELECT * FROM information_schema.metadata_lock_info;  \n+-----------+--------------------------+---------------+----------------------+-----------------+-------------+\n| THREAD_ID | LOCK_MODE                | LOCK_DURATION | LOCK_TYPE            | TABLE_SCHEMA    | TABLE_NAME  |  \n+-----------+--------------------------+---------------+----------------------+-----------------+-------------+\n|        31 | MDL_INTENTION_EXCLUSIVE  | MDL_EXPLICIT  | Global read lock     |                 |             |  \n|        31 | MDL_INTENTION_EXCLUSIVE  | MDL_EXPLICIT  | Commit lock          |                 |             |\n|        31 | MDL_INTENTION_EXCLUSIVE  | MDL_EXPLICIT  | Schema metadata lock | dbname          |             |\n|        31 | MDL_SHARED_NO_READ_WRITE | MDL_EXPLICIT  | Table metadata lock  | dbname          | exotics     |\n+-----------+--------------------------+---------------+----------------------+-----------------+-------------+\n4 rows in set (0.00 sec)\n\nURL: https://mariadb.com/docs/server/reference/plugins/other-plugins/metadata-lock-info-plugin', '', 'https://mariadb.com/docs/server/reference/plugins/other-plugins/metadata-lock-info-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (130, 5, 'mhnsw', 'Description\n-----------\n\nThis plugin is for internal use only.\n\nThis plugin implements the nhnsw vector index algorithm. It is used to create vector indexes.\n\nSee Vector Overview for the functionality, and Vector System Variables for what you can configure.\n\nIt is built in the server, and is always enabled.\n\nFor plugin version and maturity level, see this page.\n\nURL: https://mariadb.com/docs/server/reference/plugins/other-plugins/mhnsw', '', 'https://mariadb.com/docs/server/reference/plugins/other-plugins/mhnsw');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (131, 5, 'MYSQL\\_JSON', 'Description\n-----------\n\nThe TYPE_MYSQL_JSON plugin is available from MariaDB 10.5.7.\n\nThe JSON type in MySQL stores the JSON object in its own native form, while, in MariaDB, the JSON type is a LONGTEXT. Opening a table with a JSON type created in MySQL results in an error:\n\n``sql\nSELECT * FROM mysql_json_table;\nERROR 4161 (HY000): Unknown data type: ''MYSQL_JSON''\n`\n\nThe mysql_json plugin is used to make it easier to upgrade to MariaDB.\n\nInstalling\n\nInstalling can be done in a number of ways, for example:\n\n`sql\nINSTALL SONAME ''type_mysql_json'';\n``\n\nSee Making MariaDB understand MySQL JSON for a full description.\n\nURL: https://mariadb.com/docs/server/reference/plugins/other-plugins/mysql_json', '', 'https://mariadb.com/docs/server/reference/plugins/other-plugins/mysql_json');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (132, 5, 'online\\_alter\\_log', 'Description\n-----------\n\nThis plugin is for internal use only.\n\nThis plugin represents the online alter log in a transaction. It is used to commit transactions for tables while an online ALTER TABLE query is running.\n\nIt is built in the server, and is always enabled.\n\nSee the Online Schema Change page for functionality details.\n\nFor plugin version and maturity level, see this page.\n\nURL: https://mariadb.com/docs/server/reference/plugins/other-plugins/online_alter_log', '', 'https://mariadb.com/docs/server/reference/plugins/other-plugins/online_alter_log');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (133, 5, 'Query Cache Information Plugin', 'Description\n-----------\n\nThe QUERY_CACHE_INFO plugin creates the QUERY_CACHE_INFO table in the INFORMATION_SCHEMA database. This table shows all queries in the query cache. Querying this table acquires the query cache lock and will result in lock waits for queries that are using or expiring from the query cache. You must have the PROCESS privilege to query this table.\n\nInstalling the Plugin\n\nAlthough the plugin''s shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n``sql\nINSTALL SONAME ''query_cache_info'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mysqld or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = query_cache_info\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''query_cache_info'';\n``\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nExamples\n--------\n\nSELECT statement_schema, statement_text, result_blocks_count, \n  result_blocks_size FROM information_schema.query_cache_info;\n+------------------+------------------+---------------------+--------------------+\n| statement_schema | statement_text   | result_blocks_count | result_blocks_size |\n+------------------+------------------+---------------------+--------------------+\n| test             | SELECT * FROM t1 |                   1 |                512 |\n+------------------+------------------+---------------------+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/plugins/other-plugins/query-cache-information-plugin', '', 'https://mariadb.com/docs/server/reference/plugins/other-plugins/query-cache-information-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (134, 5, 'Query Response Time Plugin', 'Description\n-----------\n\nThe query_response_time plugin creates the QUERY_RESPONSE_TIME table in the INFORMATION_SCHEMA database. The plugin also adds the SHOW QUERY_RESPONSE_TIME and FLUSH QUERY_RESPONSE_TIME statements.\n\nThe slow query log provides exact information about queries that take a long time to execute. However, sometimes there are a large number of queries that each take a very short amount of time to execute. This feature provides a tool for analyzing that information by counting and displaying the number of queries according to the length of time they took to execute.\n\nThis feature is based on Percona''s Response Time Distribution.\n\nInstalling the Plugin\n\nThis shared library actually consists of a number of different plugins:\n\n QUERY_RESPONSE_TIME - An INFORMATION_SCHEMA plugin that exposes statistics.\n QUERY_RESPONSE_TIME_AUDIT - audit plugin, collects statistics.\n\nBoth plugins need to be installed to get meaningful statistics.\n\nIn addition, these additional plugins are available:\n\n QUERY_RESPONSE_TIME_READ\n QUERY_RESPONSE_TIME_READ_WRITE\n QUERY_RESPONSE_TIME_WRITE\n\nThis shared library actually consists of a number of different plugins:\n\n QUERY_RESPONSE_TIME - An INFORMATION_SCHEMA plugin that exposes statistics.\n QUERY_RESPONSE_TIME_AUDIT - audit plugin, collects statistics.\n\nBoth plugins need to be installed to get meaningful statistics.\n\nAlthough the plugin''s shared library is distributed with MariaDB by default, the plugins are not actually installed by MariaDB by default. There are two methods that can be used to install the plugins with MariaDB.\n\nThe first method can be used to install the plugin library without restarting the server. You can install the plugins dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n``sql\nINSTALL SONAME ''query_response_time'';\n`\n\nThe second method can be used to tell the server to load the plugin library when it starts up. The plugins can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mysqld or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = query_response_time\n`\n\nNote that in both cases you have to activate data collection by changing the query_response_time_stats setting to ON, it is OFF by default even when the plugin library is loaded.\n\nYou can change the setting at runtime with\n\n`sql\nSET GLOBAL query_response_time_stats=ON;\n`\n\nor in the options file after the plugin has been loaded:\n\n`ini\n[mariadb]\n...\nplugin_load_add = query_response_time\nquery_response_time_stats=ON;\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''query_response_time'';\n`\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nResponse Time Distribution\n\nThe user can define time intervals that divide the range 0 to positive infinity into smaller intervals and then collect the number of commands whose execution times fall into each of those intervals.\n\nEach interval is described as:\n\n`\n(range_base ^ n; range_base ^ (n+1)]\n`\n\nThe range_base is some positive number (see Limitations). The interval is defined as the difference between two nearby powers of the range base.\n\nIf the range base equals 10, we have the following intervals:\n\n`\n(0; 10 ^ -6], (10 ^ -6; 10 ^ -5], (10 ^ -5; 10 ^ -4], ..., \n  (10 ^ -1; 10 ^1], (10^1; 10^2]...(10^7; positive infinity]\n`\n\nor\n\n`\n(0; 0.000001], (0.000001; 0.000010], (0.000010; 0.000100], ..., \n  (0.100000; 1.0]; (1.0; 10.0]...(1000000; positive infinity]\n`\n\nFor each interval, a count is made of the queries with execution times that fell into that interval.\n\nYou can select the range of the intervals by changing the range base. For example, for base range=2 we have the following intervals:\n\n`\n(0; 2 ^ -19], (2 ^ -19; 2 ^ -18], (2 ^ -18; 2 ^ -17], ..., \n  (2 ^ -1; 2 ^1], (2 ^ 1; 2 ^ 2]...(2 ^ 25; positive infinity]\n`\n\nor\n\n`\n(0; 0.000001], (0.000001, 0.000003], ..., \n  (0.25; 0.5], (0.5; 2], (2; 4]...(8388608; positive infinity]\n`\n\nSmall numbers look strange (i.e., don’t look like powers of 2), because we lose precision on division when the ranges are calculated at runtime. In the resulting table, you look at the high boundary of the range:\n\n`sql\nSELECT  FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;\n+----------------+-------+----------------+\n| TIME           | COUNT | TOTAL          |\n+----------------+-------+----------------+\n|       0.000001 |     0 |       0.000000 |\n|       0.000010 |    17 |       0.000094 |\n|       0.000100 |  4301         0.236555 |\n|       0.001000 |  1499 |       0.824450 |\n|       0.010000 | 14851 |      81.680502 |\n|       0.100000 |  8066 |     443.635693 |\n|       1.000000 |     0 |       0.000000 |\n|      10.000000 |     0 |       0.000000 |\n|     100.000000 |     1 |      55.937094 |\n|    1000.000000 |     0 |       0.000000 |\n|   10000.000000 |     0 |       0.000000 |\n|  100000.000000 |     0 |       0.000000 |\n| 1000000.000000 |     0 |       0.000000 |\n| TOO LONG       |     0 | TOO LONG       |\n+----------------+-------+----------------+\n`\n\nThis means there were:\n\n`\n 17 queries with 0.000001 < query execution time < = 0.000010 seconds; total execution time of the 17 queries = 0.000094 seconds\n\n 4301 queries with 0.000010 < query execution time < = 0.000100 seconds; total execution time of the 4301 queries = 0.236555 seconds\n\n 1499 queries with 0.000100 < query execution time < = 0.001000 seconds; total execution time of the 1499 queries = 0.824450 seconds\n\n 14851 queries with 0.001000 < query execution time < = 0.010000 seconds; total execution time of the 14851 queries = 81.680502 seconds\n\n 8066 queries with 0.010000 < query execution time < = 0.100000 seconds; total execution time of the 8066 queries = 443.635693 seconds\n\n 1 query with 10.000000 < query execution time < = 100.0000 seconds; total execution time of the 1 query = 55.937094 seconds\n`\n\nUsing the Plugin\n\nUsing the Information Schema Table\n\nYou can get the distribution by querying the QUERY_RESPONSE_TIME table in the INFORMATION_SCHEMA database:\n\n`sql\nSELECT  FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;\n`\n\nYou can also write more complex queries:\n\n`sql\nSELECT c.count, c.time,\n(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME AS a \n   WHERE a.count != 0) AS query_count,\n(SELECT COUNT()     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME AS b \n  WHERE b.count != 0) AS not_zero_region_count,\n(SELECT COUNT()     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) AS region_count\nFROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME AS c \n  WHERE c.count > 0;\n`\n\nNote: If query_response_time_stats is set to ON, then the execution times for these two SELECT queries will also be collected.\n\nUsing the SHOW Statement\n\nAs an alternative to the QUERY_RESPONSE_TIME table in the INFORMATION_SCHEMA database, you can also use the SHOW QUERY_RESPONSE_TIME statement:\n\n`sql\nSHOW QUERY_RESPONSE_TIME;\n`\n\nFlushing Plugin Data\n\nFlushing the plugin data does two things:\n\n Clears the collected times from the QUERY_RESPONSE_TIME table in the INFORMATION_SCHEMA database.\n Reads the value of query_response_time_range_base and uses it to set the range base for the table.\n\nPlugin data can be flushed with the FLUSH QUERY_RESPONSE_TIME statement:\n\n`sql\nFLUSH QUERY_RESPONSE_TIME;\n`\n\nSetting the query_response_time_flush system variable has the same effect:\n\n`sql\nSET GLOBAL query_response_time_flush=1;\n`\n\nIt is possible to specify flushing read and/or write statements with the FLUSH QUERY_RESPONSE_TIME_READ, FLUSH QUERY_RESPONSE_TIME_WRITE and FLUSH QUERY_RESPONSE_TIME_READ_WRITE statements.\n\nIt is not possible to specify flushing read and/or write statements with the FLUSH QUERY_RESPONSE_TIME_READ, FLUSH QUERY_RESPONSE_TIME_WRITE and FLUSH QUERY_RESPONSE_TIME_READ_WRITE statements.\n\nSystem Variables\n\nquery_response_time_flush\n\n Description: Updating this variable flushes the statistics and re-reads query_response_time_range_base.\n Command line: None\n Scope: Global\n Dynamic: Yes\n Data Type: boolean\n Default Value: OFF\n\nquery_response_time_range_base\n\n Description: Select base of log for QUERY_RESPONSE_TIME ranges. WARNING: variable change takes affect only after flush.\n Command line: --query-response-time-range-base=#\n Scope: Global\n Dynamic: Yes\n Data Type: numeric\n Default Value: 10\n Range: 2 to 1000\n\nquery_response_time_exec_time_debug\n\n Description: Pretend queries take this many microseconds. When 0 (the default) use the actual execution time.\n   This system variable is only available when the plugin is a debug build.\n Scope: Global\n Dynamic: Yes\n Data Type: numeric\n Default Value: 0\n Range: 0 to 31536000\n\nquery_response_time_session_stats\n\n Description: Controls query response time statistics collection for the current session: ON - enable, OFF - disable, GLOBAL (default) - use query_response_time_stats value.\n Command line: query-response-time-session-stats=val]\n Scope: Global, Session\n Dynamic: Yes\n Data Type: enum\n Default Value: GLOBAL\n Valid Values: GLOBAL, ON, OFF\n Introduced: MariaDB 11.5\n\nquery_response_time_stats\n\n Description: Enable or disable query response time statistics collecting.\n Command line: query-response-time-stats[={0|1}]\n Scope: Global\n Dynamic: Yes\n Data Type: boolean\n Default Value: OFF\n\nOptions\n\nquery_response_time\n\n Description: Controls how the server should treat the plugin when the server starts up.\n   Valid values are:\n     OFF - Disables the plugin without removing it from the mysql.plugins table.\n     ON - Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled.\n     FORCE - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error.\n     FORCE_PLUS_PERMANENT - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. In addition, the plugin cannot be uninstalled with UNINSTALL SONAME or UNINSTALL PLUGIN while the server is running.\n   See Plugin Overview: Configuring Plugin Activation at Server Startup for more information.\n Command line: --query-response-time=value\n Data Type: enumerated\n Default Value: ON\n Valid Values: OFF, ON, FORCE, FORCE_PLUS_PERMANENT\n\nquery_response_time_audit\n\n Description: Controls how the server should treat the plugin when the server starts up.\n   Valid values are:\n     OFF - Disables the plugin without removing it from the mysql.plugins table.\n     ON - Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled.\n     FORCE - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error.\n     FORCE_PLUS_PERMANENT - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. In addition, the plugin cannot be uninstalled with UNINSTALL SONAME or UNINSTALL PLUGIN while the server is running.\n   See Plugin Overview: Configuring Plugin Activation at Server Startup for more information.\n Command line: --query-response-time-audit=value\n Data Type: enumerated\n Default Value: ON\n* Valid Values: OFF, ON, FORCE, FORCE_PLUS_PERMANENT`\n\nURL: https://mariadb.com/docs/server/reference/plugins/other-plugins/query-response-time-plugin', '', 'https://mariadb.com/docs/server/reference/plugins/other-plugins/query-response-time-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (135, 5, 'User Variables Plugin', 'Description\n-----------\n\nThe user_variables plugin creates the USER_VARIABLES table in the INFORMATION_SCHEMA database. This table contains information about user-defined variables.\n\nViewing\n\nUser-defined variables can be viewed by either querying the USER_VARIABLES, or by running SHOW USER_VARIABLES.\n\nFlushing User-Defined Variables\n\nUser-defined variables are reset and the Information Schema table emptied with the FLUSH USER_VARIABLES statement.\n\nExamples\n--------\n\nSET @v1 = 0;\nSET @v2 = ''abc'';\nSET @v3 = CAST(123 AS CHAR(5));\n\nSHOW USER_VARIABLES;\n+---------------+-------+\n| Variable_name | Value |\n+---------------+-------+\n| v3            | 123   |\n| v2            | abc   |\n| v1            | 0     |\n+---------------+-------+\n\nSELECT  FROM information_schema.USER_VARIABLES ORDER BY VARIABLE_NAME;\n+---------------+----------------+---------------+--------------------+\n| VARIABLE_NAME | VARIABLE_VALUE | VARIABLE_TYPE | CHARACTER_SET_NAME |\n+---------------+----------------+---------------+--------------------+\n| v1            | 0              | INT           | latin1             |\n| v2            | abc            | VARCHAR       | utf8               |\n| v3            | 123            | VARCHAR       | utf8               |\n+---------------+----------------+---------------+--------------------+\n\nFLUSH USER_VARIABLES;\n\nSELECT  FROM information_schema.USER_VARIABLES ORDER BY VARIABLE_NAME;\nEmpty set (0.000 sec)\n\nURL: https://mariadb.com/docs/server/reference/plugins/other-plugins/user-variables-plugin', '', 'https://mariadb.com/docs/server/reference/plugins/other-plugins/user-variables-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (136, 5, 'Cracklib Password Check Plugin', 'Description\n-----------\n\ncracklib_password_check is a password validation plugin. It uses the CrackLib library to check the strength of new passwords. CrackLib is installed by default in many Linux distributions, since the system''s Pluggable Authentication Module (PAM) authentication framework is usually configured to check the strength of new passwords with the pam_cracklib PAM module.\n\nNote that passwords can be directly set as a hash, bypassing the password validation, if the strict_password_validation variable is OFF (it is ON by default).\n\nThe plugin requires at least cracklib 2.9.0, so it is not available on Debian/Ubuntu builds before Debian 8 Jessie/Ubuntu 14.04 Trusty, RedHat Enterprise Linux / CentOS 6.\n\nInstalling the Plugin''s Package\n\nThe cracklib_password_check plugin''s shared library is included in MariaDB packages as the cracklib_password_check.so or cracklib_password_check.dll shared library on systems where it can be built.\n\nInstalling on Linux\n\nThe cracklib_password_check plugin is included in systemd binary tarballs on Linux, but not in the older generic and glibc_214 tarballs.\n\nInstalling with a Package Manager\n\nThe cracklib_password_check plugin can also be installed via a package manager on Linux. In order to do so, your system needs to be configured to install from one of the MariaDB repositories.\n\nYou can configure your package manager to install it from MariaDB Corporation''s MariaDB Package Repository by using the MariaDB Package Repository setup script.\n\nYou can also configure your package manager to install it from MariaDB Foundation''s MariaDB Repository by using the MariaDB Repository Configuration Tool.\n\nInstalling with yum/dnf\n\nOn RHEL, CentOS, Fedora, and other similar Linux distributions, it is highly recommended to install the relevant RPM package from MariaDB''s repository using yum or dnf. Starting with RHEL 8 and Fedora 22, yum has been replaced by dnf, which is the next major version of yum. However, yum commands still work on many systems that use dnf:\n\n``bash\nsudo yum install MariaDB-cracklib-password-check\n`\n\nInstalling with apt-get\n\nOn Debian, Ubuntu, and other similar Linux distributions, it is highly recommended to install the relevant DEB package from MariaDB''s repository using apt-get:\n\n`sql\nsudo apt-get install mariadb-plugin-cracklib-password-check\n`\n\nInstalling with zypper\n\nOn SLES, OpenSUSE, and other similar Linux distributions, it is highly recommended to install the relevant RPM package from MariaDB''s repository using zypper:\n\n`bash\nsudo zypper install MariaDB-cracklib-password-check\n`\n\nInstalling the Plugin\n\nOnce the shared library is in place, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n`sql\nINSTALL SONAME ''cracklib_password_check'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mariadbd, or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = cracklib_password_check\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''cracklib_password_check'';\n``\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nViewing CrackLib Errors\n\nIf password validation fails, then the original CrackLib error message can be viewed by executing SHOW WARNINGS.\n\nExamples\n--------\n\nSET PASSWORD FOR ''bob''@''%.loc.gov'' = PASSWORD(''abc'');\nERROR 1819 (HY000): Your password does not satisfy the current policy requirements\n\nURL: https://mariadb.com/docs/server/reference/plugins/password-validation-plugins/cracklib-password-check-plugin', '', 'https://mariadb.com/docs/server/reference/plugins/password-validation-plugins/cracklib-password-check-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (137, 5, 'Password Reuse Check Plugin', 'Description\n-----------\n\nThe plugin is used to prevent a user from reusing a password, which can be a requirement in some security policies. The password_reuse_check_interval system variable determines the retention period, in days, for a password. By default, this is zero, meaning unlimited retention. Old passwords are stored in the mysql.password_reuse_check_history table.\n\nNote that passwords can be directly set as a hash, bypassing the password validation, if the strict_password_validation variable is OFF (it is ON by default).\n\nInstalling the Plugin\n\nAlthough the plugin''s shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default.\n\nYou can install the plugin dynamically, without restarting the server, by executing INSTALL SONAME or INSTALL PLUGIN:\n\n``sql\nINSTALL SONAME ''password_reuse_check'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mysqld or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = password_reuse_check\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''password_reuse_check'';\n``\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nExamples\n--------\n\nINSTALL SONAME ''password_reuse_check'';\n\nGRANT SELECT ON . TO user1@localhost identified by ''pwd1'';\nQuery OK, 0 rows affected (0.038 sec)\n\nGRANT SELECT ON . TO user1@localhost identified by ''pwd1'';\nERROR 1819 (HY000): Your password does not satisfy the current policy requirements\n\nGRANT SELECT ON . TO user1@localhost identified by ''pwd2'';\nQuery OK, 0 rows affected (0.003 sec)\n\nGRANT SELECT ON . TO user1@localhost identified by ''pwd1'';\nERROR 1819 (HY000): Your password does not satisfy the current policy requirements\n\nURL: https://mariadb.com/docs/server/reference/plugins/password-validation-plugins/password-reuse-check-plugin', '', 'https://mariadb.com/docs/server/reference/plugins/password-validation-plugins/password-reuse-check-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (138, 5, 'Password Validation Plugin Overview', 'Description\n-----------\n\n_Password validation_ means ensuring that user passwords meet certain minimal security requirements. A dedicated plugin API allows the creation of password validation plugins that will check user passwords as they are set (in SET PASSWORD and GRANT statements) and either allow or reject them.\n\nSQL-Level Extensions\n\nMariaDB comes with three password validation plugins — the simple_password_check plugin, the cracklib_password_check plugin and the password_reuse_check plugin. They are not enabled by default – use INSTALL SONAME (or INSTALL PLUGIN) statement to install them.\n\nWhen at least one password plugin is loaded, all new passwords will be validated and password-changing statements will fail if the password will not pass validation checks. Several password validation plugin can be loaded at the same time — in this case a password must pass all validation checks by all plugins.\n\nPassword-Changing Statements\n\nOne can use various SQL statements to change a user password:\n\nWith Plain Text Password\n\n``sql\nSET PASSWORD = PASSWORD(''plain-text password'');\nSET PASSWORD FOR user@host = PASSWORD(''plain-text password'');\nSET PASSWORD = OLD_PASSWORD(''plain-text password'');\nSET PASSWORD FOR user@host = OLD_PASSWORD(''plain-text password'');\nCREATE USER user@host IDENTIFIED BY ''plain-text password'';\nGRANT PRIVILEGES TO user@host IDENTIFIED BY ''plain-text password'';\n`\n\nThese statements are subject to password validation. If at least one password validation plugin is loaded, plain-text passwords specified in these statements will be validated.\n\nWith Password Hash\n\n`sql\nSET PASSWORD = ''password hash'';\nSET PASSWORD FOR user@host = ''password hash'';\nCREATE USER user@host IDENTIFIED BY PASSWORD ''password hash'';\nCREATE USER user@host IDENTIFIED VIA mysql_native_password USING ''password hash'';\nCREATE USER user@host IDENTIFIED VIA mysql_old_password USING ''password hash'';\nGRANT PRIVILEGES TO user@host IDENTIFIED BY PASSWORD ''password hash'';\nGRANT PRIVILEGES TO user@host IDENTIFIED VIA mysql_native_password USING ''password hash'';\nGRANT PRIVILEGES TO user@host IDENTIFIED VIA mysql_old_password USING ''password hash'';\n``\n\nThese statements can not possibly use password validation — there is nothing to validate, the original plain-text password is not available.\n\nMariaDB introduces a strict password validation mode — controlled by a strict_password_validation global server variable.\n\nIf the strict password validation is enabled and at least one password validation plugin is loaded, passwords that cannot be validated are rejected; otherwise, they''re  accepted. By default, a strict password validation is enabled (but note that it has no effect if no password validation plugin is loaded).\n\nExamples\n--------\n\nGRANT SELECT ON . to foobar IDENTIFIED BY ''raboof'';\nERROR HY000: Your password does not satisfy the current policy requirements\n\nSHOW WARNINGS;\n+---------+------+----------------------------------------------------------------+\n| Level	  | Code | Message                                                        |\n+---------+------+----------------------------------------------------------------+\n| Warning | 1819 | cracklib: it is based on your username                         |\n| Error	  | 1819 | Your password does not satisfy the current policy requirements |\n+---------+------+----------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/plugins/password-validation-plugins/password-validation', '', 'https://mariadb.com/docs/server/reference/plugins/password-validation-plugins/password-validation');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (139, 5, 'password\\_reuse\\_check\\_interval Variable', 'Description\n-----------\n\nThe password_reuse_check_interval system variable is available when the password_reuse_check plugin is installed. It determines the retention period for the password history in days. Zero, the default, means that passwords are never discarded.\n\n Command line: --password_reuse_check_interval=#\n Scope: Global\n Read-only: No\n Data Type: numeric\n Default Value: 0\n Range: 0 to 36500\n\nURL: https://mariadb.com/docs/server/reference/plugins/password-validation-plugins/password_reuse_check_interval', '', 'https://mariadb.com/docs/server/reference/plugins/password-validation-plugins/password_reuse_check_interval');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (140, 5, 'Simple Password Check Plugin', 'Description\n-----------\n\nsimple_password_check is a password validation plugin. It can check whether a password contains at least a certain number of characters of a specific type. When first installed, a password is required to be at least eight characters, and requires at least one digit, one uppercase character, one lowercase character, and one character that is neither a digit nor a letter.\n\nNote that passwords can be directly set as a hash, bypassing the password validation, if the strict_password_validation variable is OFF (it is ON by default).\n\nInstalling the Plugin\n\nAlthough the plugin''s shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n``sql\nINSTALL SONAME ''simple_password_check'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mariadbd, or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = simple_password_check\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''simple_password_check'';\n``\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nExamples\n--------\n\nSET PASSWORD FOR ''bob''@''%.loc.gov'' = PASSWORD(''abc'');\nERROR 1819 (HY000): Your password does not satisfy the current policy requirements\n\nURL: https://mariadb.com/docs/server/reference/plugins/password-validation-plugins/simple-password-check-plugin', '', 'https://mariadb.com/docs/server/reference/plugins/password-validation-plugins/simple-password-check-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (141, 5, 'Plugin Overview', 'Description\n-----------\n\nMariaDB supports the use of plugins, software components that may be added to the core software without having to rebuild the MariaDB server from source code. Plugins can be loaded at startup, or loaded and unloaded while the server is running, without interruption. Plugins are commonly used for adding desired storage engines, additional security requirements, logging special information about the server, or even small enhancements, such as a plugin to get a timestamp as an integer.\n\nQuerying Plugin Information\n\nThere are a number of ways to see which plugins are currently active.\n\nA server almost always has a large number of active plugins, because the server contains a large number of built-in plugins, which are active by default and cannot be uninstalled.\n\nQuerying Plugin Information with SHOW PLUGINS\n\nThe SHOW PLUGINS statement can be used to query information about all active plugins.\n\nFor example:\n\n``sql\nSHOW PLUGINS\\G;\n******************* 1. row ****************\n   Name: binlog\n Status: ACTIVE\n   Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n**************** 2. row ****************\n   Name: mysql_native_password\n Status: ACTIVE\n   Type: AUTHENTICATION\nLibrary: NULL\nLicense: GPL\n**************** 3. row ******************\n   Name: mysql_old_password\n Status: ACTIVE\n   Type: AUTHENTICATION\nLibrary: NULL\nLicense: GPL\n...\n`\n\nIf a plugin''s Library column has a NULL value, then the plugin is built-in, and it cannot be uninstalled.\n\nQuerying Plugin Information with information_schema.PLUGINS\n\nThe information_schema.PLUGINS table can be queried to get more detailed information about plugins.\n\nFor example:\n\n`sql\nSELECT  FROM information_schema.PLUGINS\\G\n...\n************************ 65. row *********************\n           PLUGIN_NAME: user_variables\n        PLUGIN_VERSION: 1.0\n         PLUGIN_STATUS: ACTIVE\n           PLUGIN_TYPE: INFORMATION SCHEMA\n   PLUGIN_TYPE_VERSION: 110600.0\n        PLUGIN_LIBRARY: NULL\nPLUGIN_LIBRARY_VERSION: NULL\n         PLUGIN_AUTHOR: Sergey Vojtovich\n    PLUGIN_DESCRIPTION: User-defined variables\n        PLUGIN_LICENSE: GPL\n           LOAD_OPTION: ON\n       PLUGIN_MATURITY: Stable\n   PLUGIN_AUTH_VERSION: 1.0\n********************* 66. row *********************\n           PLUGIN_NAME: wsrep_provider\n        PLUGIN_VERSION: 1.0\n         PLUGIN_STATUS: ACTIVE\n           PLUGIN_TYPE: REPLICATION\n   PLUGIN_TYPE_VERSION: 2.0\n        PLUGIN_LIBRARY: NULL\nPLUGIN_LIBRARY_VERSION: NULL\n         PLUGIN_AUTHOR: Codership Oy\n    PLUGIN_DESCRIPTION: Wsrep provider plugin\n        PLUGIN_LICENSE: GPL\n           LOAD_OPTION: ON\n       PLUGIN_MATURITY: Alpha\n   PLUGIN_AUTH_VERSION: 1.0\n********************* 67. row ***********************\n           PLUGIN_NAME: THREAD_POOL_GROUPS\n        PLUGIN_VERSION: 1.0\n         PLUGIN_STATUS: ACTIVE\n           PLUGIN_TYPE: INFORMATION SCHEMA\n   PLUGIN_TYPE_VERSION: 110600.0\n        PLUGIN_LIBRARY: NULL\nPLUGIN_LIBRARY_VERSION: NULL\n         PLUGIN_AUTHOR: Vladislav Vaintroub\n    PLUGIN_DESCRIPTION: Provides information about threadpool groups.\n        PLUGIN_LICENSE: GPL\n           LOAD_OPTION: ON\n       PLUGIN_MATURITY: Stable\n   PLUGIN_AUTH_VERSION: 1.0\n...\n`\n\nIf a plugin''s PLUGIN_LIBRARY column has the NULL value, the plugin is built-in and cannot be uninstalled.\n\nQuerying Plugin Information with mysql.plugin\n\nThe mysql.plugin table can be queried to get information about installed plugins.\n\nThis table only contains information about plugins that have been installed via the following methods:\n\n The INSTALL SONAME statement.\n The INSTALL PLUGIN statement.\n The mariadb-plugin utility.\n\nThis table does not contain information about:\n\n Built-in plugins.\n Plugins loaded with the --plugin-load-add option.\n Plugins loaded with the --plugin-load option.\n\nThis table only contains enough information to reload the plugin when the server is restarted, which means it only contains the plugin name and the plugin library.\n\nFor example:\n\n`sql\nSELECT  FROM mysql.plugin;\n\n+------+------------+\n| name | dl         |\n+------+------------+\n| PBXT | libpbxt.so |\n+------+------------+\n`\n\nInstalling a Plugin\n\nThere are three primary ways to install a plugin:\n\n A plugin can be installed dynamically with an SQL statement.\n A plugin can be installed with a mariadbd option, but it requires a server restart.\n A plugin can be installed with the mariadb-plugin utility, while the server is completely offline.\n\nWhen you are installing a plugin, you also have to ensure that:\n\n The server''s plugin directory is properly configured, and the plugin''s library is in the plugin directory.\n The server''s minimum plugin maturity is properly configured, and the plugin is mature enough to be installed.\n\nInstalling a Plugin Dynamically\n\nA plugin can be installed dynamically by executing either the INSTALL SONAME or the INSTALL PLUGIN statement.\n\nIf a plugin is installed with one of these statements, a record will be added to the mysql.plugins table for the plugin. This means that the plugin will automatically be loaded every time the server restarts, unless specifically uninstalled or deactivated.\n\nInstalling a Plugin with INSTALL SONAME\n\nYou can install a plugin dynamically by executing the INSTALL SONAME statement. INSTALL SONAME installs all plugins from the given plugin library. This could be required for some plugin libraries.\n\nFor example, to install all plugins in the server_audit plugin library (which is currently only the server_audit audit plugin), you could execute the following:\n\n`sql\nINSTALL SONAME ''server_audit'';\n`\n\nInstalling a Plugin with INSTALL PLUGIN\n\nYou can install a plugin dynamically by executing the INSTALL PLUGIN statement. INSTALL PLUGIN installs a single plugin from the given plugin library.\n\nFor example, to install the server_audit audit plugin from the server_audit plugin library, you could execute the following:\n\n`sql\nINSTALL PLUGIN server_audit SONAME ''server_audit'';\n`\n\nInstalling a Plugin with Plugin Load Options\n\nA plugin can be installed with a mariadbd option by providing either the --plugin-load-add or the --plugin-load option.\n\nIf a plugin is installed with one of these options, then a record will not be added to the mysql.plugins table for the plugin. This means that if the server is restarted without the same option set, then the plugin will not automatically be loaded.\n\nInstalling a Plugin with --plugin-load-add\n\nYou can install a plugin with the --plugin-load-add option by specifying the option as a command-line argument to mariadbd or by specifying the option in a relevant server option group in an option file.\n\nThe --plugin-load-add option uses the following format:\n\n Plugins can be specified in the format name=library, where name is the plugin name and library is the plugin library. This format installs a single plugin from the given plugin library.\n Plugins can also be specified in the format library, where library is the plugin library. This format installs all plugins from the given plugin library.\n Multiple plugins can be specified by separating them with semicolons.\n\nFor example, to install all plugins in the server_audit plugin library (which is currently only the server_audit audit plugin) and also the ed25519 authentication plugin from the auth_ed25519 plugin library, you could set the option to the following values on the command-line:\n\n`bash\n$ mariadbd --user=mysql --plugin-load-add=''server_audit'' --plugin-load-add=''ed25519=auth_ed25519''\n`\n\nYou could also set the option to the same values in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = server_audit\nplugin_load_add = ed25519=auth_ed25519\n`\n\nSpecial care must be taken when specifying both the --plugin-load option and the --plugin-load-add option together. The --plugin-load option resets the plugin load list, and this can cause unexpected problems if you are not aware. The --plugin-load-add option does not reset the plugin load list, so it is much safer to use. See Specifying Multiple Plugin Load Options for more information.\n\nInstalling a Plugin with --plugin-load\n\nYou can install a plugin with the --plugin-load option by specifying the option as a command-line argument to mariadbd or by specifying the option in a relevant server option group in an option file.\n\nThe --plugin-load option uses the following format:\n\n Plugins can be specified in the format name=library, where name is the plugin name and library is the plugin library. This format installs a single plugin from the given plugin library.\n Plugins can also be specified in the format library, where library is the plugin library. This format installs all plugins from the given plugin library.\n Multiple plugins can be specified by separating them with semicolons.\n\nFor example, to install all plugins in the server_audit plugin library (which is currently only the server_audit audit plugin) and also the ed25519 authentication plugin from the auth_ed25519 plugin library, you could set the option to the following values on the command-line:\n\n`bash\n$ mariadbd --user=mysql --plugin-load=''server_audit;ed25519=auth_ed25519''\n`\n\nYou could also set the option to the same values in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load = server_audit;ed25519=auth_ed25519\n`\n\nSpecial care must be taken when specifying the --plugin-load option multiple times, or when specifying both the --plugin-load option and the --plugin-load-add option together. The --plugin-load option resets the plugin load list, and this can cause unexpected problems if you are not aware. The --plugin-load-add option does not reset the plugin load list, so it is much safer to use. See Specifying Multiple Plugin Load Options for more information.\n\nSpecifying Multiple Plugin Load Options\n\nSpecial care must be taken when specifying the --plugin-load option multiple times, or when specifying both the --plugin-load option and the --plugin-load-add option. The --plugin-load option resets the plugin load list, and this can cause unexpected problems if you are not aware. The --plugin-load-add option does not reset the plugin load list, so it is much safer to use.\n\nThis can have the following consequences:\n\n If the --plugin-load option is specified multiple times, then only the last instance will have any effect. For example, in the following case, the first instance of the option is reset:\n\n`ini\n[mariadb]\n...\nplugin_load = server_audit\nplugin_load = ed25519=auth_ed25519\n`\n\n If the --plugin-load option is specified after the --plugin-load-add option, then it will also reset the changes made by that option. For example, in the following case, the --plugin-load-add option does not do anything, because the subsequent --plugin-load option resets the plugin load list:\n\n`ini\n[mariadb]\n...\nplugin_load_add = server_audit\nplugin_load = ed25519=auth_ed25519\n`\n\n In contrast, if the --plugin-load option is specified before the --plugin-load-add option, then it will work fine, because the --plugin-load-add option does not reset the plugin load list. For example, in the following case, both plugins are properly loaded:\n\n`ini\n[mariadb]\n...\nplugin_load = server_audit\nplugin_load_add = ed25519=auth_ed25519\n`\n\nInstalling a Plugin with mariadb-plugin\n\nA plugin can be installed with the mariadb-plugin utility if the server is completely offline.\n\nThe syntax is:\n\n`sql\nmariadb-plugin [options] <plugin> ENABLE|DISABLE\n`\n\nFor example, to install the server_audit audit plugin, you could execute the following:\n\n`sql\nmariadb-plugin server_audit ENABLE\n`\n\nIf a plugin is installed with this utility, a record will be added to the mysql.plugins table for the plugin. This means that the plugin will automatically be loaded every time the server restarts, unless specifically uninstalled or deactivated.\n\nConfiguring the Plugin Directory\n\nWhen a plugin is being installed, the server looks for the plugin''s library in the server''s plugin directory. This directory is configured by the plugin_dir system variable. This can be specified as a command-line argument to mariadbd or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_dir = /usr/lib64/mysql/plugin\n`\n\nConfiguring the Minimum Plugin Maturity\n\nWhen a plugin is being installed, the server compares the plugin''s maturity level against the server''s minimum allowed plugin maturity. This can help prevent users from using unstable plugins on production servers. This minimum plugin maturity is configured by the plugin_maturity system variable. This can be specified as a command-line argument to mariadbd or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_maturity = stable\n`\n\nConfiguring Plugin Activation at Server Startup\n\nA plugin will be loaded by default when the server starts if:\n\n The plugin was installed with the INSTALL SONAME statement.\n The plugin was installed with the INSTALL PLUGIN statement.\n The plugin was installed with the mariadb-plugin utility.\n The server is configured to load the plugin with the --plugin-load-add option.\n The server is configured to load the plugin with the --plugin-load option.\n\nThis behavior can be changed with special options that take the form --plugin-name. For example, for the server_audit audit plugin, the special option is called --server-audit.\n\nThe possible values for these special options are:\n\n| Option Value           | Description                                                                                                                                                                                                                                                                                                                                                                                                               |\n| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| OFF                    | Disables the plugin without removing it from the mysql.plugins table.                                                                                                                                                                                                                                                                                 |\n| ON                     | Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled.\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/plugin-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (142, 16, 'Aggregate Functions', 'Description\n-----------\n\nstored-aggregate-functions.md\n\nStored Aggregate Functions allow users to create custom aggregate functions that process a sequence of rows and return a single summary result. This page provides a general overview.\n\navg.md\n\nCalculate the average value. This function computes the arithmetic mean of a numeric expression, ignoring NULL values.\n\nbit_and.md\n\nPerform a bitwise AND operation. This function returns the result of performing a bitwise AND on all values in a given expression.\n\nbit_or.md\n\nPerform a bitwise OR operation. This function returns the result of performing a bitwise OR on all values in a given expression.\n\nbit_xor.md\n\nPerform a bitwise XOR operation. This function returns the result of performing a bitwise XOR on all values in a given expression.\n\ncount-distinct.md\n\nCount unique values. This function returns the number of distinct, non-NULL values found in the specified column or expression.\n\ncount.md\n\nComplete COUNT() function reference: COUNT(*) and COUNT(expr) syntax, COUNT(DISTINCT) usage, GROUP BY aggregation, and OVER(PARTITION BY) window syntax.\n\ngroup_concat.md\n\nComplete GROUP_CONCAT reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples for production use.\n\njson_arrayagg.md\n\nAggregate values into a JSON array. This function aggregates a result set column into a single JSON array.\n\njson_objectagg.md\n\nAggregate key-value pairs into a JSON object. This function aggregates two columns or expressions into a single JSON object.\n\nmax.md\n\nFind the maximum value. This function returns the highest value in a set of values, applicable to numbers, strings, and dates.\n\nmin.md\n\nFind the minimum value. This function returns the lowest value in a set of values, applicable to numbers, strings, and dates.\n\nstd.md\n\nCalculate population standard deviation. This function returns the square root of the population variance. It is a synonym for STDDEV_POP().\n\nstddev.md\n\nCalculate population standard deviation. This function is a synonym for STD() and STDDEV_POP(), returning the square root of the population variance.\n\nstddev_pop.md\n\nCalculate population standard deviation. This function computes the standard deviation assuming the set of values represents the entire population.\n\nstddev_samp.md\n\nCalculate sample standard deviation. This function computes the standard deviation assuming the set of values represents a sample of the population.\n\nsum.md\n\nCalculate the total sum. This function returns the sum of all values in a numeric expression, ignoring NULL values.\n\nvar_pop.md\n\nCalculate population variance. This function computes the statistical variance for a set of values assumed to be the entire population.\n\nvar_samp.md\n\nCalculate sample variance. This function computes the statistical variance for a set of values assumed to be a sample of the population.\n\nvariance.md\n\nCalculate population variance. This function is a synonym for VAR_POP() and returns the variance of a set of values.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/README', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (143, 16, 'AVG', 'Syntax\n------\n\nAVG([DISTINCT] expr)\n\nDescription\n-----------\n\nReturns the average value of expr. The DISTINCT option can be used to return the average of the distinct values of expr. NULL values are ignored. It is an aggregate function, and so can be used with the GROUP BY clause.\n\nAVG() returns NULL if there were no matching rows.\n\nAVG() can be used as a window function.\n\nExamples\n--------\n\nCREATE TABLE sales (sales_value INT);\n\nINSERT INTO sales VALUES(10),(20),(20),(40);\n\nSELECT AVG(sales_value) FROM sales;\n+------------------+\n| AVG(sales_value) |\n+------------------+\n|          22.5000 |\n+------------------+\n\nSELECT AVG(DISTINCT(sales_value)) FROM sales;\n+----------------------------+\n| AVG(DISTINCT(sales_value)) |\n+----------------------------+\n|                    23.3333 |\n+----------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/avg', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/avg');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (144, 16, 'BIT\\_AND', 'Syntax\n------\n\nBIT_AND(expr) [over_clause]\n\nDescription\n-----------\n\nReturns the bitwise AND of all bits in _expr_. The calculation is performed with 64-bit (BIGINT) precision. It is an aggregate function, and so can be used with the GROUP BY clause.\n\nIf no rows match, BIT_AND will return a value with all bits set to 1. NULL values have no effect on the result unless all results are NULL, which is treated as no match.\n\nBIT_AND can be used as a window function with the addition of the _over_clause_.\n\nExamples\n--------\n\nCREATE TABLE vals (x INT);\n\nINSERT INTO vals VALUES(111),(110),(100);\n\nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n|        100 |       111 |        101 |\n+------------+-----------+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/bit_and', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/bit_and');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (145, 16, 'BIT\\_OR', 'Syntax\n------\n\nBIT_OR(expr) [over_clause]\n\nDescription\n-----------\n\nReturns the bitwise OR of all bits in expr. The calculation is performed with 64-bit (BIGINT) precision. It is an aggregate function, and so can be used with the GROUP BY clause.\n\nIf no rows match, BIT_OR will return a value with all bits set to 0. NULL values have no effect on the result unless all results are NULL, which is treated as no match.\n\nBIT_OR can be used as a window function with the addition of the _over_clause_.\n\nExamples\n--------\n\nCREATE TABLE vals (x INT);\n\nINSERT INTO vals VALUES(111),(110),(100);\n\nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n|        100 |       111 |        101 |\n+------------+-----------+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/bit_or', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/bit_or');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (146, 16, 'BIT\\_XOR', 'Syntax\n------\n\nBIT_XOR(expr) [over_clause]\n\nDescription\n-----------\n\nReturns the bitwise XOR of all bits in expr. The calculation is performed with 64-bit (BIGINT) precision. It is an aggregate function, and so can be used with the GROUP BY clause.\n\nIf no rows match, BIT_XOR will return a value with all bits set to 0. NULL values have no effect on the result unless all results are NULL, which is treated as no match.\n\nBIT_XOR can be used as a window function with the addition of the _over_clause_.\n\nExamples\n--------\n\nCREATE TABLE vals (x INT);\n\nINSERT INTO vals VALUES(111),(110),(100);\n\nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n|        100 |       111 |        101 |\n+------------+-----------+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/bit_xor', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/bit_xor');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (147, 16, 'COUNT DISTINCT', 'Syntax\n------\n\nCOUNT(DISTINCT expr,[expr...])\n\nDescription\n-----------\n\nReturns a count of the number of different non-NULL values.\n\nCOUNT(DISTINCT) returns 0 if there were no matching rows.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT); \n\nINSERT INTO student VALUES \n  (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n  (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n  (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n  (''Tatiana'', ''SQL'', 87), (''Tatiana'', ''Tuning'', 83);\n\nSELECT COUNT() FROM student;\n+----------+\n| COUNT() |\n+----------+\n|        8 |\n+----------+\n\nSELECT COUNT(DISTINCT (name)) FROM student;\n+------------------------+\n| COUNT(DISTINCT (name)) |\n+------------------------+\n|                      4 |\n+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/count-distinct', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/count-distinct');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (148, 16, 'COUNT', 'Description\n-----------\n\nReturns a count of the number of non-NULL values of expr in the rows retrieved by a SELECT statement. The result is a BIGINT value. It is an aggregate function, and so can be used with the GROUP BY clause.\n\nCOUNT(\\) counts the total number of rows in a table.\n\nCOUNT() returns 0 if there were no matching rows.\n\nCOUNT() can be used as a window function.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT); \n\nINSERT INTO student VALUES \n  (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n  (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n  (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n  (''Tatiana'', ''SQL'', 87), (''Tatiana'', ''Tuning'', 83);\n\nSELECT COUNT() FROM student;\n+----------+\n| COUNT(*) |\n+----------+\n|        8 |\n+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/count', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/count');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (149, 16, 'GROUP\\_CONCAT', 'Syntax\n------\n\nGROUP_CONCAT(expr)\n\nDescription\n-----------\n\nThis function returns a string result with the concatenated non-NULL values from a group. If any expr in GROUP_CONCAT evaluates to NULL, that tuple is not present in the list returned by GROUP_CONCAT.\n\nIt returns NULL if all arguments are NULL, or there are no matching rows.\n\nThe maximum returned length in bytes is determined by the group_concat_max_len server system variable, which defaults to 1M.\n\nIf group_concat_max_len <= 512, the return type is VARBINARY or VARCHAR; otherwise, the return type is BLOB or TEXT. The choice between binary or non-binary types depends from the input.\n\nThe full syntax is as follows:\n\n``sql\nGROUP_CONCAT([DISTINCT] expr [,expr ...]\n             [ORDER BY {unsigned_integer | col_name | expr}\n                 [ASC | DESC] [,col_name ...]]\n             [SEPARATOR str_val]\n             [LIMIT {[offset,] row_count | row_count OFFSET offset}])\n`\n\nDISTINCT eliminates duplicate values from the output string.\n\nORDER BY determines the order of returned values.\n\nSEPARATOR specifies a separator between the values. The default separator is a comma (,). It is possible to avoid using a separator by specifying an empty string.\n\nLIMIT\n\nThe LIMIT clause can be used with GROUP_CONCAT`.\n\nExamples\n--------\n\nSELECT student_name,\n       GROUP_CONCAT(test_score)\n       FROM student\n       GROUP BY student_name;\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/group_concat', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/group_concat');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (150, 16, 'MAX', 'Syntax\n------\n\nMAX([DISTINCT] expr)\n\nDescription\n-----------\n\nReturns the largest, or maximum, value of _expr_. MAX() can also take a string argument in which case it returns the maximum string value. The DISTINCT keyword can be used to find the maximum of the distinct values of _expr_, however, this produces the same result as omitting DISTINCT.\n\nNote that SET and ENUM fields are currently compared by their string value rather than their relative position in the set, so MAX() may produce a different highest result than ORDER BY DESC.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nMAX() can be used as a window function.\n\nMAX() returns NULL if there were no matching rows.\n\nNot only ascending, but also descending indexes can be used to optimize MAX.\n\nOnly ascending indexes can be used to optimize MAX.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT); \n\nINSERT INTO student VALUES \n  (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n  (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n  (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n  (''Tatiana'', ''SQL'', 87), (''Tatiana'', ''Tuning'', 83);\n\nSELECT name, MAX(score) FROM student GROUP BY name;\n+---------+------------+\n| name    | MAX(score) |\n+---------+------------+\n| Chun    |         75 |\n| Esben   |         43 |\n| Kaolin  |         88 |\n| Tatiana |         87 |\n+---------+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/max', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/max');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (151, 16, 'MIN', 'Syntax\n------\n\nMIN([DISTINCT] expr)\n\nDescription\n-----------\n\nReturns the minimum value of _expr_. MIN() may take a string argument, in which case it returns the minimum string value. The DISTINCT keyword can be used to find the minimum of the distinct values of _expr_, however, this produces the same result as omitting DISTINCT.\n\nNote that SET and ENUM fields are currently compared by their string value rather than their relative position in the set, so MIN() may produce a different lowest result than ORDER BY ASC.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nMIN() can be used as a window function.\n\nMIN() returns NULL if there were no matching rows.\n\nNot only ascending, but also descending indexes can be used to optimize MIN.\n\nOnly ascending indexes can be used to optimize MIN.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT); \n\nINSERT INTO student VALUES \n  (''Chun'', ''SQL'', 75), (''Chun'', ''Tuning'', 73), \n  (''Esben'', ''SQL'', 43), (''Esben'', ''Tuning'', 31), \n  (''Kaolin'', ''SQL'', 56), (''Kaolin'', ''Tuning'', 88), \n  (''Tatiana'', ''SQL'', 87), (''Tatiana'', ''Tuning'', 83);\n\nSELECT name, MIN(score) FROM student GROUP BY name;\n+---------+------------+\n| name    | MIN(score) |\n+---------+------------+\n| Chun    |         73 |\n| Esben   |         31 |\n| Kaolin  |         56 |\n| Tatiana |         83 |\n+---------+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/min', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/min');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (152, 16, 'STD', 'Syntax\n------\n\nSTD(expr)\n\nDescription\n-----------\n\nReturns the population standard deviation of _expr_. This is an extension to standard SQL. The standard SQL function STDDEV_POP() can be used instead.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTD() can be used as a window function.\n\nThis function returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n  (''a'',1),(''a'',2),(''a'',3),\n  (''b'',11),(''b'',12),(''b'',20),(''b'',30),(''b'',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n  FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a        |        0.8165 |         1.0000 |     0.6667 |\n| b        |       18.0400 |        20.1693 |   325.4400 |\n+----------+---------------+----------------+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/std', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/std');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (153, 16, 'STDDEV', 'Syntax\n------\n\nSTDDEV(expr)\n\nDescription\n-----------\n\nReturns the population standard deviation of _expr_. This function is provided for compatibility with Oracle. The standard SQL function STDDEV_POP() can be used instead.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTDDEV() can be used as a window function.\n\nThis function returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n  (''a'',1),(''a'',2),(''a'',3),\n  (''b'',11),(''b'',12),(''b'',20),(''b'',30),(''b'',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n  FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a        |        0.8165 |         1.0000 |     0.6667 |\n| b        |       18.0400 |        20.1693 |   325.4400 |\n+----------+---------------+----------------+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/stddev', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/stddev');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (154, 16, 'STDDEV\\_POP', 'Syntax\n------\n\nSTDDEV_POP(expr)\n\nDescription\n-----------\n\nReturns the population standard deviation of _expr_ (the square root of VAR_POP()). You can also use STD() or STDDEV(), which are equivalent but not standard SQL.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTDDEV_POP() can be used as a window function.\n\nSTDDEV_POP() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n  (''a'',1),(''a'',2),(''a'',3),\n  (''b'',11),(''b'',12),(''b'',20),(''b'',30),(''b'',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n  FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a        |        0.8165 |         1.0000 |     0.6667 |\n| b        |       18.0400 |        20.1693 |   325.4400 |\n+----------+---------------+----------------+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/stddev_pop', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/stddev_pop');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (155, 16, 'STDDEV\\_SAMP', 'Syntax\n------\n\nSTDDEV_SAMP(expr)\n\nDescription\n-----------\n\nReturns the sample standard deviation of expr (the square root of VAR_SAMP()).\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTDDEV_SAMP() can be used as a window function.\n\nSTDDEV_SAMP() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/stddev_samp', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/stddev_samp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (156, 16, 'SUM', 'Syntax\n------\n\nSUM([DISTINCT] expr)\n\nDescription\n-----------\n\nReturns the sum of _expr_. If the return set has no rows, SUM() returnsNULL. The DISTINCT keyword can be used to sum only the distinct values of expr.\n\nSUM() can be used as a window function, although not with the DISTINCT specifier.\n\nExamples\n--------\n\nCREATE TABLE sales (sales_value INT);\nINSERT INTO sales VALUES(10),(20),(20),(40);\n\nSELECT SUM(sales_value) FROM sales;\n+------------------+\n| SUM(sales_value) |\n+------------------+\n|               90 |\n+------------------+\n\nSELECT SUM(DISTINCT(sales_value)) FROM sales;\n+----------------------------+\n| SUM(DISTINCT(sales_value)) |\n+----------------------------+\n|                         70 |\n+----------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/sum', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/sum');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (157, 16, 'VAR\\_POP', 'Syntax\n------\n\nVAR_POP(expr)\n\nDescription\n-----------\n\nReturns the population standard variance of expr. It considers rows as the whole population, not as a sample, so it has the number of rows as the denominator. You can also use VARIANCE(), which is equivalent but is not standard SQL.\n\nVariance is calculated by\n\n working out the mean for the set;\n for each number, subtracting the mean and squaring the result;\n* calculating the average of the resulting differences.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nVAR_POP() can be used as a window function.\n\nVAR_POP() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE TABLE v(i tinyint);\n\nINSERT INTO v VALUES(101),(99);\n\nSELECT VAR_POP(i) FROM v;\n+------------+\n| VAR_POP(i) |\n+------------+\n|     1.0000 |\n+------------+\n\nINSERT INTO v VALUES(120),(80);\n\nSELECT VAR_POP(i) FROM v;\n+------------+\n| VAR_POP(i) |\n+------------+\n|   200.5000 |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/var_pop', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/var_pop');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (158, 16, 'VAR\\_SAMP', 'Syntax\n------\n\nVAR_SAMP(expr)\n\nDescription\n-----------\n\nReturns the sample variance of _expr_. That is, the denominator is the number of rows minus one.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nVAR_SAMP() can be used as a window function.\n\nVAR_SAMP() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n  (''a'',1),(''a'',2),(''a'',3),\n  (''b'',11),(''b'',12),(''b'',20),(''b'',30),(''b'',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n  FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a        |        0.8165 |         1.0000 |     0.6667 |\n| b        |       18.0400 |        20.1693 |   325.4400 |\n+----------+---------------+----------------+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/var_samp', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/var_samp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (159, 16, 'VARIANCE', 'Syntax\n------\n\nVARIANCE(expr)\n\nDescription\n-----------\n\nReturns the population standard variance of expr. This is an extension to standard SQL. The standard SQL function VAR_POP() can be used instead.\n\nVariance is calculated by\n\n working out the mean for the set;\n for each number, subtracting the mean and squaring the result;\n* calculating the average of the resulting differences.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nVARIANCE() can be used as a window function.\n\nVARIANCE() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE TABLE v(i tinyint);\n\nINSERT INTO v VALUES(101),(99);\n\nSELECT VARIANCE(i) FROM v;\n+-------------+\n| VARIANCE(i) |\n+-------------+\n|      1.0000 |\n+-------------+\n\nINSERT INTO v VALUES(120),(80);\n\nSELECT VARIANCE(i) FROM v;\n+-------------+\n| VARIANCE(i) |\n+-------------+\n|    200.5000 |\n+-------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/variance', '', 'https://mariadb.com/docs/server/reference/sql-functions/aggregate-functions/variance');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (160, 7, 'CASE OPERATOR', 'Syntax\n------\n\nCASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN\nresult ...] [ELSE result] END\n\nCASE WHEN [condition] THEN result [WHEN [condition] THEN result ...]\n[ELSE result] END\n\nDescription\n-----------\n\nThe first version returns the result for the first value=compare_value comparison that is true. The second version returns the result for the first condition that is true. If there was no matching result value, the result after ELSE is returned, or NULL if there is no ELSE part.\n\nThere is also a CASE statement, which differs from the CASE operator described here.\n\nExamples\n--------\n\nSELECT CASE 1 WHEN 1 THEN ''one'' WHEN 2 THEN ''two'' ELSE ''more'' END;\n+------------------------------------------------------------+\n| CASE 1 WHEN 1 THEN ''one'' WHEN 2 THEN ''two'' ELSE ''more'' END |\n+------------------------------------------------------------+\n| one                                                        |\n+------------------------------------------------------------+\n\nSELECT CASE WHEN 1>0 THEN ''true'' ELSE ''false'' END;\n+--------------------------------------------+\n| CASE WHEN 1>0 THEN ''true'' ELSE ''false'' END |\n+--------------------------------------------+\n| true                                       |\n+--------------------------------------------+\n\nSELECT CASE BINARY ''B'' WHEN ''a'' THEN 1 WHEN ''b'' THEN 2 END;\n+-----------------------------------------------------+\n| CASE BINARY ''B'' WHEN ''a'' THEN 1 WHEN ''b'' THEN 2 END |\n+-----------------------------------------------------+\n|                                                NULL |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/case-operator', '', 'https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/case-operator');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (161, 7, 'DECODE\\_ORACLE', 'Description\n-----------\n\nDECODE_ORACLE is a synonym for the Oracle mode version of the DECODE function, and is available in all modes.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/decode_oracle', '', 'https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/decode_oracle');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (162, 7, 'IF Function', 'Syntax\n------\n\nIF(expr1,expr2,expr3)\n\nDescription\n-----------\n\nIf expr1 is TRUE (expr1 <> 0 and expr1 <> NULL) then IF() returns expr2; otherwise it returns expr3. IF() returns a numeric or string value, depending on the context in which it is used.\n\nNote: There is also an IF statement which differs from theIF() function described here.\n\nExamples\n--------\n\nSELECT IF(1>2,2,3);\n+-------------+\n| IF(1>2,2,3) |\n+-------------+\n|           3 |\n+-------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/if-function', '', 'https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/if-function');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (163, 7, 'IFNULL', 'Syntax\n------\n\nIFNULL(expr1,expr2)\nNVL(expr1,expr2)\n\nDescription\n-----------\n\nIf _expr1_ is not NULL, IFNULL() returns _expr1_; otherwise it returns_expr2_. IFNULL() returns a numeric or string value, depending on the context in which it is used.\n\nNVL() is an alias for IFNULL().\n\nExamples\n--------\n\nSELECT IFNULL(1,0); \n+-------------+\n| IFNULL(1,0) |\n+-------------+\n|           1 |\n+-------------+\n\nSELECT IFNULL(NULL,10);\n+-----------------+\n| IFNULL(NULL,10) |\n+-----------------+\n|              10 |\n+-----------------+\n\nSELECT IFNULL(1/0,10);\n+----------------+\n| IFNULL(1/0,10) |\n+----------------+\n|        10.0000 |\n+----------------+\n\nSELECT IFNULL(1/0,''yes'');\n+-------------------+\n| IFNULL(1/0,''yes'') |\n+-------------------+\n| yes               |\n+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/ifnull', '', 'https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/ifnull');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (164, 7, 'NULLIF', 'Syntax\n------\n\nNULLIF(expr1,expr2)\n\nDescription\n-----------\n\nReturns NULL if expr1 = expr2 is true, otherwise returns expr1. This is the same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.\n\nExamples\n--------\n\nSELECT NULLIF(1,1);\n+-------------+\n| NULLIF(1,1) |\n+-------------+\n|        NULL |\n+-------------+\n\nSELECT NULLIF(1,2);\n+-------------+\n| NULLIF(1,2) |\n+-------------+\n|           1 |\n+-------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/nullif', '', 'https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/nullif');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (165, 7, 'NVL', 'Description\n-----------\n\nNVL is a synonym for IFNULL.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/nvl', '', 'https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/nvl');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (166, 7, 'NVL2', 'Syntax\n------\n\nNVL2(expr1,expr2,expr3)\n\nDescription\n-----------\n\nThe NVL2 function returns a value based on whether a specified expression is NULL or not. If _expr1_ is not NULL, then NVL2 returns _expr2_. If _expr1_ is NULL, then NVL2 returns _expr3_.\n\nExamples\n--------\n\nSELECT NVL2(NULL,1,2);\n+----------------+\n| NVL2(NULL,1,2) |\n+----------------+\n|              2 |\n+----------------+\n\nSELECT NVL2(''x'',1,2);\n+---------------+\n| NVL2(''x'',1,2) |\n+---------------+\n|             1 |\n+---------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/nvl2', '', 'https://mariadb.com/docs/server/reference/sql-functions/control-flow-functions/nvl2');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (167, 31, 'ADD\\_MONTHS', 'Syntax\n------\n\nADD_MONTHS(date, months)\n\nDescription\n-----------\n\nADD_MONTHS adds an integer _months_ to a given _date_ (DATE, DATETIME or TIMESTAMP), returning the resulting date.\n\n_months_ can be positive or negative. If months is not a whole number, it is rounded to the nearest whole number (not truncated).\n\nThe resulting day component will remain the same as that specified in _date_, unless the resulting month has fewer days than the day component of the given date, in which case the day will be the last day of the resulting month.\n\nReturns NULL if given an invalid date or a NULL argument.\n\nExamples\n--------\n\nSELECT ADD_MONTHS(''2012-01-31'', 2);\n+-----------------------------+\n| ADD_MONTHS(''2012-01-31'', 2) |\n+-----------------------------+\n| 2012-03-31                  |\n+-----------------------------+\n\nSELECT ADD_MONTHS(''2012-01-31'', -5);\n+------------------------------+\n| ADD_MONTHS(''2012-01-31'', -5) |\n+------------------------------+\n| 2011-08-31                   |\n+------------------------------+\n\nSELECT ADD_MONTHS(''2011-01-31'', 1);\n+-----------------------------+\n| ADD_MONTHS(''2011-01-31'', 1) |\n+-----------------------------+\n| 2011-02-28                  |\n+-----------------------------+\n\nSELECT ADD_MONTHS(''2012-01-31'', 1);\n+-----------------------------+\n| ADD_MONTHS(''2012-01-31'', 1) |\n+-----------------------------+\n| 2012-02-29                  |\n+-----------------------------+\n\nSELECT ADD_MONTHS(''2012-01-31'', 2);\n+-----------------------------+\n| ADD_MONTHS(''2012-01-31'', 2) |\n+-----------------------------+\n| 2012-03-31                  |\n+-----------------------------+\n\nSELECT ADD_MONTHS(''2012-01-31'', 3);\n+-----------------------------+\n| ADD_MONTHS(''2012-01-31'', 3) |\n+-----------------------------+\n| 2012-04-30                  |\n+-----------------------------+\n\nSELECT ADD_MONTHS(''2011-01-15'', 2.5);\n+-------------------------------+\n| ADD_MONTHS(''2011-01-15'', 2.5) |\n+-------------------------------+\n| 2011-04-15                    |\n+-------------------------------+\n1 row in set (0.001 sec)\n\nSELECT ADD_MONTHS(''2011-01-15'', 2.6);\n+-------------------------------+\n| ADD_MONTHS(''2011-01-15'', 2.6) |\n+-------------------------------+\n| 2011-04-15                    |\n+-------------------------------+\n1 row in set (0.001 sec)\n\nSELECT ADD_MONTHS(''2011-01-15'', 2.1);\n+-------------------------------+\n| ADD_MONTHS(''2011-01-15'', 2.1) |\n+-------------------------------+\n| 2011-03-15                    |\n+-------------------------------+\n1 row in set (0.004 sec)\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/add_months', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/add_months');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (168, 31, 'ADDDATE', 'Syntax\n------\n\nADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)\n\nDescription\n-----------\n\nWhen invoked with the INTERVAL form of the second argument, ADDDATE() is a synonym for DATE_ADD(). The related function SUBDATE() is a synonym for DATE_SUB(). For information on the INTERVAL unit argument, see the discussion for DATE_ADD().\n\nWhen invoked with the days form of the second argument, MariaDB treats it as an integer number of days to be added to _expr_.\n\nExamples\n--------\n\nSELECT DATE_ADD(''2008-01-02'', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_ADD(''2008-01-02'', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2008-02-02                              |\n+-----------------------------------------+\n\nSELECT ADDDATE(''2008-01-02'', INTERVAL 31 DAY);\n+----------------------------------------+\n| ADDDATE(''2008-01-02'', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2008-02-02                             |\n+----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/adddate', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/adddate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (169, 31, 'ADDTIME', 'Syntax\n------\n\nADDTIME(expr1,expr2)\n\nDescription\n-----------\n\nADDTIME() adds _expr2_ to _expr1_ and returns the result. _expr1_ is a time or datetime expression, and _expr2_ is a time expression.\n\nExamples\n--------\n\nSELECT ADDTIME(''2007-12-31 23:59:59.999999'', ''1 1:1:1.000002'');\n+---------------------------------------------------------+\n| ADDTIME(''2007-12-31 23:59:59.999999'', ''1 1:1:1.000002'') |\n+---------------------------------------------------------+\n| 2008-01-02 01:01:01.000001                              |\n+---------------------------------------------------------+\n\nSELECT ADDTIME(''01:00:00.999999'', ''02:00:00.999998'');\n+-----------------------------------------------+\n| ADDTIME(''01:00:00.999999'', ''02:00:00.999998'') |\n+-----------------------------------------------+\n| 03:00:01.999997                               |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/addtime', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/addtime');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (170, 31, 'CONVERT\\_TZ', 'Syntax\n------\n\nCONVERT_TZ(dt,from_tz,to_tz)\n\nDescription\n-----------\n\nCONVERT_TZ() converts a datetime value _dt_ from the time zone given by _from_tz_ to the time zone given by _to_tz_ and returns the resulting value.\n\nIn order to use named time zones, such as GMT, MET or Africa/Johannesburg, the time_zone tables must be loaded (see mysql_tzinfo_to_sql).\n\nNo conversion takes place if the value falls outside of the supported TIMESTAMP range when converted from _from_tz_ to UTC.\n\nThe supported range is 1970-01-01 00:00:00 to 2106-02-07 06:28:15 UTC.\n\nThe supported range is 1970-01-01 00:00:01 to 2038-01-19 05:14:07 UTC.\n\nThis function returns NULL if the arguments are invalid (or named time zones have not been loaded).\n\nSee time zones for more information.\n\nExamples\n--------\n\nSELECT CONVERT_TZ(''2016-01-01 12:00:00'',''+00:00'',''+10:00'');\n+-----------------------------------------------------+\n| CONVERT_TZ(''2016-01-01 12:00:00'',''+00:00'',''+10:00'') |\n+-----------------------------------------------------+\n| 2016-01-01 22:00:00                                 |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/convert_tz', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/convert_tz');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (171, 31, 'CURDATE', 'Syntax\n------\n\nCURDATE()\nCURRENT_DATE\nCURRENT_DATE()\n\nDescription\n-----------\n\nCURDATE returns the current date as a value in YYYY-MM-DD or YYYYMMDD format, depending on whether the function is used in a string or numeric context.\n\nCURRENT_DATE and CURRENT_DATE() are synonyms.\n\nExamples\n--------\n\nSELECT CURDATE();\n+------------+\n| CURDATE()  |\n+------------+\n| 2019-03-05 |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/curdate', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/curdate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (172, 31, 'CURRENT\\_DATE', 'Syntax\n------\n\nCURRENT_DATE, CURRENT_DATE()\n\nDescription\n-----------\n\nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/current_date', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/current_date');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (173, 31, 'CURRENT\\_TIME', 'Syntax\n------\n\nCURRENT_TIME\nCURRENT_TIME([precision])\n\nDescription\n-----------\n\nCURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/current_time', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/current_time');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (174, 31, 'CURRENT\\_TIMESTAMP', 'Syntax\n------\n\nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\n\nDescription\n-----------\n\nCURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/current_timestamp', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/current_timestamp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (175, 31, 'CURTIME', 'Syntax\n------\n\nCURTIME([precision])\n\nDescription\n-----------\n\nReturns the current time as a value in HH:MM:SS or HHMMSS.uuuuuu format, depending on whether the function is used in a string or numeric context. The value is expressed in the current time zone.\n\nThe optional _precision_ determines the microsecond precision. See Microseconds in MariaDB.\n\nExamples\n--------\n\nSELECT CURTIME();\n+-----------+\n| CURTIME() |\n+-----------+\n| 12:45:39  |\n+-----------+\n\nSELECT CURTIME() + 0;\n+---------------+\n| CURTIME() + 0 |\n+---------------+\n| 124545.000000 |\n+---------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/curtime', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/curtime');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (176, 31, 'Date and Time Units', 'Description\n-----------\n\nThe INTERVAL keyword can be used to add or subtract a time interval of time to a DATETIME, DATE or TIME value.\n\nThe syntax is:\n\n``sql\nINTERVAL time_quantity time_unit\n`\n\nFor example, the SECOND unit is used below by the DATE_ADD() function:\n\n`sql\nSELECT ''2008-12-31 23:59:59'' + INTERVAL 1 SECOND;\n+-------------------------------------------+\n| ''2008-12-31 23:59:59'' + INTERVAL 1 SECOND |\n+-------------------------------------------+\n| 2009-01-01 00:00:00                       |\n+-------------------------------------------+\n`\n\nThe following units are valid:\n\n| Unit                | Description                             |\n| ------------------- | --------------------------------------- |\n| MICROSECOND         | Microseconds                            |\n| SECOND              | Seconds                                 |\n| MINUTE              | Minutes                                 |\n| HOUR                | Hours                                   |\n| DAY                 | Days                                    |\n| WEEK                | Weeks                                   |\n| MONTH               | Months                                  |\n| QUARTER             | Quarters                                |\n| YEAR                | Years                                   |\n| SECOND_MICROSECOND | Seconds.Microseconds                    |\n| MINUTE_MICROSECOND | Minutes.Seconds.Microseconds            |\n| MINUTE_SECOND      | Minutes.Seconds                         |\n| HOUR_MICROSECOND   | Hours.Minutes.Seconds.Microseconds      |\n| HOUR_SECOND        | Hours.Minutes.Seconds                   |\n| HOUR_MINUTE        | Hours.Minutes                           |\n| DAY_MICROSECOND    | Days Hours.Minutes.Seconds.Microseconds |\n| DAY_SECOND         | Days Hours.Minutes.Seconds              |\n| DAY_MINUTE         | Days Hours.Minutes                      |\n| DAY_HOUR           | Days Hours                              |\n| YEAR_MONTH         | Years-Months                            |\n\nThe time units containing an underscore are composite; that is, they consist of multiple base time units. For base time units, time_quantity is an integer number. For composite units, the quantity must be expressed as a string with multiple integer numbers separated by any punctuation character.\n\nExample of composite units:\n\n`sql\nINTERVAL ''2:2'' YEAR_MONTH\nINTERVAL ''1:30:30'' HOUR_SECOND\nINTERVAL ''1!30!30'' HOUR_SECOND -- same as above\n`\n\nTime units can be used in the following contexts:\n\n after a + or a - operator;\n with the following DATE or TIME functions: ADDDATE(), SUBDATE(), DATE_ADD(), DATE_SUB(), TIMESTAMPADD(), TIMESTAMPDIFF(), EXTRACT();\n in the ON SCHEDULE clause of CREATE EVENT and ALTER EVENT;\n when defining a partitioning BY SYSTEM_TIME` .\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date-and-time-units', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date-and-time-units');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (177, 31, 'DATE FUNCTION', 'Syntax\n------\n\nDATE(expr)\n\nDescription\n-----------\n\nExtracts the date part of the date or datetime expression _expr_. Returns NULL and throws a warning when passed an invalid date.\n\nExamples\n--------\n\nSELECT DATE(''2013-07-18 12:21:32'');\n+-----------------------------+\n| DATE(''2013-07-18 12:21:32'') |\n+-----------------------------+\n| 2013-07-18                  |\n+-----------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date-function', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date-function');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (178, 31, 'DATE\\_ADD', 'Syntax\n------\n\nDATE_ADD(date,INTERVAL expr unit)\n\nDescription\n-----------\n\nPerforms date arithmetic. The _date_ argument specifies the starting date or datetime value. _expr_ is an expression specifying the interval value to be added to the starting date. _expr_ is a string; it may start with a "-" for negative intervals. For composite interval units (such as DAY_HOUR, MINUTE_SECOND, and SECOND_MICROSECOND), \n_expr_ can contain multiple components separated by spaces or punctuation. For example:\n\n- ''1 10'' DAY_HOUR represents 1 day and 10 hours  \n- ''1:1'' MINUTE_SECOND represents 1 minute and 1 second  \n- ''1.999999'' SECOND_MICROSECOND represents seconds and microseconds  \n\nThe exact format of _expr_ depends on the _unit_ specified.\n\n_unit_ is a keyword indicating the units in which the expression should be interpreted. See Date and Time Units for a complete list of permitted units.\n\nThe result type of DATE_ADD() is determined as follows:\n\n if the first argument is of the type DATETIME, the function returns DATETIME ;\n if the first argument is DATE and the interval uses HOUR or smaller units, the function returns DATETIME ;\n if the first argument is DATE and the interval uses DAY or larger units, the function returns DATE ;\n similarly, if the first argument is TIME and the interval uses DAY or smaller units the function returns TIME, if the interval uses anything larger, the function returns DATETIME ;\n* if the first argument isn''t a temporal type, the function returns a string.\n\nExamples\n--------\n\nSELECT ''2008-12-31 23:59:59'' + INTERVAL 1 SECOND;\n+-------------------------------------------+\n| ''2008-12-31 23:59:59'' + INTERVAL 1 SECOND |\n+-------------------------------------------+\n| 2009-01-01 00:00:00                       |\n+-------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date_add', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date_add');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (179, 31, 'DATE\\_FORMAT', 'Syntax\n------\n\nDATE_FORMAT(date, format[, locale])\n\nDescription\n-----------\n\nFormats the date value according to the format string.\n\nThe language used for the names is controlled by the value of the lc_time_names system variable. See server locale for more on the supported locales.\n\nDate Formatting Options\n\nThe options that can be used by DATE_FORMAT(), as well as its inverse STR_TO_DATE() and the FROM_UNIXTIME() function, are:\n\n| Option | Description                                                                                                                                                                                      |\n| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| %a     | Short weekday name in current locale (Variable lc_time_names).                |\n| %b     | Short form month name in current locale. For locale en_US this is one of: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec.                                                       |\n| %c     | Month with 1 or 2 digits.                                                                                                                                                                        |\n| %D     | Day with English suffix ''th'', ''nd'', ''st'' or ''rd''''. (1st, 2nd, 3rd...).                                                                                                                           |\n| %d     | Day with 2 digits.                                                                                                                                                                               |\n| %e     | Day with 1 or 2 digits.                                                                                                                                                                          |\n| %f     | Microseconds 6 digits.                                                                                                                                             |\n| %H     | Hour with 2 digits between 00-23.                                                                                                                                                                |\n| %h     | Hour with 2 digits between 01-12.                                                                                                                                                                |\n| %I     | Hour with 2 digits between 01-12.                                                                                                                                                                |\n| %i     | Minute with 2 digits.                                                                                                                                                                            |\n| %j     | Day of the year (001-366)                                                                                                                                                                        |\n| %k     | Hour with 1 digits between 0-23.                                                                                                                                                                 |\n| %l     | Hour with 1 digits between 1-12.                                                                                                                                                                 |\n| %M     | Full month name in current locale (Variable lc_time_names).                   |\n| %m     | Month with 2 digits.                                                                                                                                                                             |\n| %p     | AM/PM according to current locale (Variable lc_time_names).                   |\n| %r     | Time in 12 hour format, followed by AM/PM. Short for ''%I:%i:%S %p''.                                                                                                                              |\n| %S     | Seconds with 2 digits.                                                                                                                                                                           |\n| %s     | Seconds with 2 digits.                                                                                                                                                                           |\n| %T     | Time in 24 hour format. Short for ''%H:%i:%S''.                                                                                                                                                    |\n| %U     | Week number (00-53), when first day of the week is Sunday.                                                                                                                                       |\n| %u     | Week number (00-53), when first day of the week is Monday.                                                                                                                                       |\n| %V     | Week number (01-53), when first day of the week is Sunday. Used with %X.                                                                                                                         |\n| %v     | Week number (01-53), when first day of the week is Monday. Used with %x.                                                                                                                         |\n| %W     | Full weekday name in current locale (Variable lc_time_names).                 |\n| %w     | Day of the week. 0 = Sunday, 6 = Saturday.                                                                                                                                                       |\n| %X     | Year with 4 digits when first day of the week is Sunday. Used with %V.                                                                                                                           |\n| %x     | Year with 4 digits when first day of the week is Monday. Used with %v.                                                                                                                           |\n| %Y     | Year with 4 digits.                                                                                                                                                                              |\n| %y     | Year with 2 digits.                                                                                                                                                                              |\n| %Z     | Timezone abbreviation. From MariaDB 11.3.0.                                                          |\n| %z     | Numeric timezone +hhmm or -hhmm presenting the hour and minute offset from UTC. From MariaDB 11.3.0. |\n| %#     | For str_to_date(), skip all numbers.                                                                                                                                         |\n| %.     | For str_to_date(), skip all punctation characters.                                                                                                                           |\n| %@     | For str_to_date(), skip all alpha characters.                                                                                                                                |\n| %%     | A literal % character.                                                                                                                                                                           |\n\nTo get a date in one of the standard formats, GET_FORMAT() can be used.\n\nExamples\n--------\n\nSELECT DATE_FORMAT(''2009-10-04 22:23:00'', ''%W %M %Y'');\n+------------------------------------------------+\n| DATE_FORMAT(''2009-10-04 22:23:00'', ''%W %M %Y'') |\n+------------------------------------------------+\n| Sunday October 2009                            |\n+------------------------------------------------+\n\nSELECT DATE_FORMAT(''2007-10-04 22:23:00'', ''%H:%i:%s'');\n+------------------------------------------------+\n| DATE_FORMAT(''2007-10-04 22:23:00'', ''%H:%i:%s'') |\n+------------------------------------------------+\n| 22:23:00                                       |\n+------------------------------------------------+\n\nSELECT DATE_FORMAT(''1900-10-04 22:23:00'', ''%D %y %a %d %m %b %j'');\n+------------------------------------------------------------+\n| DATE_FORMAT(''1900-10-04 22:23:00'', ''%D %y %a %d %m %b %j'') |\n+------------------------------------------------------------+\n| 4th 00 Thu 04 10 Oct 277                                   |\n+------------------------------------------------------------+\n\nSELECT DATE_FORMAT(''1997-10-04 22:23:00'', ''%H %k %I %r %T %S %w'');\n+------------------------------------------------------------+\n| DATE_FORMAT(''1997-10-04 22:23:00'', ''%H %k %I %r %T %S %w'') |\n+------------------------------------------------------------+\n| 22 22 10 10:23:00 PM 22:23:00 00 6                         |\n+------------------------------------------------------------+\n\nSELECT DATE_FORMAT(''1999-01-01'', ''%X %V'');\n+------------------------------------+\n| DATE_FORMAT(''1999-01-01'', ''%X %V'') |\n+------------------------------------+\n| 1998 52                            |\n+------------------------------------+\n\nSELECT DATE_FORMAT(''2006-06-00'', ''%d'');\n+---------------------------------+\n| DATE_FORMAT(''2006-06-00'', ''%d'') |\n+---------------------------------+\n| 00                              |\n+---------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date_format', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date_format');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (180, 31, 'DATE\\_SUB', 'Syntax\n------\n\nDATE_SUB(date,INTERVAL expr unit)\n\nDescription\n-----------\n\nPerforms date arithmetic. The _date_ argument specifies the starting date or datetime value. _expr_ is an expression specifying the interval value to be subtracted from the starting date. _expr_ is a string; it may start with a "-" for negative intervals. _unit_ is a keyword indicating the units in which the expression should be interpreted. See Date and Time Units for a complete list of permitted units.\n\nSee also DATE_ADD().\n\nExamples\n--------\n\nSELECT DATE_SUB(''1998-01-02'', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB(''1998-01-02'', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 1997-12-02                              |\n+-----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date_sub', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date_sub');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (181, 31, 'DATEDIFF', 'Syntax\n------\n\nDATEDIFF(expr1,expr2)\n\nDescription\n-----------\n\nDATEDIFF() returns (_expr1_ – _expr2_) expressed as a value in days from one date to the other. _expr1_ and _expr2_ are date or date-and-time expressions. Only the date parts of the values are used in the calculation.\n\nExamples\n--------\n\nSELECT DATEDIFF(''2007-12-31 23:59:59'',''2007-12-30'');\n+----------------------------------------------+\n| DATEDIFF(''2007-12-31 23:59:59'',''2007-12-30'') |\n+----------------------------------------------+\n|                                            1 |\n+----------------------------------------------+\n\nSELECT DATEDIFF(''2010-11-30 23:59:59'',''2010-12-31'');\n+----------------------------------------------+\n| DATEDIFF(''2010-11-30 23:59:59'',''2010-12-31'') |\n+----------------------------------------------+\n|                                          -31 |\n+----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/datediff', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/datediff');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (182, 31, 'DAY', 'Syntax\n------\n\nDAY(date)\n\nDescription\n-----------\n\nDAY() is a synonym for DAYOFMONTH().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/day', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/day');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (183, 31, 'DAYNAME', 'Syntax\n------\n\nDAYNAME(date)\n\nDescription\n-----------\n\nReturns the name of the weekday for date. The language used for the name is controlled by the value\\\nof the lc_time_names system variable. See server locale for more on the supported locales.\n\nExamples\n--------\n\nSELECT DAYNAME(''2007-02-03'');\n+-----------------------+\n| DAYNAME(''2007-02-03'') |\n+-----------------------+\n| Saturday              |\n+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayname', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayname');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (184, 31, 'DAYOFMONTH', 'Syntax\n------\n\nDAYOFMONTH(date)\n\nDescription\n-----------\n\nReturns the day of the month for date, in the range 1 to 31, or 0 for dates such as ''0000-00-00'' or ''2008-00-00'' which have a zero day part.\n\nDAY() is a synonym.\n\nExamples\n--------\n\nSELECT DAYOFMONTH(''2007-02-03'');\n+--------------------------+\n| DAYOFMONTH(''2007-02-03'') |\n+--------------------------+\n|                        3 |\n+--------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayofmonth', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayofmonth');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (185, 31, 'DAYOFWEEK', 'Syntax\n------\n\nDAYOFWEEK(date)\n\nDescription\n-----------\n\nReturns the day of the week index for the date (1 = Sunday, 2 = Monday, ..., 7 = Saturday). These index values correspond to the ODBC standard.\n\nThis contrasts with WEEKDAY() which follows a different index numbering (0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n\nExamples\n--------\n\nSELECT DAYOFWEEK(''2007-02-03'');\n+-------------------------+\n| DAYOFWEEK(''2007-02-03'') |\n+-------------------------+\n|                       7 |\n+-------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayofweek', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayofweek');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (186, 31, 'DAYOFYEAR', 'Syntax\n------\n\nDAYOFYEAR(date)\n\nDescription\n-----------\n\nReturns the day of the year for date, in the range 1 to 366.\n\nExamples\n--------\n\nSELECT DAYOFYEAR(''2018-02-16'');\n+-------------------------+\n| DAYOFYEAR(''2018-02-16'') |\n+-------------------------+\n|                      47 |\n+-------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayofyear', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/dayofyear');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (187, 31, 'EXTRACT', 'Syntax\n------\n\nEXTRACT(unit FROM date)\n\nDescription\n-----------\n\nThe EXTRACT() function extracts the required unit from the date. See Date and Time Units for a complete list of permitted units.\n\nHOUR() is not a standard SQL function, so continues to adhere to the old behavior inherited from MySQL.\n\nExamples\n--------\n\nSELECT EXTRACT(YEAR FROM ''2009-07-02'');\n+---------------------------------+\n| EXTRACT(YEAR FROM ''2009-07-02'') |\n+---------------------------------+\n|                            2009 |\n+---------------------------------+\n\nSELECT EXTRACT(YEAR_MONTH FROM ''2009-07-02 01:02:03'');\n+------------------------------------------------+\n| EXTRACT(YEAR_MONTH FROM ''2009-07-02 01:02:03'') |\n+------------------------------------------------+\n|                                         200907 |\n+------------------------------------------------+\n\nSELECT EXTRACT(DAY_MINUTE FROM ''2009-07-02 01:02:03'');\n+------------------------------------------------+\n| EXTRACT(DAY_MINUTE FROM ''2009-07-02 01:02:03'') |\n+------------------------------------------------+\n|                                          20102 |\n+------------------------------------------------+\n\nSELECT EXTRACT(MICROSECOND FROM ''2003-01-02 10:30:00.000123'');\n+--------------------------------------------------------+\n| EXTRACT(MICROSECOND FROM ''2003-01-02 10:30:00.000123'') |\n+--------------------------------------------------------+\n|                                                    123 |\n+--------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/extract', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/extract');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (188, 31, 'FORMAT\\_PICO\\_TIME', 'Syntax\n------\n\nFORMAT_PICO_TIME(time_val)\n\nDescription\n-----------\n\nGiven a time in picoseconds, returns a human-readable time value and unit indicator. Resulting unit is dependent on the length of the argument, and can be:\n\n ps - picoseconds\n ns - nanoseconds\n us - microseconds\n ms - milliseconds\n s - seconds\n min - minutes\n h - hours\n d - days\n\nWith the exception of results under one nanosecond, which are not rounded and are represented as whole numbers, the result is rounded to 2 decimal places, with a minimum of 3 significant digits.\n\nReturns NULL if the argument is NULL.\n\nThis function is very similar to the Sys Schema FORMAT_TIME function, but with the following differences:\n\n Represents minutes as min rather than m.\n Does not represent weeks.\n\nExamples\n--------\n\nSELECT\n    FORMAT_PICO_TIME(43) AS ps,\n    FORMAT_PICO_TIME(4321) AS ns, \n    FORMAT_PICO_TIME(43211234) AS us,\n    FORMAT_PICO_TIME(432112344321) AS ms,\n    FORMAT_PICO_TIME(43211234432123) AS s,\n    FORMAT_PICO_TIME(432112344321234) AS m,\n    FORMAT_PICO_TIME(4321123443212345) AS h,\n    FORMAT_PICO_TIME(432112344321234545) AS d;\n+--------+---------+----------+-----------+---------+----------+--------+--------+\n| ps     | ns      | us       | ms        | s       | m        | h      | d      |\n+--------+---------+----------+-----------+---------+----------+--------+--------+\n|  43 ps | 4.32 ns | 43.21 us | 432.11 ms | 43.21 s | 7.20 min | 1.20 h | 5.00 d |\n+--------+---------+----------+-----------+---------+----------+--------+--------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/format_pico_time', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/format_pico_time');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (189, 31, 'FROM\\_DAYS', 'Syntax\n------\n\nFROM_DAYS(N)\n\nDescription\n-----------\n\nGiven a day number N, returns a DATE value. The day count is based on the number of days from the start of the standard calendar (0000-00-00).\n\nThe function is not designed for use with dates before the advent of the Gregorian calendar in October 1582. Results will not be reliable since it doesn''t account for the lost days when the calendar changed from the Julian calendar.\n\nThis is the converse of the TO_DAYS() function.\n\nExamples\n--------\n\nSELECT FROM_DAYS(730669);\n+-------------------+\n| FROM_DAYS(730669) |\n+-------------------+\n| 2000-07-03        |\n+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/from_days', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/from_days');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (190, 31, 'FROM\\_UNIXTIME', 'Syntax\n------\n\nFROM_UNIXTIME(unix_timestamp)\nFROM_UNIXTIME(unix_timestamp,format)\n\nDescription\n-----------\n\nConverts the number of seconds from the epoch (1970-01-01 00:00:00 UTC) to aTIMESTAMP value, the opposite of what UNIX_TIMESTAMP() is doing. Returns NULL if the result would be outside of the valid range of TIMESTAMP values.\n\nIf format is given, the result is exactly equivalent to\n\n``sql\nDATE_FORMAT(FROM_UNIXTIME(unix_timestamp), format)\n`\n\nTimestamps in MariaDB have a maximum value of 4294967295, equivalent to 2106-02-07 06:28:15. This is due to the underlying 32-bit limitation. Using the function on a timestamp beyond this will result in NULL being returned. Use DATETIME as a storage type if you require dates beyond this.\n\nThe one-argument form of FROM_UNIXTIME() returns aDATETIME. This means that it can return values outside of valid TIMESTAMP range, in particular 1970-01-01 00:00:00. And it can return the same result for different values of unix_timestamp (around DST changes).\n\nTimestamps in MariaDB have a maximum value of 4294967295, equivalent to 2106-02-07 06:28:15. This is due to the underlying 32-bit limitation. Using the function on a timestamp beyond this will result in NULL being returned. Use DATETIME as a storage type if you require dates beyond this.\n\nThe one-argument form of FROM_UNIXTIME() returns aDATETIME. This means that it can return values outside of valid TIMESTAMP range, in particular 1970-01-01 00:00:00. And it can return the same result for different values of unix_timestamp (around DST changes).\n\nThe maximum value is 2147483647, equivalent to 2038-01-19 05:14:07.\n\nThe following options can be used by FROM_UNIXTIME(), as well as DATE_FORMAT() and STR_TO_DATE():\n\n| Option | Description                                                                                                                                                                       |\n| ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| %a     | Short weekday name in current locale (Variable lc_time_names). |\n| %b     | Short form month name in current locale. For locale en_US this is one of: Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec.                                                    |\n| %c     | Month with 1 or 2 digits.                                                                                                                                                         |\n| %D     | Day with English suffix ''th'', ''nd'', ''st'' or ''rd''''. (1st, 2nd, 3rd...).                                                                                                            |\n| %d     | Day with 2 digits.                                                                                                                                                                |\n| %e     | Day with 1 or 2 digits.                                                                                                                                                           |\n| %f     | Microseconds 6 digits.                                                                                                                              |\n| %H     | Hour with 2 digits between 00-23.                                                                                                                                                 |\n| %h     | Hour with 2 digits between 01-12.                                                                                                                                                 |\n| %I     | Hour with 2 digits between 01-12.                                                                                                                                                 |\n| %i     | Minute with 2 digits.                                                                                                                                                             |\n| %j     | Day of the year (001-366)                                                                                                                                                         |\n| %k     | Hour with 1 digits between 0-23.                                                                                                                                                  |\n| %l     | Hour with 1 digits between 1-12.                                                                                                                                                  |\n| %M     | Full month name in current locale (Variable lc_time_names).    |\n| %m     | Month with 2 digits.                                                                                                                                                              |\n| %p     | AM/PM according to current locale (Variable lc_time_names).    |\n| %r     | Time in 12 hour format, followed by AM/PM. Short for ''%I:%i:%S %p''.                                                                                                               |\n| %S     | Seconds with 2 digits.                                                                                                                                                            |\n| %s     | Seconds with 2 digits.                                                                                                                                                            |\n| %T     | Time in 24 hour format. Short for ''%H:%i:%S''.                                                                                                                                     |\n| %U     | Week number (00-53), when first day of the week is Sunday.                                                                                                                        |\n| %u     | Week number (00-53), when first day of the week is Monday.                                                                                                                        |\n| %V     | Week number (01-53), when first day of the week is Sunday. Used with %X.                                                                                                          |\n| %v     | Week number (01-53), when first day of the week is Monday. Used with %x.                                                                                                          |\n| %W     | Full weekday name in current locale (Variable lc_time_names).  |\n| %w     | Day of the week. 0 = Sunday, 6 = Saturday.                                                                                                                                        |\n| %X     | Year with 4 digits when first day of the week is Sunday. Used with %V.                                                                                                            |\n| %x     | Year with 4 digits when first day of the week is Sunday. Used with %v.                                                                                                            |\n| %Y     | Year with 4 digits.                                                                                                                                                               |\n| %y     | Year with 2 digits.                                                                                                                                                               |\n| %#     | For str_to_date(), skip all numbers.                                                                                                                          |\n| %.     | For str_to_date(), skip all punctation characters.                                                                                                            |\n| %@     | For str_to_date(), skip all alpha characters.                                                                                                                 |\n| %%     | A literal % character.                                                                                                                                                            |\n\nPerformance Considerations\n\nIf your session time zone is set to SYSTEM (the default), FROM_UNIXTIME() will call the OS function to convert the data using the system time zone. At least on Linux, the corresponding function (localtime_r`) uses a global mutex inside glibc that can cause contention under high concurrent load.\n\nSet your time zone to a named time zone to avoid this issue. See mysql time zone tables for details on how to do this.\n\nExamples\n--------\n\nSELECT FROM_UNIXTIME(1196440219);\n+---------------------------+\n| FROM_UNIXTIME(1196440219) |\n+---------------------------+\n| 2007-11-30 11:30:19       |\n+---------------------------+\n\nSELECT FROM_UNIXTIME(1196440219) + 0;\n+-------------------------------+\n| FROM_UNIXTIME(1196440219) + 0 |\n+-------------------------------+\n|         20071130113019.000000 |\n+-------------------------------+\n\nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), ''%Y %D %M %h:%i:%s %x'');\n+---------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(), ''%Y %D %M %h:%i:%s %x'') |\n+---------------------------------------------------------+\n| 2010 27th March 01:03:47 2010                           |\n+---------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/from_unixtime', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/from_unixtime');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (191, 31, 'GET\\_FORMAT', 'Syntax\n------\n\nGET_FORMAT({DATE|DATETIME|TIME}, {''EUR''|''USA''|''JIS''|''ISO''|''INTERNAL''})\n\nDescription\n-----------\n\nReturns a format string. This function is useful in combination with the DATE_FORMAT() and the STR_TO_DATE() functions.\n\nPossible result formats are:\n\n| Function Call                    | Result Format       |\n| -------------------------------- | ------------------- |\n| GET_FORMAT(DATE,''EUR'')          | ''%d.%m.%Y''          |\n| GET_FORMAT(DATE,''USA'')          | ''%m.%d.%Y''          |\n| GET_FORMAT(DATE,''JIS'')          | ''%Y-%m-%d''          |\n| GET_FORMAT(DATE,''ISO'')          | ''%Y-%m-%d''          |\n| GET_FORMAT(DATE,''INTERNAL'')     | ''%Y%m%d''            |\n| GET_FORMAT(DATETIME,''EUR'')      | ''%Y-%m-%d %H.%i.%s'' |\n| GET_FORMAT(DATETIME,''USA'')      | ''%Y-%m-%d %H.%i.%s'' |\n| GET_FORMAT(DATETIME,''JIS'')      | ''%Y-%m-%d %H:%i:%s'' |\n| GET_FORMAT(DATETIME,''ISO'')      | ''%Y-%m-%d %H:%i:%s'' |\n| GET_FORMAT(DATETIME,''INTERNAL'') | ''%Y%m%d%H%i%s''      |\n| GET_FORMAT(TIME,''EUR'')          | ''%H.%i.%s''          |\n| GET_FORMAT(TIME,''USA'')          | ''%h:%i:%s %p''       |\n| GET_FORMAT(TIME,''JIS'')          | ''%H:%i:%s''          |\n| GET_FORMAT(TIME,''ISO'')          | ''%H:%i:%s''          |\n| GET_FORMAT(TIME,''INTERNAL'')     | ''%H%i%s''            |\n\nExamples\n--------\n\nSELECT GET_FORMAT(DATE, ''EUR'');\n+-------------------------+\n| GET_FORMAT(DATE, ''EUR'') |\n+-------------------------+\n| %d.%m.%Y                |\n+-------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/get_format', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/get_format');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (192, 31, 'HOUR', 'Description\n-----------\n\nReturns the hour for time. The range of the return value is 0 to 23 for time-of-day values. However, the range of TIME values actually is much larger, so HOUR can return values greater than 23.\n\nThe return value is always positive, even if a negative TIME value is provided.\n\nExamples\n--------\n\nSELECT HOUR(''10:05:03'');\n+------------------+\n| HOUR(''10:05:03'') |\n+------------------+\n|               10 |\n+------------------+\n\nSELECT HOUR(''272:59:59'');\n+-------------------+\n| HOUR(''272:59:59'') |\n+-------------------+\n|               272 |\n+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/hour', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/hour');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (193, 31, 'LAST\\_DAY', 'Syntax\n------\n\nLAST_DAY(date)\n\nDescription\n-----------\n\nTakes a date or datetime value and returns the corresponding value for the last day of the month. Returns NULL if the argument is invalid.\n\nExamples\n--------\n\nSELECT LAST_DAY(''2003-02-05'');\n+------------------------+\n| LAST_DAY(''2003-02-05'') |\n+------------------------+\n| 2003-02-28             |\n+------------------------+\n\nSELECT LAST_DAY(''2004-02-05'');\n+------------------------+\n| LAST_DAY(''2004-02-05'') |\n+------------------------+\n| 2004-02-29             |\n+------------------------+\n\nSELECT LAST_DAY(''2004-01-01 01:01:01'');\n+---------------------------------+\n| LAST_DAY(''2004-01-01 01:01:01'') |\n+---------------------------------+\n| 2004-01-31                      |\n+---------------------------------+\n\nSELECT LAST_DAY(''2003-03-32'');\n+------------------------+\n| LAST_DAY(''2003-03-32'') |\n+------------------------+\n| NULL                   |\n+------------------------+\n1 row in set, 1 warning (0.00 sec)\n\nWarning (Code 1292): Incorrect datetime value: ''2003-03-32''\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/last_day', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/last_day');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (194, 31, 'LOCALTIME', 'Syntax\n------\n\nLOCALTIME\nLOCALTIME([precision])\n\nDescription\n-----------\n\nLOCALTIME and LOCALTIME() are synonyms for NOW().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/localtime', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/localtime');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (195, 31, 'LOCALTIMESTAMP', 'Syntax\n------\n\nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n\nDescription\n-----------\n\nLOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/localtimestamp', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/localtimestamp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (196, 31, 'MAKEDATE', 'Syntax\n------\n\nMAKEDATE(year,dayofyear)\n\nDescription\n-----------\n\nReturns a date, given year and day-of-year values. dayofyear must be greater than 0 or the result is NULL.\n\nExamples\n--------\n\nSELECT MAKEDATE(2011,31), MAKEDATE(2011,32);\n+-------------------+-------------------+\n| MAKEDATE(2011,31) | MAKEDATE(2011,32) |\n+-------------------+-------------------+\n| 2011-01-31        | 2011-02-01        |\n+-------------------+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/makedate', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/makedate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (197, 31, 'MAKETIME', 'Syntax\n------\n\nMAKETIME(hour,minute,second)\n\nDescription\n-----------\n\nReturns a time value calculated from the hour, minute, and second arguments.\n\nIf minute or second are out of the range 0 to 60, NULL is returned. The hour can be in the range -838 to 838, outside of which the value is truncated with a warning.\n\nExamples\n--------\n\nSELECT MAKETIME(13,57,33);\n+--------------------+\n| MAKETIME(13,57,33) |\n+--------------------+\n| 13:57:33           |\n+--------------------+\n\nSELECT MAKETIME(-13,57,33);\n+---------------------+\n| MAKETIME(-13,57,33) |\n+---------------------+\n| -13:57:33           |\n+---------------------+\n\nSELECT MAKETIME(13,67,33);\n+--------------------+\n| MAKETIME(13,67,33) |\n+--------------------+\n| NULL               |\n+--------------------+\n\nSELECT MAKETIME(-1000,57,33);\n+-----------------------+\n| MAKETIME(-1000,57,33) |\n+-----------------------+\n| -838:59:59            |\n+-----------------------+\n1 row in set, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+---------+------+-----------------------------------------------+\n| Level   | Code | Message                                       |\n+---------+------+-----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: ''-1000:57:33'' |\n+---------+------+-----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/maketime', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/maketime');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (198, 31, 'MICROSECOND', 'Syntax\n------\n\nMICROSECOND(expr)\n\nDescription\n-----------\n\nReturns the microseconds from the time or datetime expression _expr_ as a number in the range from 0 to 999999.\n\nIf _expr_ is a time with no microseconds, zero is returned, while if _expr_ is a date with no time, zero with a warning is returned.\n\nExamples\n--------\n\nSELECT MICROSECOND(''12:00:00.123456'');\n+--------------------------------+\n| MICROSECOND(''12:00:00.123456'') |\n+--------------------------------+\n|                         123456 |\n+--------------------------------+\n\nSELECT MICROSECOND(''2009-12-31 23:59:59.000010'');\n+-------------------------------------------+\n| MICROSECOND(''2009-12-31 23:59:59.000010'') |\n+-------------------------------------------+\n|                                        10 |\n+-------------------------------------------+\n\nSELECT MICROSECOND(''2013-08-07 12:13:14'');\n+------------------------------------+\n| MICROSECOND(''2013-08-07 12:13:14'') |\n+------------------------------------+\n|                                  0 |\n+------------------------------------+\n\nSELECT MICROSECOND(''2013-08-07'');\n+---------------------------+\n| MICROSECOND(''2013-08-07'') |\n+---------------------------+\n|                         0 |\n+---------------------------+\n1 row in set, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+---------+------+----------------------------------------------+\n| Level   | Code | Message                                      |\n+---------+------+----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: ''2013-08-07'' |\n+---------+------+----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/microsecond', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/microsecond');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (199, 31, 'Microseconds in MariaDB', 'Description\n-----------\n\nThe TIME, DATETIME, and TIMESTAMP types, along with the temporal functions, CAST and dynamic columns, support microseconds. The datetime precision of a column can be specified when creating the table with CREATE TABLE, for example:\n\n``sql\nCREATE TABLE example(\n  col_microsec DATETIME(6),\n  col_millisec TIME(3)\n);\n`\n\nGenerally, the precision can be specified for any TIME, DATETIME, or TIMESTAMP column, in parentheses, after the type name. The datetime precision specifies number of digits after the decimal dot and can be any integer number from 0 to 6. If no precision is specified it is assumed to be 0, for backward compatibility reasons.\n\nA datetime precision can be specified wherever a type name is used. For example:\n\n when declaring arguments of stored routines;\n when specifying a return type of a stored function;\n when declaring variables;\n in a CAST function.\n\n`sql\nCREATE FUNCTION example(x DATETIME(5)) RETURNS TIME(4)\nBEGIN\n DECLARE y TIMESTAMP(6);\n RETURN CAST(x AS time(2));\nEND;\n`\n\n%f is used as the formatting option for microseconds in the STR_TO_DATE, DATE_FORMAT and FROM_UNIXTIME functions, for example:\n\n`sql\nSELECT STR_TO_DATE(''20200809 020917076'',''%Y%m%d %H%i%s%f'');\n+-----------------------------------------------------+\n| STR_TO_DATE(''20200809 020917076'',''%Y%m%d %H%i%s%f'') |\n+-----------------------------------------------------+\n| 2020-08-09 02:09:17.076000                          |\n+-----------------------------------------------------+\n`\n\nAdditional Information\n\n When comparing anything to a temporal value (DATETIME, TIME, DATE, or TIMESTAMP), both values are compared as temporal values, not as strings.\n The INFORMATION_SCHEMA.COLUMNS table has a new column DATETIME_PRECISION\n NOW(), CURTIME(), UTC_TIMESTAMP(), UTC_TIME(), CURRENT_TIME(), CURRENT_TIMESTAMP(), LOCALTIME() and LOCALTIMESTAMP() accept datetime precision as an optional argument. For example:\n\n`sql\nSELECT CURTIME(4);\n--> 10:11:12.3456\n`\n\n TIME_TO_SEC() and UNIX_TIMESTAMP() preserve microseconds of the argument. These functions will return a decimal number if the result non-zero datetime precision and an integer otherwise (for backward compatibility).\n\n`sql\nSELECT TIME_TO_SEC(''10:10:10.12345'');\n--> 36610.12345\n`\n\n Current versions of this patch fix a bug in the following optimization: In certain queries with DISTINCT MariaDB can ignore this clause if it can prove that all result rows are unique anyway, for example, when a primary key is compared with a constant. Sometimes this optimization was applied incorrectly, though — for example, when comparing a string with a date constant. This is now fixed.\n DATE_ADD() and DATE_SUB() functions can now take a TIME expression as an argument (not just DATETIME as before).\n\n`sql\nSELECT TIME(''10:10:10'') + INTERVAL 100 MICROSECOND;\n--> 10:10:10.000100\n`\n\n The event_time field in the mysql.general_log table and the start_time, query_time, and lock_time fields in the mysql.slow_log table now store values with microsecond precision.\n The old syntax TIMESTAMP(N), where N is the display width, is no longer supported.\n When a DATETIME value is compared to a TIME value, the latter is treated as a full datetime with a zero date part, similar to comparing DATE to a DATETIME, or to comparing DECIMAL numbers.\\\n  Earlier versions of MariaDB used to compare only the time part of both operands in such a case.\n In MariaDB, an extra column TIME_MS has been added to the INFORMATION_SCHEMA.PROCESSLIST table, as well as to the output of SHOW FULL PROCESSLIST.\n\nNote: When you convert a temporal value to a value with a smaller precision, it will be truncated, not rounded. This is done to guarantee that the date part is not changed. For example:\n\n`sql\nSELECT CAST(''2009-12-31 23:59:59.998877'' AS DATETIME(3));\n-> 2009-12-31 23:59:59.998\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/microseconds-in-mariadb', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/microseconds-in-mariadb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (200, 31, 'MINUTE', 'Syntax\n------\n\nMINUTE(time)\n\nDescription\n-----------\n\nReturns the minute for _time_, in the range 0 to 59.\n\nExamples\n--------\n\nSELECT MINUTE(''2013-08-03 11:04:03'');\n+-------------------------------+\n| MINUTE(''2013-08-03 11:04:03'') |\n+-------------------------------+\n|                             4 |\n+-------------------------------+\n\n SELECT MINUTE (''23:12:50'');\n+---------------------+\n| MINUTE (''23:12:50'') |\n+---------------------+\n|                  12 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/minute', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/minute');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (201, 31, 'MONTH', 'Syntax\n------\n\nMONTH(date)\n\nDescription\n-----------\n\nReturns the month for date in the range 1 to 12 for January to December, or 0 for dates such as 0000-00-00 or 2008-00-00 that have a zero month part.\n\nExamples\n--------\n\nSELECT MONTH(''2019-01-03'');\n+---------------------+\n| MONTH(''2019-01-03'') |\n+---------------------+\n|                   1 |\n+---------------------+\n\nSELECT MONTH(''2019-00-03'');\n+---------------------+\n| MONTH(''2019-00-03'') |\n+---------------------+\n|                   0 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/month', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/month');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (202, 31, 'MONTHNAME', 'Syntax\n------\n\nMONTHNAME(date)\n\nDescription\n-----------\n\nReturns the full name of the month for date. The language used for the name is controlled by the value of the lc_time_names system variable. See server locale for more on the supported locales.\n\nExamples\n--------\n\nSELECT MONTHNAME(''2019-02-03'');\n+-------------------------+\n| MONTHNAME(''2019-02-03'') |\n+-------------------------+\n| February                |\n+-------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/monthname', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/monthname');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (203, 31, 'MONTHS\\_BETWEEN', 'Description\n-----------\n\nMONTHS_BETWEEN returns the number of months between dates two dates. If the first date given is later than the second date, the result is positive; otherwise, the result is negative. If both dates are the same days of the month, or both are last days of months, the result is always an integer. Otherwise, the fractional portion of the result based on a 31-day month is calculated, and considered the difference in time components between the dates.\n\nThe following example calculates the months between two dates:\n\n``sql\nSELECT MONTHS_BETWEEN\n       (TO_DATE(''02-02-1995'',''MM-DD-YYYY''),\n        TO_DATE(''01-01-1995'',''MM-DD-YYYY'') \n       );\n`\n\nThe result is 1.03225806`.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/months_between', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/months_between');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (204, 31, 'NOW', 'Syntax\n------\n\nNOW([precision])\nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\nLOCALTIME, LOCALTIME([precision])\nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n\nDescription\n-----------\n\nReturns the current date and time as a value in YYYY-MM-DD HH:MM:SS or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a string or numeric context. The value is expressed in the current time zone.\n\nMariaDB starting with 11.7\n\nThese functions return SQL standard compliant types:\n\n NOW() and CURRENT_TIMESTAMP() return a TIMESTAMP value (analogous to the standard type TIMESTAMP WITH LOCAL TIME ZONE) which corresponds to the current point in time and is unambiguous around DST changes.\n LOCALTIMESTAMP returns a DATETIME value (analogous to the standard type TIMESTAMP WITHOUT TIME ZONE). Storing its result in a TIMESTAMP column can result in a data loss around DST changes.\n\nThese functions do not return SQL standard compliant types:\n\n NOW()\n CURRENT_TIMESTAMP()\n* LOCALTIMESTAMP\n\nThe optional _precision_ determines the microsecond precision. See Microseconds in MariaDB.\n\nNOW() (or its synonyms) can be used as the default value for TIMESTAMP columns as well as.\n\nWhen displayed in the INFORMATION_SCHEMA.COLUMNS table, a default CURRENT TIMESTAMP is displayed as current_timestamp() .\n\nChanging the timestamp system variable with a SET timestamp statement affects the value returned by NOW(), but not by SYSDATE().\n\nExamples\n--------\n\nSELECT NOW();\n+---------------------+\n| NOW()               |\n+---------------------+\n| 2010-03-27 13:13:25 |\n+---------------------+\n\nSELECT NOW() + 0;\n+-----------------------+\n| NOW() + 0             |\n+-----------------------+\n| 20100327131329.000000 |\n+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/now', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/now');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (205, 31, 'PERIOD\\_ADD', 'Syntax\n------\n\nPERIOD_ADD(P,N)\n\nDescription\n-----------\n\nAdds N months to period P. P is in the format YYMM or YYYYMM, and is not a date value. If P contains a two-digit year, values from 00 to 69 are converted to from 2000 to 2069, while values from 70 are converted to 1970 upwards.\n\nReturns a value in the format YYYYMM.\n\nExamples\n--------\n\nSELECT PERIOD_ADD(200801,2);\n+----------------------+\n| PERIOD_ADD(200801,2) |\n+----------------------+\n|               200803 |\n+----------------------+\n\nSELECT PERIOD_ADD(6910,2);\n+--------------------+\n| PERIOD_ADD(6910,2) |\n+--------------------+\n|             206912 |\n+--------------------+\n\nSELECT PERIOD_ADD(7010,2);\n+--------------------+\n| PERIOD_ADD(7010,2) |\n+--------------------+\n|             197012 |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/period_add', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/period_add');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (206, 31, 'PERIOD\\_DIFF', 'Syntax\n------\n\nPERIOD_DIFF(P1,P2)\n\nDescription\n-----------\n\nReturns the number of months between periods P1 and P2. P1 and P2 can be in the format YYMM or YYYYMM, and are not date values.\n\nIf P1 or P2 contains a two-digit year, values from 00 to 69 are converted to from 2000 to 2069, while values from 70 are converted to 1970 upwards.\n\nExamples\n--------\n\nSELECT PERIOD_DIFF(200802,200703);\n+----------------------------+\n| PERIOD_DIFF(200802,200703) |\n+----------------------------+\n|                         11 |\n+----------------------------+\n\nSELECT PERIOD_DIFF(6902,6803);\n+------------------------+\n| PERIOD_DIFF(6902,6803) |\n+------------------------+\n|                     11 |\n+------------------------+\n\nSELECT PERIOD_DIFF(7002,6803);\n+------------------------+\n| PERIOD_DIFF(7002,6803) |\n+------------------------+\n|                  -1177 |\n+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/period_diff', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/period_diff');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (207, 31, 'QUARTER', 'Syntax\n------\n\nQUARTER(date)\n\nDescription\n-----------\n\nReturns the quarter of the year for date, in the range 1 to 4. Returns 0 if month contains a zero value, or NULL if the given value is not otherwise a valid date (zero values are accepted).\n\nExamples\n--------\n\nSELECT QUARTER(''2008-04-01'');\n+-----------------------+\n| QUARTER(''2008-04-01'') |\n+-----------------------+\n|                     2 |\n+-----------------------+\n\nSELECT QUARTER(''2019-00-01'');\n+-----------------------+\n| QUARTER(''2019-00-01'') |\n+-----------------------+\n|                     0 |\n+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/quarter', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/quarter');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (208, 31, 'SEC\\_TO\\_TIME', 'Syntax\n------\n\nSEC_TO_TIME(seconds)\n\nDescription\n-----------\n\nReturns the seconds argument, converted to hours, minutes, and seconds, as a TIME value. The range of the result is constrained to that of the TIME data type. A warning occurs if the argument corresponds to a value outside that range.\n\nThe time will be returned in the format hh:mm:ss, or hhmmss if used in a numeric calculation.\n\nExamples\n--------\n\nSELECT SEC_TO_TIME(12414);\n+--------------------+\n| SEC_TO_TIME(12414) |\n+--------------------+\n| 03:26:54           |\n+--------------------+\n\nSELECT SEC_TO_TIME(12414)+0;\n+----------------------+\n| SEC_TO_TIME(12414)+0 |\n+----------------------+\n|                32654 |\n+----------------------+\n\nSELECT SEC_TO_TIME(9999999);\n+----------------------+\n| SEC_TO_TIME(9999999) |\n+----------------------+\n| 838:59:59            |\n+----------------------+\n1 row in set, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+---------+------+-------------------------------------------+\n| Level   | Code | Message                                   |\n+---------+------+-------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: ''9999999'' |\n+---------+------+-------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/sec_to_time', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/sec_to_time');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (209, 31, 'SECOND', 'Syntax\n------\n\nSECOND(time)\n\nDescription\n-----------\n\nReturns the second for a given time (which can include microseconds), in the range 0 to 59, or NULL if not given a valid time value.\n\nExamples\n--------\n\nSELECT SECOND(''10:05:03'');\n+--------------------+\n| SECOND(''10:05:03'') |\n+--------------------+\n|                  3 |\n+--------------------+\n\nSELECT SECOND(''10:05:01.999999'');\n+---------------------------+\n| SECOND(''10:05:01.999999'') |\n+---------------------------+\n|                         1 |\n+---------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/second', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/second');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (210, 31, 'STR\\_TO\\_DATE', 'Syntax\n------\n\nSTR_TO_DATE(str,format)\n\nDescription\n-----------\n\nThis is the inverse of the DATE_FORMAT() function. It takes a string str and a format string format. STR_TO_DATE() returns aDATETIME value if the format string contains both date and time parts, or aDATE or TIME value if the string contains only date or time parts.\n\nThe date, time, or datetime values contained in str should be given in the format indicated by format. If str contains an illegal date, time, or datetime value, STR_TO_DATE() returns NULL. An illegal value also produces a warning.\n\nUnder specific SQL_MODE settings an error may also be generated if the str isn''t a valid date:\n\n ALLOW_INVALID_DATES\n NO_ZERO_DATE\n* NO_ZERO_IN_DATE\n\nThe options that can be used by STR_TO_DATE(), as well as its inverse DATE_FORMAT() and the FROM_UNIXTIME() function, are:\n\n| Option | Description                                                                                                                                                                       |\n| ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| %a     | Short weekday name in current locale (Variable lc_time_names). |\n| %b     | Short form month name in current locale. For locale en_US this is one of: Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec.                                                    |\n| %c     | Month with 1 or 2 digits.                                                                                                                                                         |\n| %D     | Day with English suffix ''th'', ''nd'', ''st'' or ''rd''''. (1st, 2nd, 3rd...).                                                                                                            |\n| %d     | Day with 2 digits.                                                                                                                                                                |\n| %e     | Day with 1 or 2 digits.                                                                                                                                                           |\n| %f     | Microseconds 6 digits.                                                                                                                              |\n| %H     | Hour with 2 digits between 00-23.                                                                                                                                                 |\n| %h     | Hour with 2 digits between 01-12.                                                                                                                                                 |\n| %I     | Hour with 2 digits between 01-12.                                                                                                                                                 |\n| %i     | Minute with 2 digits.                                                                                                                                                             |\n| %j     | Day of the year (001-366)                                                                                                                                                         |\n| %k     | Hour with 1 digits between 0-23.                                                                                                                                                  |\n| %l     | Hour with 1 digits between 1-12.                                                                                                                                                  |\n| %M     | Full month name in current locale (Variable lc_time_names).    |\n| %m     | Month with 2 digits.                                                                                                                                                              |\n| %p     | AM/PM according to current locale (Variable lc_time_names).    |\n| %r     | Time in 12 hour format, followed by AM/PM. Short for ''%I:%i:%S %p''.                                                                                                               |\n| %S     | Seconds with 2 digits.                                                                                                                                                            |\n| %s     | Seconds with 2 digits.                                                                                                                                                            |\n| %T     | Time in 24 hour format. Short for ''%H:%i:%S''.                                                                                                                                     |\n| %U     | Week number (00-53), when first day of the week is Sunday.                                                                                                                        |\n| %u     | Week number (00-53), when first day of the week is Monday.                                                                                                                        |\n| %V     | Week number (01-53), when first day of the week is Sunday. Used with %X.                                                                                                          |\n| %v     | Week number (01-53), when first day of the week is Monday. Used with %x.                                                                                                          |\n| %W     | Full weekday name in current locale (Variable lc_time_names).  |\n| %w     | Day of the week. 0 = Sunday, 6 = Saturday.                                                                                                                                        |\n| %X     | Year with 4 digits when first day of the week is Sunday. Used with %V.                                                                                                            |\n| %x     | Year with 4 digits when first day of the week is Monday. Used with %v.                                                                                                            |\n| %Y     | Year with 4 digits.                                                                                                                                                               |\n| %y     | Year with 2 digits.                                                                                                                                                               |\n| %#     | For str_to_date(), skip all numbers.                                                                                                                          |\n| %.     | For str_to_date(), skip all punctation characters.                                                                                                            |\n| %@     | For str_to_date(), skip all alpha characters.                                                                                                                 |\n| %%     | A literal % character.                                                                                                                                                            |\n\nExamples\n--------\n\nSELECT STR_TO_DATE(''Wednesday, June 2, 2014'', ''%W, %M %e, %Y'');\n+---------------------------------------------------------+\n| STR_TO_DATE(''Wednesday, June 2, 2014'', ''%W, %M %e, %Y'') |\n+---------------------------------------------------------+\n| 2014-06-02                                              |\n+---------------------------------------------------------+\n\nSELECT STR_TO_DATE(''Wednesday23423, June 2, 2014'', ''%W, %M %e, %Y'');\n+--------------------------------------------------------------+\n| STR_TO_DATE(''Wednesday23423, June 2, 2014'', ''%W, %M %e, %Y'') |\n+--------------------------------------------------------------+\n| NULL                                                         |\n+--------------------------------------------------------------+\n1 row in set, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+---------+------+-----------------------------------------------------------------------------------+\n| Level   | Code | Message                                                                           |\n+---------+------+-----------------------------------------------------------------------------------+\n| Warning | 1411 | Incorrect datetime value: ''Wednesday23423, June 2, 2014'' for function str_to_date |\n+---------+------+-----------------------------------------------------------------------------------+\n\nSELECT STR_TO_DATE(''Wednesday23423, June 2, 2014'', ''%W%#, %M %e, %Y'');\n+----------------------------------------------------------------+\n| STR_TO_DATE(''Wednesday23423, June 2, 2014'', ''%W%#, %M %e, %Y'') |\n+----------------------------------------------------------------+\n| 2014-06-02                                                     |\n+----------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/str_to_date', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/str_to_date');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (211, 31, 'SUBDATE', 'Syntax\n------\n\nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n\nDescription\n-----------\n\nWhen invoked with the INTERVAL form of the second argument, SUBDATE() is a synonym for DATE_SUB(). See Date and Time Units for a complete list of permitted units.\n\nThe second form allows the use of an integer value for days. In such cases, it is interpreted as the number of days to be subtracted from the date or datetime expression expr.\n\nExamples\n--------\n\nSELECT DATE_SUB(''2008-01-02'', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB(''2008-01-02'', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2007-12-02                              |\n+-----------------------------------------+\n\nSELECT SUBDATE(''2008-01-02'', INTERVAL 31 DAY);\n+----------------------------------------+\n| SUBDATE(''2008-01-02'', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2007-12-02                             |\n+----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/subdate', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/subdate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (212, 31, 'SUBTIME', 'Syntax\n------\n\nSUBTIME(expr1,expr2)\n\nDescription\n-----------\n\nSUBTIME() returns expr1 - expr2 expressed as a value in the same format as expr1. expr1 is a time or datetime expression, and expr2 is a time expression.\n\nExamples\n--------\n\nSELECT SUBTIME(''2007-12-31 23:59:59.999999'',''1 1:1:1.000002'');\n+--------------------------------------------------------+\n| SUBTIME(''2007-12-31 23:59:59.999999'',''1 1:1:1.000002'') |\n+--------------------------------------------------------+\n| 2007-12-30 22:58:58.999997                             |\n+--------------------------------------------------------+\n\nSELECT SUBTIME(''01:00:00.999999'', ''02:00:00.999998'');\n+-----------------------------------------------+\n| SUBTIME(''01:00:00.999999'', ''02:00:00.999998'') |\n+-----------------------------------------------+\n| -00:59:59.999999                              |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/subtime', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/subtime');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (213, 31, 'SYSDATE', 'Syntax\n------\n\nSYSDATE([precision])\n\nDescription\n-----------\n\nReturns the current date and time as a value in YYYY-MM-DD HH:MM:SS or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a string or numeric context.\n\nThe optional _precision_ determines the microsecond precision. See Microseconds in MariaDB.\n\nSYSDATE() returns the time at which it executes. This differs from the behavior for NOW(), which returns a constant time that indicates the time at which the statement began to execute. (Within a stored routine or trigger, NOW() returns the time at which the routine or triggering statement began to execute.)\n\nIn addition, changing the timestamp system variable with a SET timestamp statement affects the value returned by NOW() but not by SYSDATE(). This means that timestamp settings in the binary log have no effect on invocations of SYSDATE().\n\nBecause SYSDATE() can return different values even within the same statement, and is not affected by SET TIMESTAMP, it is non-deterministic and therefore unsafe for replication if statement-based binary logging is used. If that is a problem, you can use row-based logging, or start the server with the --sysdate-is-now mariadbd option to cause SYSDATE() to be an alias for NOW(). The non-deterministic nature of SYSDATE() also means that indexes cannot be used for evaluating expressions that refer to it, and that statements using the SYSDATE() function are unsafe for statement-based replication.\n\nExamples\n--------\n\nSELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW()               | SLEEP(2) | NOW()               |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:40 |        0 | 2010-03-27 13:23:40 |\n+---------------------+----------+---------------------+\n\nSELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE()           | SLEEP(2) | SYSDATE()           |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:52 |        0 | 2010-03-27 13:23:54 |\n+---------------------+----------+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/sysdate', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/sysdate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (214, 31, 'TIME\\_FORMAT', 'Syntax\n------\n\nTIME_FORMAT(time,format)\n\nDescription\n-----------\n\nThis is used like the DATE_FORMAT() function, but the format string may contain format specifiers only for hours, minutes, and seconds. Other specifiers produce a NULL value or 0.\n\nExamples\n--------\n\nSELECT TIME_FORMAT(''100:00:00'', ''%H %k %h %I %l'');\n+--------------------------------------------+\n| TIME_FORMAT(''100:00:00'', ''%H %k %h %I %l'') |\n+--------------------------------------------+\n| 100 100 04 04 4                            |\n+--------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/time_format', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/time_format');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (215, 31, 'TIME\\_TO\\_SEC', 'Syntax\n------\n\nTIME_TO_SEC(time)\n\nDescription\n-----------\n\nReturns the time argument, converted to seconds.\n\nThe value returned by TIME_TO_SEC is of type DOUBLE. The returned value preserves microseconds of the argument. See also Microseconds in MariaDB.\n\nExamples\n--------\n\nSELECT TIME_TO_SEC(''22:23:00'');\n+-------------------------+\n| TIME_TO_SEC(''22:23:00'') |\n+-------------------------+\n|                   80580 |\n+-------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/time_to_sec', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/time_to_sec');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (216, 31, 'TIMEDIFF', 'Syntax\n------\n\nTIMEDIFF(expr1,expr2)\n\nDescription\n-----------\n\nTIMEDIFF() returns expr1 - expr2 expressed as a time value. expr1 andexpr2 are time or date-and-time expressions, but both must be of the\\\nsame type.\n\nExamples\n--------\n\nSELECT TIMEDIFF(''2000:01:01 00:00:00'', ''2000:01:01 00:00:00.000001'');\n+---------------------------------------------------------------+\n| TIMEDIFF(''2000:01:01 00:00:00'', ''2000:01:01 00:00:00.000001'') |\n+---------------------------------------------------------------+\n| -00:00:00.000001                                              |\n+---------------------------------------------------------------+\n\nSELECT TIMEDIFF(''2008-12-31 23:59:59.000001'', ''2008-12-30 01:01:01.000002'');\n+----------------------------------------------------------------------+\n| TIMEDIFF(''2008-12-31 23:59:59.000001'', ''2008-12-30 01:01:01.000002'') |\n+----------------------------------------------------------------------+\n| 46:58:57.999999                                                      |\n+----------------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/timediff', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/timediff');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (217, 31, 'TIMESTAMPADD', 'Syntax\n------\n\nTIMESTAMPADD(unit,interval,datetime_expr)\n\nDescription\n-----------\n\nAdds the integer expression interval to the date or datetime expression datetime_expr. The unit for interval is given by the unit argument, which should be one of the following values: MICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.\n\nThe unit value may be specified using one of keywords as shown, or with a prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are allowed.\n\nExamples\n--------\n\nSELECT TIMESTAMPADD(MINUTE,1,''2003-01-02'');\n+-------------------------------------+\n| TIMESTAMPADD(MINUTE,1,''2003-01-02'') |\n+-------------------------------------+\n| 2003-01-02 00:01:00                 |\n+-------------------------------------+\n\nSELECT TIMESTAMPADD(WEEK,1,''2003-01-02'');\n+-----------------------------------+\n| TIMESTAMPADD(WEEK,1,''2003-01-02'') |\n+-----------------------------------+\n| 2003-01-09                        |\n+-----------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/timestampadd', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/timestampadd');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (218, 31, 'TIMESTAMPDIFF', 'Syntax\n------\n\nTIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)\n\nDescription\n-----------\n\nReturns datetime_expr2 - datetime_expr1, where datetime_expr1 anddatetime_expr2 are date or datetime expressions. One expression may be a date and the other a datetime; a date value is treated as a datetime having the time part ''00:00:00'' where necessary. The unit for the result (an integer) is given by the unit argument. The legal values for unit are the same as those listed in the description of the TIMESTAMPADD() function, that is, MICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.\n\nTIMESTAMPDIFF can also be used to calculate age.\n\nExamples\n--------\n\nSELECT TIMESTAMPDIFF(MONTH,''2003-02-01'',''2003-05-01'');\n+------------------------------------------------+\n| TIMESTAMPDIFF(MONTH,''2003-02-01'',''2003-05-01'') |\n+------------------------------------------------+\n|                                              3 |\n+------------------------------------------------+\n\nSELECT TIMESTAMPDIFF(YEAR,''2002-05-01'',''2001-01-01'');\n+-----------------------------------------------+\n| TIMESTAMPDIFF(YEAR,''2002-05-01'',''2001-01-01'') |\n+-----------------------------------------------+\n|                                            -1 |\n+-----------------------------------------------+\n\nSELECT TIMESTAMPDIFF(MINUTE,''2003-02-01'',''2003-05-01 12:05:55'');\n+----------------------------------------------------------+\n| TIMESTAMPDIFF(MINUTE,''2003-02-01'',''2003-05-01 12:05:55'') |\n+----------------------------------------------------------+\n|                                                   128885 |\n+----------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/timestampdiff', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/timestampdiff');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (219, 31, 'TO\\_DATE', 'Syntax\n------\n\nTO_DATE(string_expression [DEFAULT string_expression ON CONVERSION ERROR],\n        format_string [,NLS_FORMAT_STRING])\n\nDescription\n-----------\n\nTO_DATE was added for Oracle support.\n\n format_string has the same format elements as TO_CHAR(), except a few elements that are not supported (see below). TO_DATE() returns a datetime value.\n The allowed separators are the same as for TO_CHAR(): space ( ), tab (\\t), and any of !, #, %, '', (, ), , +, -, ., /, :, ;, <, =, or >.\n & can be used if the next character is not a character in the a-z or A-Z range. text indicates a text string that is used verbatim in the format. You cannot use the double-quote (") as a separator.\n NLS_FORMAT_STRING supports these options: NLS_CALENDAR=GREGORIAN and NLS_DATE_LANGUAGE=_language_, where _language_ can be one of the following:\n   All MariaDB short locales, like en_AU.\n   The following Oracle language names: ALBANIAN, AMERICAN, ARABIC, BASQUE, BELARUSIAN, BRAZILIAN PORTUGUESE, BULGARIAN, CANADIAN FRENCH, CATALAN, CROATIAN, CYRILLIC SERBIAN, CZECH, DANISH, DUTCH, ENGLISH, ESTONIAN, FINNISH, FRENCH, GERMAN, GREEK, HEBREW, HINDI, HUNGARIAN, ICELANDIC, INDONESIAN, ITALIAN, JAPANESE, KANNADA, KOREAN, LATIN AMERICAN SPANISH, LATVIAN, LITHUANIAN, MACEDONIAN, MALAY, MEXICAN SPANISH, NORWEGIAN, POLISH, PORTUGUESE, ROMANIAN, RUSSIAN, SIMPLIFIED CHINESE, SLOVAK, SLOVENIAN, SPANISH, SWAHILI, SWEDISH, TAMIL, THAI, TRADITIONAL CHINESE, TURKISH, UKRAINIAN, VIETNAMESE\n\nSupported Format Elements\n\n AD – Anno Domini ("in the year of the Lord")\n AD_DOT – Anno Domini ("in the year of the Lord")&#x20;\n AM – Meridian indicator (before midday)\n AM_DOT – Meridian indicator (before midday)\n DAY – Name of day\n DD – Day (1-31)\n DDD – Day of year (1-336)\n DY – Abbreviated name of day\n FF[1-6] – Fractional seconds\n HH – Hour (1-12)\n HH12 – Hour (1-12)\n HH24 – Hour (0-23)\n MI – Minutes (0-59)\n MM – Month (1-12)\n MON – Abbreviated name of month\n MONTH – Name of Month\n PM – Meridian indicator (after midday)\n PM_DOT – Meridian indicator (after midday)\n RR – 20th century dates in the 21st century. 2 digits in the 50-99 range are assumed starting from the year 2000, and 0-49 is assumed from 1900.&#x20;\n RRRR – 20th century dates in the 21st century. 4 digits\n SS – Seconds\n SYYYY – Signed 4-digit year; MariaDB only supports positive years\n Y – 1-digit year\n YY – 2-digit year\n YYY – 3-digit year\n YYYY – 4 digit year\n\nIf no datetime is given, the current datetime is used. For example, if ''MM-DD HH-MM-SS'' is given, the current year is used. (This is Oracle behavior.)\n\nUnsupported Options\n\n BC, D, DL, DS, E, EE, FM, FX, RM, SSSSS, TS, TZD, TZH, TZR, X, and SY BC are not supported by MariaDB datetime.\n Most other formats do not make sense in a MariaDB context, as we return  datetime with fractions, not as a string.\n D (day-of-week) is not supported as it is not clear how it would map to MariaDB. This element depends on the NLS territory of the session.\n RR only works with 2-digit years. (In Oracle, RR may also work with 4-digit years in some context, but the rules are not clear.)\n\nExtensions and Differences Compared to Oracle\n\n MariaDB supports FF (fractional seconds). If FF[#] is used, TO_DATE  returns a datetime with # of subseconds. If FF is not used, a datetime is returned. A warning (but no error) is issued if the string contains more digits than specified with F(#].\n Names can be shortened to their unique prefixes. For example, both January and Ja work fine.\n No error is issued if the datetime string is shorter than format_string and the next unused character is not a number. This is useful to get a datetime from a mixed set of strings in datetime format. By contrast, Oracle gives an error if the datetime string is too short.\n MariaDB supports short locales as language names.\n NLS_DATE_FORMAT can use double-quote (") and single-quote ('') for quoting.\n* NLS_DATE_FORMAT must be a constant string. This is to ensure that the server knows which locale to use when executing the function.\n\nExamples\n--------\n\nSELECT TO_DATE(''February 5, 2026, 20:56'',''%Y-%m-%e'')\n+-----------------------------------------------+\n| TO_DATE(''February 5, 2026, 20:56'',''%Y-%m-%e'') |\n+-----------------------------------------------+\n| 2026-02-05                                    |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/to_date', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/to_date');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (220, 31, 'TO\\_DAYS', 'Syntax\n------\n\nTO_DAYS(date)\n\nDescription\n-----------\n\nGiven a date date, returns the number of days since the start of the current calendar (0000-00-00).\n\nThe function is not designed for use with dates before the advent of the Gregorian calendar in October 1582. Results are not reliable since it doesn''t account for the lost days when the calendar changed from the Julian calendar.\n\nThis is the converse of the FROM_DAYS() function.\n\nExamples\n--------\n\nSELECT TO_DAYS(''2007-10-07'');\n+-----------------------+\n| TO_DAYS(''2007-10-07'') |\n+-----------------------+\n|                733321 |\n+-----------------------+\n\nSELECT TO_DAYS(''0000-01-01'');\n+-----------------------+\n| TO_DAYS(''0000-01-01'') |\n+-----------------------+\n|                     1 |\n+-----------------------+\n\nSELECT TO_DAYS(950501);\n+-----------------+\n| TO_DAYS(950501) |\n+-----------------+\n|          728779 |\n+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/to_days', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/to_days');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (221, 31, 'TO\\_SECONDS', 'Syntax\n------\n\nTO_SECONDS(expr)\n\nDescription\n-----------\n\nReturns the number of seconds from year 0 till expr, or NULL if expr is not a valid date or datetime.\n\nExamples\n--------\n\nSELECT TO_SECONDS(''2013-06-13'');\n+--------------------------+\n| TO_SECONDS(''2013-06-13'') |\n+--------------------------+\n|              63538300800 |\n+--------------------------+\n\nSELECT TO_SECONDS(''2013-06-13 21:45:13'');\n+-----------------------------------+\n| TO_SECONDS(''2013-06-13 21:45:13'') |\n+-----------------------------------+\n|                       63538379113 |\n+-----------------------------------+\n\nSELECT TO_SECONDS(NOW());\n+-------------------+\n| TO_SECONDS(NOW()) |\n+-------------------+\n|       63543530875 |\n+-------------------+\n\nSELECT TO_SECONDS(20130513);\n+----------------------+\n| TO_SECONDS(20130513) |\n+----------------------+\n|          63535622400 |\n+----------------------+\n1 row in set (0.00 sec)\n\nSELECT TO_SECONDS(130513);\n+--------------------+\n| TO_SECONDS(130513) |\n+--------------------+\n|        63535622400 |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/to_seconds', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/to_seconds');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (222, 31, 'TRUNC', 'Syntax\n------\n\nTRUNC(date[,fmt])\n\nDescription\n-----------\n\nReturns a DATETIME truncated according to fmt.\n\nSupported formats:\n\nTruncate to day: DD, DDD, J\\\nTruncate to month: MM, MON, MONTH, RM\\\nTruncate to year: SYEAR, SYYYY, Y,YEAR, YY, YYY, YYYY\n\nExamples\n--------\n\nSELECT TRUNC(''2025-09-24 12:43'',''DD'');\n+--------------------------------+\n| TRUNC(''2025-09-24 12:43'',''DD'') |\n+--------------------------------+\n| 2025-09-24 00:00:00            |\n+--------------------------------+\n\nSELECT TRUNC(''2025-09-24 12:43'',''MM'');\n+--------------------------------+\n| TRUNC(''2025-09-24 12:43'',''MM'') |\n+--------------------------------+\n| 2025-09-01 00:00:00            |\n+--------------------------------+\n\nSELECT TRUNC(''2025-09-24 12:43'',''YY'');\n+--------------------------------+\n| TRUNC(''2025-09-24 12:43'',''YY'') |\n+--------------------------------+\n| 2025-01-01 00:00:00            |\n+--------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/trunc', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/trunc');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (223, 31, 'UNIX\\_TIMESTAMP', 'Syntax\n------\n\nUNIX_TIMESTAMP()\nUNIX_TIMESTAMP(date)\n\nDescription\n-----------\n\nIf called with no argument, returns a Unix timestamp (seconds since 1970-01-01 00:00:00 UTC) as an unsigned integer. If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since 1970-01-01 00:00:00 UTC. date may be a DATE string, a DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD. The server interprets date as a value in the current time zone and converts it to an internal value in UTC. Clients can set their time zone as described in time zones.\n\nThe inverse function of UNIX_TIMESTAMP() is FROM_UNIXTIME()\n\nUNIX_TIMESTAMP() supports microseconds.\n\nTimestamps in MariaDB have a maximum value of 4294967295, equivalent to 2106-02-07 06:28:15. This is due to the underlying 32-bit limitation. Using the function on a timestamp beyond this will result in NULL being returned. Use DATETIME as a storage type if you require dates beyond this.\n\nTimestamps in MariaDB have a maximum value of 2147483647, equivalent to 2038-01-19 05:14:07. This is due to the underlying 32-bit limitation. Using the function on a timestamp beyond this will result in NULL being returned. Use DATETIME as a storage type if you require dates beyond this.\n\nError Handling\n\nReturns NULL for wrong arguments to UNIX_TIMESTAMP().\n\nExamples\n--------\n\nSELECT UNIX_TIMESTAMP();\n+------------------+\n| UNIX_TIMESTAMP() |\n+------------------+\n|       1269711082 |\n+------------------+\n\nSELECT UNIX_TIMESTAMP(''2007-11-30 10:30:19'');\n+---------------------------------------+\n| UNIX_TIMESTAMP(''2007-11-30 10:30:19'') |\n+---------------------------------------+\n|                     1196436619.000000 |\n+---------------------------------------+\n\nSELECT UNIX_TIMESTAMP("2007-11-30 10:30:19.123456");\n+----------------------------------------------+\n| unix_timestamp("2007-11-30 10:30:19.123456") |\n+----------------------------------------------+\n|                            1196411419.123456 |\n+----------------------------------------------+\n\nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(''2007-11-30 10:30:19''));\n+------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(''2007-11-30 10:30:19'')) |\n+------------------------------------------------------+\n| 2007-11-30 10:30:19.000000                           |\n+------------------------------------------------------+\n\nSELECT FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(''2007-11-30 10:30:19'')));\n+-------------------------------------------------------------+\n| FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(''2007-11-30 10:30:19''))) |\n+-------------------------------------------------------------+\n| 2007-11-30 10:30:19                                         |\n+-------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/unix_timestamp', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/unix_timestamp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (224, 31, 'UTC\\_DATE', 'Syntax\n------\n\nUTC_DATE, UTC_DATE()\n\nDescription\n-----------\n\nReturns the current UTC date as a value in YYYY-MM-DD or YYYYMMDD format, depending on whether the function is used in a string or numeric context.\n\nExamples\n--------\n\nSELECT UTC_DATE(), UTC_DATE() + 0;\n+------------+----------------+\n| UTC_DATE() | UTC_DATE() + 0 |\n+------------+----------------+\n| 2010-03-27 |       20100327 |\n+------------+----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/utc_date', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/utc_date');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (225, 31, 'UTC\\_TIME', 'Syntax\n------\n\nUTC_TIME\nUTC_TIME([precision])\n\nDescription\n-----------\n\nReturns the current UTC time as a value in HH:MM:SS or HHMMSS.uuuuuu format, depending on whether the function is used in a string or numeric context.\n\nThe optional _precision_ determines the microsecond precision. See Microseconds in MariaDB.\n\nExamples\n--------\n\nSELECT UTC_TIME(), UTC_TIME() + 0;\n+------------+----------------+\n| UTC_TIME() | UTC_TIME() + 0 |\n+------------+----------------+\n| 17:32:34   |  173234.000000 |\n+------------+----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/utc_time', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/utc_time');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (226, 31, 'UTC\\_TIMESTAMP', 'Syntax\n------\n\nUTC_TIMESTAMP\nUTC_TIMESTAMP([precision])\n\nDescription\n-----------\n\nReturns the current UTC date and time as a value in YYYY-MM-DD HH:MM:SS or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a string or numeric context.\n\nThe optional _precision_ determines the microsecond precision. See Microseconds in MariaDB.\n\nExamples\n--------\n\nSELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\n+---------------------+-----------------------+\n| UTC_TIMESTAMP()     | UTC_TIMESTAMP() + 0   |\n+---------------------+-----------------------+\n| 2010-03-27 17:33:16 | 20100327173316.000000 |\n+---------------------+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/utc_timestamp', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/utc_timestamp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (227, 31, 'WEEK', 'Syntax\n------\n\nWEEK(date[,mode])\n\nDescription\n-----------\n\nThis function returns the week number for date. The two-argument form ofWEEK() allows you to specify whether the week starts on Sunday or Monday and whether the return value should be in the range from 0 to 53 or from 1 to 53. If the mode argument is omitted, the value of the default_week_format system variable is used.\n\nModes\n\n| Mode | 1st day of week | Range | Week 1 is the 1st week with |\n| ---- | --------------- | ----- | --------------------------- |\n| 0    | Sunday          | 0-53  | a Sunday in this year       |\n| 1    | Monday          | 0-53  | more than 3 days this year  |\n| 2    | Sunday          | 1-53  | a Sunday in this year       |\n| 3    | Monday          | 1-53  | more than 3 days this year  |\n| 4    | Sunday          | 0-53  | more than 3 days this year  |\n| 5    | Monday          | 0-53  | a Monday in this year       |\n| 6    | Sunday          | 1-53  | more than 3 days this year  |\n| 7    | Monday          | 1-53  | a Monday in this year       |\n\nWith the mode value of 3, which means ''more than 3 days this year'', weeks are numbered according to ISO 8601:1988.\n\nExamples\n--------\n\nSELECT WEEK(''2008-02-20'');\n+--------------------+\n| WEEK(''2008-02-20'') |\n+--------------------+\n|                  7 |\n+--------------------+\n\nSELECT WEEK(''2008-02-20'',0);\n+----------------------+\n| WEEK(''2008-02-20'',0) |\n+----------------------+\n|                    7 |\n+----------------------+\n\nSELECT WEEK(''2008-02-20'',1);\n+----------------------+\n| WEEK(''2008-02-20'',1) |\n+----------------------+\n|                    8 |\n+----------------------+\n\nSELECT WEEK(''2008-12-31'',0);\n+----------------------+\n| WEEK(''2008-12-31'',0) |\n+----------------------+\n|                   52 |\n+----------------------+\n\nSELECT WEEK(''2008-12-31'',1);\n+----------------------+\n| WEEK(''2008-12-31'',1) |\n+----------------------+\n|                   53 |\n+----------------------+\n\n SELECT WEEK(''2019-12-30'',3);\n+----------------------+\n| WEEK(''2019-12-30'',3) |\n+----------------------+\n|                    1 |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/week', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/week');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (228, 31, 'WEEKDAY', 'Syntax\n------\n\nWEEKDAY(date)\n\nDescription\n-----------\n\nReturns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n\nThis contrasts with DAYOFWEEK() which follows the ODBC standard (1 = Sunday, 2 = Monday, ..., 7 = Saturday).\n\nExamples\n--------\n\nSELECT WEEKDAY(''2008-02-03 22:23:00'');\n+--------------------------------+\n| WEEKDAY(''2008-02-03 22:23:00'') |\n+--------------------------------+\n|                              6 |\n+--------------------------------+\n\nSELECT WEEKDAY(''2007-11-06'');\n+-----------------------+\n| WEEKDAY(''2007-11-06'') |\n+-----------------------+\n|                     1 |\n+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/weekday', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/weekday');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (229, 31, 'WEEKOFYEAR', 'Syntax\n------\n\nWEEKOFYEAR(date)\n\nDescription\n-----------\n\nReturns the calendar week of the date as a number in the range from 1 sqto 53. WEEKOFYEAR() is a compatibility function that is equivalent to WEEK(date,3).\n\nExamples\n--------\n\nSELECT WEEKOFYEAR(''2008-02-20'');\n+--------------------------+\n| WEEKOFYEAR(''2008-02-20'') |\n+--------------------------+\n|                        8 |\n+--------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/weekofyear', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/weekofyear');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (230, 31, 'YEAR', 'Syntax\n------\n\nYEAR(date)\n\nDescription\n-----------\n\nReturns the year for the given date, in the range 1000 to 9999, or 0 for the "zero" date.\n\nSQL_TSI_YEAR is a synonym for YEAR:\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n    ("2007-01-30 21:31:07"),\n    ("1983-10-15 06:42:51"),\n    ("2011-04-21 12:34:56"),\n    ("2011-10-30 06:31:41"),\n    ("2011-01-30 14:03:25"),\n    ("2004-10-07 11:19:34");\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/year', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/year');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (231, 31, 'YEARWEEK', 'Syntax\n------\n\nYEARWEEK(date), YEARWEEK(date,mode)\n\nDescription\n-----------\n\nReturns year and week for a date. The mode argument works exactly like the mode argument to WEEK(). The year in the result may be different from the year in the date argument for the first and the last week of the year.\n\nExamples\n--------\n\nSELECT YEARWEEK(''1987-01-01'');\n+------------------------+\n| YEARWEEK(''1987-01-01'') |\n+------------------------+\n|                 198652 |\n+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/yearweek', '', 'https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/yearweek');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (232, 35, 'Functions & Operators', 'Description\n-----------\n\n| Name                                                                                                                                    | Description                                                                                                               | Added                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |\n| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| +                                                               | Addition operator                                                                                                         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| /                                                               | Division operator                                                                                                         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| \\*                                                        | Multiplication operator                                                                                                   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| %                                                                 | Modulo operator. Returns the remainder of N divided by M                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| -                                                            | Subtraction operator                                                                                                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| !=                                                                      | Not equals                                                                                                                |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| <                                                                       | Less than                                                                                                                 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| <=                                                             | Less than or equal                                                                                                        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| <=>                                                               | NULL-safe equal                                                                                                           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| =                                                                           | Equal                                                                                                                     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| >                                                                    | Greater than                                                                                                              |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| >=                                                          | Greater than or equal                                                                                                     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| &                                                                     | Bitwise AND                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| <<                                                                     | Shift left                                                                                                                |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| >>                                                                    | Shift right                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| ^                                                                     | Bitwise XOR                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| !                                                                                | Logical NOT                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| &&                                                                               | Logical AND                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| XOR\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-functions/function-and-operator-reference');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (233, 4, 'ABS', 'Syntax\n------\n\nABS(X)\n\nDescription\n-----------\n\nReturns the absolute (non-negative) value of X. If X is not a number, it is converted to a numeric type.\n\nExamples\n--------\n\nSELECT ABS(42);\n+---------+\n| ABS(42) |\n+---------+\n|      42 |\n+---------+\n\nSELECT ABS(-42);\n+----------+\n| ABS(-42) |\n+----------+\n|       42 |\n+----------+\n\nSELECT ABS(DATE ''1994-01-01'');\n+------------------------+\n| ABS(DATE ''1994-01-01'') |\n+------------------------+\n|               19940101 |\n+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/abs', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/abs');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (234, 4, 'ACOS', 'Syntax\n------\n\nACOS(X)\n\nDescription\n-----------\n\nReturns the arc cosine of X, that is, the value whose cosine is X. Returns NULL if X is not in the range -1 to 1.\n\nExamples\n--------\n\nSELECT ACOS(1);\n+---------+\n| ACOS(1) |\n+---------+\n|       0 |\n+---------+\n\nSELECT ACOS(1.0001);\n+--------------+\n| ACOS(1.0001) |\n+--------------+\n|         NULL |\n+--------------+\n\nSELECT ACOS(0);\n+-----------------+\n| ACOS(0)         |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n\nSELECT ACOS(0.234);\n+------------------+\n| ACOS(0.234)      |\n+------------------+\n| 1.33460644244679 |\n+------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/acos', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/acos');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (235, 4, 'ASIN', 'Syntax\n------\n\nASIN(X)\n\nDescription\n-----------\n\nReturns the arc sine of X, that is, the value whose sine is X. Returns NULL if X is not in the range -1 to 1.\n\nExamples\n--------\n\nSELECT ASIN(0.2);\n+--------------------+\n| ASIN(0.2)          |\n+--------------------+\n| 0.2013579207903308 |\n+--------------------+\n\nSELECT ASIN(''foo'');\n+-------------+\n| ASIN(''foo'') |\n+-------------+\n|           0 |\n+-------------+\n\nSHOW WARNINGS;\n+---------+------+-----------------------------------------+\n| Level   | Code | Message                                 |\n+---------+------+-----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: ''foo'' |\n+---------+------+-----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/asin', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/asin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (236, 4, 'ATAN', 'Syntax\n------\n\nATAN(X)\n\nDescription\n-----------\n\nReturns the arc tangent of X, that is, the value whose tangent is X.\n\nExamples\n--------\n\nSELECT ATAN(2);\n+--------------------+\n| ATAN(2)            |\n+--------------------+\n| 1.1071487177940904 |\n+--------------------+\n\nSELECT ATAN(-2);\n+---------------------+\n| ATAN(-2)            |\n+---------------------+\n| -1.1071487177940904 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/atan', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/atan');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (237, 4, 'ATAN2', 'Syntax\n------\n\nATAN(Y,X), ATAN2(Y,X)\n\nDescription\n-----------\n\nReturns the arc tangent of the two variables X and Y. It is similar to calculating the arc tangent of Y / X, except that the signs of both arguments are used to determine the quadrant of the result.\n\nExamples\n--------\n\nSELECT ATAN(-2,2);\n+---------------------+\n| ATAN(-2,2)          |\n+---------------------+\n| -0.7853981633974483 |\n+---------------------+\n\nSELECT ATAN2(PI(),0);\n+--------------------+\n| ATAN2(PI(),0)      |\n+--------------------+\n| 1.5707963267948966 |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/atan2', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/atan2');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (238, 4, 'CEIL', 'Syntax\n------\n\nCEIL(X)\n\nDescription\n-----------\n\nCEIL() is a synonym for CEILING().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/ceil', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/ceil');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (239, 4, 'CEILING', 'Syntax\n------\n\nCEILING(X)\n\nDescription\n-----------\n\nReturns the smallest integer value not less than X.\n\nExamples\n--------\n\nSELECT CEILING(1.23);\n+---------------+\n| CEILING(1.23) |\n+---------------+\n|             2 |\n+---------------+\n\nSELECT CEILING(-1.23);\n+----------------+\n| CEILING(-1.23) |\n+----------------+\n|             -1 |\n+----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/ceiling', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/ceiling');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (240, 4, 'CONV', 'Syntax\n------\n\nCONV(N,from_base,to_base)\n\nDescription\n-----------\n\nConverts numbers between different number bases. Returns a string representation of the number _N_, converted from base _from_base_ to base _to_base_.\n\nReturns NULL if any argument is NULL, or if the second or third argument are not in the allowed range.\n\nThe argument _N_ is interpreted as an integer, but may be specified as an integer or a string. The minimum base is 2 and the maximum base is 62. If _to_base_ is a negative number, _N_ is regarded as a signed number. Otherwise, _N_ is treated as unsigned. CONV() works with 64-bit precision.\n\nThe argument _N_ is interpreted as an integer, but may be specified as an integer or a string. The minimum base is 2 and the maximum base is 36. If _to_base_ is a negative number, _N_ is regarded as a signed number. Otherwise, _N_ is treated as unsigned. CONV() works with 64-bit precision.\n\nSome shortcuts for this function are also available: BIN(), OCT(), HEX(), UNHEX(). Also, MariaDB allows binary literal values and hexadecimal literal values.\n\nExamples\n--------\n\nSELECT CONV(''a'',16,2);\n+----------------+\n| CONV(''a'',16,2) |\n+----------------+\n| 1010           |\n+----------------+\n\nSELECT CONV(''6E'',18,8);\n+-----------------+\n| CONV(''6E'',18,8) |\n+-----------------+\n| 172             |\n+-----------------+\n\nSELECT CONV(-17,10,-18);\n+------------------+\n| CONV(-17,10,-18) |\n+------------------+\n| -H               |\n+------------------+\n\nSELECT CONV(12+''10''+''10''+0xa,10,10);\n+------------------------------+\n| CONV(12+''10''+''10''+0xa,10,10) |\n+------------------------------+\n| 42                           |\n+------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/conv', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/conv');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (241, 4, 'COS', 'Syntax\n------\n\nCOS(X)\n\nDescription\n-----------\n\nReturns the cosine of X, where X is given in radians.\n\nExamples\n--------\n\nSELECT COS(PI());\n+-----------+\n| COS(PI()) |\n+-----------+\n|        -1 |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/cos', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/cos');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (242, 4, 'COT', 'Syntax\n------\n\nCOT(X)\n\nDescription\n-----------\n\nReturns the cotangent of X.\n\nExamples\n--------\n\nSELECT COT(42);\n+--------------------+\n| COT(42)            |\n+--------------------+\n| 0.4364167060752729 |\n+--------------------+\n\nSELECT COT(12);\n+---------------------+\n| COT(12)             |\n+---------------------+\n| -1.5726734063976893 |\n+---------------------+\n\nSELECT COT(0);\nERROR 1690 (22003): DOUBLE value is out of range in ''cot(0)''\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/cot', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/cot');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (243, 4, 'CRC32', 'Syntax\n------\n\nCRC32([par,]expr)\n\nDescription\n-----------\n\nComputes a cyclic redundancy check (CRC) value and returns a 32-bit unsigned value. The result is NULL if the argument is NULL. The argument is expected to be a string and (if possible) is treated as one if it is not.\n\nUses the alternate Castagnoli polynomia.\n\nOften, CRC is computed in pieces. To facilitate this, there''s an optional parameter: CRC32(''MariaDB'')=CRC32(CRC32(''Maria''),''DB'').\n\nUses the ISO 3309 polynomial that used by zlib and many others.\n\nExamples\n--------\n\nSELECT CRC32(CRC32(''Maria''),''DB'');\n+----------------------------+\n| CRC32(CRC32(''Maria''),''DB'') |\n+----------------------------+\n|                 4227209140 |\n+----------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/crc32', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/crc32');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (244, 4, 'CRC32C', 'Syntax\n------\n\nCRC32C([par,]expr)\n\nDescription\n-----------\n\nMariaDB has always included a native unary function CRC32() that computes the CRC-32 of a string using the ISO 3309 polynomial that used by zlib and many others.\n\nInnoDB and MyRocks use a different polynomial, which was implemented in SSE4.2 instructions that were introduced in the Intel Nehalem microarchitecture. This is commonly called CRC-32C (Castagnoli).\n\nThe CRC32C function uses the Castagnoli polynomial.\n\nThis allows SELECT…INTO DUMPFILE to be used for the creation of files with valid checksums, such as a logically empty InnoDB redo log fileib_logfile0 corresponding to a particular log sequence number.\n\nThe optional parameter allows the checksum to be computed in pieces:\\\nCRC32C(''MariaDB'')=CRC32C(CRC32C(''Maria''),''DB'').\n\nExamples\n--------\n\nSELECT CRC32C(''MariaDB'');\n+-------------------+\n| CRC32C(''MariaDB'') |\n+-------------------+\n|         809606978 |\n+-------------------+\n\nSELECT CRC32C(CRC32C(''Maria''),''DB'');\n+------------------------------+\n| CRC32C(CRC32C(''Maria''),''DB'') |\n+------------------------------+\n|                    809606978 |\n+------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/crc32c', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/crc32c');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (245, 4, 'DEGREES', 'Syntax\n------\n\nDEGREES(X)\n\nDescription\n-----------\n\nReturns the argument _X_, converted from radians to degrees.\n\nThis is the converse of the RADIANS() function.\n\nExamples\n--------\n\nSELECT DEGREES(PI());\n+---------------+\n| DEGREES(PI()) |\n+---------------+\n|           180 |\n+---------------+\n\nSELECT DEGREES(PI() / 2);\n+-------------------+\n| DEGREES(PI() / 2) |\n+-------------------+\n|                90 |\n+-------------------+\n\nSELECT DEGREES(45);\n+-----------------+\n| DEGREES(45)     |\n+-----------------+\n| 2578.3100780887 |\n+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/degrees', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/degrees');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (246, 4, 'DIV', 'Syntax\n------\n\nDIV\n\nDescription\n-----------\n\nInteger division. Similar to FLOOR(), but is safe with BIGINT values. Incorrect results may occur for non-integer operands that exceed the BIGINT range.\n\nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, a division by zero produces an error. Otherwise, it returns NULL.\n\nThe remainder of a division can be obtained using the MOD operator.\n\nExamples\n--------\n\nSELECT 300 DIV 7;\n+-----------+\n| 300 DIV 7 |\n+-----------+\n|        42 |\n+-----------+\n\nSELECT 300 DIV 0;\n+-----------+\n| 300 DIV 0 |\n+-----------+\n|      NULL |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/div', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/div');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (247, 4, 'EXP', 'Syntax\n------\n\nEXP(X)\n\nDescription\n-----------\n\nReturns the value of e (the base of natural logarithms) raised to the power of X. The inverse of this function is LOG() (using a single argument only) or LN().\n\nIf X is NULL, this function returns NULL.\n\nExamples\n--------\n\nSELECT EXP(2);\n+------------------+\n| EXP(2)           |\n+------------------+\n| 7.38905609893065 |\n+------------------+\n\nSELECT EXP(-2);\n+--------------------+\n| EXP(-2)            |\n+--------------------+\n| 0.1353352832366127 |\n+--------------------+\n\nSELECT EXP(0);\n+--------+\n| EXP(0) |\n+--------+\n|      1 |\n+--------+\n\nSELECT EXP(NULL);\n+-----------+\n| EXP(NULL) |\n+-----------+\n|      NULL |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/exp', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/exp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (248, 4, 'FLOOR', 'Syntax\n------\n\nFLOOR(X)\n\nDescription\n-----------\n\nReturns the largest integer value not greater than X.\n\nExamples\n--------\n\nSELECT FLOOR(1.23);\n+-------------+\n| FLOOR(1.23) |\n+-------------+\n|           1 |\n+-------------+\n\nSELECT FLOOR(-1.23);\n+--------------+\n| FLOOR(-1.23) |\n+--------------+\n|           -2 |\n+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/floor', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/floor');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (249, 4, 'LN', 'Syntax\n------\n\nLN(X)\n\nDescription\n-----------\n\nReturns the natural logarithm of X; that is, the base-e logarithm of X. If X is less than or equal to 0, or NULL, then NULL is returned.\n\nThe inverse of this function is EXP().\n\nExamples\n--------\n\nSELECT LN(2);\n+-------------------+\n| LN(2)             |\n+-------------------+\n| 0.693147180559945 |\n+-------------------+\n\nSELECT LN(-2);\n+--------+\n| LN(-2) |\n+--------+\n|   NULL |\n+--------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/ln', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/ln');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (250, 4, 'LOG', 'Syntax\n------\n\nLOG(X), LOG(B,X)\n\nDescription\n-----------\n\nIf called with one parameter, this function returns the natural logarithm of X. If X is less than or equal to 0, then NULL is returned.\n\nIf called with two parameters, it returns the logarithm of X to the base B. If B is <= 1 or X <= 0, the function returns NULL.\n\nIf any argument is NULL, the function returns NULL.\n\nThe inverse of this function (when called with a single argument) is the EXP() function.\n\nExamples\n--------\n\nSELECT LOG(2);\n+-------------------+\n| LOG(2)            |\n+-------------------+\n| 0.693147180559945 |\n+-------------------+\n\nSELECT LOG(-2);\n+---------+\n| LOG(-2) |\n+---------+\n|    NULL |\n+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/log', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/log');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (251, 4, 'LOG10', 'Syntax\n------\n\nLOG10(X)\n\nDescription\n-----------\n\nReturns the base-10 logarithm of X.\n\nExamples\n--------\n\nSELECT LOG10(2);\n+-------------------+\n| LOG10(2)          |\n+-------------------+\n| 0.301029995663981 |\n+-------------------+\n\nSELECT LOG10(100);\n+------------+\n| LOG10(100) |\n+------------+\n|          2 |\n+------------+\n\nSELECT LOG10(-100);\n+-------------+\n| LOG10(-100) |\n+-------------+\n|        NULL |\n+-------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/log10', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/log10');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (252, 4, 'LOG2', 'Syntax\n------\n\nLOG2(X)\n\nDescription\n-----------\n\nReturns the base-2 logarithm of X.\n\nExamples\n--------\n\nSELECT LOG2(4398046511104);\n+---------------------+\n| LOG2(4398046511104) |\n+---------------------+\n|                  42 |\n+---------------------+\n\nSELECT LOG2(65536);\n+-------------+\n| LOG2(65536) |\n+-------------+\n|          16 |\n+-------------+\n\nSELECT LOG2(-100);\n+------------+\n| LOG2(-100) |\n+------------+\n|       NULL |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/log2', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/log2');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (253, 4, 'MOD', 'Syntax\n------\n\nMOD(N,M), N % M, N MOD M\n\nDescription\n-----------\n\nModulo operation. Returns the remainder of N divided by M. See also Modulo Operator.\n\nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, any number modulus zero produces an error. Otherwise, it returns NULL.\n\nThe integer part of a division can be obtained using DIV.\n\nExamples\n--------\n\nSELECT 1042 % 50;\n+-----------+\n| 1042 % 50 |\n+-----------+\n|        42 |\n+-----------+\n\nSELECT MOD(234, 10);\n+--------------+\n| MOD(234, 10) |\n+--------------+\n|            4 |\n+--------------+\n\nSELECT 253 % 7;\n+---------+\n| 253 % 7 |\n+---------+\n|       1 |\n+---------+\n\nSELECT MOD(29,9);\n+-----------+\n| MOD(29,9) |\n+-----------+\n|         2 |\n+-----------+\n\nSELECT 29 MOD 9;\n+----------+\n| 29 MOD 9 |\n+----------+\n|        2 |\n+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/mod', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/mod');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (254, 4, 'OCT', 'Syntax\n------\n\nOCT(N)\n\nDescription\n-----------\n\nReturns a string representation of the octal value of N, where N is a longlong (BIGINT) number. This is equivalent to CONV(N,10,8). Returns NULL if N is NULL.\n\nExamples\n--------\n\nSELECT OCT(34);\n+---------+\n| OCT(34) |\n+---------+\n| 42      |\n+---------+\n\nSELECT OCT(12);\n+---------+\n| OCT(12) |\n+---------+\n| 14      |\n+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/oct', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/oct');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (255, 4, 'PI', 'Syntax\n------\n\nPI()\n\nDescription\n-----------\n\nReturns the value of π (pi). The default number of decimal places displayed is six, but MariaDB uses the full double-precision value internally.\n\nExamples\n--------\n\nSELECT PI();\n+----------+\n| PI()     |\n+----------+\n| 3.141593 |\n+----------+\n\nSELECT PI()+0.0000000000000000000000;\n+-------------------------------+\n| PI()+0.0000000000000000000000 |\n+-------------------------------+\n|      3.1415926535897931159980 |\n+-------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/pi', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/pi');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (256, 4, 'POW', 'Syntax\n------\n\nPOW(X,Y)\n\nDescription\n-----------\n\nReturns the value of X raised to the power of Y.\n\nPOWER() is a synonym.\n\nExamples\n--------\n\nSELECT POW(2,3);\n+----------+\n| POW(2,3) |\n+----------+\n|        8 |\n+----------+\n\nSELECT POW(2,-2);\n+-----------+\n| POW(2,-2) |\n+-----------+\n|      0.25 |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/pow', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/pow');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (257, 4, 'POWER', 'Syntax\n------\n\nPOWER(X,Y)\n\nDescription\n-----------\n\nThis is a synonym for POW(), which returns the value of X raised to the power of Y.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/power', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/power');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (258, 4, 'RADIANS', 'Syntax\n------\n\nRADIANS(X)\n\nDescription\n-----------\n\nReturns the argument _X_, converted from degrees to radians. Note that π radians equals 180 degrees.\n\nThis is the converse of the DEGREES() function.\n\nExamples\n--------\n\nSELECT RADIANS(45);\n+-------------------+\n| RADIANS(45)       |\n+-------------------+\n| 0.785398163397448 |\n+-------------------+\n\nSELECT RADIANS(90);\n+-----------------+\n| RADIANS(90)     |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n\nSELECT RADIANS(PI());\n+--------------------+\n| RADIANS(PI())      |\n+--------------------+\n| 0.0548311355616075 |\n+--------------------+\n\nSELECT RADIANS(180);\n+------------------+\n| RADIANS(180)     |\n+------------------+\n| 3.14159265358979 |\n+------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/radians', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/radians');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (259, 4, 'RAND', 'Description\n-----------\n\nReturns a random DOUBLE precision floating point value v in the range 0 <= v < 1.0. If a constant integer argument N is specified, it is used as the seed value, which produces a repeatable sequence of column values. In the example below, note that the sequences of values produced by RAND(3) is the same both places where it occurs.\n\nIn a WHERE clause, RAND() is evaluated each time the WHERE is executed.\n\nStatements using the RAND() function are not safe for statement-based replication.\n\nPractical uses\n\nThe expression to get a random integer from a given range is the following:\n\n``sql\nFLOOR(min_value + RAND()  (max_value - min_value +1))\n`\n\nRAND() is often used to read random rows from a table, as follows:\n\n`sql\nSELECT  FROM my_table ORDER BY RAND() LIMIT 10;\n`\n\nNote, however, that this technique should never be used on a large table as it will be extremely slow. MariaDB will read all rows in the table, generate a random value for each of them, order them, and finally will apply the LIMIT` clause.\n\nExamples\n--------\n\nCREATE TABLE t (i INT);\n\nINSERT INTO t VALUES(1),(2),(3);\n\nSELECT i, RAND() FROM t;\n+------+-------------------+\n| i    | RAND()            |\n+------+-------------------+\n|    1 | 0.255651095188829 |\n|    2 | 0.833920199269355 |\n|    3 |  0.40264774151393 |\n+------+-------------------+\n\nSELECT i, RAND(3) FROM t;\n+------+-------------------+\n| i    | RAND(3)           |\n+------+-------------------+\n|    1 |  0.90576975597606 |\n|    2 | 0.373079058130345 |\n|    3 | 0.148086053457191 |\n+------+-------------------+\n\nSELECT i, RAND() FROM t;\n+------+-------------------+\n| i    | RAND()            |\n+------+-------------------+\n|    1 | 0.511478140495232 |\n|    2 | 0.349447508668012 |\n|    3 | 0.212803152588013 |\n+------+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/rand', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/rand');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (260, 4, 'ROUND', 'Description\n-----------\n\nRounds the argument X to D decimal places. D defaults to 0 if not specified.D can be negative to cause D digits left of the decimal point of the value X to become zero.\n\nThe rounding algorithm depends on the data type of X:\n\n For floating-point types (FLOAT, DOUBLE) the C libraries rounding function is used, so the behavior _may_ differ between operating systems.\n For fixed-point types (DECIMAL, DEC/NUMBER/FIXED) the "round half up" rule is used, meaning that e.g. a value ending in exactly .5 is always rounded up.\n\nExamples\n--------\n\nSELECT ROUND(-1.23);\n+--------------+\n| ROUND(-1.23) |\n+--------------+\n|           -1 |\n+--------------+\n\nSELECT ROUND(-1.58);\n+--------------+\n| ROUND(-1.58) |\n+--------------+\n|           -2 |\n+--------------+\n\nSELECT ROUND(1.58); \n+-------------+\n| ROUND(1.58) |\n+-------------+\n|           2 |\n+-------------+\n\nSELECT ROUND(1.298, 1);\n+-----------------+\n| ROUND(1.298, 1) |\n+-----------------+\n|             1.3 |\n+-----------------+\n\nSELECT ROUND(1.298, 0);\n+-----------------+\n| ROUND(1.298, 0) |\n+-----------------+\n|               1 |\n+-----------------+\n\nSELECT ROUND(23.298, -1);\n+-------------------+\n| ROUND(23.298, -1) |\n+-------------------+\n|                20 |\n+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/round', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/round');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (261, 4, 'SIGN', 'Syntax\n------\n\nSIGN(X)\n\nDescription\n-----------\n\nReturns the sign of the argument as -1, 0, or 1, depending on whether X is negative, zero, or positive.\n\nExamples\n--------\n\nSELECT SIGN(-32);\n+-----------+\n| SIGN(-32) |\n+-----------+\n|        -1 |\n+-----------+\n\nSELECT SIGN(0);\n+---------+\n| SIGN(0) |\n+---------+\n|       0 |\n+---------+\n\nSELECT SIGN(234);\n+-----------+\n| SIGN(234) |\n+-----------+\n|         1 |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/sign', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/sign');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (262, 4, 'SIN', 'Syntax\n------\n\nSIN(X)\n\nDescription\n-----------\n\nReturns the sine of X, where X is given in radians.\n\nExamples\n--------\n\nSELECT SIN(1.5707963267948966);\n+-------------------------+\n| SIN(1.5707963267948966) |\n+-------------------------+\n|                       1 |\n+-------------------------+\n\nSELECT SIN(PI());\n+----------------------+\n| SIN(PI())            |\n+----------------------+\n| 1.22460635382238e-16 |\n+----------------------+\n\nSELECT ROUND(SIN(PI()));\n+------------------+\n| ROUND(SIN(PI())) |\n+------------------+\n|                0 |\n+------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/sin', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/sin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (263, 4, 'SQRT', 'Syntax\n------\n\nSQRT(X)\n\nDescription\n-----------\n\nReturns the square root of X. If X is negative, NULL is returned.\n\nExamples\n--------\n\nSELECT SQRT(4);\n+---------+\n| SQRT(4) |\n+---------+\n|       2 |\n+---------+\n\nSELECT SQRT(20);\n+------------------+\n| SQRT(20)         |\n+------------------+\n| 4.47213595499958 |\n+------------------+\n\nSELECT SQRT(-16);\n+-----------+\n| SQRT(-16) |\n+-----------+\n|      NULL |\n+-----------+\n\nSELECT SQRT(1764);\n+------------+\n| SQRT(1764) |\n+------------+\n|         42 |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/sqrt', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/sqrt');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (264, 4, 'TAN', 'Syntax\n------\n\nTAN(X)\n\nDescription\n-----------\n\nReturns the tangent of X, where X is given in radians.\n\nExamples\n--------\n\nSELECT TAN(0.7853981633974483);\n+-------------------------+\n| TAN(0.7853981633974483) |\n+-------------------------+\n|      0.9999999999999999 |\n+-------------------------+\n\nSELECT TAN(PI());\n+-----------------------+\n| TAN(PI())             |\n+-----------------------+\n| -1.22460635382238e-16 |\n+-----------------------+\n\nSELECT TAN(PI()+1);\n+-----------------+\n| TAN(PI()+1)     |\n+-----------------+\n| 1.5574077246549 |\n+-----------------+\n\nSELECT TAN(RADIANS(PI()));\n+--------------------+\n| TAN(RADIANS(PI())) |\n+--------------------+\n| 0.0548861508080033 |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/tan', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/tan');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (265, 4, 'TO\\_NUMBER', 'Syntax\n------\n\nTO_NUMBER(number_or_string_subject)\nTO_NUMBER(string_subject,string_format)\n\nDescription\n-----------\n\nThe function returns the DOUBLE data type for all signatures and input data types.\n\nThe format parser understands the following components:\n\n Digits: 0, 9\n Hex digits: X\n Group separators: comma (,) and G\n Decimal delimiters: period (.) and D\n Approximate number signature: EEEE\n Currency/numeric flags: $ and B\n Currency signatures: C, L, U\n Sign signatures: S, MI, PR\n Special format signatures: V, TM, TM9, TME\n Format flag: FM\n\nThe function was introduced for Oracle compatibility, but does not include the following features:\n\n The ON CONVERSION ERROR clause\n The third parameter (nlsparam)\n* Internationalized components: G, D, C, L, U\n\nThese features are planned to be be implemented via MDEV-36978.\n\nExamples\n--------\n\nSELECT TO_NUMBER(''100.00'');\n+---------------------+\n| TO_NUMBER(''100.00'') |\n+---------------------+\n|                 100 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/to_number', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/to_number');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (266, 4, 'TRUNCATE', 'Syntax\n------\n\nTRUNCATE(X,D)\n\nDescription\n-----------\n\nReturns the number X, truncated to D decimal places. If D is 0, the result has no decimal point or fractional part. D can be negative to cause D digits left of the decimal point of the value X to become\\\nzero.\n\nExamples\n--------\n\nSELECT TRUNCATE(1.223,1);\n+-------------------+\n| TRUNCATE(1.223,1) |\n+-------------------+\n|               1.2 |\n+-------------------+\n\nSELECT TRUNCATE(1.999,1);\n+-------------------+\n| TRUNCATE(1.999,1) |\n+-------------------+\n|               1.9 |\n+-------------------+\n\nSELECT TRUNCATE(1.999,0); \n+-------------------+\n| TRUNCATE(1.999,0) |\n+-------------------+\n|                 1 |\n+-------------------+\n\nSELECT TRUNCATE(-1.999,1);\n+--------------------+\n| TRUNCATE(-1.999,1) |\n+--------------------+\n|               -1.9 |\n+--------------------+\n\nSELECT TRUNCATE(122,-2);\n+------------------+\n| TRUNCATE(122,-2) |\n+------------------+\n|              100 |\n+------------------+\n\nSELECT TRUNCATE(10.28100,0);\n+-----------------------+\n| TRUNCATE(10.28100,0) |\n+-----------------------+\n|                  1028 |\n+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/truncate', '', 'https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/truncate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (267, 35, '\\_rowid', 'Syntax\n------\n\n_rowid\n\nDescription\n-----------\n\nThe _rowid pseudo column is mapped to the primary key in the related table. This can be used as a replacement of the rowid pseudo column in other databases. Another usage is to simplify sql queries as one doesn''t have to know the name of the primary key.\n\nExamples\n--------\n\nCREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(80));\nINSERT INTO t1 VALUES (1,"one"),(2,"two");\nSELECT * FROM t1 WHERE _rowid=1;\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/pseudo-columns/_rowid', '', 'https://mariadb.com/docs/server/reference/sql-functions/pseudo-columns/_rowid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (268, 19, 'BIT\\_COUNT', 'Syntax\n------\n\nBIT_COUNT(N)\n\nDescription\n-----------\n\nReturns the number of bits that are set in the argument N.\n\nExamples\n--------\n\nSELECT BIT_COUNT(29), BIT_COUNT(b''101010'');\n+---------------+----------------------+\n| BIT_COUNT(29) | BIT_COUNT(b''101010'') |\n+---------------+----------------------+\n|             4 |                    3 |\n+---------------+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bit_count', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bit_count');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (269, 19, '\\~', 'Syntax\n------\n\n~\n\nDescription\n-----------\n\nBitwise NOT. Converts the value to 4 bytes binary and inverts all bits.\n\nExamples\n--------\n\nSELECT 3 & ~1;\n+--------+\n| 3 & ~1 |\n+--------+\n|      2 |\n+--------+\n\nSELECT 5 & ~1;\n+--------+\n| 5 & ~1 |\n+--------+\n|      4 |\n+--------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-not', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-not');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (270, 19, '|', 'Syntax\n------\n\n|\n\nDescription\n-----------\n\nBitwise OR. Converts the values to binary and compares bits. If either of the corresponding bits has a value of 1, the resulting bit is also 1.\n\nSee also bitwise AND.\n\nExamples\n--------\n\nSELECT 2|1;\n+-----+\n| 2|1 |\n+-----+\n|   3 |\n+-----+\n\nSELECT 29 | 15;\n+---------+\n| 29 | 15 |\n+---------+\n|      31 |\n+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-or', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-or');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (271, 19, '^', 'Syntax\n------\n\n^\n\nDescription\n-----------\n\nBitwise XOR. Converts the values to binary and compares bits. If one (and only one) of the corresponding bits is 1 is the resulting bit also 1.\n\nExamples\n--------\n\nSELECT 1 ^ 1;\n+-------+\n| 1 ^ 1 |\n+-------+\n|     0 |\n+-------+\n\nSELECT 1 ^ 0;\n+-------+\n| 1 ^ 0 |\n+-------+\n|     1 |\n+-------+\n\nSELECT 11 ^ 3;\n+--------+\n| 11 ^ 3 |\n+--------+\n|      8 |\n+--------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-xor', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-xor');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (272, 19, '&', 'Syntax\n------\n\n&\n\nDescription\n-----------\n\nBitwise AND. Converts the values to binary and compares bits. Only if both the corresponding bits are 1 is the resulting bit also 1.\n\nSee also bitwise OR.\n\nExamples\n--------\n\nSELECT 2&1;\n+-----+\n| 2&1 |\n+-----+\n|   0 |\n+-----+\n\nSELECT 3&1;\n+-----+\n| 3&1 |\n+-----+\n|   1 |\n+-----+\n\nSELECT 29 & 15;\n+---------+\n| 29 & 15 |\n+---------+\n|      13 |\n+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise_and', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise_and');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (273, 19, 'Parentheses', 'Description\n-----------\n\nParentheses are sometimes called precedence operators - this means that they can be used to change the other operator''s precedence in an expression. The expressions that are written between parentheses are computed before the expressions that are written outside. Parentheses must always contain an expression (that is, they cannot be empty), and can be nested.\n\nFor example, the following expressions could return different results:\n\n NOT a OR b\n NOT (a OR b)\n\nIn the first case, NOT applies to a, so if a is FALSE or b is TRUE, the expression returns TRUE. In the second case, NOT applies to the result of a OR b, so if at least one of a or b is TRUE, the expression is TRUE.\n\nWhen the precedence of operators is not intuitive, you can use parentheses to make it immediately clear for whoever reads the statement.\n\nThe precedence of the NOT operator can also be affected by the HIGH_NOT_PRECEDENCE SQL_MODE flag.\n\nOther uses\n\nParentheses must always be used to enclose subqueries.\n\nParentheses can also be used in a JOIN statement between multiple tables to determine which tables must be joined first.\n\nAlso, parentheses are used to enclose the list of parameters to be passed to built-in functions, user-defined functions and stored routines. However, when no parameter is passed to a stored procedure, parentheses are optional. For builtin functions and user-defined functions, spaces are not allowed between the function name and the open parenthesis, unless the IGNORE_SPACE SQL_MODE is set. For stored routines (and for functions if IGNORE_SPACE is set) spaces are allowed before the open parenthesis, including tab characters and new line characters.\n\nSyntax errors\n\nIf there are more open parentheses than closed parentheses, the error usually looks like this:\n\n``sql\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that\ncorresponds to your MariaDB server version for the right syntax to use near '''' a\nt line 1\n`\n\nNote the empty string.\n\nIf there are more closed parentheses than open parentheses, the error usually looks like this:\n\n`sql\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that\ncorresponds to your MariaDB server version for the right syntax to use near '')''\nat line 1\n``\n\nNote the quoted closed parenthesis.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/parentheses', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/parentheses');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (274, 19, '<<', 'Syntax\n------\n\nvalue1 << value2\n\nDescription\n-----------\n\nConverts a longlong (BIGINT) number (_value1_) to binary and shifts _value2_ units to the left.\n\nExamples\n--------\n\nSELECT 1 << 2;\n+--------+\n| 1 << 2 |\n+--------+\n|      4 |\n+--------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/shift-left', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/shift-left');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (275, 19, '>>', 'Syntax\n------\n\nvalue1 >> value2\n\nDescription\n-----------\n\nConverts a longlong (BIGINT) number (_value1_) to binary and shifts _value2_ units to the right.\n\nExamples\n--------\n\nSELECT 4 >> 2;\n+--------+\n| 4 >> 2 |\n+--------+\n|      1 |\n+--------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/shift-right', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/shift-right');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (276, 19, 'TRUE FALSE', 'Description\n-----------\n\nThe constants TRUE and FALSE evaluate to 1 and 0, respectively. The constant names can be written in any lettercase.\n\nExamples\n--------\n\nSELECT TRUE, true, FALSE, false;\n+------+------+-------+-------+\n| TRUE | TRUE | FALSE | FALSE |\n+------+------+-------+-------+\n|    1 |    1 |     0 |     0 |\n+------+------+-------+-------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/true-false', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/true-false');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (277, 35, 'AES\\_DECRYPT', 'Syntax\n------\n\nAES_ENCRYPT(crypt_str, key_str, [, iv [, mode]])\n\nDescription\n-----------\n\nThis function allows decryption of data using the official AES (Advanced Encryption Standard) algorithm. For more information, see the description of AES_ENCRYPT().\n\nThe function supports an initialization vector, and control of the block encryption mode. The default mode is specified by the block_encryption_mode system variable, which can be changed when calling the function with a mode. _mode_ is aes-{128,192,256}-{ecb,cbc,ctr} for example: "AES-128-cbc".\n\nFor modes that require it, the initialization_vector _iv_ should be 16 bytes (it can be longer, but the extra bytes are ignored). A shorter _iv_, where one is required, results in the function returning NULL. Calling RANDOM_BYTES(16) will generate a random series of bytes that can be used for the _iv_.\n\nExamples\n\n``sql\nSELECT HEX(AES_ENCRYPT(''foo'', ''bar'', ''0123456789abcdef'', ''aes-128-ctr'')) AS x; \n+--------+\n| x      |\n+--------+\n| C57C4B |\n+--------+\n\nSELECT AES_DECRYPT(x''C57C4B'', ''bar'', ''0123456789abcdef'', ''aes-128-ctr''); \n+------------------------------------------------------------------+\n| AES_DECRYPT(x''C57C4B'', ''bar'', ''0123456789abcdef'', ''aes-128-ctr'') |\n+------------------------------------------------------------------+\n| foo                                                              |\n+------------------------------------------------------------------+\n``\n\nThe function does not support an initialization vector.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/aes_decrypt', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/aes_decrypt');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (278, 35, 'AES\\_ENCRYPT', 'Syntax\n------\n\nAES_ENCRYPT(str, key, [, iv [, mode]])\n\nDescription\n-----------\n\nAES_ENCRYPT() and AES_DECRYPT() allow encryption and decryption of data using the official AES (Advanced Encryption Standard) algorithm, previously known as "Rijndael." Encoding with a 128-bit key length is used (from MariaDB 11.2.0, this is the default, and can be changed). 128 bits is much faster and is secure enough for most purposes.\n\nAES_ENCRYPT() encrypts a string _str_ using the key _key_str_, and returns a binary string.\n\nAES_DECRYPT() decrypts the encrypted string and returns the original string.\n\nThe input arguments may be any length. If either argument is NULL, the result of this function is also NULL.\n\nBecause AES is a block-level algorithm, padding is used to encode uneven length strings and so the result string length may be calculated using this formula:\n\n``sql\n16 x (trunc(string_length / 16) + 1)\n`\n\nIf AES_DECRYPT() detects invalid data or incorrect padding, it returns NULL. However, it is possible for AES_DECRYPT() to return a non-NULL value (possibly garbage) if the input data or the key is invalid.\n\nMariaDB starting with 11.2\n\nThe function supports an initialization vector, and control of the block encryption mode. The default mode is specified by the block_encryption_mode system variable, which can be changed when calling the function with a mode. _mode_ is aes-{128,192,256}-{ecb,cbc,ctr} for example: "AES-128-cbc".\\\nAES_ENCRYPT(str, key)` can no longer be used in persistent virtual columns (and the like).\n\nThe function does not support an initialization vector.\n\nExamples\n--------\n\nSELECT HEX(AES_ENCRYPT(''foo'', ''bar'', ''0123456789abcdef'', ''aes-256-cbc'')) AS x;\n+----------------------------------+\n| x                                |\n+----------------------------------+\n| 42A3EB91E6DFC40A900D278F99E0726E |\n+----------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/aes_encrypt', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/aes_encrypt');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (279, 35, 'COMPRESS', 'Syntax\n------\n\nCOMPRESS(string_to_compress)\n\nDescription\n-----------\n\nCompresses a string and returns the result as a binary string. This function requires MariaDB to have been compiled with a compression library such as zlib. Otherwise, the return value is always NULL. The\\\ncompressed string can be uncompressed with UNCOMPRESS().\n\nThe have_compress server system variable indicates whether a compression library is present.\n\nExamples\n--------\n\nSELECT LENGTH(COMPRESS(REPEAT(''a'',1000)));\n+------------------------------------+\n| LENGTH(COMPRESS(REPEAT(''a'',1000))) |\n+------------------------------------+\n|                                 21 |\n+------------------------------------+\n\nSELECT LENGTH(COMPRESS(''''));\n+----------------------+\n| LENGTH(COMPRESS('''')) |\n+----------------------+\n|                    0 |\n+----------------------+\n\nSELECT LENGTH(COMPRESS(''a''));\n+-----------------------+\n| LENGTH(COMPRESS(''a'')) |\n+-----------------------+\n|                    13 |\n+-----------------------+\n\nSELECT LENGTH(COMPRESS(REPEAT(''a'',16)));\n+----------------------------------+\n| LENGTH(COMPRESS(REPEAT(''a'',16))) |\n+----------------------------------+\n|                               15 |\n+----------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/compress', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/compress');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (280, 35, 'DECODE', 'Syntax\n------\n\nDECODE(crypt_str,pass_str)\n\nDescription\n-----------\n\nIn the default mode, DECODE decrypts the encrypted string <kbd>_crypt_str_</kbd> using <kbd>_pass_str_</kbd> as the password. _crypt_str_ should be a string returned from ENCODE(). The resulting string will be the original string only if <kbd>_pass_str_</kbd> is the same.\n\nIn Oracle mode, DECODE compares <kbd>_expr_</kbd> to the search expressions, in order. If it finds a match, the corresponding result expression is returned. If no matches are found, the default expression is returned, or NULL if no default is provided.\n\nNULL values are treated as equivalent.\n\nDECODE_ORACLE is a synonym for the Oracle-mode version of the function, and is available in all modes.\n\nExamples\n--------\n\nSELECT DECODE_ORACLE(2+1,31,''found1'',32,''found2'',''default'');\n+--------------------------------------------------------+\n| DECODE_ORACLE(2+1,31,''found1'',32,''found2'',''default'') |\n+--------------------------------------------------------+\n| found1                                                 |\n+--------------------------------------------------------+\n\nSELECT DECODE_ORACLE(2+4,31,''found1'',32,''found2'',''default'');\n+--------------------------------------------------------+\n| DECODE_ORACLE(2+4,31,''found1'',32,''found2'',''default'') |\n+--------------------------------------------------------+\n| found2                                                 |\n+--------------------------------------------------------+\n\nSELECT DECODE_ORACLE(2+2,31,''found1'',32,''found2'',''default'');\n+--------------------------------------------------------+\n| DECODE_ORACLE(2+2,31,''found1'',32,''found2'',''default'') |\n+--------------------------------------------------------+\n| default                                                |\n+--------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/decode', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/decode');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (281, 35, 'DES\\_DECRYPT', 'Syntax\n------\n\nDES_DECRYPT(crypt_str[,key_str])\n\nDescription\n-----------\n\nDecrypts a string encrypted with DES_ENCRYPT(). If an error occurs, this function returns NULL.\n\nThis function works only if MariaDB has been configured with TLS support.\n\nIf no key_str argument is given, DES_DECRYPT() examines the first byte of the encrypted string to determine the DES key number that was used to encrypt the original string, and then reads the key from the DES key file to decrypt the message. For this to work, the user must have the SUPER privilege. The key file can be specified with the--des-key-file server option.\n\nIf you pass this function a <kbd>key_str</kbd> argument, that string is used as the key for decrypting the message.\n\nIf the <kbd>crypt_str</kbd> argument does not appear to be an encrypted string, MariaDB returns the given <kbd>crypt_str</kbd>.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/des_decrypt', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/des_decrypt');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (282, 35, 'DES\\_ENCRYPT', 'Syntax\n------\n\nDES_ENCRYPT(str[,{key_num|key_str}])\n\nDescription\n-----------\n\nEncrypts the string with the given key using the Triple-DES algorithm.\n\nThis function works only if MariaDB has been configured with TLS support.\n\nThe encryption key to use is chosen based on the second argument toDES_ENCRYPT(), if one was given. With no argument, the first key from the DES key file is used. With a _key_num_ argument, the given key\\\nnumber (0-9) from the DES key file is used. With a _key_str_ argument, the given key string is used to encrypt _str_.\n\nThe key file can be specified with the --des-key-file server option.\n\nThe return string is a binary string where the first character isCHAR(128 | key_num). If an error occurs, DES_ENCRYPT() returns NULL.\n\nThe 128 is added to make it easier to recognize an encrypted key. If you use a string key, _key_num_ is 127.\n\nThe string length for the result is given by this formula:\n\n``sql\nnew_len = orig_len + (8 - (orig_len % 8)) + 1\n`\n\nEach line in the DES key file has the following format:\n\n`sql\nkey_num des_key_str\n`\n\nEach _key_num_ value must be a number in the range from 0 to 9. Lines in the file may be in any order. _des_key_str_ is the string that is used to encrypt the message. There should be at least one space between the number and the key. The first key is the default key that is used if you do not specify any key argument to DES_ENCRYPT().\n\nYou can tell MariaDB to read new key values from the key file with the FLUSH DES_KEY_FILE` statement. This requires the RELOAD privilege.\n\nOne benefit of having a set of default keys is that it gives applications a way to check for the existence of encrypted column values, without giving the end user the right to decrypt those values.\n\nExamples\n--------\n\nSELECT customer_address FROM customer_table \n   WHERE crypted_credit_card = DES_ENCRYPT(''credit_card_number'');\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/des_encrypt', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/des_encrypt');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (283, 35, 'ENCODE', 'Syntax\n------\n\nENCODE(str,pass_str)\n\nDescription\n-----------\n\nENCODE is not considered cryptographically secure, and should not be used for password encryption.\n\nEncrypt str using pass_str as the password. To decrypt the result, use DECODE().\n\nThe result is a binary string of the same length as str.\n\nThe strength of the encryption is based on how good the random generator is.\n\nIt is not recommended to rely on the encryption performed by the ENCODE function. Using a salt value (changed when a password is updated) will improve matters somewhat, but for storing passwords, consider a more cryptographically secure function, such as SHA2().\n\nExamples\n--------\n\nENCODE(''not so secret text'', CONCAT(''random_salt'',''password''))\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/encode', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/encode');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (284, 35, 'ENCRYPT', 'Syntax\n------\n\nENCRYPT(str[,salt])\n\nDescription\n-----------\n\nEncrypts a string using the Unix crypt() system call, returning an encrypted binary string. The salt argument should be a string with at least two characters or the returned result will be NULL. If no salt argument is given, a random value of sufficient length is used.\n\nIt is not recommended to use ENCRYPT() with utf16, utf32 or ucs2 multi-byte character sets because the crypt() system call expects a string terminated with a zero byte.\n\nNote that the underlying crypt() system call may have some limitations, such as ignoring all but the first eight characters.\n\nIf the have_crypt system variable is set to NO (because the crypt() system call is not available), the ENCRYPT function will always return NULL.\n\nExamples\n--------\n\nSELECT ENCRYPT(''encrypt me'');\n+-----------------------+\n| ENCRYPT(''encrypt me'') |\n+-----------------------+\n| 4I5BsEx0lqTDk         |\n+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/encrypt', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/encrypt');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (285, 35, 'KDF', 'Syntax\n------\n\nKDF(key_str, salt [, {info | iterations} [, kdf_name [, width ]]])\n\nDescription\n-----------\n\nKDF is a key derivation function, similar to OpenSSL''s EVP_KDF_derive(). The purpose of a KDF is to be slow, so if the calculated value is lost/stolen, the original key_str is not achievable easily with modern GPU. KDFs are therefore an ideal replacement for password hashes. KDFs can also pad out a password secret to the number of bits used in encryption algorithms.\n\nFor generating good encryption keys for AES_ENCRYPT a less expensive but cryptographically secure function like RANDOM_BYTES is recommended.\n\n <kbd>kdf_name</kbd> is "hkdf" or "pbkdf2_hmac" (default).\n Width (in bits) can be any number divisible by 8, by default it''s taken from @@block_encryption_mode.\n* Iterations must be positive, and is 1000 by default.\n\nNote that OpenSSL 1.0 doesn''t support HKDF, so in this case NULL is returned. This OpenSSL version is still used in SLES 12 and CentOS 7.\n\nExamples\n--------\n\nselect hex(kdf(''foo'', ''bar'', ''infa'', ''hkdf'')); \n+----------------------------------------+\n| hex(kdf(''foo'', ''bar'', ''infa'', ''hkdf'')) |\n+----------------------------------------+\n| 612875F859CFB4EE0DFEFF9F2A18E836       |\n+----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/kdf', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/kdf');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (286, 35, 'MD5', 'Syntax\n------\n\nMD5(str)\n\nDescription\n-----------\n\nCalculates an MD5 128-bit checksum for the string.\n\nThe return value is a 32-hex digit string, and a nonbinary string in the connection character set and collation, determined by the values of the character_set_connection and collation_connection system variables.\n\nNULL is returned if the argument was NULL.\n\nDon''t use this function as an encryption function.\n\nMD5 can be used as a checksum to verify data integrity against unintentional corruption. Historically it was widely used as a cryptographic hash function; however it has been found to suffer from extensive vulnerabilities.\n\nSee https://en.wikipedia.org/wiki/MD5 for details.\n\nExamples\n--------\n\nSELECT MD5(''testing'');\n+----------------------------------+\n| MD5(''testing'')                   |\n+----------------------------------+\n| ae2b1fca515949e5d54fb22b8ed95575 |\n+----------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/md5', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/md5');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (287, 35, 'OLD\\_PASSWORD', 'Syntax\n------\n\nOLD_PASSWORD(str)\n\nDescription\n-----------\n\nOLD_PASSWORD() was added to MySQL when the implementation of PASSWORD() was changed to improve security. OLD_PASSWORD() returns the value of the old (pre-MySQL 4.1) implementation of PASSWORD() as a string, and is intended to permit you to reset passwords for any pre-4.1 clients that need to connect to a more recent MySQL server version, or any version of MariaDB, without locking them out.\n\nThe return value is a nonbinary string in the connection character set and collation, determined by the values of the character_set_connection and collation_connection system variables.\n\nThe return value is 16 bytes in length, or NULL if the argument was NULL.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/old_password', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/old_password');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (288, 35, 'PASSWORD', 'Syntax\n------\n\nPASSWORD(str)\n\nDescription\n-----------\n\nThe PASSWORD() function is used for hashing passwords for use in authentication by the MariaDB server. It is not intended for use in other applications.\n\nCalculates and returns a hashed password string from the plaintext password _str_. Returns an empty string if the argument is NULL.\n\nThe return value is a nonbinary string in the connection character set and collation, determined by the values of the character_set_connection and collation_connection system variables.\n\nThis is the function that is used for hashing MariaDB passwords for storage in the Password column of the user table (see privileges), usually used with the SET PASSWORD statement. It is not intended for use in other applications.\n\nThe function takes into account the authentication plugin where applicable (a CREATE USER or SET PASSWORD statement). For example, when used in conjunction with a user authenticated by the ed25519 plugin, the statement will create a longer hash:\n\n``sql\nCREATE USER edtest@localhost IDENTIFIED VIA ed25519 USING PASSWORD(''secret'');\n\nCREATE USER edtest2@localhost IDENTIFIED BY ''secret'';\n\nSELECT CONCAT(user, ''@'', host, '' => '', JSON_DETAILED(priv)) FROM mysql.global_priv\n  WHERE user LIKE ''edtest%''\\G\n************************ 1. row *********************\nCONCAT(user, ''@'', host, '' => '', JSON_DETAILED(priv)): edtest@localhost => {\n...\n    "plugin": "ed25519",\n    "authentication_string": "ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY",\n...\n}\n********************* 2. row ***********************\nCONCAT(user, ''@'', host, '' => '', JSON_DETAILED(priv)): edtest2@localhost => {\n...\n    "plugin": "mysql_native_password",\n    "authentication_string": "14E65567ABDB5135D0CFD9A70B3032C179A49EE7",\n...\n}\n`\n\nThe behavior of this function is affected by the value of the old_passwords system variable. If this is set to 1 (0` is default), MariaDB reverts to using the mysql_old_password authentication plugin by default for newly created users and passwords.\n\nExamples\n--------\n\nSELECT PASSWORD(''notagoodpwd'');\n+-------------------------------------------+\n| PASSWORD(''notagoodpwd'')                   |\n+-------------------------------------------+\n| *3A70EE9FC6594F88CE9E959CD51C5A1C002DC937 |\n+-------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/password', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/password');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (289, 35, 'RANDOM\\_BYTES', 'Syntax\n------\n\nRANDOM_BYTES(length)\n\nDescription\n-----------\n\nGiven a _length_ from 1 to 1024, generates a binary string of _length_ consisting of random bytes generated by the SSL library''s random number generator.\n\nSee the RAND_bytes() function documentation of your SSL library for information on the random number generator. In the case of OpenSSL, a cryptographically secure pseudo random generator (CSPRNG) is used.\n\nStatements containing the RANDOM_BYTES function are unsafe for statement-based replication.\n\nAn error occurs if _length_ is outside the range 1 to 1024.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/random_bytes', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/random_bytes');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (290, 35, 'SHA1', 'Syntax\n------\n\nSHA1(str), SHA(str)\n\nDescription\n-----------\n\nCalculates an SHA-1 160-bit checksum for the string _str_, as described in RFC 3174 (Secure Hash Algorithm).\n\nThe value is returned as a string of 40 hex digits, or NULL if the argument was NULL. The return value is a nonbinary string in the connection character set and collation, determined by the values of the character_set_connection and collation_connection system variables.\n\nExamples\n--------\n\nSELECT SHA1(''some boring text'');\n+------------------------------------------+\n| SHA1(''some boring text'')                 |\n+------------------------------------------+\n| af969fc2085b1bb6d31e517d5c456def5cdd7093 |\n+------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/sha1', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/sha1');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (291, 35, 'SHA2', 'Syntax\n------\n\nSHA2(str,hash_len)\n\nDescription\n-----------\n\nGiven a string _str_, calculates an SHA-2 checksum, which is considered more cryptographically secure than its SHA-1 equivalent. The SHA-2 family includes SHA-224, SHA-256, SHA-384, and SHA-512, and the _hash_len_ must correspond to one of these, i.e. 224, 256, 384 or 512. 0 is equivalent to 256.\n\nThe return value is a nonbinary string in the connection character set and collation, determined by the values of the character_set_connection and collation_connection system variables.\n\nNULL is returned if the hash length is not valid, or the string str is NULL.\n\nSHA2 only works if MariaDB is configured with TLS support.\n\nExamples\n--------\n\nSELECT SHA2(''Maria'',224);\n+----------------------------------------------------------+\n| SHA2(''Maria'',224)                                        |\n+----------------------------------------------------------+\n| 6cc67add32286412efcab9d0e1675a43a5c2ef3cec8879f81516ff83 |\n+----------------------------------------------------------+\n\nSELECT SHA2(''Maria'',256);\n+------------------------------------------------------------------+\n| SHA2(''Maria'',256)                                                |\n+------------------------------------------------------------------+\n| 9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16 |\n+------------------------------------------------------------------+\n\nSELECT SHA2(''Maria'',0);\n+------------------------------------------------------------------+\n| SHA2(''Maria'',0)                                                  |\n+------------------------------------------------------------------+\n| 9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16 |\n+------------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/sha2', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/sha2');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (292, 35, 'UNCOMPRESS', 'Syntax\n------\n\nUNCOMPRESS(string_to_uncompress)\n\nDescription\n-----------\n\nUncompresses a string compressed by the COMPRESS() function. If the argument is not a compressed value, the result is NULL. This function requires MariaDB to have been compiled with a compression library such as zlib. Otherwise, the return value is always NULL. The have_compress server system variable indicates whether a compression library is present.\n\nExamples\n--------\n\nSELECT UNCOMPRESS(COMPRESS(''a string''));\n+----------------------------------+\n| UNCOMPRESS(COMPRESS(''a string'')) |\n+----------------------------------+\n| a string                         |\n+----------------------------------+\n\nSELECT UNCOMPRESS(''a string'');\n+------------------------+\n| UNCOMPRESS(''a string'') |\n+------------------------+\n| NULL                   |\n+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/uncompress', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/uncompress');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (293, 35, 'UNCOMPRESSED\\_LENGTH', 'Syntax\n------\n\nUNCOMPRESSED_LENGTH(compressed_string)\n\nDescription\n-----------\n\nReturns the length that the compressed string had before being compressed with COMPRESS().\n\nUNCOMPRESSED_LENGTH() returns NULL or an incorrect result if the string is not compressed.\n\nReturns MYSQL_TYPE_LONG, or int(10), if the result fits within 32-bits.\n\nExamples\n--------\n\nSELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(''a'',30)));\n+-----------------------------------------------+\n| UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(''a'',30))) |\n+-----------------------------------------------+\n|                                            30 |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/uncompressed_length', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/uncompressed_length');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (294, 17, 'BENCHMARK', 'Syntax\n------\n\nBENCHMARK(count,expr)\n\nDescription\n-----------\n\nThe BENCHMARK() function executes the expression expr repeatedly count times. It may be used to time how quickly MariaDB processes the expression. The result value is always 0. The intended use is from within the mariadb client, which reports query execution times.\n\nExamples\n--------\n\nSELECT BENCHMARK(1000000,ENCODE(''hello'',''goodbye''));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE(''hello'',''goodbye'')) |\n+----------------------------------------------+\n|                                            0 |\n+----------------------------------------------+\n1 row in set (0.21 sec)\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/benchmark', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/benchmark');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (295, 17, 'BINLOG\\_GTID\\_POS', 'Syntax\n------\n\nBINLOG_GTID_POS(binlog_filename,binlog_offset)\n\nDescription\n-----------\n\nThe BINLOG_GTID_POS() function takes as input an old-style binary log position in the form of a file name and a file offset. It looks up the position in the current binlog, and returns a string representation of the corresponding GTID position. If the position is not found in the current binlog, NULL is returned.\n\nExamples\n--------\n\nSELECT BINLOG_GTID_POS("master-bin.000001", 600);\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/binlog_gtid_pos', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/binlog_gtid_pos');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (296, 17, 'CHARSET', 'Syntax\n------\n\nCHARSET(str)\n\nDescription\n-----------\n\nReturns the character set of the string argument. If str is not a string, it is considered as a binary string (so the function returns ''binary''). This applies to NULL, too. The return value is a string in the utf8 character set.\n\nExamples\n--------\n\nSELECT CHARSET(''abc'');\n+----------------+\n| CHARSET(''abc'') |\n+----------------+\n| latin1         |\n+----------------+\n\nSELECT CHARSET(CONVERT(''abc'' USING utf8));\n+------------------------------------+\n| CHARSET(CONVERT(''abc'' USING utf8)) |\n+------------------------------------+\n| utf8                               |\n+------------------------------------+\n\nSELECT CHARSET(USER());\n+-----------------+\n| CHARSET(USER()) |\n+-----------------+\n| utf8            |\n+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/charset', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/charset');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (297, 17, 'COERCIBILITY', 'Syntax\n------\n\nCOERCIBILITY(str)\n\nDescription\n-----------\n\nReturns the collation coercibility value of the string argument. Coercibility defines what will be converted to what in case of collation conflict, with an expression with higher coercibility being converted to the collation of an expression with lower coercibility.\n\n| Coercibility | Description     | Example                                                     |\n| ------------ | --------------- | ----------------------------------------------------------- |\n| 0            | Explicit        | Value using a COLLATE clause                                |\n| 1            | No collation    | Concatenated strings using different collations             |\n| 2            | Implicit        | A string data type column value, CAST to a string data type |\n| 3            | System constant | DATABASE(), USER() return value                             |\n| 4            | Coercible       | Literal string                                              |\n| 5            | Numeric         | Numeric and temporal values                                 |\n| 6            | Ignorable       | NULL or derived from NULL                                   |\n\nExamples\n--------\n\nSELECT COERCIBILITY(_latin1 ''abc'' COLLATE latin1_swedish_ci);\n+-----------------------------------------------+\n| COERCIBILITY(_latin1 ''abc'' COLLATE latin1_swedish_ci) |\n+-----------------------------------------------+\n|                                             0 |\n+-----------------------------------------------+\n\nCREATE TABLE t (a VARCHAR(30) COLLATE uca1400_swedish_ai_ci, b VARCHAR(30) COLLATE uca1400_german2_ai_ci) CHARSET utf8mb4;\nINSERT INTO t VALUES (''abc'', ''def''); / a 2 coercibility /\nSELECT COERCIBILITY(CONCAT(a, b)) FROM t;\n+----------------------------+\n| COERCIBILITY(CONCAT(a, b)) |\n+----------------------------+\n|                          1 |\n+----------------------------+\n\nSELECT COERCIBILITY(CAST(1 AS CHAR));\n+-------------------------------+\n| COERCIBILITY(CAST(1 AS CHAR)) |\n+-------------------------------+\n|                             2 |\n+-------------------------------+\n\nSELECT COERCIBILITY(USER());\n+----------------------+\n| COERCIBILITY(USER()) |\n+----------------------+\n|                    3 |\n+----------------------+\n\nSELECT COERCIBILITY(''abc'');\n+---------------------+\n| COERCIBILITY(''abc'') |\n+---------------------+\n|                   4 |\n+---------------------+\n\nSELECT COERCIBILITY(1);\n+-----------------+\n| COERCIBILITY(1) |\n+-----------------+\n|               5 |\n+-----------------+\n\nSELECT COERCIBILITY(NULL);\n+--------------------+\n| COERCIBILITY(NULL) |\n+--------------------+\n|                  6 |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/coercibility', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/coercibility');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (298, 17, 'COLLATION', 'Syntax\n------\n\nCOLLATION(str)\n\nDescription\n-----------\n\nReturns the collation of the string argument. If str is not a string, it is considered as a binary string (so the function returns ''binary''). This applies to NULL, too. The return value is a string in the utf8 character set.\n\nSee Character Sets and Collations.\n\nExamples\n--------\n\nSELECT COLLATION(''abc'');\n+-------------------+\n| COLLATION(''abc'')  |\n+-------------------+\n| latin1_swedish_ci |\n+-------------------+\n\nSELECT COLLATION(_utf8''abc'');\n+-----------------------+\n| COLLATION(_utf8''abc'') |\n+-----------------------+\n| utf8_general_ci       |\n+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/collation', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/collation');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (299, 17, 'CONNECTION\\_ID', 'Syntax\n------\n\nCONNECTION_ID()\n\nDescription\n-----------\n\nReturns the connection ID for the connection. Every connection (including events) has an ID that is unique among the set of currently connected clients.\n\nReturns MYSQL_TYPE_LONG, or int(10).\n\nExamples\n--------\n\nSELECT CONNECTION_ID();\n+-----------------+\n| CONNECTION_ID() |\n+-----------------+\n|               3 |\n+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/connection_id', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/connection_id');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (300, 17, 'CURRENT\\_ROLE', 'Syntax\n------\n\nCURRENT_ROLE, CURRENT_ROLE()\n\nDescription\n-----------\n\nReturns the current role name. The return value is a string in the\\\nutf8 character set.\n\nIf there is no current role, NULL is returned.\n\nUSER() returns the combination of user and host used to login. CURRENT_USER() returns the account used to determine current connection''s privileges.\n\nStatements using the CURRENT_ROLE function are not safe for statement-based replication.\n\nExamples\n--------\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL         |\n+--------------+\n\nSET ROLE staff;\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| staff        |\n+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/current_role', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/current_role');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (301, 17, 'CURRENT\\_USER', 'Syntax\n------\n\nCURRENT_USER, CURRENT_USER()\n\nDescription\n-----------\n\nReturns the user name and host name combination for the MariaDB account that the server used to authenticate the current client. This account determines your access privileges. The return value is a string in the utf8 character set.\n\nThe value of CURRENT_USER() can differ from the value of USER(). CURRENT_ROLE() returns the current active role.\n\nStatements using the CURRENT_USER function are not safe for statement-based replication.\n\nExamples\n--------\n\nshell> mysql --user="anonymous"\n\nSELECT USER(),CURRENT_USER();\n+---------------------+----------------+\n| USER()              | CURRENT_USER() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost     |\n+---------------------+----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/current_user', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/current_user');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (302, 17, 'DATABASE', 'Syntax\n------\n\nDATABASE()\nSCHEMA()\n\nDescription\n-----------\n\nReturns the default (current) database name as a string in the utf8 character set. If there is no default database, DATABASE() returns NULL. Within a stored routine, the default database is the database that the routine is associated with, which is not necessarily the same as the database that is the default in the calling context.\n\nSCHEMA() is a synonym for DATABASE().\n\nTo select a default database, the USE statement can be run. Another way to set the default database is specifying its name at mariadb command line client startup.\n\nExamples\n--------\n\nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| NULL       |\n+------------+\n\nUSE test;\nDatabase changed\n\nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| test       |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/database', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/database');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (303, 17, 'DECODE\\_HISTOGRAM', 'Syntax\n------\n\nDECODE_HISTOGRAM(hist_type,histogram)\n\nDescription\n-----------\n\nReturns a string of comma separated numeric values corresponding to a probability distribution represented by the histogram of type hist_type (SINGLE_PREC_HB or DOUBLE_PREC_HB). The hist_type and histogram would be commonly used from the mysql.column_stats table.\n\nSee Histogram Based Statistics for details.\n\nExamples\n--------\n\nCREATE TABLE origin (\n  i INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n  v INT UNSIGNED NOT NULL\n);\n\nINSERT INTO origin(v) VALUES \n  (1),(2),(3),(4),(5),(10),(20),\n  (30),(40),(50),(60),(70),(80),\n  (90),(100),(200),(400),(800);\n\nSET histogram_size=10,histogram_type=SINGLE_PREC_HB;\n\nANALYZE TABLE origin PERSISTENT FOR ALL;\n+-------------+---------+----------+-----------------------------------------+\n| Table       | Op      | Msg_type | Msg_text                                |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status   | Engine-independent statistics collected |\n| test.origin | analyze | status   | OK                                      |\n+-------------+---------+----------+-----------------------------------------+\n\nSELECT db_name,table_name,column_name,hist_type,\n  hex(histogram),decode_histogram(hist_type,histogram) \n  FROM mysql.column_stats WHERE db_name=''test'' and table_name=''origin'';\n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type      | hex(histogram)       | decode_histogram(hist_type,histogram)                             |\n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n| test    | origin     | i           | SINGLE_PREC_HB | 0F2D3C5A7887A5C3D2F0 | 0.059,0.118,0.059,0.118,0.118,0.059,0.118,0.118,0.059,0.118,0.059 |\n| test    | origin     | v           | SINGLE_PREC_HB | 000001060C0F161C1F7F | 0.000,0.000,0.004,0.020,0.024,0.012,0.027,0.024,0.012,0.376,0.502 |\n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n\nSET histogram_size=20,histogram_type=DOUBLE_PREC_HB;\n\nANALYZE TABLE origin PERSISTENT FOR ALL;\n+-------------+---------+----------+-----------------------------------------+\n| Table       | Op      | Msg_type | Msg_text                                |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status   | Engine-independent statistics collected |\n| test.origin | analyze | status   | OK                                      |\n+-------------+---------+----------+-----------------------------------------+\n\nSELECT db_name,table_name,column_name,\n  hist_type,hex(histogram),decode_histogram(hist_type,histogram) \n  FROM mysql.column_stats WHERE db_name=''test'' and table_name=''origin'';\n+---------+------------+-------------+----------------+------------------------------------------+-----------------------------------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type      | hex(histogram)                           | decode_histogram(hist_type,histogram)                                                   |\n+---------+------------+-------------+----------------+------------------------------------------+-----------------------------------------------------------------------------------------+\n| test    | origin     | i           | DOUBLE_PREC_HB | 0F0F2D2D3C3C5A5A78788787A5A5C3C3D2D2F0F0 | 0.05882,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765,0.05882 |\n| test    | origin     | v           | DOUBLE_PREC_HB | 5200F600480116067E0CB30F1B16831CB81FD67F | 0.00125,0.00250,0.00125,0.01877,0.02502,0.01253,0.02502,0.02502,0.01253,0.37546,0.50063 |\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/decode_histogram', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/decode_histogram');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (304, 17, 'DEFAULT', 'Syntax\n------\n\nDEFAULT(col_name)\n\nDescription\n-----------\n\nReturns the default value for a table column. If the column has no default value (and is not NULLABLE - NULLABLE fields have a NULL default), an error is returned.\n\nFor integer columns using AUTO_INCREMENT, 0 is returned.\n\nWhen using DEFAULT as a value to set in an INSERT or UPDATE statement, you can use the bare keyword DEFAULT without the parentheses and argument to refer to the column in context. You can only use DEFAULT as a bare keyword if you are using it alone without a surrounding expression or function.\n\nExamples\n--------\n\nSELECT i FROM t WHERE i != DEFAULT(i);\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/default', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/default');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (305, 17, 'FOUND\\_ROWS', 'Syntax\n------\n\nFOUND_ROWS()\n\nDescription\n-----------\n\nA SELECT statement may include a LIMIT clause to restrict the number of rows the server returns to the client. In some cases, it is desirable to know how many rows the statement would have returned without the LIMIT, but without running the statement again. To obtain this row count, include an SQL_CALC_FOUND_ROWS option in the SELECT statement, and then invoke FOUND_ROWS() afterwards.\n\nYou can also use FOUND_ROWS() to obtain the number of rows returned by a SELECT which does not contain a LIMIT clause. In this case you don''t need to use the SQL_CALC_FOUND_ROWS option. This can be useful for example in a stored procedure.\n\nAlso, this function works with some other statements which return a result set, including SHOW, DESC and HELP. For DELETE ... RETURNING you should use ROW_COUNT(). It also works as a prepared statement, or after executing a prepared statement.\n\nStatements which don''t return any results don''t affect FOUND_ROWS() - the previous value will still be returned.\n\nWarning: When used after a CALL statement, this function returns the number of rows selected by the last query in the procedure, not by the whole procedure.\n\nStatements using the FOUND_ROWS() function are not safe for statement-based replication.\n\nExamples\n--------\n\nSHOW ENGINES\\G\n************************ 1. row *********************\n      Engine: CSV\n     Support: YES\n     Comment: Stores tables as CSV files\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n********************* 2. row *********************\n      Engine: MRG_MyISAM\n     Support: YES\n     Comment: Collection of identical MyISAM tables\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n\n...\n\n********************* 8. row ************************\n      Engine: PERFORMANCE_SCHEMA\n     Support: YES\n     Comment: Performance Schema\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n8 rows in set (0.000 sec)\n\nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n|           8 |\n+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/found_rows', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/found_rows');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (306, 17, 'LAST\\_INSERT\\_ID', 'Syntax\n------\n\nLAST_INSERT_ID(), LAST_INSERT_ID(expr)\n\nDescription\n-----------\n\nLAST_INSERT_ID() (no arguments) returns the first automatically generated value successfully inserted for an AUTO_INCREMENT column as a result of the most recently executed INSERT\\\nstatement. The value of LAST_INSERT_ID() remains unchanged if no rows are successfully inserted.\n\nIf one gives an argument to LAST_INSERT_ID(), then it will return the value of the expression and\\\nthe next call to LAST_INSERT_ID() will return the same value. The value is also sent to the client\\\nand can be accessed by the mysql_insert_id function.\n\nFor example, after inserting a row that generates an AUTO_INCREMENT value, you can get the value like this:\n\n``sql\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n|                9 |\n+------------------+\n`\n\nYou can also use LAST_INSERT_ID() to delete the last inserted row:\n\n`sql\nDELETE FROM product WHERE id = LAST_INSERT_ID();\n`\n\nIf no rows were successfully inserted, LAST_INSERT_ID() returns 0.\n\nYou can also use INSERT...RETURNING for this purpose.\n\nThe value of LAST_INSERT_ID() will be consistent across all versions if all rows in the INSERT or UPDATE statement were successful.\n\nThe currently executing statement does not affect the value of LAST_INSERT_ID(). Suppose that you generate an AUTO_INCREMENT value with one statement, and then refer to LAST_INSERT_ID() in a\\\nmultiple-row INSERT statement that inserts rows into a table with its own AUTO_INCREMENT column. The value of LAST_INSERT_ID() will remain stable in the second statement; its value for the second and later rows is not affected by the earlier row insertions. (However, if you mix references to LAST_INSERT_ID() and LAST_INSERT_ID(<kbd>expr</kbd>), the effect is undefined.)\n\nIf the previous statement returned an error, the value of LAST_INSERT_ID() is undefined. For transactional tables, if the statement is rolled back due to an error, the value of LAST_INSERT_ID() is left undefined. For manual ROLLBACK, the value of LAST_INSERT_ID() is not restored to that before the transaction; it remains as it was at the point of the ROLLBACK.\n\nWithin the body of a stored routine (procedure or function) or a trigger, the value of LAST_INSERT_ID() changes the same way as for statements executed outside the body of these kinds of objects. The\\\neffect of a stored routine or trigger upon the value of LAST_INSERT_ID() that is seen by following statements depends on the kind of routine:\n\n If a stored procedure executes statements that change the value of LAST_INSERT_ID()`, the new value will be seen by statements that follow the procedure call.\n For stored functions and triggers that change the value, the value is restored when the function or trigger ends, so following statements will not see a changed value.\n\nExamples\n--------\n\nCREATE TABLE t (\n  id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY, \n  f VARCHAR(1)) \nENGINE = InnoDB;\n\nINSERT INTO t(f) VALUES(''a'');\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n|                1 |\n+------------------+\n\nINSERT INTO t(f) VALUES(''b'');\n\nINSERT INTO t(f) VALUES(''c'');\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n|                3 |\n+------------------+\n\nINSERT INTO t(f) VALUES(''d''),(''e'');\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n|                4 |\n+------------------+\n\nSELECT  FROM t;\n+----+------+\n| id | f    |\n+----+------+\n|  1 | a    |\n|  2 | b    |\n|  3 | c    |\n|  4 | d    |\n|  5 | e    |\n+----+------+\n\nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n|                 12 |\n+--------------------+\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n|               12 |\n+------------------+\n\nINSERT INTO t(f) VALUES(''f'');\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n|                6 |\n+------------------+\n\nSELECT  FROM t;\n+----+------+\n| id | f    |\n+----+------+\n|  1 | a    |\n|  2 | b    |\n|  3 | c    |\n|  4 | d    |\n|  5 | e    |\n|  6 | f    |\n+----+------+\n\nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n|                 12 |\n+--------------------+\n\nINSERT INTO t(f) VALUES(''g'');\n\nSELECT * FROM t;\n+----+------+\n| id | f    |\n+----+------+\n|  1 | a    |\n|  2 | b    |\n|  3 | c    |\n|  4 | d    |\n|  5 | e    |\n|  6 | f    |\n|  7 | g    |\n+----+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/last_insert_id', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/last_insert_id');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (307, 17, 'LAST\\_VALUE', 'Syntax\n------\n\nLAST_VALUE(expr,[expr,...])\n\nDescription\n-----------\n\nLAST_VALUE() evaluates all expressions and returns the last. This is useful together with setting user variables to a value with @var:=expr, for example when you want to get data of rows updated/deleted without having to do two queries against the table.\n\nLAST_VALUE can be used as a window function.\n\nReturns NULL if no last value exists.\n\nExamples\n--------\n\nCREATE TABLE t1 (a int, b int);\nINSERT INTO t1 VALUES(1,10),(2,20);\nDELETE FROM t1 WHERE a=1 AND last_value(@a:=a,@b:=b,1);\nSELECT @a,@b;\n+------+------+\n| @a   | @b   |\n+------+------+\n|    1 |   10 |\n+------+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/last_value', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/last_value');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (308, 17, 'PROCEDURE ANALYSE', 'Syntax\n------\n\nANALYSE([max_elements[,max_memory]])\n\nDescription\n-----------\n\nThis procedure is defined in the sql/sql_analyse.cc file. It examines the result from a query and returns an analysis of the results that suggests optimal data types for each column. To obtain this analysis, append PROCEDURE ANALYSE to the end of a SELECT statement:\n\n``sql\nSELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements,[max_memory]])\n`\n\nFor example:\n\n`sql\nSELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);\n`\n\nThe results show some statistics for the values returned by the query, and propose an optimal data type for the columns. This can be helpful for checking your existing tables, or after importing new data. You may need to try different settings for the arguments so that PROCEDURE ANALYSE() does not suggest the ENUM data type when it is not appropriate.\n\nThe arguments are optional and are used as follows:\n\n max_elements (default 256) is the maximum number of distinct values that analyse notices per column. This is used by analyse to check whether the optimal data type should be of type ENUM; if there are more than max_elements distinct values, then ENUM` is not a suggested type.\n max_memory (default 8192) is the maximum amount of memory that analyse should allocate per column while trying to find all distinct values.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/procedure-analyse', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/procedure-analyse');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (309, 17, 'ROW\\_COUNT', 'Syntax\n------\n\nROW_COUNT()\n\nDescription\n-----------\n\nROW_COUNT() returns the number of rows updated, inserted or deleted by the preceding statement. This is the same as the row count that the mariadb client displays and the value from the mysql_affected_rows() C API function.\n\nGenerally:\n\n For statements which return a result set (such as SELECT, SHOW, DESC or HELP), returns -1, even when the result set is empty. This is also true for administrative statements, such as OPTIMIZE.\n For DML statements other than SELECT and for ALTER TABLE, returns the number of affected rows.\n For DDL statements (including TRUNCATE) and for other statements which don''t return any result set (such as USE, DO, SIGNAL or DEALLOCATE PREPARE), returns 0.\n\nFor UPDATE, affected rows is by default the number of rows that were actually changed. If the CLIENT_FOUND_ROWS flag to mysql_real_connect() is specified when connecting to mariadbd, affected rows is instead the number of rows matched by the WHERE clause.\n\nFor REPLACE, deleted rows are also counted. So, if REPLACE deletes a row and adds a new row, ROW_COUNT() returns 2.\n\nFor INSERT ... ON DUPLICATE KEY, values returned are as follows:\n\n 0: an existing row is set to its current values, and the CLIENT_FOUND_ROWS is not set.\n 1: the values are inserted as a new row, or an existing row is set to its current values, and the CLIENT_FOUND_ROWS is set.\n 2: an existing row is updated with new values.\n\nROW_COUNT() does not take into account rows that are not directly deleted/updated by the last statement. This means that rows deleted by foreign keys or triggers are not counted.\n\nWarning: You can use ROW_COUNT() with prepared statements, but you need to call it after EXECUTE, not after DEALLOCATE PREPARE, because the row count for allocate prepare is always 0.\n\nWarning: When used after a CALL statement, this function returns the number of rows affected by the last statement in the procedure, not by the whole procedure.\n\nWarning: After INSERT DELAYED, ROW_COUNT() returns the number of the rows you tried to insert, not the number of the successful writes.\n\nThis information can also be found in the diagnostics area.\n\nStatements using the ROW_COUNT() function are not safe for statement-based replication.\n\nExamples\n--------\n\nCREATE TABLE t (A INT);\n\nINSERT INTO t VALUES(1),(2),(3);\n\nSELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n|           3 |\n+-------------+\n\nDELETE FROM t WHERE A IN(1,2);\n\nSELECT ROW_COUNT(); \n+-------------+\n| ROW_COUNT() |\n+-------------+\n|           2 |\n+-------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/row_count', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/row_count');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (310, 17, 'ROWNUM', 'Syntax\n------\n\nROWNUM()\n\nDescription\n-----------\n\nROWNUM() returns the current number of accepted rows in the current context. It main purpose is to emulate the ROWNUM pseudo column in Oracle. For MariaDB native applications, we recommend the usage of LIMIT, as it is easier to use and gives more predictable results than the usage of ROWNUM().\n\nThe main difference between using LIMIT andROWNUM() to limit the rows in the result is thatLIMIT works on the result set while ROWNUM works on the number of accepted rows (before any ORDER orGROUP BY clauses).\n\nThe following queries will return the same results:\n\n``sql\nSELECT  FROM t1 LIMIT 10;\nSELECT  FROM t1 WHERE ROWNUM() <= 10;\n`\n\nWhile the following may return different results based on in which orders the rows are found:\n\n`sql\nSELECT  FROM t1 ORDER BY a LIMIT 10;\nSELECT  FROM t1 ORDER BY a WHERE ROWNUM() <= 10;\n`\n\nThe recommended way to use ROWNUM to limit the number of returned rows and get predictable results is to have the query in a subquery and test for ROWNUM() in the outer query:\n\n`sql\nSELECT  FROM (SELECT  FROM t1 ORDER BY a) WHERE ROWNUM() <= 10;\n`\n\nROWNUM() can be used in the following contexts:\n\n SELECT\n INSERT\n UPDATE\n DELETE\n* LOAD DATA INFILE\n\nUsed in other contexts, ROWNUM()` will return 0.\n\nExamples\n--------\n\nINSERT INTO t1 VALUES (1,ROWNUM()),(2,ROWNUM()),(3,ROWNUM());\n\nINSERT INTO t1 VALUES (1),(2) RETURNING a, ROWNUM();\n\nUPDATE t1 SET row_num_column=ROWNUM();\n\nDELETE FROM t1 WHERE a < 10 AND ROWNUM() < 2;\n\nLOAD DATA INFILE ''filename'' INTO TABLE t1 fields terminated BY '','' \n  lines terminated BY "\\r\\n" (a,b) SET c=ROWNUM();\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/rownum', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/rownum');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (311, 17, 'SCHEMA', 'Syntax\n------\n\nSCHEMA()\n\nDescription\n-----------\n\nThis function is a synonym for DATABASE().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/schema', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/schema');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (312, 17, 'SESSION\\_USER', 'Syntax\n------\n\nSESSION_USER()\n\nDescription\n-----------\n\nShows the value of CURRENT_USER() when the session was created, that is, it shows a user@host pair from the mysql.global_priv table, like CURRENT_USER(), but unlike CURRENT_USER() it will not change inside stored routines and views. This is SQL Standard behavior for the SESSION_USER function.\n\nSESSION_USER() is a synonym for USER().\n\nBackward-compatible behavior can be restored by setting old mode to SESSION_USER_IS_USER.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/session_user', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/session_user');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (313, 17, 'SYSTEM\\_USER', 'Syntax\n------\n\nSYSTEM_USER()\n\nDescription\n-----------\n\nSYSTEM_USER() is a synonym for USER().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/system_user', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/system_user');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (314, 17, 'USER', 'Syntax\n------\n\nUSER()\n\nDescription\n-----------\n\nReturns the current MariaDB user name and host name, given when authenticating to MariaDB, as a string in the utf8 character set.\n\nThe value of USER() may differ from the value of CURRENT_USER(), which is the user used to authenticate the current client. CURRENT_ROLE() returns the currently active role.\n\nSYSTEM_USER() is a synonym for USER().\n\nSYSTEM_USER() and SESSION_USER are synonyms for USER().\n\nStatements using the USER() function or one of its synonyms are not safe for statement level replication.\n\nExamples\n--------\n\nshell> mysql --user="anonymous"\n\nSELECT USER(),CURRENT_USER();\n+---------------------+----------------+\n| USER()              | CURRENT_USER() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost     |\n+---------------------+----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/user', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/user');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (315, 17, 'VERSION', 'Syntax\n------\n\nVERSION()\n\nDescription\n-----------\n\nReturns a string that indicates the MariaDB server version. The string uses the utf8 character set.\n\nExamples\n--------\n\nSELECT VERSION();\n+----------------+\n| VERSION()      |\n+----------------+\n| 10.4.7-MariaDB |\n+----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/version', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/version');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (316, 14, 'GET\\_LOCK', 'Syntax\n------\n\nGET_LOCK(str,timeout)\n\nDescription\n-----------\n\nTries to obtain a lock with a name given by the string str, using a timeout of timeout seconds. Returns 1 if the lock was obtained successfully, 0 if the attempt timed out (for example, because another client has previously locked the name), or NULL if an error occurred (such as running out of memory or the thread was killed with mariadb-admin kill).\n\nA lock is released with RELEASE_LOCK(), when the connection terminates (either normally or abnormally). A connection can hold multiple locks at the same time, so a lock that is no longer needed needs to be explicitly released.\n\nThe IS_FREE_LOCK function returns whether a specified lock is free or not, and the IS_USED_LOCK whether the function is in use or not.\n\nLocks obtained with GET_LOCK() do not interact with transactions. That is, committing a transaction does not release any such locks obtained during the transaction.\n\nIt is also possible to recursively set the same lock. If a lock with the same name is set n times, it needs to be released n times as well.\n\nstr is case insensitive for GET_LOCK() and related functions. If str is an empty string or NULL, GET_LOCK() returns NULL and does nothing. timeout supports microseconds.\n\nIf the metadata_lock_info plugin is installed, locks acquired with this function are visible in the Information Schema METADATA_LOCK_INFO table.\n\nThis function can be used to implement application locks or to simulate record locks. Names are locked on a server-wide basis. If a name has been locked by one client, GET_LOCK() blocks any request by another client for a lock with the same name. This allows clients that agree on a given lock name to use the name to perform cooperative advisory locking. But be aware that it also allows a client that is not among the set of cooperating clients to lock a name, either inadvertently or deliberately, and thus prevent any of the cooperating clients from locking that name. One way to reduce the likelihood of this is to use lock names that are database-specific or application-specific. For example, use lock names of the form db_name.str or app_name.str.\n\nStatements using the GET_LOCK function are not safe for statement-based replication.\n\nThe patch to permit multiple locks was contributed by Konstantin "Kostja" Osipov (MDEV-3917).\n\nExamples\n--------\n\nSELECT GET_LOCK(''lock1'',10);\n+----------------------+\n| GET_LOCK(''lock1'',10) |\n+----------------------+\n|                    1 |\n+----------------------+\n\nSELECT IS_FREE_LOCK(''lock1''), IS_USED_LOCK(''lock1'');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(''lock1'') | IS_USED_LOCK(''lock1'') |\n+-----------------------+-----------------------+\n|                     0 |                    46 |\n+-----------------------+-----------------------+\n\nSELECT IS_FREE_LOCK(''lock2''), IS_USED_LOCK(''lock2'');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(''lock2'') | IS_USED_LOCK(''lock2'') |\n+-----------------------+-----------------------+\n|                     1 |                  NULL |\n+-----------------------+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/get_lock', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/get_lock');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (317, 14, 'INET6\\_ATON', 'Syntax\n------\n\nINET6_ATON(expr)\n\nDescription\n-----------\n\nGiven an IPv6 or IPv4 network address as a string, returns a binary string that represents the numeric value of the address.\n\nNo trailing zone ID''s or traling network masks are permitted. For IPv4 addresses, or IPv6 addresses with IPv4 address parts, no classful addresses or trailing port numbers are permitted and octal numbers are not supported.\n\nThe returned binary string will be VARBINARY(16) or VARBINARY(4) for IPv6 and IPv4 addresses respectively.\n\nReturns NULL if the argument is not understood.\n\nMariaDB starting with 10.5.0\n\nINET6_ATON can take INET6 as an argument.\n\nINET6_ATON cannot take INET6 as an argument.\n\nExamples\n--------\n\nSELECT HEX(INET6_ATON(''10.0.1.1''));\n+-----------------------------+\n| HEX(INET6_ATON(''10.0.1.1'')) |\n+-----------------------------+\n| 0A000101                    |\n+-----------------------------+\n\nSELECT HEX(INET6_ATON(''48f3::d432:1431:ba23:846f''));\n+----------------------------------------------+\n| HEX(INET6_ATON(''48f3::d432:1431:ba23:846f'')) |\n+----------------------------------------------+\n| 48F3000000000000D4321431BA23846F             |\n+----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet6_aton', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet6_aton');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (318, 14, 'INET6\\_NTOA', 'Syntax\n------\n\nINET6_NTOA(expr)\n\nDescription\n-----------\n\nGiven an IPv6 or IPv4 network address as a numeric binary string, returns the address as a nonbinary string in the connection character set.\n\nThe return string is lowercase, and is platform independent, since it does not use functions specific to the operating system. It has a maximum length of 39 characters.\n\nReturns NULL if the argument is not understood.\n\nExamples\n--------\n\nSELECT INET6_NTOA(UNHEX(''0A000101''));\n+-------------------------------+\n| INET6_NTOA(UNHEX(''0A000101'')) |\n+-------------------------------+\n| 10.0.1.1                      |\n+-------------------------------+\n\nSELECT INET6_NTOA(UNHEX(''48F3000000000000D4321431BA23846F''));\n+-------------------------------------------------------+\n| INET6_NTOA(UNHEX(''48F3000000000000D4321431BA23846F'')) |\n+-------------------------------------------------------+\n| 48f3::d432:1431:ba23:846f                             |\n+-------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet6_ntoa', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet6_ntoa');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (319, 14, 'INET\\_ATON', 'Syntax\n------\n\nINET_ATON(expr)\n\nDescription\n-----------\n\nGiven the dotted-quad representation of an IPv4 network address as a string, returns an integer that represents the numeric value of the address. Addresses may be 4- or 8-byte addresses.\n\nReturns NULL if the argument is not understood.\n\nExamples\n--------\n\nSELECT INET_ATON(''192.168.1.1'');\n+--------------------------+\n| INET_ATON(''192.168.1.1'') |\n+--------------------------+\n|               3232235777 |\n+--------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet_aton', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet_aton');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (320, 14, 'INET\\_NTOA', 'Syntax\n------\n\nINET_NTOA(expr)\n\nDescription\n-----------\n\nGiven a numeric IPv4 network address in network byte order (4 or 8 byte), returns the dotted-quad representation of the address as a string.\n\nExamples\n--------\n\nSELECT INET_NTOA(3232235777);\n+-----------------------+\n| INET_NTOA(3232235777) |\n+-----------------------+\n| 192.168.1.1           |\n+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet_ntoa', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet_ntoa');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (321, 14, 'IS\\_FREE\\_LOCK', 'Syntax\n------\n\nIS_FREE_LOCK(str)\n\nDescription\n-----------\n\nChecks whether the lock named str is free to use (that is, not locked). Returns 1 if the lock is free (no one is using the lock),0 if the lock is in use, and NULL if an error occurs (such as an incorrect argument, like an empty string or NULL). str is case insensitive.\n\nIf the metadata_lock_info plugin is installed, the Information Schema metadata_lock_info table contains information about locks of this kind (as well as metadata locks).\n\nStatements using the IS_FREE_LOCK function are not safe for statement-based replication.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_free_lock', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_free_lock');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (322, 14, 'IS\\_IPV4', 'Syntax\n------\n\nIS_IPV4(expr)\n\nDescription\n-----------\n\nIf the expression is a valid IPv4 address, returns 1, otherwise returns 0.\n\nIS_IPV4() is stricter than INET_ATON(), but as strict as INET6_ATON(), in determining the validity of an IPv4 address. This implies that if IS_IPV4 returns 1, the same expression will always return a non-NULL result when passed to INET_ATON(), but that the reverse may not apply.\n\nExamples\n--------\n\nSELECT IS_IPV4(''1110.0.1.1'');\n+-----------------------+\n| IS_IPV4(''1110.0.1.1'') |\n+-----------------------+\n|                     0 |\n+-----------------------+\n\nSELECT IS_IPV4(''48f3::d432:1431:ba23:846f'');\n+--------------------------------------+\n| IS_IPV4(''48f3::d432:1431:ba23:846f'') |\n+--------------------------------------+\n|                                    0 |\n+--------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv4', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv4');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (323, 14, 'IS\\_IPV4\\_COMPAT', 'Syntax\n------\n\nIS_IPV4_COMPAT(expr)\n\nDescription\n-----------\n\nReturns 1 if a given numeric binary string IPv6 address, such as returned by INET6_ATON(), is IPv4-compatible, otherwise returns 0.\n\nWhen the argument is not INET6, automatic implicit CAST to INET6 is applied. As a consequence, IS_IPV4_COMPAT now understands arguments in both text representation and binary(16) representation.\n\nThe function understands only binary(16) representation.\n\nExamples\n--------\n\nSELECT IS_IPV4_COMPAT(INET6_ATON(''::10.0.1.1''));\n+------------------------------------------+\n| IS_IPV4_COMPAT(INET6_ATON(''::10.0.1.1'')) |\n+------------------------------------------+\n|                                        1 |\n+------------------------------------------+\n\nSELECT IS_IPV4_COMPAT(INET6_ATON(''::48f3::d432:1431:ba23:846f''));\n+-----------------------------------------------------------+\n| IS_IPV4_COMPAT(INET6_ATON(''::48f3::d432:1431:ba23:846f'')) |\n+-----------------------------------------------------------+\n|                                                         0 |\n+-----------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv4_compat', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv4_compat');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (324, 14, 'IS\\_IPV4\\_MAPPED', 'Syntax\n------\n\nIS_IPV4_MAPPED(expr)\n\nDescription\n-----------\n\nReturns 1 if a given a numeric binary string IPv6 address, such as returned by INET6_ATON(), is a valid IPv4-mapped address, otherwise returns 0.\n\nWhen the argument is not INET6, automatic implicit CAST to INET6 is applied. As a consequence, IS_IPV4_MAPPED now understands arguments in both text representation and binary(16) representation.\n\nThe function understands only binary(16) representation.\n\nExamples\n--------\n\nSELECT IS_IPV4_MAPPED(INET6_ATON(''::10.0.1.1''));\n+------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(''::10.0.1.1'')) |\n+------------------------------------------+\n|                                        0 |\n+------------------------------------------+\n\nSELECT IS_IPV4_MAPPED(INET6_ATON(''::ffff:10.0.1.1''));\n+-----------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(''::ffff:10.0.1.1'')) |\n+-----------------------------------------------+\n|                                             1 |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv4_mapped', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv4_mapped');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (325, 14, 'IS\\_IPV6', 'Syntax\n------\n\nIS_IPV6(expr)\n\nDescription\n-----------\n\nReturns 1 if the expression is a valid IPv6 address specified as a string, otherwise returns 0. Does not consider IPv4 addresses to be valid IPv6 addresses.\n\nExamples\n--------\n\nSELECT IS_IPV6(''48f3::d432:1431:ba23:846f'');\n+--------------------------------------+\n| IS_IPV6(''48f3::d432:1431:ba23:846f'') |\n+--------------------------------------+\n|                                    1 |\n+--------------------------------------+\n1 row in set (0.02 sec)\n\nSELECT IS_IPV6(''10.0.1.1'');\n+---------------------+\n| IS_IPV6(''10.0.1.1'') |\n+---------------------+\n|                   0 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv6', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_ipv6');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (326, 14, 'IS\\_USED\\_LOCK', 'Syntax\n------\n\nIS_USED_LOCK(str)\n\nDescription\n-----------\n\nChecks whether the lock named str is in use (that is, locked). If so, it returns the connection identifier of the client that holds the lock. Otherwise, it returns NULL. str is case insensitive.\n\nIf the metadata_lock_info plugin is installed, the Information Schema metadata_lock_info table contains information about locks of this kind (as well as metadata locks).\n\nStatements using the IS_USED_LOCK function are not safe for statement-based replication.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_used_lock', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_used_lock');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (327, 14, 'MASTER\\_GTID\\_WAIT', 'Syntax\n------\n\nMASTER_GTID_WAIT(gtid-list, timeout)\n\nDescription\n-----------\n\nThis function takes a string containing a comma-separated list of [global transaction id''s (similar to the value of, for example, gtid_binlog_pos). It waits until the value of gtid_slave_pos has the same or higher seq_no within all replication domains specified in the gtid-list; in other words, it waits until the slave has reached the specified GTID position.\n\nAn optional second argument gives a timeout in seconds. If the timeout expires before the specified GTID position is reached, then the function returns -1. Passing NULL or a negative number for the timeout means no timeout, and the function will wait indefinitely.\n\nIf the wait completes without a timeout, 0 is returned. Passing NULL for the gtid-list makes the function return NULL immediately, without waiting.\n\nThe gtid-list may be the empty string, in which case MASTER_GTID_WAIT() returns immediately. If the gtid-list contains fewer domains than gtid_slave_pos, then only those domains are waited upon. If gtid-list contains a domain that is not present in @@gtid_slave_pos, then MASTER_GTID_WAIT() will wait until an event containing such domain_id arrives on the slave (or until timed out or killed).\n\nMASTER_GTID_WAIT() can be useful to ensure that a slave has caught up to a master. Simply take the value of gtid_binlog_pos on the master, and use it in a MASTER_GTID_WAIT() call on the slave; when the call completes, the slave will have caught up with that master position.\n\nMASTER_GTID_WAIT() can also be used in client applications together with the last_gtid session variable. This is useful in a read-scaleout replication setup, where the application writes to a single master but divides the reads out to a number of slave to distribute the load. In such a setup, there\\\nis a risk that an application could first do an update on the master, and then a bit later do a read on a slave, and if the slave is not fast enough, the data read from the slave might not include the update just made, possibly confusing the application and/or the end-user. One way to avoid this is to request the value of last_gtid on the master just after the update. Then before doing the read on the slave, do a MASTER_GTID_WAIT() on the value obtained from the master; this will ensure that the read is not performed until the slave has replicated sufficiently far for the update to have become visible.\n\nNote that MASTER_GTID_WAIT() can be used even if the slave is configured not to use GTID for connections (CHANGE MASTER TO master_use_gtid=no). This is because from MariaDB 10, GTIDs are always logged on the master server, and always recorded on the slave servers.\n\nDifferences to MASTER_POS_WAIT()\n\n MASTER_GTID_WAIT() is global; it waits for any master connection to reach the specified GTID position. MASTER_POS_WAIT() works only against a specific connection. This also means that while MASTER_POS_WAIT() aborts if its master connection is terminated with STOP SLAVE or due to an error, MASTER_GTID_WAIT() continues to wait while slaves are stopped.\n MASTER_GTID_WAIT() can take its timeout as a floating-point value, so a timeout in fractional seconds is supported, eg. MASTER_GTID_WAIT("0-1-100", 0.5). (The minimum wait is one microsecond, 0.000001 seconds).\n MASTER_GTID_WAIT() allows one to specify a timeout of zero in order to do a non-blocking check to see if the slaves have progressed to a specific GTID position (MASTER_POS_WAIT() takes a zero timeout as meaning an infinite wait). To do an infinite MASTER_GTID_WAIT(), specify a negative timeout, or omit the timeout argument.\n MASTER_GTID_WAIT() does not return the number of events executed since the wait started, nor does it return NULL if a slave thread is stopped. It always returns either 0 for successful wait completed, or -1 for timeout reached (or NULL if the specified gtid-pos is NULL).\n\nSince MASTER_GTID_WAIT() looks only at the seq_no part of the GTIDs, not the server_id, care is needed if a slave becomes diverged from another server so that two different GTIDs with the same seq_no (in the same domain) arrive at the same server. This situation is in any case best avoided; setting gtid_strict_mode is recommended, as this will prevent any such out-of-order sequence numbers from ever being replicated on a slave.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/master_gtid_wait', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/master_gtid_wait');
