-- Copyright (c) 2003, 2008-2012, Oracle and/or its affiliates. All rights reserved.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; version 2 of the License.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-- DO NOT EDIT THIS FILE. It is generated automatically.

-- To use this file, load its contents into the mysql database. For example,
-- with the mysql client program, process the file like this, where
-- file_name is the name of this file:

--     mysql -u root -p mysql < file_name

set names 'utf8';

set sql_log_bin = 0;

use mysql;
delete from help_topic;
delete from help_category;
delete from help_keyword;
delete from help_relation;

insert into help_category (help_category_id,name,parent_category_id,url) values (1,'Geographic',0,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (2,'Polygon properties',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (3,'WKT',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (4,'Numeric Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (5,'Plugins',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (6,'MBR',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (7,'Control flow functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (8,'Transactions',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (9,'Help Metadata',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (10,'Account Management',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (11,'Point properties',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (12,'Encryption Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (13,'LineString properties',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (14,'Miscellaneous Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (15,'Logical operators',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (16,'Functions and Modifiers for Use with GROUP BY',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (17,'Information Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (18,'Comparison operators',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (19,'Bit Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (20,'Table Maintenance',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (21,'User-Defined Functions',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (22,'Data Types',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (23,'Compound Statements',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (24,'Geometry constructors',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (25,'GeometryCollection properties',1,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (26,'Administration',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (27,'Data Manipulation',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (28,'Utility',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (29,'Language Structure',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (30,'Geometry relations',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (31,'Date and Time Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (32,'WKB',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (33,'Procedures',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (34,'Geographic Features',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (35,'Contents',0,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (36,'Geometry properties',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (37,'String Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (38,'Functions',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (39,'Data Definition',35,'');

INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (0, 22, 'AUTO\\_INCREMENT FAQ', 'Description\n-----------\n\nHow do I get the last inserted auto_increment value?\n\nUse the LAST_INSERT_ID() function:\n\n``sql\nSELECT LAST_INSERT_ID();\n`\n\nWhat if someone else inserts before I select my id?\n\nLAST_INSERT_ID() is connection specific, so there is no problem from race conditions.\n\nHow do I get the next value to be inserted?\n\nYou don''t. Insert, then find out what you did with LAST_INSERT_ID().\n\nHow do I change what number auto_increment starts with?\n\nRun a query, ALTER TABLE yourTable AUTO_INCREMENT = x; . The next insert will contain x or MAX(autoField) + 1, whichever is higher.\n\nAs an alternative, run INSERT INTO yourTable (autoField) VALUES (x); . The next insert will contain x+1 or MAX(autoField) + 1, whichever is higher.\n\nIssuing TRUNCATE TABLE will delete all the rows in the table, and will reset the auto_increment value to 0 in most cases.\n\nHow do I renumber rows once I deleted some in the middle?\n\nTypically, you don''t want to. Gaps are hardly ever a problem; if your application can''t handle gaps in the sequence, you probably should rethink your application.\n\nCan I do group-wise auto_increment?\n\nYes, if you use the MyISAM engine.\n\nHow do I get the AUTO_INCREMENT value in a BEFORE INSERT trigger?\n\nThis isn''t possible. It''s only available after insert.\n\nHow do I assign two fields the same auto_increment value in one query?\n\nYou can''t, not even with an AFTER INSERT trigger. Insert, then go back and update using LAST_INSERT_ID(). Those two statements could be wrapped into one stored procedure if you wish.\n\nHowever, you can mimic this behavior with a BEFORE INSERT trigger and a second table to store the sequence position:\n\n`sql\nCREATE TABLE sequence (table_name VARCHAR(255), position INT UNSIGNED);\nINSERT INTO sequence VALUES (''testTable'', 0);\nCREATE TABLE testTable (firstAuto INT UNSIGNED, secondAuto INT UNSIGNED);\nDELIMITER //\nCREATE TRIGGER testTable_BI BEFORE INSERT ON testTable FOR EACH ROW BEGIN\n  UPDATE sequence SET position = LAST_INSERT_ID(position + 1) WHERE table_name = ''testTable'';\n  SET NEW.firstAuto = LAST_INSERT_ID();\n  SET NEW.secondAuto = LAST_INSERT_ID();\nEND//\nDELIMITER ;\nINSERT INTO testTable VALUES (NULL, NULL), (NULL, NULL);\nSELECT  FROM testTable;\n\n+-----------+------------+\n| firstAuto | secondAuto |\n+-----------+------------+\n|         1 |          1 |\n|         2 |          2 |\n+-----------+------------+\n`\n\nThe same sequence table can maintain separate sequences for multiple tables (or separate sequences for different fields in the same table) by adding extra rows.\n\nDoes the auto_increment field have to be primary key?\n\nNo, it only has to be indexed. It doesn''t even have to be unique.\n\nHow does InnoDB handle AUTO_INCREMENT?\n\nSee AUTO_INCREMENT handling in InnoDB.\n\nGeneral Information To Read\n\nAUTO_INCREMENT\n\nManual Notes\n\nThere can be only one AUTO_INCREMENT column per table, it must be indexed, and it cannot have a DEFAULT value. An AUTO_INCREMENT column works properly only if it contains only positive values. Inserting a negative number is regarded as inserting a very large positive number. This is done to avoid precision problems when numbers wrap over from positive to negative and also to ensure that you do not accidentally get an AUTO_INCREMENT column that contains 0.\n\nHow to start a table with a set AUTO_INCREMENT value?\n\n`sql\nCREATE TABLE autoinc_test (\n  h INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, \n  m INT UNSIGNED \n) AUTO_INCREMENT = 100;\n\nINSERT INTO autoinc_test ( m ) VALUES ( 1 );\n\nSELECT  FROM autoinc_test;\n+-----+------+\n| h   | m    |\n+-----+------+\n| 100 |    1 |\n+-----+------+\n``\n\nURL: https://mariadb.com/docs/server/reference/data-types/auto_increment-faq', '', 'https://mariadb.com/docs/server/reference/data-types/auto_increment-faq');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1, 22, 'AUTO\\_INCREMENT', 'Description\n-----------\n\nThe AUTO_INCREMENT attribute can be used to generate a unique identity for new rows. When you insert a new record into the table (or upon adding an AUTO_INCREMENT attribute with the ALTER TABLE statement), and the AUTO_INCREMENT field is NULL or DEFAULT (in the case of an INSERT), automatically be incremented. This also applies to 0, unless the NO_AUTO_VALUE_ON_ZERO SQL_MODE is enabled.\n\nAUTO_INCREMENT columns start from 1 by default. The automatically generated value can never be lower than 0.\n\nEach table can have only one AUTO_INCREMENT column. It must defined as a key (not necessarily the PRIMARY KEY or UNIQUE key). In some storage engines (including the default InnoDB), if the key consists of multiple columns, the AUTO_INCREMENT column must be the first column. Storage engines that permit the column to be placed elsewhere are Aria, MyISAM, MERGE, Spider, TokuDB, BLACKHOLE, FederatedX and Federated.\n\n``sql\nCREATE TABLE animals (\n     id MEDIUMINT NOT NULL AUTO_INCREMENT,\n     name CHAR(30) NOT NULL,\n     PRIMARY KEY (id)\n );\n\nINSERT INTO animals (name) VALUES\n    (''dog''),(''cat''),(''penguin''),\n    (''fox''),(''whale''),(''ostrich'');\n`\n\n`sql\nSELECT  FROM animals;\n+----+---------+\n| id | name    |\n+----+---------+\n|  1 | dog     |\n|  2 | cat     |\n|  3 | penguin |\n|  4 | fox     |\n|  5 | whale   |\n|  6 | ostrich |\n+----+---------+\n`\n\nSERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.\n\n`sql\nCREATE TABLE t (id SERIAL, c CHAR(1)) ENGINE=InnoDB;\n\nSHOW CREATE TABLE t \\G\n*********************** 1. row ***********************\n       Table: t\nCreate Table: CREATE TABLE t (\n  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n  c char(1) DEFAULT NULL,\n  UNIQUE KEY id (id)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n`\n\nSetting or Changing the Auto_Increment Value\n\nYou can use an ALTER TABLE statement to assign a new value to the auto_increment table option, or set the insert_id server system variable to change the next AUTO_INCREMENT value inserted by the current session.\n\nLAST_INSERT_ID() can be used to see the last AUTO_INCREMENT value inserted by the current session.\n\n`sql\nALTER TABLE animals AUTO_INCREMENT=8;\n\nINSERT INTO animals (name) VALUES (''aardvark'');\n\nSELECT  FROM animals;\n+----+-----------+\n| id | name      |\n+----+-----------+\n|  1 | dog       |\n|  2 | cat       |\n|  3 | penguin   |\n|  4 | fox       |\n|  5 | whale     |\n|  6 | ostrich   |\n|  8 | aardvark  |\n+----+-----------+\n\nSET insert_id=12;\n\nINSERT INTO animals (name) VALUES (''gorilla'');\n\nSELECT  FROM animals;\n+----+-----------+\n| id | name      |\n+----+-----------+\n|  1 | dog       |\n|  2 | cat       |\n|  3 | penguin   |\n|  4 | fox       |\n|  5 | whale     |\n|  6 | ostrich   |\n|  8 | aardvark  |\n| 12 | gorilla   |\n+----+-----------+\n`\n\nInnoDB\n\nAUTO_INCREMENT is persistent in InnoDB.\n\nSee also AUTO_INCREMENT Handling in InnoDB.\n\nSetting Explicit Values\n\nIt is possible to specify a value for an AUTO_INCREMENT column. If the key is primary or unique, the value must not already exist in the key.\n\nIf the new value is higher than the current maximum value, the AUTO_INCREMENT value is updated, so the next value will be higher. If the new value is lower than the current maximum value, the AUTO_INCREMENT value remains unchanged.\n\nThe following example demonstrates these behaviors:\n\n`sql\nCREATE TABLE t (id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE = InnoDB;\n\nINSERT INTO t VALUES (NULL);\nSELECT id FROM t;\n+----+\n| id |\n+----+\n|  1 |\n+----+\n\nINSERT INTO t VALUES (10); -- higher value\nSELECT id FROM t;\n+----+\n| id |\n+----+\n|  1 |\n| 10 |\n+----+\n\nINSERT INTO t VALUES (2); -- lower value\nINSERT INTO t VALUES (NULL); -- auto value\nSELECT id FROM t;\n+----+\n| id |\n+----+\n|  1 |\n|  2 |\n| 10 |\n| 11 |\n+----+\n`\n\nThe ARCHIVE storage engine does not allow to insert a value that is lower than the current maximum.\n\nMissing Values\n\nAn AUTO_INCREMENT column normally has missing values. This happens because if a row is deleted, or an AUTO_INCREMENT value is explicitly updated, old values are never re-used. The REPLACE statement also deletes a row, and its value is wasted. With InnoDB, values can be reserved by a transaction; but if the transaction fails (for example, because of a ROLLBACK) the reserved value will be lost.\n\nThus AUTO_INCREMENT values can be used to sort results in a chronological order, but not to create a numeric sequence.\n\nReplication\n\nTo make master-master or Galera safe to use AUTO_INCREMENT , you should use the system variables auto_increment_increment and auto_increment_offset to generate unique values for each server.\n\n`sql\nSET @@auto_increment_increment=3;\n\nSHOW VARIABLES LIKE ''auto_inc%'';\n+--------------------------+-------+\n| Variable_name            | Value |\n+--------------------------+-------+\n| auto_increment_increment | 3     |\n| auto_increment_offset    | 1     |\n+--------------------------+-------+\n\nCREATE TABLE t (c INT NOT NULL AUTO_INCREMENT PRIMARY KEY);\n\nINSERT INTO t VALUES (NULL), (NULL), (NULL);\n\nSELECT  FROM t;\n+---+\n| c |\n+---+\n| 1 |\n| 4 |\n| 7 |\n+---+\n\nCREATE TABLE t2 (c INT NOT NULL AUTO_INCREMENT PRIMARY KEY);\n\nSET @@auto_increment_offset=2;\n\nSHOW VARIABLES LIKE ''auto_inc%'';\n+--------------------------+-------+\n| Variable_name            | Value |\n+--------------------------+-------+\n| auto_increment_increment | 3     |\n| auto_increment_offset    | 2     |\n+--------------------------+-------+\n\nINSERT INTO t2 VALUES (NULL), (NULL), (NULL);\n\nSELECT  FROM t2;\n+---+\n| c |\n+---+\n| 2 |\n| 5 |\n| 8 |\n+---+\n`\n\nIf auto_increment_offset is larger than auto_increment_increment, the value of auto_increment_offset is ignored, and the offset reverts to the default of 1 instead:\n\n`sql\nSET @@auto_increment_offset=5;\n\nSHOW VARIABLES LIKE ''auto_inc%'';\n+--------------------------+-------+\n| Variable_name            | Value |\n+--------------------------+-------+\n| auto_increment_increment | 3     |\n| auto_increment_offset    | 5     |\n+--------------------------+-------+\n\nCREATE TABLE t3 (c INT NOT NULL AUTO_INCREMENT PRIMARY KEY);\n\nINSERT INTO t3 VALUES (NULL), (NULL), (NULL);\n\nSELECT  FROM t3;\n+---+\n| c |\n+---+\n| 1 |\n| 4 |\n| 5 |\n+---+\n\n+--------------------------+-------+\n| Variable_name            | Value |\n+--------------------------+-------+\n| auto_increment_increment | 3     |\n| auto_increment_offset    | 3     |\n+--------------------------+-------+\n\nINSERT INTO t4 VALUES (NULL), (NULL), (NULL);\n\nSELECT  FROM t4;\n+---+\n| c |\n+---+\n| 3 |\n| 6 |\n| 9 |\n+---+\n`\n\nChanging auto_increment_increment and auto_incremenet_offset when adding a new master to a multi-master setup\n\nThe purpose of auto_increment_increment and auto_increment_offset is to ensure that in a multi-master or multi-source setup, all masters generate unique values for auto_increment fields or for sequences with INCREMENT=0.\n\nIf auto_increment_increment is larger than the current number of masters, then one can configure the new master with the not used auto_increment_offset. The easiest way to add a new master is to stop all MariaDB servers, update auto_increment_increment and auto_increment_offset in the configuration files, and restart.\\\\\n\nThis has to be done if auto_increment_increment is 1. If one has more than one master (auto_increment_increment > 1), there is a way to add more masters with only having to restart one of the masters. The ''trick'' is to configure one of the masters to not use all the values in its current sequence.\n\nThe following example illustrates how to do it. Assume you have two masters, A and B.\n\nIn this case you will have auto_increment_increment=2 for both masters and A would have auto_increment_offset=1 and B would have auto_increment_offset=2. For A, all auto_increment and generated sequence values will be odd.\n\n`sql\n1\n3\n5\n7\n`\n\nFor B, all values will be even:\n\n`sql\n2\n4\n6\n8\n`\n\nSee the Replication section above.\n\nIf we change auto_increment_increment from 2 to 4 in A, it will now generate values from this sequence:\n\n`sql\n1\n5\n9\n13\n`\n\nAs you can see, values 3, 7, 11 are not going to be used.We can get C to use values from this sequence by configuring auto_increment_increment=4 and auto_increment_offset=3.\n\n`sql\n3\n7\n11\n`\n\nIf we would like to add a 4''th master (D), we can do that by changing ''B'' to use auto_increment_increment=4 and then configure D to have auto_increment_increment=4 and auto_increment_offset=4.\n\nNote that when changing the auto_increment_increment or auto_increment_offset on a server, you have to either restart the server or ensure that all current connections are killed. This is needed to force all connections to use the new values.\n\nAlso ensure that, if you want to use the above trick, you always double the value of auto_increment_increment. This is needed to ensure that the sequence used will not conflict with numbers generated by any other master.\n\nCHECK Constraints, DEFAULT Values and Virtual Columns\n\nAUTO_INCREMENT columns are not permitted in CHECK constraints, DEFAULT value expressions and virtual columns.\n\nGenerating Auto_Increment Values When Adding the Attribute\n\n`sql\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (0),(0),(0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT  FROM t1;\n+---+\n| a |\n+---+\n| 1 |\n| 2 |\n| 3 |\n+---+\n`\n\n`sql\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (5),(0),(8),(0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT  FROM t1;\n+---+\n| a |\n+---+\n| 5 |\n| 6 |\n| 8 |\n| 9 |\n+---+\n`\n\nIf the NO_AUTO_VALUE_ON_ZERO SQL_MODE is set, zero values will not be automatically incremented:\n\n`sql\nSET SQL_MODE=''no_auto_value_on_zero'';\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (3), (0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT  FROM t1;\n+---+\n| a |\n+---+\n| 0 |\n| 3 |\n+---+\n``\n\nURL: https://mariadb.com/docs/server/reference/data-types/auto_increment', '', 'https://mariadb.com/docs/server/reference/data-types/auto_increment');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (2, 22, 'Data Type Storage Requirements', 'Description\n-----------\n\nThe following tables indicate the approximate data storage requirements for each data type.\n\nNumeric Data Types\n\n| Data Type                                    | Storage Requirement                   |\n| -------------------------------------------- | ------------------------------------- |\n| TINYINT     | 1 byte                                |\n| SMALLINT   | 2 bytes                               |\n| MEDIUMINT | 3 bytes                               |\n| INT             | 4 bytes                               |\n| BIGINT       | 8 bytes                               |\n| FLOAT(p)      | 4 bytes if p <= 24, otherwise 8 bytes |\n| DOUBLE       | 8 bytes                               |\n| DECIMAL     | See table below                       |\n| BIT(M)          | (M+7)/8 bytes                         |\n\nNote that MEDIUMINT columns will require 4 bytes in memory (for example, in InnoDB buffer pool).\n\nDecimal\n\nDecimals are stored using a binary format, with the integer and the fraction stored separately. Each nine-digit multiple requires 4 bytes, followed by a number of bytes for whatever remains, as follows:\n\n| Remaining digits | Storage Requirement |\n| ---------------- | ------------------- |\n| 0                | 0 bytes             |\n| 1                | 1 byte              |\n| 2                | 1 byte              |\n| 3                | 2 bytes             |\n| 4                | 2 bytes             |\n| 5                | 3 bytes             |\n| 6                | 3 bytes             |\n| 7                | 4 bytes             |\n| 8                | 4 bytes             |\n\nString Data Types\n\nIn the descriptions below, M is the declared column length (in characters or in bytes), while len is the actual length in bytes of the value.\n\n| Data Type                                                                                    | Storage Requirement                                                                                        |\n| -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |\n| ENUM                                                            | 1 byte for up to 255 enum values, 2 bytes for 256 to 65,535 enum values                                    |\n| CHAR(M)                                                         | M × w bytes, where w is the number of bytes required for the maximum-length character in the character set |\n| BINARY(M)                                                     | M bytes                                                                                                    |\n| VARCHAR(M), VARBINARY(M)   | len + 1 bytes if column is 0 – 255 bytes, len + 2 bytes if column may require more than 255 bytes          |\n| TINYBLOB, TINYTEXT         | len + 1 bytes                                                                                              |\n| BLOB, TEXT                         | len + 2 bytes                                                                                              |\n| MEDIUMBLOB, MEDIUMTEXT | len + 3 bytes                                                                                              |\n| LONGBLOB, LONGTEXT         | len + 4 bytes                                                                                              |\n| XMLTYPE                                                      | len + 4 bytes (same as LONGBLOB)                                                                           |\n| SET                                                    | Given M members of the set, (M+7)/8 bytes, rounded up to 1, 2, 3, 4, or 8 bytes                            |\n| INET6                                                          | 16 bytes                                                                                                   |\n| UUID                                                  | 16 bytes                                                                                                   |\n\nNote: Introduced in MariaDB 12.3, the XMLTYPE data type has a maximum storage capacity of 4GB, similar to LONGBLOB_._\n\nIn some character sets, not all characters use the same number of bytes. utf8 encodes characters with one to three bytes per character, while utf8mb4 requires one to four bytes per character.\n\nWhen using field the COMPRESSED attribute, 1 byte is reserved for metadata. For example, VARCHAR(255) will use +2 bytes instead of +1.\n\nURL: https://mariadb.com/docs/server/reference/data-types/data-type-storage-requirements', '', 'https://mariadb.com/docs/server/reference/data-types/data-type-storage-requirements');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (3, 22, 'DATE', 'Syntax\n------\n\nDATE\n\nDescription\n-----------\n\nA date. The supported range is ''1000-01-01'' to ''9999-12-31''. MariaDB displays DATE values in ''YYYY-MM-DD'' format, but can be assigned dates in looser formats, including strings or numbers, as long as they make sense. These include a short year, YY-MM-DD, no delimiters, YYMMDD, or any other acceptable delimiter, for example YYYY/MM/DD. For details, see date and time literals.\n\n''0000-00-00'' is a permitted special value (zero-date), unless the NO_ZERO_DATE SQL_MODE is used. Also, individual components of a date can be set to 0 (for example: ''2015-00-12''), unless the NO_ZERO_IN_DATE SQL_MODE is used. In many cases, the result of en expression involving a zero-date, or a date with zero-parts, is NULL. If the ALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is in the range between 1 and 31, the date does not produce any error, even for months that have less than 31 days.\n\nOracle Mode\n\nIn Oracle mode, DATE with a time portion is a synonym for DATETIME. See also mariadb_schema.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATE);\n\nINSERT INTO t1 VALUES ("2010-01-12"), ("2011-2-28"), (''120314''),(''130421'');\n\nSELECT * FROM t1;\n+------------+\n| d          |\n+------------+\n| 2010-01-12 |\n| 2011-02-28 |\n| 2012-03-14 |\n| 2013-04-21 |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/date', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/date');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (4, 22, 'DATETIME', 'Syntax\n------\n\nDATETIME [(microsecond precision)]\n\nDescription\n-----------\n\nA date and time combination.\n\nMariaDB displays DATETIME values in ''YYYY-MM-DD HH:MM:SS.ffffff'' format, but allows assignment of values to DATETIME columns using either strings or numbers. For details, see date and time literals.\n\nDATETIME columns also accept CURRENT_TIMESTAMP as the default value.\n\nThe --mysql56-temporal-format option, on by default, allows MariaDB to store DATETME values using the same low-level format MySQL 5.6 uses. For more information, see Internal Format, below.\n\nFor storage requirements, see Data Type Storage Requirements.\n\nSupported Values\n\nMariaDB stores values that use the DATETIME data type in a format that supports values between 1000-01-01 00:00:00.000000 and 9999-12-31 23:59:59.999999.\n\nMariaDB can also store microseconds with a precision between 0 and 6. If no microsecond precision is specified, then 0 is used by default.\n\nMariaDB also supports ''0000-00-00'' as a special _zero-date_ value, unless NO_ZERO_DATE is specified in the SQL_MODE. Similarly, individual components of a date can be set to 0 (for example: ''2015-00-12''), unless NO_ZERO_IN_DATE is specified in the SQL_MODE. In many cases, the result of en expression involving a zero-date, or a date with zero-parts, is NULL. If the ALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is in the range between 1 and 31, the date does not produce any error, even for months that have less than 31 days.\n\nOracle Mode\n\nIn Oracle mode, DATE with a time portion is a synonym for DATETIME. See also mariadb_schema.\n\nInternal Format\n\nA new temporal format was introduced from MySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels. These changes allow these temporal data types to have fractional parts and negative values. You can disable this feature using the mysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of MariaDB or that were created while the mysql56_temporal_format system variable was disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format, execute an ALTER TABLE... MODIFY COLUMN statement that changes the column to the _same_ data type. This change may be needed if you want to export the table''s tablespace and import it onto a server that has mysql56_temporal_format=ON set (see MDEV-15225).\n\nFor instance, if you have a DATETIME column in your table:\n\n``sql\nSHOW VARIABLES LIKE ''mysql56_temporal_format'';\n\n+-------------------------+-------+\n| Variable_name           | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON    |\n+-------------------------+-------+\n\nALTER TABLE example_table MODIFY ts_col DATETIME;\n`\n\nWhen MariaDB executes the ALTER TABLE statement, it converts the data from the older temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data types that you want to switch over to the new format, make sure the system variable is enabled, then perform a dump and restore using mysqldump. The columns using relevant temporal data types are restored using the new temporal format.\n\nColumns with old temporal formats are marked with a / mariadb-5.3 / comment in the output of SHOW CREATE TABLE, SHOW COLUMNS, DESCRIBE statements, as well as in the COLUMN_TYPE column of the INFORMATION_SCHEMA.COLUMNS Table.\n\n`sql\nSHOW CREATE TABLE mariadb5312_datetime\\G\n************************ 1. row ***********************\n       Table: mariadb5312_datetime\nCreate Table: CREATE TABLE mariadb5312_datetime (\n  dt0 datetime / mariadb-5.3 / DEFAULT NULL,\n  dt6 datetime(6) / mariadb-5.3 / DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n``\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATETIME);\n\nINSERT INTO t1 VALUES ("2011-03-11"), ("2012-04-19 13:08:22"),\n ("2013-07-18 13:44:22.123456");\n\nSELECT  FROM t1;\n+---------------------+\n| d                   |\n+---------------------+\n| 2011-03-11 00:00:00 |\n| 2012-04-19 13:08:22 |\n| 2013-07-18 13:44:22 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/datetime', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/datetime');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (5, 22, 'SQL\\_TSI\\_YEAR', 'Description\n-----------\n\nSee YEAR.\n\nExamples\n--------\n\nCREATE TABLE sql_tsi_year_example (\n  example SQL_TSI_YEAR\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/sql_tsi_year', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/sql_tsi_year');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (6, 22, 'TIME', 'Syntax\n------\n\nTIME [(<microsecond precision>)]\n\nDescription\n-----------\n\nA time. The range is ''-838:59:59.999999'' to ''838:59:59.999999''. Microsecond precision can be from 0-6; if not specified 0 is used.\n\nMariaDB displays TIME values in ''HH:MM:SS.ssssss'' format, but allows assignment of times in looser formats, including ''D HH:MM:SS'', ''HH:MM:SS'', ''HH:MM'', ''D HH:MM'', ''D HH'', ''SS'', or ''HHMMSS'', as well as permitting dropping of any leading zeros when a delimiter is provided, for example ''3:9:10''. For details, see date and time literals.\n\nThe --mysql56-temporal-format option, on by default, allows MariaDB to store TIME values using the same low-level format MySQL 5.6 uses.\n\nInternal Format\n\nA new temporal format was introduced from MySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels. These changes allow these temporal data types to have fractional parts and negative values. You can disable this feature using the mysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of MariaDB or that were created while the mysql56_temporal_format system variable was disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format, execute an ALTER TABLE... MODIFY COLUMN statement that changes the column to the _same_ data type. This change may be needed if you want to export the table''s tablespace and import it onto a server that has mysql56_temporal_format=ON set (see MDEV-15225).\n\nFor instance, if you have a TIME column in your table:\n\n``sql\nSHOW VARIABLES LIKE ''mysql56_temporal_format'';\n\n+-------------------------+-------+\n| Variable_name           | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON    |\n+-------------------------+-------+\n\nALTER TABLE example_table MODIFY ts_col TIME;\n`\n\nWhen MariaDB executes the ALTER TABLE statement, it converts the data from the older temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data types that you want to switch over to the new format, make sure the system variable is enabled, then perform a dump and restore using mariadb-dump. The columns using relevant temporal data types are restored using the new temporal format.\n\nColumns with old temporal formats are marked with a / mariadb-5.3 / comment in the output of SHOW CREATE TABLE, SHOW COLUMNS, DESCRIBE statements, as well as in the COLUMN_TYPE column of the INFORMATION_SCHEMA.COLUMNS Table.\n\n`sql\nSHOW CREATE TABLE mariadb5312_time\\G\n************************ 1. row ***********************\n       Table: mariadb5312_time\nCreate Table: CREATE TABLE mariadb5312_time (\n  t0 time / mariadb-5.3 / DEFAULT NULL,\n  t6 time(6) / mariadb-5.3 / DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n``\n\nColumns with the current format are not marked with a comment.\n\nExamples\n--------\n\nINSERT INTO time VALUES (''90:00:00''), (''800:00:00''), (800), (22), (151413), (''9:6:3''), (''12 09'');\n\nSELECT  FROM time;\n+-----------+\n| t         |\n+-----------+\n| 90:00:00  |\n| 800:00:00 |\n| 00:08:00  |\n| 00:00:22  |\n| 15:14:13  |\n| 09:06:03  |\n| 297:00:00 |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/time', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/time');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (7, 22, 'TIMESTAMP', 'Syntax\n------\n\nTIMESTAMP [(<microsecond precision)]\n\nDescription\n-----------\n\nA timestamp in the format YYYY-MM-DD HH:MM:SS.ffffff.\n\nThe timestamp field is generally used to define at which moment in time a row was added or updated and by default will automatically be assigned the current datetime when a record is inserted or updated. The automatic properties only apply to the first TIMESTAMP in the record; subsequent TIMESTAMP columns will not be changed.\n\nMariaDB includes the --mysql56-temporal-format option, on by default, which allows MariaDB to store TIMESTAMP values using the same low-level format MySQL 5.6 uses.\n\nFor more information, see Internal Format.\n\nSupported Values\n\nMariaDB stores values that use the TIMESTAMP data type as the number of seconds since ''1970-01-01 00:00:00'' (UTC). This means that the TIMESTAMP data type can hold values between ''1970-01-01 00:00:01'' (UTC) and ''2106-02-07 06:28:15 UTC''.\n\nMariaDB stores values that use the TIMESTAMP data type as the number of seconds since ''1970-01-01 00:00:00'' (UTC). This means that the TIMESTAMP data type can hold values between ''1970-01-01 00:00:01'' (UTC) and ''2038-01-19 03:14:07'' (UTC).\n\nMariaDB can also store microseconds with a precision between 0 and 6. If no microsecond precision is specified, then 0 is used by default.\n\nAutomatic Values\n\nMariaDB has special behavior for the first column that uses the TIMESTAMP data type in a specific table when the system variable explicit_defaults_for_timestamp is not set (which was the default until MariaDB 10.10). For the first column that uses the TIMESTAMP data type in a specific table, MariaDB automatically assigns the following properties to the column:\n\n DEFAULT CURRENT_TIMESTAMP\n ON UPDATE CURRENT_TIMESTAMP\n\nThis means that if the column is not explicitly assigned a value in an INSERT or UPDATE query, then MariaDB will automatically initialize the column''s value with the current date and time.\n\nThis automatic initialization for INSERT and UPDATE queries can also be explicitly enabled for a column that uses the TIMESTAMP data type by specifying the DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses for the column. In these clauses, any synonym of CURRENT_TIMESTAMP is accepted, including CURRENT_TIMESTAMP(), NOW(), LOCALTIME, LOCALTIME(), LOCALTIMESTAMP, and LOCALTIMESTAMP().\n\nThis automatic initialization for INSERT queries can also be explicitly disabled for a column that uses the TIMESTAMP data type by specifying a constant DEFAULT value. For example, DEFAULT 0.\n\nThis automatic initialization for UPDATE queries can also be explicitly disabled for a column that uses the TIMESTAMP data type by specifying a DEFAULT clause for the column, but no ON UPDATE clause. If a DEFAULT clause is explicitly specified for a column that uses the TIMESTAMP data type, but an ON UPDATE clause is not specified for the column, then the timestamp value will not automatically change when an UPDATE statement is executed.\n\nMariaDB also has special behavior if NULL is assigned to column that uses the TIMESTAMP data type. If the column is assigned the NULL value in an INSERT or UPDATE query, then MariaDB will automatically initialize the column''s value with the current date and time. For details, see NULL values in MariaDB.\n\nThis automatic initialization for NULL values can also be explicitly disabled for a column that uses the TIMESTAMP data type by specifying the NULL attribute for the column. In this case, if the column''s value is set to NULL, then the column''s value will actually be set to NULL.\n\nTime Zones\n\nIf a column uses the TIMESTAMP data type, then any inserted values are converted from the session''s time zone to Coordinated Universal Time (UTC) when stored, and converted back to the session''s time zone when retrieved.\n\nMariaDB validates TIMESTAMP literals against the session''s time zone. For example, if a specific time range never occurred in a specific time zone due to daylight savings time, then TIMESTAMP values within that range would be invalid for that time zone.\n\nMariaDB does not store any time zone identifier with the value of the TIMESTAMP data type. See MDEV-10018 for more information.\n\nMariaDB does not support time zone literals that contain time zone identifiers. See MDEV-11829 for more information.\n\nLimitations\n\n Because the TIMESTAMP value is stored as Epoch Seconds, the timestamp value ''1970-01-01 00:00:00'' (UTC) is reserved since the second #0 is used to represent ''0000-00-00 00:00:00''.\n\nSQL_MODE=MAXDB\n\nIf the SQL_MODE is set to MAXDB, TIMESTAMP fields will be silently converted to DATETIME.\n\nInternal Format\n\nA temporal format was introduced from MySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels. These changes allow these temporal data types to have fractional parts and negative values. You can disable this feature using the mysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of MariaDB or that were created while the mysql56_temporal_format system variable was disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format, execute an ALTER TABLE... MODIFY COLUMN statement that changes the column to the _same_ data type. This change may be needed if you want to export the table''s tablespace and import it onto a server that has mysql56_temporal_format=ON set (see MDEV-15225).\n\nFor instance, if you have a TIMESTAMP column in your table:\n\n``sql\nSHOW VARIABLES LIKE ''mysql56_temporal_format'';\n\n+-------------------------+-------+\n| Variable_name           | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON    |\n+-------------------------+-------+\n\nALTER TABLE example_table MODIFY ts_col TIMESTAMP;\n`\n\nWhen MariaDB executes the ALTER TABLE statement, it converts the data from the older temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data types that you want to switch over to the new format, make sure the system variable is enabled, then perform a dump and restore using mariadb-dump. The columns using relevant temporal data types are restored using the new temporal format.\n\nColumns with old temporal formats are marked with a / mariadb-5.3 / comment in the output of SHOW CREATE TABLE, SHOW COLUMNS, DESCRIBE statements, as well as in the COLUMN_TYPE column of the INFORMATION_SCHEMA.COLUMNS Table.\n\nColumns with old temporal formats are not marked with a / mariadb-5.3 / comment in the output of SHOW CREATE TABLE, SHOW COLUMNS, DESCRIBE statements, as well as in the COLUMN_TYPE column of the INFORMATION_SCHEMA.COLUMNS Table.\n\n`sql\nSHOW CREATE TABLE mariadb5312_timestamp\\G\n*********************** 1. row ***********************\n       Table: mariadb5312_timestamp\nCreate Table: CREATE TABLE mariadb5312_timestamp (\n  ts0 timestamp / mariadb-5.3 / NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  ts6 timestamp(6) / mariadb-5.3 / NOT NULL DEFAULT ''0000-00-00 00:00:00.000000''\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n``\n\nExamples\n--------\n\nCREATE TABLE t (id INT, ts TIMESTAMP);\n\nDESC t;\n+-------+-----------+------+-----+-------------------+-----------------------------+\n| Field | Type      | Null | Key | Default           | Extra                       |\n+-------+-----------+------+-----+-------------------+-----------------------------+\n| id    | int(11)   | YES  |     | NULL              |                             |\n| ts    | timestamp | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |\n+-------+-----------+------+-----+-------------------+-----------------------------+\n\nINSERT INTO t(id)  VALUES (1),(2);\n\nSELECT  FROM t;\n+------+---------------------+\n| id   | ts                  |\n+------+---------------------+\n|    1 | 2013-07-22 12:50:05 |\n|    2 | 2013-07-22 12:50:05 |\n+------+---------------------+\n\nINSERT INTO t  VALUES (3,NULL),(4,''2001-07-22 12:12:12'');\n\nSELECT * FROM t;\n+------+---------------------+\n| id   | ts                  |\n+------+---------------------+\n|    1 | 2013-07-22 12:50:05 |\n|    2 | 2013-07-22 12:50:05 |\n|    3 | 2013-07-22 12:51:56 |\n|    4 | 2001-07-22 12:12:12 |\n+------+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/timestamp', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/timestamp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (8, 22, 'YEAR Data Type', 'Syntax\n------\n\nYEAR[(4)]\n\nDescription\n-----------\n\nA year in four-digit format. The two-digit format, while supported, is error-prone and deprecated since 2012.\n\nIn four-digit format, the allowable values are 1901 to 2155, and 0000. In two-digit format, the allowable values are 70 to 69, representing years from 1970 to 2069. MariaDB displays YEAR values in YYYY format, but allows you to assign values to YEAR columns using either strings or numbers.\n\nInserting numeric zero has a different result for YEAR(4) and YEAR(2). For YEAR(2), the value 00 reflects the year 2000. For YEAR(4), the value 0000 reflects the year zero. This only applies to numeric zero. String zero always reflects the year 2000.\n\nExamples\n--------\n\nCREATE TABLE y(y YEAR);\n\nINSERT INTO y VALUES (1990),(''2012'');\n\nSELECT * FROM y;\n+------+\n| y    |\n+------+\n| 1990 |\n| 2012 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/year-data-type', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/year-data-type');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (9, 22, 'NULL Values', 'Description\n-----------\n\nNULL represents an unknown value. It is _not_ an empty string (by default), or a zero value. These are all valid values, and are not NULL values.\n\nWhen a table is created or the format altered, columns can be specified as accepting NULL values, or not accepting them, with the NULL and NOT NULL clauses respectively.\n\nFor example, a customer table could contain dates of birth. For some customers, this information is unknown, so the value could be NULL.\n\nThe same system could allocate a customer ID for each customer record, and in this case a NULL value would not be permitted.\n\n``sql\nCREATE TABLE customer (\n id INT NOT NULL, \n date_of_birth DATE NULL\n...\n)\n`\n\nUser-defined variables are NULL until a value is explicitly assigned.\n\nStored routines parameters and local variables can always be set to NULL. If no DEFAULT value is specified for a local variable, its initial value will be NULL. If no value is assigned to an OUT parameter in a stored procedure, NULL is assigned at the end of the procedure.\n\nSyntax\n\nThe case of NULL is not relevant. (uppercase) is an alias for NULL.\n\nThe IS operator accepts UNKNOWN as an alias for NULL, which is meant for boolean contexts.\n\nComparison Operators\n\nNULL values cannot be used with most comparison operators. For example, =, >, >=, <=, <, or != cannot be used, as any comparison with a NULL always returns a NULL value, never true (1) or false (0).\n\n`sql\nSELECT NULL = NULL;\n+-------------+\n| NULL = NULL |\n+-------------+\n|        NULL |\n+-------------+\n\nSELECT 99 = NULL;\n+-----------+\n| 99 = NULL |\n+-----------+\n|      NULL |\n+-----------+\n`\n\nTo overcome this, certain operators are specifically designed for use with NULL values. To cater for testing equality between two values that may contain NULL values, there''s <=>, NULL-safe equal.\n\n`sql\nSELECT 99 <=> NULL, NULL <=> NULL;\n+-------------+---------------+\n| 99 <=> NULL | NULL <=> NULL |\n+-------------+---------------+\n|           0 |             1 |\n+-------------+---------------+\n`\n\nOther operators for working with NULL values include IS NULL and IS NOT NULL, ISNULL (for testing an expression) and COALESCE (for returning the first non-NULL parameter).\n\nOrdering\n\nWhen you order by a field that may contain NULL values, any NULL values are considered to have the lowest value. So ordering in DESC order will see the NULL values appearing last. To force NULL values to be regarded as highest values, one can add another column which has a higher value when the main field is NULL. Example:\n\n`sql\nSELECT col1 FROM tab ORDER BY ISNULL(col1), col1;\n`\n\nDescending order, with NULL values first:\n\n`sql\nSELECT col1 FROM tab ORDER BY IF(col1 IS NULL, 0, 1), col1 DESC;\n`\n\nAll NULL values are also regarded as equivalent for the purposes of the DISTINCT and GROUP BY clauses.\n\nFunctions\n\nIn most cases, functions will return NULL if any of the parameters are NULL. There are also functions specifically for handling NULL values. These include IFNULL(), NULLIF() and COALESCE().\n\n`sql\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 COALESCE(NULL,NULL,1);\n+-----------------------+\n| COALESCE(NULL,NULL,1) |\n+-----------------------+\n|                     1 |\n+-----------------------+\n`\n\nAggregate functions, such as SUM and AVG ignore NULL values.\n\n`sql\nCREATE TABLE t(x INT);\n\nINSERT INTO t VALUES (1),(9),(NULL);\n\nSELECT SUM(x) FROM t;\n+--------+\n| SUM(x) |\n+--------+\n|     10 |\n+--------+\n\nSELECT AVG(x) FROM t;\n+--------+\n| AVG(x) |\n+--------+\n| 5.0000 |\n+--------+\n`\n\nThe one exception is COUNT(\\), which counts rows, and doesn''t look at whether a value is NULL or not. Compare for example, COUNT(x), which ignores the NULL, and COUNT(), which counts it:\n\n`sql\nSELECT COUNT(x) FROM t;\n+----------+\n| COUNT(x) |\n+----------+\n|        2 |\n+----------+\n\nSELECT COUNT() FROM t;\n+----------+\n| COUNT() |\n+----------+\n|        3 |\n+----------+\n`\n\nAUTO_INCREMENT, TIMESTAMP and Virtual Columns\n\nMariaDB handles NULL values in a special way if the field is an AUTO_INCREMENT, a TIMESTAMP or a virtual column. Inserting a NULL value into a numeric AUTO_INCREMENT column will result in the next number in the auto increment sequence being inserted instead. This technique is frequently used with AUTO_INCREMENT fields, which are left to take care of themselves.\n\n`sql\nCREATE TABLE t2(id INT PRIMARY KEY AUTO_INCREMENT, letter CHAR(1));\n\nINSERT INTO t2(letter) VALUES (''a''),(''b'');\n\nSELECT  FROM t2;\n+----+--------+\n| id | letter |\n+----+--------+\n|  1 | a      |\n|  2 | b      |\n+----+--------+\n`\n\nSimilarly, if a NULL value is assigned to a TIMESTAMP field, the current date and time is assigned instead.\n\n`sql\nCREATE TABLE t3 (x INT, ts TIMESTAMP);\n\nINSERT INTO t3(x) VALUES (1),(2);\n`\n\nAfter a pause:\n\n`sql\nINSERT INTO t3(x) VALUES (3);\n\nSELECT FROM t3;\n+------+---------------------+\n| x    | ts                  |\n+------+---------------------+\n|    1 | 2013-09-05 10:14:18 |\n|    2 | 2013-09-05 10:14:18 |\n|    3 | 2013-09-05 10:14:29 |\n+------+---------------------+\n`\n\nIf a NULL is assigned to a VIRTUAL or PERSISTENT column, the default value is assigned instead.\n\n`sql\nCREATE TABLE virt (c INT, v INT AS (c+10) PERSISTENT) ENGINE=InnoDB;\n\nINSERT INTO virt VALUES (1, NULL);\n\nSELECT c, v FROM virt;\n+------+------+\n| c    | v    |\n+------+------+\n|    1 |   11 |\n+------+------+\n`\n\nIn all these special cases, NULL is equivalent to the DEFAULT keyword.\n\nInserting\n\nIf a NULL value is single-row inserted into a column declared as NOT NULL, an error will be returned. However, if the SQL mode is not strict (strict is the default), if a NULL value is multi-row inserted into a column declared as NOT NULL, the implicit default for the column type will be inserted (and NOT` the default value in the table definition). The implicit defaults are an empty string for string types, and the zero value for numeric, date and time types.\n\nBy default, both cases will result in an error.\n\nExamples\n--------\n\nCREATE TABLE nulltest (\n  a INT(11), \n  x VARCHAR(10) NOT NULL DEFAULT ''a'', \n  y INT(11) NOT NULL DEFAULT 23\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/null-values', '', 'https://mariadb.com/docs/server/reference/data-types/null-values');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (10, 22, 'BIGINT', 'Syntax\n------\n\nBIGINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA large integer. The signed range is -9223372036854775808 to9223372036854775807. The unsigned range is 0 to18446744073709551615.\n\nIf a column has been set to ZEROFILL, all values will be prepended by zeros so that the BIGINT value contains a number of M digits.\n\nNote: If the ZEROFILL attribute has been specified, the column will automatically become UNSIGNED.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nSERIAL is an alias for:\n\n``sql\nBIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE\n`\n\nINT8 is a synonym for BIGINT`.\n\nExamples\n--------\n\nCREATE TABLE bigints (a BIGINT,b BIGINT UNSIGNED,c BIGINT ZEROFILL);\n\nINSERT INTO bigints VALUES (-10,-10,-10);\nERROR 1264 (22003): Out of range value for column ''b'' at row 1\n\nINSERT INTO bigints VALUES (-10,10,-10);\nERROR 1264 (22003): Out of range value for column ''c'' at row 1\n\nINSERT INTO bigints VALUES (-10,10,10);\n\nINSERT INTO bigints VALUES (9223372036854775808,9223372036854775808,9223372036854775808);\nERROR 1264 (22003): Out of range value for column ''a'' at row 1\n\nINSERT INTO bigints VALUES (9223372036854775807,9223372036854775808,9223372036854775808);\n\nSELECT * FROM bigints;\n+---------------------+---------------------+----------------------+\n| a                   | b                   | c                    |\n+---------------------+---------------------+----------------------+\n|                 -10 |                  10 | 00000000000000000010 |\n| 9223372036854775807 | 9223372036854775808 | 09223372036854775808 |\n+---------------------+---------------------+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bigint', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bigint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (11, 22, 'BIT', 'Syntax\n------\n\nBIT[(M)]\n\nDescription\n-----------\n\nA bit-field type. M indicates the number of bits per value, from 1 to64. The default is 1 if M is omitted.\n\nBit values can be inserted with b''value'' notation, where value is the bit value in 0''s and 1''s.\n\nBit fields are automatically zero-padded from the left to the full length of the bit, so for example in a BIT(4) field, ''10'' is equivalent to ''0010''.\n\nBits are returned as binary, so to display them, either add 0, or use a function such as HEX, OCT or BIN to convert them.\n\nExamples\n--------\n\nCREATE TABLE bit_example (\n  description VARCHAR(20),\n  b1 BIT,\n  b4 BIT(4),\n  b16 BIT(16)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bit', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bit');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (12, 22, 'BOOL', 'Description\n-----------\n\nSee TINYINT.\n\nExamples\n--------\n\nCREATE TABLE bool_example (\n  example BOOL\n) DEFAULT CHARSET=latin1;\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bool', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bool');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (13, 22, 'BOOLEAN', 'Syntax\n------\n\nBOOL, BOOLEAN\n\nDescription\n-----------\n\nThese types are synonyms for TINYINT(1). A value of zero is considered false. Non-zero values are considered true.\n\nHowever, the values TRUE and FALSE are merely aliases for 1 and 0. See Boolean Literals, as well as the IS operator for testing values against a boolean.\n\nExamples\n--------\n\nCREATE TABLE boolean_example (\n  example BOOLEAN\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/boolean', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/boolean');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (14, 22, 'DEC, NUMERIC, FIXED', 'Syntax\n------\n\nDEC[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n\nNUMERIC[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n\nFIXED[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nThese types are synonyms for DECIMAL. The FIXED synonym is available for compatibility with other database systems.\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/dec-numeric-fixed', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/dec-numeric-fixed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (15, 22, 'DECIMAL', 'Syntax\n------\n\nDECIMAL[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA packed "exact" fixed-point number. M is the total number of digits (the precision), and D is the number of digits after the decimal point (the scale).\n\n The decimal point and (for negative numbers) the "-" sign are not counted in M.\n If D is 0, values have no decimal point or fractional part, and on INSERT, the value will be rounded to the nearest DECIMAL.\n The maximum number of digits (M) for DECIMAL is 65.\n The maximum number of supported decimals (D) is 30 before MariadB 10.2.1 and 38 afterwards.\n If D is omitted, the default is 0. If M is omitted, the default is 10.\n\nUNSIGNED, if specified, disallows negative values.\n\nZEROFILL, if specified, pads the number with zeros, up to the total number of digits specified by M.\n\nAll basic calculations (+, -, \\, /) with DECIMAL columns are done with a precision of 65 digits.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nDEC, NUMERIC, and FIXED are synonyms, as well as NUMBER in Oracle mode.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DECIMAL UNSIGNED ZEROFILL);\n\nINSERT INTO t1 VALUES (1),(2),(3),(4.0),(5.2),(5.7);\nQuery OK, 6 rows affected, 2 warnings (0.16 sec)\nRecords: 6  Duplicates: 0  Warnings: 2\n\nNote (sql 1265): Data truncated for column ''d'' at row 5\nNote (sql 1265): Data truncated for column ''d'' at row 6\n\nSELECT * FROM t1;\n+------------+\n| d          |\n+------------+\n| 0000000001 |\n| 0000000002 |\n| 0000000003 |\n| 0000000004 |\n| 0000000005 |\n| 0000000006 |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/decimal', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/decimal');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (16, 22, 'DOUBLE PRECISION', 'Syntax\n------\n\nDOUBLE PRECISION[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nREAL[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nREAL and DOUBLE PRECISION are synonyms for DOUBLE.\n\nException: If the REAL_AS_FLOAT SQL mode is enabled, REAL is a synonym for FLOAT rather than DOUBLE.\n\nExamples\n--------\n\nCREATE TABLE double_precision_example (\n  example DOUBLE PRECISION\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/double-precision', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/double-precision');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (17, 22, 'DOUBLE', 'Syntax\n------\n\nDOUBLE[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nDOUBLE PRECISION[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nREAL[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA normal-size (double-precision) floating-point number (see FLOAT for a single-precision floating-point number). Allowable values are:\n\n -1.7976931348623157E+308 to -2.2250738585072014E-308\n 0\n 2.2250738585072014E-308 to 1.7976931348623157E+308\n\nThese are the theoretical limits, based on the IEEE standard. The actual range might be slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following the decimal point. If M and D are omitted, values are stored to the limits allowed by the hardware. A double-precision floating-point number is accurate to approximately 15 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nZEROFILL, if specified, pads the number with zeros, up to the total number of digits specified by M.\n\nREAL and DOUBLE PRECISION are synonyms, unless the REAL_AS_FLOAT SQL mode is enabled, in which case REAL is a synonym for FLOAT rather than DOUBLE.\n\nSee Floating Point Accuracy for issues when using floating-point numbers.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DOUBLE(5,0) zerofill);\n\nINSERT INTO t1 VALUES (1),(2),(3),(4);\n\nSELECT  FROM t1;\n+-------+\n| d     |\n+-------+\n| 00001 |\n| 00002 |\n| 00003 |\n| 00004 |\n+-------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/double', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/double');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (18, 22, 'FIXED', 'Description\n-----------\n\nSee DECIMAL.\n\nExamples\n--------\n\nCREATE TABLE fixed_example (\n  example FIXED\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/fixed', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/fixed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (19, 22, 'FLOAT', 'Syntax\n------\n\nFLOAT[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA small (single-precision) floating-point number (see DOUBLE for a regular-size floating point number). Allowable values are:\n\n -3.402823466E+38 to -1.175494351E-38\n 0\n* 1.175494351E-38 to 3.402823466E+38.\n\nThese are the theoretical limits, based on the IEEE standard. The actual range might be slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following the decimal point. If M and D are omitted, values are stored to the limits allowed by the hardware. A single-precision floating-point number is accurate to approximately 7 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nUsing FLOAT might give you some unexpected problems because all calculations in MariaDB are done with double precision. See Floating Point Accuracy.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE float_signed_example (\n  description VARCHAR(20),\n  example FLOAT,\n  sz6_2 FLOAT(6,2),\n  sz20_19 FLOAT(20,19) SIGNED\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (20, 22, 'FLOAT4', 'Description\n-----------\n\nSee FLOAT.\n\nExamples\n--------\n\nCREATE TABLE float4_example (\n  example FLOAT4\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float4', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float4');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (21, 22, 'FLOAT8', 'Description\n-----------\n\nSee DOUBLE.\n\nExamples\n--------\n\nCREATE TABLE float8_example (\n  example FLOAT8\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float8', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float8');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (22, 22, 'Floating-point Accuracy', 'Description\n-----------\n\nDue to their nature, not all floating-point numbers can be stored with exact precision. Hardware architecture, the CPU or even the compiler version and optimization level may affect the precision.\n\nIf you are comparing DOUBLEs or FLOATs with numeric decimals, it is not safe to use the equality operator.\n\nSometimes, changing a floating-point number from single-precision (FLOAT) to double-precision (DOUBLE) will fix the problem.\n\nExamples\n--------\n\nCREATE TABLE fpn (id INT, f1 FLOAT, f2 DOUBLE, f3 DECIMAL (10,3));\nINSERT INTO fpn VALUES (1,2,2,2),(2,0.1,0.1,0.1);\n\nSELECT  FROM fpn WHERE f1f1 = f2*f2;\n+------+------+------+-------+\n| id   | f1   | f2   | f3    |\n+------+------+------+-------+\n|    1 |    2 |    2 | 2.000 |\n+------+------+------+-------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/floating-point-accuracy', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/floating-point-accuracy');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (23, 22, 'INT', 'Syntax\n------\n\nINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\nINTEGER[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA normal-size integer. When marked UNSIGNED, it ranges from 0 to 4294967295, otherwise its range is -2147483648 to 2147483647 (SIGNED is the default). If a column has been set to ZEROFILL, all values will be prepended by zeros so that the INT value contains a number of M digits. INTEGER is a synonym for INT.\n\nNote: If the ZEROFILL attribute has been specified, the column will automatically become UNSIGNED.\n\nINT4 is a synonym for INT.\n\nFor details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE ints (a INT,b INT UNSIGNED,c INT ZEROFILL);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (24, 22, 'INT1', 'Description\n-----------\n\nINT1 is a synonym for TINYINT.\n\n``sql\nCREATE TABLE t1 (x INT1);\n\nDESC t1;\n+-------+------------+------+-----+---------+-------+\n| Field | Type       | Null | Key | Default | Extra |\n+-------+------------+------+-----+---------+-------+\n| x     | tinyint(4) | YES  |     | NULL    |       |\n+-------+------------+------+-----+---------+-------+\n``\n\nExamples\n--------\n\nCREATE TABLE int1_example (\n  example INT1\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int1', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int1');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (25, 22, 'INT2', 'Description\n-----------\n\nINT2 is a synonym for SMALLINT.\n\n``sql\nCREATE TABLE t1 (x INT2);\n\nDESC t1;\n+-------+-------------+------+-----+---------+-------+\n| Field | Type        | Null | Key | Default | Extra |\n+-------+-------------+------+-----+---------+-------+\n| x     | smallint(6) | YES  |     | NULL    |       |\n+-------+-------------+------+-----+---------+-------+\n``\n\nExamples\n--------\n\nCREATE TABLE int2_example (\n  example INT2\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int2', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int2');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (26, 22, 'INT3', 'Description\n-----------\n\nINT3 is a synonym for MEDIUMINT.\n\n``sql\nCREATE TABLE t1 (x INT3);\n\nDESC t1;\n+-------+--------------+------+-----+---------+-------+\n| Field | Type         | Null | Key | Default | Extra |\n+-------+--------------+------+-----+---------+-------+\n| x     | mediumint(9) | YES  |     | NULL    |       |\n+-------+--------------+------+-----+---------+-------+\n``\n\nExamples\n--------\n\nCREATE TABLE int3_example (\n  example INT3\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int3', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int3');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (27, 22, 'INT4', 'Description\n-----------\n\nINT4 is a synonym for INT.\n\n``sql\nCREATE TABLE t1 (x INT4);\n\nDESC t1;\n+-------+---------+------+-----+---------+-------+\n| Field | Type    | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| x     | int(11) | YES  |     | NULL    |       |\n+-------+---------+------+-----+---------+-------+\n``\n\nExamples\n--------\n\nCREATE TABLE int4_example (\n  example INT4\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int4', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int4');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (28, 22, 'INT8', 'Description\n-----------\n\nINT8 is a synonym for BIGINT.\n\n``sql\nCREATE TABLE t1 (x INT8);\n\nDESC t1;\n+-------+------------+------+-----+---------+-------+\n| Field | Type       | Null | Key | Default | Extra |\n+-------+------------+------+-----+---------+-------+\n| x     | bigint(20) | YES  |     | NULL    |       |\n+-------+------------+------+-----+---------+-------+\n``\n\nExamples\n--------\n\nCREATE TABLE int8_example (\n  example INT8\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int8', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int8');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (29, 22, 'INTEGER', 'Syntax\n------\n\nINTEGER[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nThis type is a synonym for INT.\n\nExamples\n--------\n\nCREATE TABLE integer_example (\n  example INTEGER\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/integer', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/integer');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (30, 22, 'MEDIUMINT', 'Syntax\n------\n\nMEDIUMINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA medium-sized integer. The signed range is -8388608 to 8388607. The unsigned range is 0 to 16777215.\n\nZEROFILL pads the integer with zeroes and assumes UNSIGNED (even if UNSIGNED is not specified).\n\nINT3 is a synonym for MEDIUMINT.\n\nFor details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE mediumints (a MEDIUMINT,b MEDIUMINT UNSIGNED,c MEDIUMINT ZEROFILL);\n\nDESCRIBE mediumints;\n+-------+--------------------------------+------+-----+---------+-------+\n| Field | Type                           | Null | Key | Default | Extra |\n+-------+--------------------------------+------+-----+---------+-------+\n| a     | mediumint(9)                   | YES  |     | NULL    |       |\n| b     | mediumint(8) unsigned          | YES  |     | NULL    |       |\n| c     | mediumint(8) unsigned zerofill | YES  |     | NULL    |       |\n+-------+--------------------------------+------+-----+---------+-------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/mediumint', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/mediumint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (31, 22, 'MIDDLEINT', 'Description\n-----------\n\nSee MEDIUMINT.\n\nExamples\n--------\n\nCREATE TABLE middleint_example (\n  example MIDDLEINT\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/middleint', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/middleint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (32, 22, 'NUMBER', 'Description\n-----------\n\n``sql\nNUMBER[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n`\n\nIn Oracle mode, NUMBER` is a synonym for DECIMAL.\n\nExamples\n--------\n\nSET sql_mode=''oracle'';\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/number', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/number');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (33, 22, 'Numeric Data Type Overview', 'Description\n-----------\n\nThere are a number of numeric data types:\n\n BOOLEAN - Synonym for TINYINT(1)\n INT1 - Synonym for TINYINT\n INT2 - Synonym for SMALLINT\n INT3 - Synonym for MEDIUMINT\n INT, INTEGER\n INT4 - Synonym for INT\n INT8 - Synonym for BIGINT\n TINYINT\n SMALLINT\n MEDIUMINT\n BIGINT\n DECIMAL, DEC, NUMERIC, FIXED\n FLOAT\n DOUBLE, DOUBLE PRECISION, REAL\n BIT\n VECTOR\n\nSee the specific articles for detailed information on each.\n\nSIGNED, UNSIGNED and ZEROFILL\n\nMost numeric types can be defined as SIGNED, UNSIGNED or ZEROFILL, for example:\n\n``sql\nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n`\n\nIf SIGNED, or no attribute, is specified, a portion of the numeric type will be reserved for the sign (plus or minus). For example, a TINYINT SIGNED can range from -128 to 127.\n\nIf UNSIGNED is specified, no portion of the numeric type is reserved for the sign, so for integer types range can be larger. For example, a TINYINT UNSIGNED can range from 0 to 255. Floating point and fixed-point types also can be UNSIGNED, but this only prevents negative values from being stored and doesn''t alter the range.\n\nIf ZEROFILL is specified, the column will be set to UNSIGNED and the spaces used by default to pad the field are replaced with zeros. ZEROFILL is ignored in expressions or as part of a UNION. ZEROFILL is a non-standard MySQL and MariaDB enhancement.\n\nNote that although the preferred syntax indicates that the attributes are exclusive, more than one attribute can be specified.\n\nOnly the following combinations are supported:\n\n SIGNED\n UNSIGNED\n ZEROFILL\n UNSIGNED ZEROFILL\n ZEROFILL UNSIGNED\n\nThe latter two should be replaced with simply ZEROFILL`, but are still accepted by the parser.\n\nExamples\n--------\n\nCREATE TABLE zf (\n  i1 TINYINT SIGNED,\n  i2 TINYINT UNSIGNED,\n  i3 TINYINT ZEROFILL\n);\n\nINSERT INTO zf VALUES (2,2,2);\n\nSELECT  FROM zf;\n+------+------+------+\n| i1   | i2   | i3   |\n+------+------+------+\n|    2 |    2 |  002 |\n+------+------+------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric-data-type-overview', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric-data-type-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (34, 22, 'DEC', 'Description\n-----------\n\nSee DECIMAL.\n\nExamples\n--------\n\nCREATE TABLE dec_example (\n  example DEC\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric-data-types-dec', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric-data-types-dec');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (35, 22, 'NUMERIC', 'Description\n-----------\n\nSee DECIMAL.\n\nExamples\n--------\n\nCREATE TABLE numeric_example (\n  example NUMERIC\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (36, 22, 'REAL', 'Description\n-----------\n\nSee DOUBLE.\n\nExamples\n--------\n\nCREATE TABLE real_example (\n  example REAL\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/real', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/real');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (37, 22, 'SMALLINT', 'Syntax\n------\n\nSMALLINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA small integer. The signed range is -32768 to 32767. The unsigned range is 0 to 65535.\n\nIf a column has been set to ZEROFILL, all values will be prepended by zeros so that the SMALLINT value contains a number of M digits.\n\nNote:\n\nIf the ZEROFILL attribute has been specified, the column will automatically become UNSIGNED.\n\nINT2 is a synonym for SMALLINT.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE smallints (a SMALLINT,b SMALLINT UNSIGNED,c SMALLINT ZEROFILL);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/smallint', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/smallint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (38, 22, 'TINYINT', 'Syntax\n------\n\nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA very small integer. The signed range is -128 to 127. The unsigned range is 0 to 255. For details on the attributes, see Numeric Data Type Overview.\n\nINT1, BOOL, and BOOLEAN are synonyms for TINYINT.\n\nExamples\n--------\n\nCREATE TABLE tinyints (a TINYINT,b TINYINT UNSIGNED,c TINYINT ZEROFILL);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/tinyint', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/tinyint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (39, 22, 'VECTOR', 'Syntax\n------\n\nVECTOR(N)\n\nDescription\n-----------\n\nThe VECTOR data type was added as part of the vectors feature, which permits MariaDB Server to perform as a relational vector database. N represents the fixed number of dimensions of the vector up to a maximum of 16383. The N dimension will be determined by the embedding algorithm.\n\nExamples\n--------\n\nCREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, v VECTOR(5) NOT NULL,\n VECTOR INDEX (v));\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/vector', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/vector');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (40, 22, 'ROW TYPE OF', 'Description\n-----------\n\nThis is special declaration only available inside a stored procedure.\n\nExamples\n--------\n\nCREATE TABLE rowtypeof_table(\n  descr VARCHAR(20),\n  val INT\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/row-type-of', '', 'https://mariadb.com/docs/server/reference/data-types/row-type-of');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (41, 22, 'SERIAL', 'Description\n-----------\n\nThis is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.\n\nExamples\n--------\n\nCREATE TABLE serial_example (\n  id SERIAL,\n  data VARCHAR(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/serial', '', 'https://mariadb.com/docs/server/reference/data-types/serial');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (42, 22, 'BINARY', 'Description\n-----------\n\nThe BINARY type is similar to the CHAR type, but stores binary byte strings rather than non-binary character strings. M represents the column length in bytes.\n\nIt contains no character set, and comparison and sorting are based on the numeric value of the bytes.\n\nIf the maximum length is exceeded, and SQL strict mode is not enabled , the extra characters will be dropped with a warning. If strict mode is enabled, an error will occur.\n\nBINARY values are right-padded with 0x00 (the zero byte) to the specified length when inserted. The padding is _not_ removed on select, so this needs to be taken into account when sorting and comparing, where all bytes are significant. The zero byte, 0x00 is less than a space for comparison purposes.\n\nUse Cases for Zero Length\n\nA BINARY(0) or VARBINARY(0) column is restricted to an empty byte string or NULL.\n\n Schema Preservation: Use these columns when a system expects a specific column to exist, but no data storage is required for your current application.\n Space-Efficient Indicators: These columns can act as a two-state indicator where the presence of an empty byte string represents one state and NULL represents another.\n\nIf you attempt to insert a value other than an empty string, MariaDB returns an ERROR 1406 (22001) indicating the data is too long for the column.\n\nExamples\n--------\n\nCREATE TABLE bins (a BINARY(10));\n\nINSERT INTO bins VALUES(''12345678901'');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSELECT * FROM bins;\n+------------+\n| a          |\n+------------+\n| 1234567890 |\n+------------+\n\nSET sql_mode=''STRICT_ALL_TABLES'';\n\nINSERT INTO bins VALUES(''12345678901'');\nERROR 1406 (22001): Data too long for column ''a'' at row 1\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/binary', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/binary');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (43, 22, 'BLOB and TEXT Data Types', 'Description\n-----------\n\nA BLOB is a binary large object that can hold a variable amount of data. The four BLOB types are\n\n TINYBLOB,\n BLOB,\n MEDIUMBLOB, and\n LONGBLOB.\n\nThese differ only in the maximum length of the values they can hold.\n\nThe TEXT types are\n\n TINYTEXT,\n TEXT,\n MEDIUMTEXT, and\n LONGTEXT.\n JSON (alias for LONGTEXT)\n\nThese correspond to the four BLOB types and have the same maximum lengths and storage requirements.\n\nBLOB and TEXT columns can have a DEFAULT value.\n\nIt is possible to set a unique index on columns that use the BLOB or TEXT data types.\n\nHandling Large Data via APIs\n\nWhen working with very large BLOB or TEXT values, the data may exceed the limit set by the max_allowed_packet system variable. To avoid this—and to reduce memory consumption on the client—most MariaDB connectors allow you to "stream" data in chunks.\n\n Connector/C: Use mysql_stmt_send_long_data() to send parameter data in pieces before calling mysql_stmt_execute(). This bypasses max_allowed_packet  limits and reduces the peak memory footprint (RSS) of the application.\n Connector/J: Use PreparedStatement.setBinaryStream() (for BLOB) or PreparedStatement.setCharacterStream() (for TEXT).\n Protocol: These APIs utilize the COM_STMT_SEND_LONG_DATA command, which appends data to a parameter on the server side.\n\nTechnical Rules for C/C++\n\n 0-Based Indexing: Parameter numbering starts at 0.\n The  is_null Flag: This must be 0; if set to nonzero, the server may discard the streamed data.\n Resetting: Use  mysql_stmt_reset() to clear all accumulated long data on the server if you need to abort or retry.\n Chunk Size: A practical performance "sweet spot" is between 64 KB and 1 MB per chunk.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/blob-and-text-data-types', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/blob-and-text-data-types');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (44, 22, 'BLOB', 'Syntax\n------\n\nBLOB[(M)]\n\nDescription\n-----------\n\nIf you are handling large binary data that exceeds the max_allowed_packet limit, you can stream the data in chunks using specialized API functions like mysql_stmt_send_long_data() or setBinaryStream(). See Handling Large Data via APIs for more details.\n\nA BLOB column with a maximum length of 65,535 (2¹⁶ - 1) bytes. Each BLOB value is stored using a two-byte length prefix that indicates the number of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MariaDB creates the column as the smallest BLOB type large enough to hold values _M_ bytes long.\n\nBLOB values can also be used to store dynamic columns.\n\nBLOB and TEXT columns can both be assigned a DEFAULT value.\n\nIndexing\n\nOn a column that uses the BLOB data type, setting a unique index is now possible.\n\nNote\n\nIn previous releases, setting a unique index on a column that uses the BLOB data type was not possible. Index would only guarantee the uniqueness of a fixed number of characters.\n\nOracle Mode\n\nIn Oracle mode, BLOB is a synonym for LONGBLOB.\n\nExamples\n--------\n\nCREATE TABLE blob_example (\n   description VARCHAR(20),\n   example BLOB\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/blob', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/blob');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (45, 22, 'CHAR BYTE', 'Description\n-----------\n\nThe CHAR BYTE data type is an alias for the BINARY data type. This is a compatibility feature.\n\nExamples\n--------\n\nCREATE TABLE char_byte_example (\n  example CHAR BYTE\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/char-byte', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/char-byte');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (46, 22, 'CHAR VARYING', 'Description\n-----------\n\nThis is a synonym for VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE char_varying_example (\n  example CHAR VARYING(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/char-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/char-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (47, 22, 'CHAR', 'Syntax\n------\n\n[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA fixed-length string that is always right-padded with spaces to the specified length when stored. M represents the column length in characters. The range of M is 0 to 255. If M is omitted, the length is 1.\n\nTrailing spaces are removed when CHAR values are retrieved unless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nIf a unique index consists of a column where trailing pad characters are stripped or ignored, inserts into that column where values differ only by the number of trailing pad characters will result in a duplicate-key error.\n\nCHAR(0) columns can contain 2 values: an empty string or NULL. Such columns cannot be part of an index. The CONNECT storage engine does not support CHAR(0).\n\nUse Cases for Zero Length\n\nA CHAR(0) or VARCHAR(0) column occupies minimal space and is restricted to two possible values: an empty string ('''') or NULL. You can use these columns for the following purposes:\n\n Legacy Compatibility: Include these columns to maintain compatibility with older applications that require a specific table schema, even if the data is no longer collected.\n Two-State Flags: A CHAR(0) NULL column can function as a boolean indicator. It uses only one bit of storage to distinguish between a "set" state (the empty string) and an "unset" state (NULL).\n* Row Marking: You can use a CHAR(0) column to mark a specific row in a table. For example, if you require only one "active" row, set that row to an empty string while keeping all other rows NULL.\n\nThe following error occurs if you attempt to insert any character data into a 0-length column: ERROR 1406 (22001): Data too long for column.\n\nExamples\n--------\n\nCREATE TABLE strtest (c CHAR(10));\nINSERT INTO strtest VALUES(''Maria   '');\n\nSELECT c=''Maria'',c=''Maria   '' FROM strtest;\n+-----------+--------------+\n| c=''Maria'' | c=''Maria   '' |\n+-----------+--------------+\n|         1 |            1 |\n+-----------+--------------+\n\nSELECT c LIKE ''Maria'',c LIKE ''Maria   '' FROM strtest;\n+----------------+-------------------+\n| c LIKE ''Maria'' | c LIKE ''Maria   '' |\n+----------------+-------------------+\n|              1 |                 0 |\n+----------------+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/char', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/char');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (48, 22, 'Character Set and Collation Overview', 'Description\n-----------\n\nWhat are Character Sets and Collations?\n\nA character set is a set of characters, while a collation comprises the rules for comparing and sorting a particular character set.\n\nFor example, a subset of a character set could consist of the letters A, B and C. A default collation could define these as appearing in an ascending order of A, B, C.\n\nIf we consider different case characters, more complexity is added. A binary collation would evaluate the characters A and a differently, ordering them in a particular way. A case-insensitive collation would evaluate A and a equivalently, while the German phone book collation evaluates the characters ue and ü equivalently.\n\nA character set can have many collations associated with it, while each collation is only associated with one character set. In MariaDB, the character set name is always part of the collation name. For example, the latin1_german1_ci collation applies only to the latin1 character set. Each character set also has one default collation. The latin1 default collation is latin1_swedish_ci.\n\nAs an example, by default, the character y comes between x and z, while in Lithuanian, it''s sorted between i and k. Similarly, the German phone book order is different to the German dictionary order, so while they share the same character set, the collation is different.\n\nViewing Character Sets and Collations\n\nThe default character set is utf8mb4 and the default collation is utf8mb4_uca1400_ai_ci.\\\nThis may differ in some distros, see for example Differences in MariaDB in Debian.\n\nThe default character set is latin1 and the default collation is latin1_swedish_ci.\\\nThis may differ in some distros, see for example Differences in MariaDB in Debian.\n\nYou can view a full list of character sets and collations supported by MariaDB at Supported Character Sets and Collations, or see what''s supported on your server with the SHOW CHARACTER SET and SHOW COLLATION commands.\n\nBy default, A comes before Z, so the following evaluates to true:\n\n``sql\nSELECT "A" < "Z";\n+-----------+\n| "A" < "Z" |\n+-----------+\n|         1 |\n+-----------+\n`\n\nBy default, comparisons are case-insensitive:\n\n`sql\nSELECT "A" < "a", "A" = "a";\n+-----------+-----------+\n| "A" < "a" | "A" = "a" |\n+-----------+-----------+\n|         0 |         1 |\n+-----------+-----------+\n`\n\nChanging Character Sets and Collations\n\nCharacter sets and collations can be set from the server level right down to the column level, as well as for client-server communication.\n\nFor example, ue and ü are by default evaluated differently.\n\n`sql\nSELECT ''Mueller'' = ''Müller'';\n+----------------------+\n| ''Müller'' = ''Mueller'' |\n+----------------------+\n|                    0 |\n+----------------------+\n`\n\nBy using the collation_connection system variable to change the connection character set to latin1_german2_ci, or German phone book, the same two characters will evaluate as equivalent.\n\n`sql\nSET collation_connection = latin1_german2_ci;\n\nSELECT ''Mueller'' = ''Müller'';\n+-----------------------+\n| ''Mueller'' = ''Müller''  |\n+-----------------------+\n|                     1 |\n+-----------------------+\n``\n\nSee Setting Character Sets and Collations for more.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/character-set-and-collation-overview', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/character-set-and-collation-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (49, 22, 'Coordinated Universal Time', 'Description\n-----------\n\nUTC stands for Coordinated Universal Time. It is the world standard for regulating time.\n\nMariaDB stores values internally in UTC, converting them to the required time zone as required.\n\nIn general terms it is equivalent to Greenwich Mean Time (GMT), but UTC is used in technical contexts, as it is precisely defined at the subsecond level.\n\nTime zones are offset relative to UTC. For example, time in Tonga is UTC + 13, so 03h00 UTC is 16h00 in Tonga.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/coordinated-universal-time', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/coordinated-universal-time');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (50, 22, 'Locales Plugin', 'Description\n-----------\n\nThe LOCALES plugin creates the LOCALES table in the INFORMATION_SCHEMA database. The plugin also adds the SHOW LOCALES statement.The table and statement can be queried to see all locales that are compiled into the server.\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. For example:\n\n``sql\nINSTALL SONAME ''locales'';\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. For example:\n\n`sql\n[mariadb]\n...\nplugin_load_add = locales\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN. For example:\n\n`sql\nUNINSTALL SONAME ''locales'';\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.LOCALES;\n+-----+-------+-------------------------------------+-----------------------+---------------------+---------------+--------------+------------------------+\n| ID  | NAME  | DESCRIPTION                         | MAX_MONTH_NAME_LENGTH | MAX_DAY_NAME_LENGTH | DECIMAL_POINT | THOUSAND_SEP | ERROR_MESSAGE_LANGUAGE |\n+-----+-------+-------------------------------------+-----------------------+---------------------+---------------+--------------+------------------------+\n|   0 | en_US | English - United States             |                     9 |                   9 | .             | ,            | english                |\n|   1 | en_GB | English - United Kingdom            |                     9 |                   9 | .             | ,            | english                |\n|   2 | ja_JP | Japanese - Japan                    |                     3 |                   3 | .             | ,            | japanese               |\n|   3 | sv_SE | Swedish - Sweden                    |                     9 |                   7 | ,             |              | swedish                |\n|   4 | de_DE | German - Germany                    |                     9 |                  10 | ,             | .            | german                 |\n|   5 | fr_FR | French - France                     |                     9 |                   8 | ,             |              | french                 |\n|   6 | ar_AE | Arabic - United Arab Emirates       |                     6 |                   8 | .             | ,            | english                |\n|   7 | ar_BH | Arabic - Bahrain                    |                     6 |                   8 | .             | ,            | english                |\n|   8 | ar_JO | Arabic - Jordan                     |                    12 |                   8 | .             | ,            | english                |\n...\n| 106 | no_NO | Norwegian - Norway                  |                     9 |                   7 | ,             | .            | norwegian              |\n| 107 | sv_FI | Swedish - Finland                   |                     9 |                   7 | ,             |              | swedish                |\n| 108 | zh_HK | Chinese - Hong Kong SAR             |                     3 |                   3 | .             | ,            | english                |\n| 109 | el_GR | Greek - Greece                      |                    11 |                   9 | ,             | .            | greek                  |\n| 110 | rm_CH | Romansh - Switzerland               |                     9 |                   9 | ,             | .            | english                |\n+-----+-------+-------------------------------------+-----------------------+---------------------+---------------+--------------+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/locales-plugin', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/locales-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (51, 22, 'Server Locale', 'Description\n-----------\n\nThe lc_time_names server system variable sets the language used by the date and time functions DAYNAME(), MONTHNAME(), and DATE_FORMAT(), and the lc_messages sets the language for error messages.\n\nThe list of the locales supported by the current MariaDB installation can be obtained via the LOCALES plugin.\n\nMariaDB supports the following locale values:\n\n| Locale | Language          | Territory                                                                                                                                                                                                                                                     |\n| ------ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| ar_AE | Arabic            | United Arab Emirates                                                                                                                                                                                                                                          |\n| ar_BH | Arabic            | Bahrain                                                                                                                                                                                                                                                       |\n| ar_DZ | Arabic            | Algeria                                                                                                                                                                                                                                                       |\n| ar_EG | Arabic            | Egypt                                                                                                                                                                                                                                                         |\n| ar_IN | Arabic            | Iran                                                                                                                                                                                                                                                          |\n| ar_IQ | Arabic            | Iraq                                                                                                                                                                                                                                                          |\n| ar_JO | Arabic            | Jordan                                                                                                                                                                                                                                                        |\n| ar_KW | Arabic            | Kuwait                                                                                                                                                                                                                                                        |\n| ar_LB | Arabic            | Lebanon                                                                                                                                                                                                                                                       |\n| ar_LY | Arabic            | Libya                                                                                                                                                                                                                                                         |\n| ar_MA | Arabic            | Morocco                                                                                                                                                                                                                                                       |\n| ar_OM | Arabic            | Oman                                                                                                                                                                                                                                                          |\n| ar_QA | Arabic            | Qatar                                                                                                                                                                                                                                                         |\n| ar_SA | Arabic            | Saudi Arabia                                                                                                                                                                                                                                                  |\n| ar_SD | Arabic            | Sudan                                                                                                                                                                                                                                                         |\n| ar_SY | Arabic            | Syria                                                                                                                                                                                                                                                         |\n| ar_TN | Arabic            | Tunisia                                                                                                                                                                                                                                                       |\n| ar_YE | Arabic            | Yemen                                                                                                                                                                                                                                                         |\n| be_BY | Belarusian        | Belarus                                                                                                                                                                                                                                                       |\n| bg_BG | Bulgarian         | Bulgaria                                                                                                                                                                                                                                                      |\n| ca_ES | Catalan           | Catalan                                                                                                                                                                                                                                                       |\n| cs_CZ | Czech             | Czech Republic                                                                                                                                                                                                                                                |\n| da_DK | Danish            | Denmark                                                                                                                                                                                                                                                       |\n| de_AT | German            | Austria                                                                                                                                                                                                                                                       |\n| de_BE | German            | Belgium                                                                                                                                                                                                                                                       |\n| de_CH | German            | Switzerland                                                                                                                                                                                                                                                   |\n| de_DE | German            | Germany                                                                                                                                                                                                                                                       |\n| de_LU | German            | Luxembourg                                                                                                                                                                                                                                                    |\n| el_GR | Greek             | Greece                                                                                                                                                                                                                                                        |\n| en_AU | English           | Australia                                                                                                                                                                                                                                                     |\n| en_CA | English           | Canada                                                                                                                                                                                                                                                        |\n| en_GB | English           | United Kingdom                                                                                                                                                                                                                                                |\n| en_IN | English           | India                                                                                                                                                                                                                                                         |\n| en_NZ | English           | New Zealand                                                                                                                                                                                                                                                   |\n| en_PH | English           | Philippines                                                                                                                                                                                                                                                   |\n| en_US | English           | United States                                                                                                                                                                                                                                                 |\n| en_ZA | English           | South Africa                                                                                                                                                                                                                                                  |\n| en_ZW | English           | Zimbabwe                                                                                                                                                                                                                                                      |\n| es_AR | Spanish           | Argentina                                                                                                                                                                                                                                                     |\n| es_BO | Spanish           | Bolivia                                                                                                                                                                                                                                                       |\n| es_CL | Spanish           | Chile                                                                                                                                                                                                                                                         |\n| es_CO | Spanish           | Columbia                                                                                                                                                                                                                                                      |\n| es_CR | Spanish           | Costa Rica                                                                                                                                                                                                                                                    |\n| es_DO | Spanish           | Dominican Republic                                                                                                                                                                                                                                            |\n| es_EC | Spanish           | Ecuador                                                                                                                                                                                                                                                       |\n| es_ES | Spanish           | Spain                                                                                                                                                                                                                                                         |\n| es_GT | Spanish           | Guatemala                                                                                                                                                                                                                                                     |\n| es_HN | Spanish           | Honduras                                                                                                                                                                                                                                                      |\n| es_MX | Spanish           | Mexico                                                                                                                                                                                                                                                        |\n| es_NI | Spanish           | Ni\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/server-locale');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (52, 22, 'Setting the Language for Error Messages', 'Description\n-----------\n\nMariaDB server error messages are by default in English. However, MariaDB server also supports error message localization in many different languages. Each supported language has its own version of the error message file called errmsg.sys in a dedicated directory for that language.\n\nSupported Languages for Error Messages\n\nError message localization is supported for the following languages:\n\n Bulgarian\n Chinese (from MariaDB 10.4.25, 10.5.16, 10.6.8, 10.7.4, 10.8.3)\n Czech\n Danish\n Dutch\n English\n Estonian\n French\n Georgian (from MariaDB 10.11.3)\n German\n Greek\n Hindi\n Hungarian\n Italian\n Japanese\n Korean\n Norwegian\n Norwegian-ny (Nynorsk)\n Polish\n Portuguese\n Romanian\n Russian\n Serbian\n Slovak\n Spanish\n Swahili (from MariaDB 11.1.2)\n Swedish\n Ukrainian\n\nSetting the lc_messages and lc_messages_dir System Variables\n\nThe lc_messages and lc_messages_dir system variables can be used to set the server locale used for error messages.\n\nThe lc_messages system variable can be specified as a locale name. The language of the associated locale will be used for error messages. See Server Locales for a list of supported locales and their associated languages.\n\nThe lc_messages system variable is set to en_US by default, which means that error messages are in English by default.\n\nIf the lc_messages system variable is set to a valid locale name, but the server can''t find an error message file for the language associated with the locale, then the default language will be used instead.\n\nThis system variable can be specified as command-line arguments to mariadbd or it can be specified in a relevant server option group in an option file. For example:\n\n``ini\n[mariadb]\n...\nlc_messages=fr_CA\n`\n\nThe lc_messages system variable can also be changed dynamically with SET GLOBAL. For example:\n\n`sql\nSET GLOBAL lc_messages=''fr_CA'';\n`\n\nIf a server has the lc_messages system variable set to the fr_CA locale like the above example, then error messages would be in French. For example:\n\n`sql\nSELECT blah;\nERROR 1054 (42S22): Champ ''blah'' inconnu dans field list\n`\n\nThe lc_messages_dir system variable can be specified either as the path to the directory storing the server''s error message files or as the path to the directory storing the specific language''s error message file.\n\nThe server initially tries to interpret the value of the lc_messages_dir system variable as a path to the directory storing the server''s error message files. Therefore, it constructs the path to the language''s error message file by concatenating the value of the lc_messages_dir system variable with the language name of the locale specified by the lc_messages system variable .\n\nIf the server does not find the error message file for the language, then it tries to interpret the value of the lc_messages_dir system variable as a direct path to the directory storing the specific language''s error message file.\n\nThis system variable can be specified as command-line arguments to mariadbd or it can be specified in a relevant server option group in an option file.\n\nFor example, to specify the path to the directory storing the server''s error message files:\n\n`ini\n[mariadb]\n...\nlc_messages_dir=/usr/share/mysql/\n`\n\nOr to specify the path to the directory storing the specific language''s error message file:\n\n`ini\n[mariadb]\n...\nlc_messages_dir=/usr/share/mysql/french/\n`\n\nThe lc_messages_dir system variable can not be changed dynamically.\n\nSetting the --language Option\n\nThe --language option can also be used to set the server''s language for error messages, but it is deprecated. It is recommended to set the lc_messages system variable instead.\n\nThe --language option can be specified either as a language name or as the path to the directory storing the language''s error message file. See Server Locales for a list of supported locales and their associated languages.\n\nThis option can be specified as command-line arguments to mariadbd or it can be specified in a relevant server option group in an option file.\n\nFor example, to specify a language name:\n\n`ini\n[mariadb]\n...\nlanguage=french\n`\n\nOr to specify the path to the directory storing the language''s error message file:\n\n`ini\n[mariadb]\n...\nlanguage=/usr/share/mysql/french/\n``\n\nCharacter Set\n\nThe character set that the error messages are returned in is determined by the character_set_results variable, which defaults to UTF8.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/setting-the-language-for-error-messages', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/setting-the-language-for-error-messages');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (53, 22, 'Time Zones', 'Description\n-----------\n\nMariaDB keeps track of several time zone settings.\n\nSetting the Time Zone\n\nThe time_zone system variable is the primary way to set the time zone. It can be specified in one of the following formats:\n\n The default value is SYSTEM, which indicates that the system time zone defined in the system_time_zone system variable will be used. Note that if you are using SYSTEM with replication in either statement or mixed mode, you MUST use the same value for system_time_zone on all slaves (otherwise TIMESTAMP columns will not replicate correctly). See System Time Zone below for more information.\n An offset from Coordinated Universal Time (UTC), such as +5:00 or -9:00, can also be used.\n If the time zone tables in the mysql database were loaded, then a named time zone, such as America/New_York, Africa/Johannesburg, or Europe/Helsinki, is also permissible. See mysql Time Zone Tables below for more information.\n\nThere are two time zone settings that can be set within MariaDB--the global server time zone, and the time zone for your current session. There is also a third time zone setting which may be relevant--the system time zone.\n\nGlobal Server Time Zone\n\nThe global server time zone can be changed at server startup by setting the --default-time-zone option either on the command-line or in a server option group in an option file. For example:\n\n``ini\n[mariadb]\n...\ndefault_time_zone = ''America/New_York''\n`\n\nThe global server time zone can also be changed dynamically by setting the time_zone system variable as a user account that has the SUPER privilege. For example:\n\n`sql\nSET GLOBAL time_zone = ''America/New_York'';\n`\n\nThe current global server time zone can be viewed by looking at the global value of the time_zone system variable. For example:\n\n`sql\nSHOW GLOBAL VARIABLES LIKE ''time_zone'';\n+---------------+--------+\n| Variable_name | Value  |\n+---------------+--------+\n| time_zone     | SYSTEM |\n+---------------+--------+\n`\n\nSession Time Zone\n\nEach session that connects to the server will also have its own time zone. This time zone is initially inherited from the global value of the time_zone system variable, which sets the session value of the same variable.\n\nA session''s time zone can be changed dynamically by setting the time_zone system variable. For example:\n\n`sql\nSET time_zone = ''America/New_York'';\n`\n\nThe current session time zone can be viewed by looking at the session value of the time_zone system variable. For example:\n\n`sql\nSHOW SESSION VARIABLES LIKE ''time_zone'';\n+---------------+--------+\n| Variable_name | Value  |\n+---------------+--------+\n| time_zone     | SYSTEM |\n+---------------+--------+\n`\n\nSystem Time Zone\n\nThe system time zone is determined when the server starts, and it sets the value of the system_time_zone system variable. The system time zone is usually read from the operating system''s environment. You can change the system time zone in several different ways, such as:\n\n If you are starting the server with mariadbd-safe, then you can set the system time zone with the --timezone option either on the command-line or in the \\[mariadbd-safe] option group in an option file. For example:\n\n`ini\n[mariadbd-safe]\ntimezone=''America/New_York''\n`\n\n If you are using a Unix-like operating system, then you can set the system time zone by setting the TZ environment variable in your shell before starting the server. For example:\n\n`bash\n$ export TZ=''America/New_York''\n$ service mariadb start\n`\n\n On some Linux operating systems, you can change the default time zone for the whole system by making the /etc/localtime symbolic link point to the desired time zone. For example:\n\n`bash\n$ sudo rm /etc/localtime\n$ sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime\n`\n\n On some Debian-based Linux operating systems, you can change the default time zone for the whole system by executing the following:\n\n`bash\nsudo dpkg-reconfigure tzdata\n`\n\n On Linux operating systems that use systemd, you can change the default time zone for the whole system by using the timedatectl utility. For example:\n\n`bash\nsudo timedatectl set-timezone America/New_York\n``\n\nTime Zone Effects\n\nTime Zone Effects on Functions\n\nSome functions are affected by the time zone settings. These include:\n\n NOW()\n SYSDATE()\n CURDATE()\n CURTIME()\n UNIX_TIMESTAMP()\n\nSome functions are not affected. These include:\n\n UTC_DATE()\n UTC_TIME()\n UTC_TIMESTAMP()\n\nTime Zone Effects on Data Types\n\nSome data types are affected by the time zone settings.\n\n TIMESTAMP - See TIMESTAMP: Time Zones for information on how this data type is affected by time zones.\n DATETIME - See DATETIME: Time Zones for information on how this data type is affected by time zones.\n\nmysql Time Zone Tables\n\nThe mysql database contains a number of time zone tables:\n\n time_zone\n time_zone_leap_second\n time_zone_name\n time_zone_transition\n* time_zone_transition_type\n\nBy default, these time zone tables in the mysql database are created, but not populated.\n\nIf you are using a Unix-like operating system, then you can populate these tables using the mariadb-tzinfo-to-sql utility, which uses the zoneinfo data available on Linux, Mac OS X, FreeBSD and Solaris.\n\nIf you are using Windows, then you will need to import pre-populated time zone tables. These are available at MariaDB mirrors.\n\nTime zone data needs to be updated on occasion. When that happens, the time zone tables may need to be reloaded.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/time-zones', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/time-zones');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (54, 22, 'SET CHARACTER SET', 'Syntax\n------\n\nSET {CHARACTER SET | CHARSET}\n    {charset_name | DEFAULT}\n\nDescription\n-----------\n\nSets the character_set_client and character_set_results session system variables to the specified character set and collation_connection to the value of collation_database, which implicitly sets character_set_connection to the value of character_set_database.\n\nThis maps all strings sent between the current client and the server with the given mapping.\n\nExamples\n--------\n\nSHOW VARIABLES LIKE ''character_set_%'';\n+--------------------------+--------+\n| Variable_name            | Value  |\n+--------------------------+--------+\n| character_set_client     | utf8   |\n| character_set_connection | utf8   |\n| character_set_database   | latin1 |\n| character_set_filesystem | binary |\n| character_set_results    | utf8   |\n| character_set_server     | latin1 |\n| character_set_system     | utf8   |\n+--------------------------+--------+\n\nSHOW VARIABLES LIKE ''collation%'';\n+----------------------+-------------------+\n| Variable_name        | Value             |\n+----------------------+-------------------+\n| collation_connection | utf8_general_ci   |\n| collation_database   | latin1_swedish_ci |\n| collation_server     | latin1_swedish_ci |\n+----------------------+-------------------+\n\nSET CHARACTER SET utf8mb4;\n\nSHOW VARIABLES LIKE ''character_set_%'';\n+--------------------------+---------+\n| Variable_name            | Value   |\n+--------------------------+---------+\n| character_set_client     | utf8mb4 |\n| character_set_connection | latin1  |\n| character_set_database   | latin1  |\n| character_set_filesystem | binary  |\n| character_set_results    | utf8mb4 |\n| character_set_server     | latin1  |\n| character_set_system     | utf8    |\n+--------------------------+---------+\n\nSHOW VARIABLES LIKE ''collation%'';\n+----------------------+-------------------+\n| Variable_name        | Value             |\n+----------------------+-------------------+\n| collation_connection | latin1_swedish_ci |\n| collation_database   | latin1_swedish_ci |\n| collation_server     | latin1_swedish_ci |\n+----------------------+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/set-character-set', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/set-character-set');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (55, 22, 'SET NAMES', 'Syntax\n------\n\nSET NAMES {''charset_name''\n    [COLLATE ''collation_name''] | DEFAULT}\n\nDescription\n-----------\n\nSets the character_set_client, character_set_connection, character_set_results and, implicitly, the collation_connection session system variables to the specified character set and collation.\n\nThis determines which character set the client will use to send statements to the server, and the server will use for sending results back to the client.\n\nucs2, utf16, utf16le and utf32 are not valid character sets for SET NAMES, as they cannot be used as client character sets.\n\nThe collation clause is optional. If not defined (or if DEFAULT is specified), the default collation for the character set will be used.\n\nQuotes are optional for the character set or collation clauses.\n\nExamples\n--------\n\nSET NAMES DEFAULT;                \n\nSELECT VARIABLE_NAME, SESSION_VALUE \n    FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n    VARIABLE_NAME LIKE ''character_set_con%'' OR \n    VARIABLE_NAME LIKE ''character_set_cl%'' OR \n    VARIABLE_NAME LIKE ''character_set_re%'' OR \n    VARIABLE_NAME LIKE ''collation_c%'';\n+--------------------------+-----------------------+\n| VARIABLE_NAME            | SESSION_VALUE         |\n+--------------------------+-----------------------+\n| CHARACTER_SET_RESULTS    | utf8mb4               |\n| CHARACTER_SET_CONNECTION | utf8mb4               |\n| CHARACTER_SET_CLIENT     | utf8mb4               |\n| COLLATION_CONNECTION     | utf8mb4_uca1400_ai_ci |\n+--------------------------+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/set-names', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/set-names');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (56, 22, 'Setting Character Sets and Collations', 'Description\n-----------\n\nThe default character set is utf8mb4 and the default collation is utf8mb4_uca1400_ai_ci.\\\nThis may differ in some distros, see for example Differences in MariaDB in Debian.\n\nThe default character set is latin1 and the default collation is latin1_swedish_ci.\\\nThis may differ in some distros, see for example Differences in MariaDB in Debian.\n\nIn MariaDB 11.6, the default character set changed from latin1 to utf8mb4.\n\nWhen upgrading to 11.6 or above from a previous release series, this can lead to behavior different from what you''ve been seeing in the old version.\n\nSee this section for details, including the impact on replicating to older MariaDB (or MySQL) slaves.\n\nThe character sets and the collations can be specified from the server right down to the column level, as well as for client-server connections. When changing a character set and not specifying a collation, the default collation for the new character set is always used.\n\nCharacter sets and collations always cascade down, so a column without a specified collation will look for the table default, the table for the database, and the database for the server. It''s therefore possible to have extremely fine-grained control over all the character sets and collations used in your data.\n\nDefault collations for each character set can be viewed with the SHOW COLLATION statement, for example, to find the default collation for the latin2 character set:\n\n``sql\nSHOW COLLATION LIKE ''latin2%'';\n+---------------------+---------+----+---------+----------+---------+\n| Collation           | Charset | Id | Default | Compiled | Sortlen |\n+---------------------+---------+----+---------+----------+---------+\n| latin2_czech_cs     | latin2  |  2 |         | Yes      |       4 |\n| latin2_general_ci   | latin2  |  9 | Yes     | Yes      |       1 |\n| latin2_hungarian_ci | latin2  | 21 |         | Yes      |       1 |\n| latin2_croatian_ci  | latin2  | 27 |         | Yes      |       1 |\n| latin2_bin          | latin2  | 77 |         | Yes      |       1 |\n+---------------------+---------+----+---------+----------+---------+\n`\n\nServer Level\n\nThe character_set_server system variable can be used to change the default server character set. It can be set both on startup or dynamically, with the SET command:\n\n`sql\nSET character_set_server = ''latin2'';\n`\n\nSimilarly, the collation_server variable is used for setting the default server collation.\n\n`sql\nSET collation_server = ''latin2_czech_cs'';\n`\n\nDatabase Level\n\nThe CREATE DATABASE and ALTER DATABASE statements have optional character set and collation clauses. If these are left out, the server defaults are used.\n\n`sql\nCREATE DATABASE czech_slovak_names \n  CHARACTER SET = ''keybcs2''\n  COLLATE = ''keybcs2_bin'';\n`\n\n`sql\nALTER DATABASE czech_slovak_names COLLATE = ''keybcs2_general_ci'';\n`\n\nTo determine the default character set used by a database, use:\n\n`sql\nSHOW CREATE DATABASE czech_slovak_names;\n+--------------------+--------------------------------------------------------------------------------+\n| Database           | Create Database                                                                |\n+--------------------+--------------------------------------------------------------------------------+\n| czech_slovak_names | CREATE DATABASE czech_slovak_names /!40100 DEFAULT CHARACTER SET keybcs2 / |\n+--------------------+--------------------------------------------------------------------------------+\n`\n\nAlternatively, for the character set and collation:\n\n`sql\nSELECT  FROM INFORMATION_SCHEMA.SCHEMATA;\n+--------------+--------------------+----------------------------+------------------------+----------+\n| CATALOG_NAME | SCHEMA_NAME        | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH |\n+--------------+--------------------+----------------------------+------------------------+----------+\n| def          | czech_slovak_names | keybcs2                    | keybcs2_general_ci     | NULL     |\n| def          | information_schema | utf8                       | utf8_general_ci        | NULL     |\n| def          | mysql              | latin1                     | latin1_swedish_ci      | NULL     |\n| def          | performance_schema | utf8                       | utf8_general_ci        | NULL     |\n| def          | test               | latin1                     | latin1_swedish_ci      | NULL     |\n+--------------+--------------------+----------------------------+------------------------+----------+\n`\n\nIt is also possible to specify only the collation, and, since each collation only applies to one character set, the associated character set will automatically be specified.\n\n`sql\nCREATE DATABASE danish_names COLLATE ''utf8_danish_ci'';\n\nSHOW CREATE DATABASE danish_names;\n+--------------+----------------------------------------------------------------------------------------------+\n| Database     | Create Database                                                                              |\n+--------------+----------------------------------------------------------------------------------------------+\n| danish_names | CREATE DATABASE danish_names /!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_danish_ci / |\n+--------------+----------------------------------------------------------------------------------------------+\n`\n\nAlthough there are character_set_database and collation_database system variables which can be set dynamically, these are used for determining the character set and collation for the default database, and should only be set by the server.\n\nTable Level\n\nThe CREATE TABLE and ALTER TABLE statements support optional character set and collation clauses, a MariaDB and MySQL extension to standard SQL.\n\n`sql\nCREATE TABLE english_names (id INT, name VARCHAR(40)) \n  CHARACTER SET ''utf8'' \n  COLLATE ''utf8_icelandic_ci'';\n`\n\nIf neither character set nor collation is provided, the database default will be used. If only the character set is provided, the default collation for that character set will be used . If only the collation is provided, the associated character set will be used. See Supported Character Sets and Collations.\n\n`sql\nALTER TABLE table_name\n CONVERT TO CHARACTER SET charset_name [COLLATE collation_name];\n`\n\nIf no collation is provided, the collation will be set to the default collation for that character set. See Supported Character Sets and Collations.\n\nFor VARCHAR or TEXT columns, CONVERT TO CHARACTER SET changes the data type if needed to ensure the new column is long enough to store as many characters as the original column.\n\nFor example, an ascii TEXT column requires a single byte per character, so the column can hold up to 65,535 characters. If the column is converted to utf8mb4, 4 bytes can be required for each character, so the column will be converted to MEDIUMTEXT to be able to hold the same number of characters.\n\nCONVERT TO CHARACTER SET binary will convert CHAR, VARCHAR and TEXT columns to BINARY, VARBINARY and BLOB respectively, and from that point will no longer have a character set, or be affected by future CONVERT TO CHARACTER SET statements.\n\nTo avoid data type changes resulting from CONVERT TO CHARACTER SET, use MODIFY on the individual columns instead. For example:\n\n`sql\nALTER TABLE table_name MODIFY ascii_text_column TEXT CHARACTER SET utf8;\nALTER TABLE table_name MODIFY ascii_varchar_column VARCHAR(M) CHARACTER SET utf8;\n`\n\nColumn Level\n\nCharacter sets and collations can also be specified for columns that are character types CHAR, TEXT or VARCHAR. The CREATE TABLE and ALTER TABLE statements support optional character set and collation clauses for this purpose - unlike those at the table level, the column level definitions are standard SQL.\n\n`sql\nCREATE TABLE european_names (\n  croatian_names VARCHAR(40) COLLATE ''cp1250_croatian_ci'',\n  greek_names VARCHAR(40) CHARACTER SET ''greek'');\n`\n\nIf neither collation nor character set is provided, the table default is used. If only the character set is specified, that character set''s default collation is used, while if only the collation is specified, the associated character set is used.\n\nWhen using ALTER TABLE to change a column''s character set, you need to ensure the character sets are compatible with your data. MariaDB will map the data as best it can, but it''s possible to lose data if care is not taken.\n\nThe SHOW CREATE TABLE statement or INFORMATION SCHEMA database can be used to determine column character sets and collations.\n\n`sql\nSHOW CREATE TABLE european_names\\G\n*********************** 1. row ***********************\n       Table: european_names\nCreate Table: CREATE TABLE european_names (\n  croatian_names varchar(40) CHARACTER SET cp1250 COLLATE cp1250_croatian_ci DEFAULT NULL,\n  greek_names varchar(40) CHARACTER SET greek DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_danish_ci\n`\n\n`sql\nSELECT  FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME LIKE ''european%''\\G\n************************ 1. row *********************\n           TABLE_CATALOG: def\n            TABLE_SCHEMA: danish_names\n              TABLE_NAME: european_names\n             COLUMN_NAME: croatian_names\n        ORDINAL_POSITION: 1\n          COLUMN_DEFAULT: NULL\n             IS_NULLABLE: YES\n               DATA_TYPE: varchar\nCHARACTER_MAXIMUM_LENGTH: 40\n  CHARACTER_OCTET_LENGTH: 40\n       NUMERIC_PRECISION: NULL\n           NUMERIC_SCALE: NULL\n      DATETIME_PRECISION: NULL\n      CHARACTER_SET_NAME: cp1250\n          COLLATION_NAME: cp1250_croatian_ci\n             COLUMN_TYPE: varchar(40)\n              COLUMN_KEY: \n                   EXTRA: \n              PRIVILEGES: select,insert,update,references\n          COLUMN_COMMENT: \n********************* 2. row ***********************\n           TABLE_CATALOG: def\n            TABLE_SCHEMA: danish_names\n              TABLE_NAME: european_names\n             COLUMN_NAME: greek_names\n        ORDINAL_POSITION: 2\n          COLUMN_DEFAULT: NULL\n             IS_NULLABLE: YES\n               DATA_TYPE: varchar\nCHARACTER_MAXIMUM_LENGTH: 40\n  CHARACTER_OCTET_LENGTH: 40\n       NUMERIC_PRECISION: NULL\n           NUMERIC_SCALE: NULL\n      DATETIME_PRECISION: NULL\n      CHARACTER_SET_NAME: greek\n          COLLATION_NAME: greek_general_ci\n             COLUMN_TYPE: varchar(40)\n              COLUMN_KEY: \n                   EXTRA: \n              PRIVILEGES: select,insert,update,references\n          COLUMN_COMMENT:\n`\n\nFilenames\n\nThe character_set_filesystem system variable has controlled interpretation of file names that are given as literal strings. This affects the following statements and functions:\n\n SELECT INTO DUMPFILE\n SELECT INTO OUTFILE\n LOAD DATA INFILE\n LOAD XML\n LOAD_FILE()\n\nLiterals\n\nBy default, the character set and collation used for literals is determined by the character_set_connection and collation_connection system variables. However, they can also be specified explicitly:\n\n`sql\n[_charset_name]''string'' [COLLATE collation_name]\n`\n\nThe character set of string literals that do not have a character set introducer is determined by the character_set_connection system variable.\n\nThis query always returns the same character set name in both columns.:\n\n`sql\nSELECT CHARSET(''a''), @@character_set_connection;\n`\n\ncharacter_set_client and character_set_connection are normally (e.g. during handshake, or after a SET NAMES` query) are set to equal values. However, it''s possible to set to different values.\n\nExamples\n--------\n\nCREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_general_ci;\nINSERT INTO t1 VALUES (''oe''),(''ö'');\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/setting-character-sets-and-collations', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/setting-character-sets-and-collations');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (57, 22, 'Supported Character Sets and Collations', 'Description\n-----------\n\nCharacter Sets\n\nYou can see which character sets are available in a particular version by running the SHOW CHARACTER SET statement or by querying the Information Schema CHARACTER_SETS Table.\n\nIt is possible to change the default collation associated with a character set. See Changing Default Collation.\n\nIt is not possible to change the default collation associated with a character set. See Changing Default Collation\n\nMariaDB supports the following character sets:\n\n| Charset  | Description                 | Default collation                                                                                                                                                                                                                                                                                                 | Maxlen                                                                               |\n| -------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |\n| armscii8 | ARMSCII-8 Armenian          | armscii8_general_ci                                                                                                                                                                                                                                                                                             | 1                                                                                    |\n| ascii    | US ASCII                    | ascii_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| big5     | Big5 Traditional Chinese    | big5_chinese_ci                                                                                                                                                                                                                                                                                                 | 2                                                                                    |\n| binary   | Binary pseudo charset       | binary                                                                                                                                                                                                                                                                                                            | 1                                                                                    |\n| cp1250   | Windows Central European    | cp1250_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| cp1251   | Windows Cyrillic            | cp1251_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| cp1256   | Windows Arabic              | cp1256_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| cp1257   | Windows Baltic              | cp1257_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| cp850    | DOS West European           | cp850_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| cp852    | DOS Central European        | cp852_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| cp866    | DOS Russian                 | cp866_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| cp932    | SJIS for Windows Japanese   | cp932_japanese_ci                                                                                                                                                                                                                                                                                               | 2                                                                                    |\n| dec8     | DEC West European           | dec8_swedish_ci                                                                                                                                                                                                                                                                                                 | 1                                                                                    |\n| eucjpms  | UJIS for Windows Japanese   | eucjpms_japanese_ci                                                                                                                                                                                                                                                                                             | 3                                                                                    |\n| euckr    | EUC-KR Korean               | euckr_korean_ci                                                                                                                                                                                                                                                                                                 | 2                                                                                    |\n| gb2312   | GB2312 Simplified Chinese   | gb2312_chinese_ci                                                                                                                                                                                                                                                                                               | 2                                                                                    |\n| gbk      | GBK Simplified Chinese      | gbk_chinese_ci                                                                                                                                                                                                                                                                                                  | 2                                                                                    |\n| geostd8  | GEOSTD8 Georgian            | geostd8_general_ci                                                                                                                                                                                                                                                                                              | 1                                                                                    |\n| greek    | ISO 8859-7 Greek            | greek_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| hebrew   | ISO 8859-8 Hebrew           | hebrew_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| hp8      | HP West European            | hp8_english_ci                                                                                                                                                                                                                                                                                                  | 1                                                                                    |\n| keybcs2  | DOS Kamenicky Czech-Slovak  | keybcs2_general_ci                                                                                                                                                                                                                                                                                              | 1                                                                                    |\n| koi8r    | KOI8-R Relcom Russian       | koi8r_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| koi8u    | KOI8-U Ukrainian            | koi8u_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| latin1   | cp1252 West European        | latin1_swedish_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| latin2   | ISO 8859-2 Central European | latin2_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| latin5   | ISO 8859-9 Turkish          | latin5_turkish_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| latin7   | ISO 8859-13 Baltic          | latin7_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| macce    | Mac Central European        | macce_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| macroman | Mac West European           | macroman_general_ci                                                                                                                                                                                                                                                                                             | 1                                                                                    |\n| sjis     | Shift-JIS Japanese          | sjis_japanese_ci                                                                                                                                                                                                                                                                                                | 2                                                                                    |\n| swe7     | 7bit Swedish                | swe7_swedish_ci\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/supported-character-sets-and-collations');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (58, 22, 'Unicode', 'Description\n-----------\n\nUnicode is a standard for encoding text across multiple writing systems. MariaDB supports a number of character sets for storing Unicode data:\n\n| Character Set | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |\n| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| ucs2        | UCS-2, each character is represented by a 2-byte code with the most significant byte first. Fixed-length 16-bit encoding.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |\n| utf8        | utf8 is an alias for utf8mb3, but this can changed to ut8mb4 by changing the default value of the old_mode system variable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |\n| utf8mb3     | UTF-8 encoding using one to three bytes per character. Basic Latin letters, numbers and punctuation use one byte. European and Middle East letters mostly fit into 2 bytes. Korean, Chinese, and Japanese ideographs use 3-bytes. No supplementary characters are stored. Until MariaDB 10.5, this was an alias for utf8. From MariaDB 10.6, utf8 is by default an alias for utf8mb3, but this can changed to ut8mb4 by changing the default value of the old_mode system variable. |\n| utf8mb4     | UTF-8 encoding the same as utf8mb3 but which stores supplementary characters in four bytes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |\n| utf16       | UTF-16, same as ucs2, but stores supplementary characters in 32 bits. 16 or 32-bits.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |\n| utf32       | UTF-32, fixed-length 32-bit encoding.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n\nSupport for the UCA-14.0.0 collations was added in MariaDB 10.10 (MDEV-27009).\n\nSupport for the MySQL 8.0 UCA-9-0-0 (utf8mb4_0900_...) collations will be added to MariaDB 11.4.5.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/unicode', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/unicode');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (59, 22, 'CHARACTER', 'Description\n-----------\n\nThis is a synonym for CHAR.\n\nExamples\n--------\n\nCREATE TABLE character_example (\n  example CHARACTER\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (60, 22, 'CLOB', 'Description\n-----------\n\nThis is a synonym for LONGTEXT.\n\nExamples\n--------\n\nSET sql_mode=''oracle'';\n\nCREATE TABLE clob_example (\n  example CLOB\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/clob', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/clob');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (61, 22, 'ENUM', 'Syntax\n------\n\nENUM(''value1'',''value2'',...) [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nAn enumeration. A string object that can have only one value, chosen from the list of values ''value1'', ''value2'', ..., NULL or the special '''' error value. In theory, an ENUM column can have a maximum of 65,535 distinct values; in practice, the real maximum depends on many factors. ENUM values are represented internally as integers.\n\nTrailing spaces are automatically stripped from ENUM values on table creation.\n\nENUM values require relatively little storage space compared to strings, either one or two bytes depending on the number of enumeration values.\n\nNULL and empty values\n\nAn ENUM can also contain NULL and empty values. If the ENUM column is declared to permit NULL values, NULL becomes a valid value, as well as the default value (see below). If strict SQL Mode is not enabled, and an invalid value is inserted into an ENUM, a special empty string, with an index value of zero (see Numeric index, below), is inserted, with a warning. This may be confusing, because the empty string is also a possible value, and the only difference if that is this case its index is not 0. Inserting will fail with an error if strict mode is active.\n\nIf a DEFAULT clause is missing, the default value will be:\n\n NULL if the column is nullable;\n otherwise, the first value in the enumeration.\n\nNumeric index\n\nENUM values are indexed numerically in the order they are defined, and sorting will be performed in this numeric order. We suggest not using ENUM to store numerals, as there is little to no storage space benefit, and it is easy to confuse the enum integer with the enum numeral value by leaving out the quotes.\n\nAn ENUM defined as ENUM(''apple'',''orange'',''pear'') would have the following index values:\n\n| Index | Value    |\n| ----- | -------- |\n| NULL  | NULL     |\n| 0     | ''''       |\n| 1     | ''apple''  |\n| 2     | ''orange'' |\n| 3     | ''pear''   |\n\nExamples\n--------\n\nCREATE TABLE fruits (\n  id INT NOT NULL auto_increment PRIMARY KEY,\n  fruit ENUM(''apple'',''orange'',''pear''),\n  bushels INT);\n\nDESCRIBE fruits;\n+---------+-------------------------------+------+-----+---------+----------------+\n| Field   | Type                          | Null | Key | Default | Extra          |\n+---------+-------------------------------+------+-----+---------+----------------+\n| id      | int(11)                       | NO   | PRI | NULL    | auto_increment |\n| fruit   | enum(''apple'',''orange'',''pear'') | YES  |     | NULL    |                |\n| bushels | int(11)                       | YES  |     | NULL    |                |\n+---------+-------------------------------+------+-----+---------+----------------+\n\nINSERT INTO fruits\n    (fruit,bushels) VALUES\n    (''pear'',20),\n    (''apple'',100),\n    (''orange'',25);\n\nINSERT INTO fruits\n    (fruit,bushels) VALUES\n    (''avocado'',10);\nERROR 1265 (01000): Data truncated for column ''fruit'' at row 1\n\nSELECT * FROM fruits;\n+----+--------+---------+\n| id | fruit  | bushels |\n+----+--------+---------+\n|  1 | pear   |      20 |\n|  2 | apple  |     100 |\n|  3 | orange |      25 |\n+----+--------+---------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/enum', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/enum');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (62, 22, 'INET4', 'Syntax\n------\n\nINET4\n\nDescription\n-----------\n\nINET4 is a data type to store IPv4 addresses, as 4-byte binary strings.\n\nCasting from INET4 data types to INET6 is permitted, allowing for example comparisons between the two data types, and for INET4 values to be inserted into INET6 columns.\n\nCasting from INET4 data types to INET6 is not permitted.\n\nExamples\n--------\n\nCREATE OR REPLACE TABLE t1 (a INET4);\n\nINSERT INTO t1 VALUES(''0.0.0.0''), (''255.10.0.0''), (''255.255.255.255'');\n\nINSERT INTO t1 VALUES (0xa0000001);\nINSERT INTO t1 VALUES (0xf0000000);\nINSERT INTO t1 VALUES (0xff000001);\n\nSELECT HEX(a), a FROM t1 ORDER BY a;\n+----------+-----------------+\n| HEX(a)   | a               |\n+----------+-----------------+\n| 00000000 | 0.0.0.0         |\n| A0000001 | 160.0.0.1       |\n| F0000000 | 240.0.0.0       |\n| FF000001 | 255.0.0.1       |\n| FF0A0000 | 255.10.0.0      |\n| FFFFFFFF | 255.255.255.255 |\n+----------+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/inet4', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/inet4');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (63, 22, 'INET6', 'Syntax\n------\n\nINET6\n\nDescription\n-----------\n\nThe INET6 data type is intended for storage of IPv6 addresses, as well as IPv4 addresses assuming conventional mapping of IPv4 addresses into IPv6 addresses.\n\nBoth short and long IPv6 notation are permitted, according to RFC-5952.\n\n Values are stored as a 16-byte fixed length binary string, with most significant byte first.\n Storage engines see INET6 as BINARY(16).\n Clients see INET6 as CHAR(39) and get text representation on retrieval.\n\nThe IPv4-compatible notation is considered as deprecated. It is supported for compatibility with the INET6_ATON function, which also understands this format. It''s recommended to use the mapped format to store IPv4 addresses in INET6.\n\nWhen an IPv4 mapped (or compatible) value is stored in INET6, it still occupies 16 bytes:\n\nRetrieval\n\nOn retrieval, in the client-server text protocol, INET6 values are converted to the short text representation, according to RFC-5952, that is with all leading zeroes in each group removed and with consequent zero groups compressed.\n\nBesides creating one''s own stored function, there is no a way to retrieve an INET6 value using long text representation.\n\nCasting\n\n CAST from a character string to INET6 understands addresses in short or long text notation (including IPv4 mapped and compatible addresses). NULL is returned if the format is not understood.\n CAST from a binary string to INET6 requires a 16-byte string as an argument. NULL is returned if the argument length is not equal to 16.\n CAST from other data types to INET6 first converts data to a character string, then CAST from character string to INET6 is applied.\n CAST from INET6 to CHAR returns short text address notation.\n CAST from INET6 to BINARY returns its 16-byte binary string representation.\n CAST from INET6 to data types other than CHAR (e.g. SIGNED, UNSIGNED, TIME, etc) returns an error.\n\nComparisons\n\nAn INET6 expression can be compared to:\n\n another INET6 expression\n a character string expression with a text (short or long) address representation:\n a 16-byte binary string expression.\n\nAttempting to compare INET6 to an expression of any other data type returns an error.\n\nMixing INET6 Values for Result\n\nAn INET6 expression can be mixed for result (i.e. UNION, CASE..THEN, COALESCE etc) with:\n\n another INET6 expression. The resulting data type is INET6.\n a character string in text (short or long) address representation. The result data type is INET6. The character string counterpart is automatically converted to INET6. If the string format is not understood, it''s converted with a warning to either NULL or to ''::'', depending on the NULL-ability of the result.\n a 16-byte binary string. The resulting data type is INET6. The binary string counterpart is automatically converted to INET6. If the length of the binary string is not equal to 16, it''s converted with a warning to NULL or to ''::'' depending on the NULL-ability of the result.\n\nAttempts to mix INET6 for result with other data types will return an error.\n\nMixing INET6 with other data types for LEAST and GREATEST, when mixing for comparison and mixing for result are involved at the same time, uses the same rules with mixing for result, described in the previous paragraphs.\n\nFunctions and Operators\n\n HEX() with an INET6 argument returns a hexadecimal representation of the underlying 16-byte binary string\n Arithmetic operators (+,-,\\,/,MOD,DIV) are not supported for INET6. This may change in the future.\n The INET6_ATON function now understands INET6 values as an argument\n The prototypes of the IS_IPV4_COMPAT and I S_IPV4_MAPPED functions have changed from a BINARY(16) to a INET6,\n\nWhen the argument for the aforementioned two functions is not INET6, automatic implicit CAST to INET6 is applied. As a consequence, both functions understand arguments in both text representation and binary(16) representation.\n\nWhen the argument for the aforementioned two functions is not INET6, automatic implicit CAST to INET6 is not applied.\n\nPrepared Statement Parameters\n\nINET6 understands both text and binary(16) address representation in prepared statement parameters (PREPARE..EXECUTE and EXECUTE IMMEDIATE statements).\n\nMigration between BINARY(16) and INET6\n\nYou may have used BINARY(16) as a storage for IPv6 internet addresses, in combination with INET6_ATON and INET6_NTOA to respectively insert and retrieve data.\n\nHowever, you can ALTER BINARY(16) columns storing IPv6 addresses to INET6. After such an alter, there is no a need to use INET6_ATON() and INET6_NTOA(). Addresses can be inserted and retrieved directly.\n\nYou may use BINARY(16) as a storage for IPv6 internet addresses, in combination with INET6_ATON and INET6_NTOA to respectively insert and retrieve data.\n\nIt is also possible to convert INET6 columns to BINARY(16) and continue using the data in combination with INET6_NTOA() and INET6_ATON().\n\nExamples\n--------\n\nCREATE TABLE t1 (a INET6);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/inet6', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/inet6');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (64, 22, 'JSON Data Type', 'Description\n-----------\n\nThe JSON alias was added to make it possible to use JSON columns in statement based replication from MySQL to MariaDB and to make it possible for MariaDB to read mysqldumps from MySQL.\n\nJSON is an alias for LONGTEXT COLLATE utf8mb4_bin introduced for compatibility reasons with MySQL''s JSON data type. MariaDB implements this as a LONGTEXT rather, as the JSON data type contradicts the SQL:2016 standard, and MariaDB''s benchmarks indicate that performance is at least equivalent.\n\nIn order to ensure that a valid json document is inserted, the JSON_VALID function can be used as a CHECK constraint. This constraint is automatically included for types using the JSON alias.\n\nThe assigned text value is retained verbatim. If a value fails JSON_VALID(), an error is raised. This CHECK constraint can also be manually added to any LONGTEXT field. When a JSON object contains duplicate keys, only the first key-value pair is accessible via functions like JSON_EXTRACT().\n\nExamples\n--------\n\nCREATE TABLE t (j JSON);\n\nDESC t;\n+-------+----------+------+-----+---------+-------+\n| Field | Type     | Null | Key | Default | Extra |\n+-------+----------+------+-----+---------+-------+\n| j     | longtext | YES  |     | NULL    |       |\n+-------+----------+------+-----+---------+-------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/json', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/json');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (65, 22, 'LONG and LONG VARCHAR', 'Description\n-----------\n\nLONG and LONG VARCHAR are synonyms for MEDIUMTEXT.\n\n``sql\nCREATE TABLE t1 (a LONG, b LONG VARCHAR);\n\nDESC t1;\n+-------+------------+------+-----+---------+-------+\n| Field | Type       | Null | Key | Default | Extra |\n+-------+------------+------+-----+---------+-------+\n| a     | mediumtext | YES  |     | NULL    |       |\n| b     | mediumtext | YES  |     | NULL    |       |\n+-------+------------+------+-----+---------+-------+\n``\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-and-long-varchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-and-long-varchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (66, 22, 'LONG CHAR VARYING', 'Description\n-----------\n\nSee MEDIUMTEXT.\n\nExamples\n--------\n\nCREATE TABLE long_char_varying_example (\n  example LONG CHAR VARYING\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-char-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-char-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (67, 22, 'LONG CHARACTER VARYING', 'Description\n-----------\n\nSee MEDIUMTEXT.\n\nExamples\n--------\n\nCREATE TABLE long_character_varying_example (\n  example LONG CHARACTER VARYING\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-character-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-character-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (68, 22, 'LONG VARBINARY', 'Description\n-----------\n\nSee MEDIUMBLOB.\n\nExamples\n--------\n\nCREATE TABLE long_varbinary_example (\n  example LONG VARBINARY\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varbinary', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varbinary');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (69, 22, 'LONG VARCHAR', 'Description\n-----------\n\nSee MEDIUMTEXT.\n\nExamples\n--------\n\nCREATE TABLE long_varchar_example (\n  example LONG VARCHAR\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (70, 22, 'LONG VARCHARACTER', 'Description\n-----------\n\nSee MEDIUMTEXT.\n\nExamples\n--------\n\nCREATE TABLE long_varcharacter_example (\n  example LONG VARCHARACTER\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varcharacter', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varcharacter');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (71, 22, 'LONGBLOB', 'Syntax\n------\n\nLONGBLOB\n\nDescription\n-----------\n\nA BLOB column with a maximum length of 4,294,967,295 bytes (2³² - 1), or 4GB. The effective maximum length of LONGBLOB columns depends on the configured maximum packet size in the client/server protocol and available memory. Each LONGBLOB value is stored using a four-byte length prefix that indicates the number of bytes in the value.\n\nOracle Mode\n\nIn Oracle mode, BLOB is a synonym for LONGBLOB.\n\nExamples\n--------\n\nCREATE TABLE longblob_example (\n   description VARCHAR(20),\n   example LONGBLOB\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/longblob', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/longblob');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (72, 22, 'LONGTEXT', 'Syntax\n------\n\nLONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA TEXT column with a maximum length of 4,294,967,295 or 4GB (2³² - 1) characters. The effective maximum length is less if the value contains multi-byte characters. The effective maximum length of LONGTEXT columns also depends on the configured maximum packet size in the client/server protocol and available memory. Each LONGTEXT value is stored using a four-byte length prefix that indicates the number of bytes in the value.\n\nJSON is an alias for LONGTEXT. See JSON Data Type for details.\n\nOracle Mode\n\nIn Oracle mode, CLOB is a synonym for LONGTEXT.\n\nExamples\n--------\n\nCREATE TABLE longtext_example (\n   description VARCHAR(20),\n   example LONGTEXT\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/longtext', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/longtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (73, 22, 'MEDIUMBLOB', 'Syntax\n------\n\nMEDIUMBLOB\n\nDescription\n-----------\n\nA BLOB column with a maximum length of 16,777,215 (2²⁴ - 1) bytes. Each MEDIUMBLOB value is stored using a three-byte length prefix that indicates the number of bytes in the value.\n\nLONG VARBINARY is a synonym for MEDIUMBLOB .\n\nExamples\n--------\n\nCREATE TABLE mediumblob_example (\n   description VARCHAR(20),\n   example MEDIUMBLOB\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/mediumblob', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/mediumblob');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (74, 22, 'MEDIUMTEXT', 'Syntax\n------\n\nMEDIUMTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA TEXT column with a maximum length of 16,777,215 (2²⁴ - 1) characters. The effective maximum length is less if the value contains multi-byte characters. Each MEDIUMTEXT value is stored using\\\na three-byte length prefix that indicates the number of bytes in the value.\n\nSYNONYMS\n\nThe following are synonyms for MEDIUMTEXT:\n\n LONG\n LONG CHAR VARYING\n LONG CHARACTER VARYING\n LONG VARCHAR\n* LONG VARCHARACTER\n\nExamples\n--------\n\nCREATE TABLE mediumtext_example (\n   description VARCHAR(20),\n   example MEDIUMTEXT\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/mediumtext', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/mediumtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (75, 22, 'NATIONAL CHAR VARYING', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE national_char_varying_example (\n  example NATIONAL CHAR VARYING(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-char-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-char-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (76, 22, 'NATIONAL CHAR', 'Description\n-----------\n\nFixed-length string of specific character set with limit up to 255 bytes.\n\nExamples\n--------\n\nCREATE TABLE national_char_example (\n  example NATIONAL CHAR(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-char', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-char');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (77, 22, 'NATIONAL CHARACTER VARYING', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE national_character_varying_example (\n  example NATIONAL CHARACTER VARYING(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-character-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-character-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (78, 22, 'NATIONAL CHARACTER', 'Description\n-----------\n\nSee NATIONAL CHAR.\n\nExamples\n--------\n\nCREATE TABLE national_character_example (\n  example NATIONAL CHARACTER(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-character', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-character');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (79, 22, 'NATIONAL VARCHAR', 'Description\n-----------\n\nVariable-length string of specific character set with limit up to 65,535 bytes.\n\nExamples\n--------\n\nCREATE TABLE national_varchar_example (\n  example NATIONAL VARCHAR(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-varchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-varchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (80, 22, 'NATIONAL VARCHARACTER', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE national_varcharacter_example (\n  example NATIONAL VARCHARACTER(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-varcharacter', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-varcharacter');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (81, 22, 'NCHAR VARCHAR', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE nchar_varchar_example (\n  example NCHAR VARCHAR(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (82, 22, 'NCHAR VARCHARACTER', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE nchar_varcharacter_example (\n  example NCHAR VARCHARACTER(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varcharacter', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varcharacter');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (83, 22, 'NCHAR VARYING', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE nchar_varying_example (\n  example NCHAR VARYING(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (84, 22, 'NCHAR', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE nchar_example (\n  example NCHAR(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (85, 22, 'RAW', 'Description\n-----------\n\nSee VARBINARY.\n\nExamples\n--------\n\nSET sql_mode=''oracle'';\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/raw', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/raw');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (86, 22, 'ROW', 'Syntax\n------\n\nROW (<field name> <data type> [{, <field name> <data type>}... ])\n\nDescription\n-----------\n\nROW is a data type for stored procedure variables.\n\nFeatures\n\nROW fields as normal variables\n\nROW fields (members) act as normal variables, and are able to appear in all query parts where a stored procedure variable is allowed:\n\n Assignment is using the := operator and the SET command:\n\n``sql\na.x:= 10;\na.x:= b.x;\nSET a.x= 10, a.y=20, a.z= b.z;\n`\n\n Passing to functions and operators:\n\n`sql\nSELECT f1(rec.a), rec.a<10;\n`\n\n Clauses (select list, WHERE, HAVING, LIMIT, etc...,):\n\n`sql\nSELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c;\n`\n\n INSERT values:\n\n`sql\nINSERT INTO t1 VALUES (rec.a, rec.b, rec.c);\n`\n\n SELECT .. INTO targets:\n\n`sql\nSELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10;\n`\n\n Dynamic SQL out parameters (EXECUTE and EXECUTE IMMEDIATE)\n\n`sql\nEXECUTE IMMEDIATE ''CALL proc_with_out_param(?)'' USING rec.a;\n`\n\nROW type variables as FETCH targets\n\nROW type variables are allowed as FETCH targets:\n\n`sql\nFETCH cur INTO rec;\n`\n\nwhere cur is a CURSOR and rec is a ROW type stored procedure variable.\n\nNote, currently an attempt to use FETCH for a ROW type variable returns this error:\n\n`sql\nERROR 1328 (HY000): Incorrect number of FETCH variables\n`\n\nFETCH from a cursor cur into a ROW variable rec works as follows:\n\n The number of fields in cur must match the number of fields in rec. Otherwise, an error is reported.\n Assignment is done from left to right. The first cursor field is assigned to the first variable field, the second cursor field is assigned to the second variable field, etc.\n Field names in rec are not important and can differ from field names in cur.\n\nSee FETCH Examples (below) for examples of using this withsql_mode=ORACLE and sql_mode=DEFAULT.\n\nROW type variables as SELECT...INTO targets\n\nROW type variables are allowed as SELECT..INTO targets with some differences depending on which sql_mode is in use.\n\n When using sql_mode=ORACLE, table%ROWTYPE and cursor%ROWTYPE variables can be used as SELECT...INTO targets.\n Using multiple ROW variables in the SELECT..INTO list will report an error.\n Using ROW variables with a different column count than in the SELECT..INTO list will report an error.\n\nSee SELECT...INTO Examples (below) for examples of using this with sql_mode=ORACLE and sql_mode=DEFAULT.\n\nFeatures not implemented\n\nThe following features are planned, but not implemented yet:\n\n Returning a ROW type expression from a stored function (see MDEV-12252). This will need some grammar change to support field names after parentheses:\n\n`sql\nSELECT f1().x FROM DUAL;\n`\n\n Returning a ROW type expression from a built-in hybrid type function, such as CASE, IF, etc.\n* ROW of ROW` values\n\nExamples\n--------\n\nDELIMITER $$\nCREATE PROCEDURE p1()\nBEGIN\n  DECLARE r ROW (c1 INT, c2 VARCHAR(10));\n  SET r.c1= 10;\n  SET r.c2= ''test'';\n  INSERT INTO t1 VALUES (r.c1, r.c2);\nEND;\n$$\nDELIMITER ;\nCALL p1();\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/row', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/row');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (87, 22, 'SET Data Type', 'Syntax\n------\n\nSET(''value1'',''value2'',...) [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA set. A string object that can have zero or more values, each of which must be chosen from the list of values ''value1'', ''value2'', ... A SET column can have a maximum of 64 members. SET values are\\\nrepresented internally as integers.\n\nSET values cannot contain commas.\n\nIf a SET contains duplicate values, an error will be returned if strict mode is enabled, or a warning if strict mode is not enabled.\n\nExamples\n--------\n\nCREATE TABLE set_example (\n  description VARCHAR(20),\n  example SET(''Foo'', ''Bar'', ''Baz'', ''Bob'')\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/set-data-type', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/set-data-type');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (88, 22, 'TEXT', 'Syntax\n------\n\nTEXT[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nIf you are handling large text data that exceeds the max_allowed_packet limit, you can stream the data in chunks using specialized API functions like mysql_stmt_send_long_data() or setCharacterStream(). See Handling Large Data via APIs for more details.\n\nA TEXT column with a maximum length of 65,535 (2¹⁶ - 1) characters. The effective maximum length is less if the value contains multi-byte characters. Each TEXT value is stored using a two-byte length prefix that indicates the number of bytes in the value. If you need a bigger storage, consider using MEDIUMTEXT instead.\n\nAn optional length M can be given for this type. If this is done, MariaDB creates the column as the smallest TEXT type large enough to hold valuesM characters long.\n\nBLOB and TEXT columns can be assigned a DEFAULT value.\n\nExamples\n--------\n\nCREATE TABLE strtest (d TEXT(10));\nINSERT INTO strtest VALUES(''Maria   '');\n\nSELECT d=''Maria'',d=''Maria   '' FROM strtest;\n+-----------+--------------+\n| d=''Maria'' | d=''Maria   '' |\n+-----------+--------------+\n|         1 |            1 |\n+-----------+--------------+\n\nSELECT d LIKE ''Maria'',d LIKE ''Maria   '' FROM strtest;\n+----------------+-------------------+\n| d LIKE ''Maria'' | d LIKE ''Maria   '' |\n+----------------+-------------------+\n|              0 |                 1 |\n+----------------+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/text', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/text');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (89, 22, 'TINYBLOB', 'Syntax\n------\n\nTINYBLOB\n\nDescription\n-----------\n\nA BLOB column with a maximum length of 255 (2⁸ - 1) bytes. Each TINYBLOB value is stored using a one-byte length prefix that indicates the number of bytes in the value.\n\nExamples\n--------\n\nCREATE TABLE tinyblob_example (\n   description VARCHAR(20),\n   example TINYBLOB\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/tinyblob', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/tinyblob');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (90, 22, 'TINYTEXT', 'Syntax\n------\n\nTINYTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA TEXT column with a maximum length of 255 (2⁸ - 1) characters. The effective maximum length is less if the value contains multi-byte characters. Each TINYTEXT value is stored using a one-byte length prefix that indicates the number of bytes in the value.\n\nExamples\n--------\n\nCREATE TABLE tinytext_example (\n   description VARCHAR(20),\n   example TINYTEXT\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/tinytext', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/tinytext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (91, 22, 'UUID Data Type', 'Syntax\n------\n\nUUID\n\nDescription\n-----------\n\nThe UUID data type is intended for the storage of 128-bit UUID (Universally Unique Identifier) data. See the UUID function page for more details on UUIDs themselves.\n\nRetrieval\n\nData retrieved by this data type is in the string representation defined in RFC4122.\n\nCasting\n\nString literals of hexadecimal characters and CHAR/VARCHAR/TEXT can be cast to the UUID data type. Likewise hexadecimal literals, binary-literals, and BINARY/VARBINARY/BLOB types can also be cast to UUID.\n\nThe data type will not accept a short UUID generated with the UUID_SHORT function, but will accept a value without the - character generated by the SYS_GUID function (or inserted directly). Hyphens can be partially omitted as well, or included after any group of two digits.\n\nThe type does not accept UUID values in braces, permitted by some implementations.\n\nStorage\n\nUUID values are stored in an index-friendly manner; the order of a UUID of llllllll-mmmm-Vhhh-vsss-nnnnnnnnnnnn is stored as:\n\n``sql\nnnnnnnnnnnnn-vsss-Vhhh-mmmm-llllllll\n`\n\nThis provides a sorting order, assuming a UUIDv1 (node and timestamp) is used, of the node, followed by the timestamp. The key aspect is the timestamps are sequential.\n\nMariaDB starting with 10.10\n\nTaking into account that UUIDv7 and other versions are designed around time ordering, UUID values version >= 6 are stored without byte-swapping, and UUID values with version >=8 and variant=0 are now considered invalid (as the SQL standard suggests).\n\nUUID values version >= 6 are not stored without byte-swapping, and UUID` values with version >=8 and variant=0 are not considered invalid.\n\nExamples\n--------\n\nCREATE TABLE t1 (id UUID);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/uuid-data-type', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/uuid-data-type');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (92, 22, 'VARBINARY', 'Syntax\n------\n\nVARBINARY(M)\n\nDescription\n-----------\n\nThe VARBINARY type is similar to the VARCHAR type, but stores binary byte strings rather than non-binary character strings. M represents the maximum column length in bytes.\n\nIt contains no character set, and comparison and sorting are based on the numeric value of the bytes.\n\nIf the maximum length is exceeded, and SQL strict mode is not enabled , the extra characters will be dropped with a warning. If strict mode is enabled, an error will occur.\n\nUnlike BINARY values, VARBINARY values are not right-padded when inserting.\n\nUse Cases for Zero Length\n\nA BINARY(0) or VARBINARY(0) column is restricted to an empty byte string or NULL.\n\n Schema Preservation: Use these columns when a system expects a specific column to exist, but no data storage is required for your current application.\n Space-Efficient Indicators: These columns can act as a two-state indicator where the presence of an empty byte string represents one state and NULL represents another.\n\nIf you attempt to insert a value other than an empty string, MariaDB returns an ERROR 1406 (22001) indicating the data is too long for the column.\n\nOracle Mode\n\nIn Oracle mode, RAW is a synonym for VARBINARY.\n\nExamples\n--------\n\nCREATE TABLE varbins (a VARBINARY(10));\n\nINSERT INTO varbins VALUES(''12345678901'');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSELECT * FROM varbins;\n+------------+\n| a          |\n+------------+\n| 1234567890 |\n+------------+\n\nSET sql_mode=''STRICT_ALL_TABLES'';\n\nINSERT INTO varbins VALUES(''12345678901'');\nERROR 1406 (22001): Data too long for column ''a'' at row 1\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/varbinary', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/varbinary');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (93, 22, 'VARCHAR', 'Syntax\n------\n\n[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA variable-length string. M represents the maximum column length in characters. The range of M is 0 to 65,532. The effective maximum length of a VARCHAR is subject to the maximum row size and the character set used. For example, utf-8 characters can require up to three bytes per character, so a VARCHAR column that uses the utf-8 character set can be declared to be a maximum of 21,844 characters.\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the standard SQL way to define that a VARCHAR column should use some predefined character set. MariaDB uses utf-8 as its\\\npredefined character set, as does MySQL. NVARCHAR is shorthand for NATIONAL VARCHAR.\n\nMariaDB stores VARCHAR values as a one-byte or two-byte length prefix plus data. The length prefix indicates the number of bytes in the value. A VARCHAR column uses one length byte if values require no more than 255 bytes, two length bytes if values may require more than 255 bytes.\n\nMariaDB follows the standard SQL specification and does not remove trailing spaces from VARCHAR values.\n\nIf a unique index consists of a column where trailing pad characters are stripped or ignored, inserts into that column where values differ only by the number of trailing pad characters will result in a duplicate-key error.\n\nFor the ColumnStore engine, M represents the maximum column length in bytes.\n\nFor MariaDB, a number of NO PAD collations are available.\n\nVARCHAR(0) columns can contain 2 values: an empty string or NULL. Such columns cannot be part of an index. The CONNECT storage engine does not support VARCHAR(0).\n\nUse Cases for Zero Length\n\nA CHAR(0) or VARCHAR(0) column occupies minimal space and is restricted to two possible values: an empty string ('''') or NULL. You can use these columns for the following purposes:\n\n Legacy Compatibility: Include these columns to maintain compatibility with older applications that require a specific table schema, even if the data is no longer collected.\n Two-State Flags: A CHAR(0) NULL column can function as a boolean indicator. It uses only one bit of storage to distinguish between a "set" state (the empty string) and an "unset" state (NULL).\n Row Marking: You can use a CHAR(0) column to mark a specific row in a table. For example, if you require only one "active" row, set that row to an empty string while keeping all other rows NULL.\n\nThe following error occurs if you attempt to insert any character data into a 0-length column: ERROR 1406 (22001): Data too long for column.\n\nSYNONYMS\n\nThe following are synonyms for VARCHAR:\n\n CHAR VARYING\n CHARACTER VARYING\n VARCHAR2\n* VARCHARACTER\n\nExamples\n--------\n\nVARCHAR(30) CHARACTER SET utf8\nNATIONAL VARCHAR(30)\nNVARCHAR(30)\nNCHAR VARCHAR(30)\nNATIONAL CHARACTER VARYING(30)\nNATIONAL CHAR VARYING(30)\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/varchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/varchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (94, 22, 'VARCHAR2', 'Description\n-----------\n\nThis is a synonym for VARCHAR.\n\nExamples\n--------\n\nSET sql_mode=''oracle'';\n\nCREATE TABLE varchar2_example (\n  example VARCHAR2(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/varchar2', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/varchar2');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (95, 22, 'VARCHARACTER', 'Description\n-----------\n\nSee VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE varcharacter_example (\n  example VARCHARACTER(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/varcharacter', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/varcharacter');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (96, 22, 'XMLTYPE', 'Description\n-----------\n\nXMLTYPE is a data type introduced in MariaDB 12.3 for storing XML data. It is designed to:\n\n Provide convenient storage of XML data\n Ensure compatibility with Oracle databases\n Support future XML validation and processing capabilities\n\nIn its initial implementatio&#x6E;_,_ XMLTYPE provides basic XML storage capabilities onl&#x79;_,_ without validation or specialized XML-specific functionalit&#x79;_._ When using string functions, the data type is effectively converted to strings and is maintained in temporary tables.\n\nCharacteristics\n\n Maximum storage capacity: 4GB (same as LONGBLOB)\n Compatibilit&#x79;: Designed to be compatible with Oracle’s XMLTYPE\n Validatio&#x6E;: XML validation or schema enforcement is not supported\n Length restrictio&#x6E;: Length cannot be specified.\n\nExample (invalid usage):\n\n``\nCREATE TABLE t1 (a XMLTYPE(6));\n`\n\nXMLTYPE does not accept length parameters, unlike data types such as VARCHAR(255) or DECIMAL(10,2)_._\n\nRelated Functions\n\nWith MariaDB 12.3, the following functions return the XMLTYPE data type:\n\n UPDATEXML&#x20;\n CAST&#x20;\n\nExamples\n\nBasic Tables Creation\n\n`\nCREATE TABLE t1(id INT, x xmltype);\nSHOW CREATE TABLE t1;\n`\n\nOutput\n\n`\nTable	Create Table\nt1	CREATE TABLE t1 (\n  id int(11) DEFAULT NULL,\n  x xmltype DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci\n`\n\nCharacter Set Specification\n\n`\nCREATE TABLE t1(id INT, x xmltype  CHARACTER SET utf8mb3) CHARACTER SET utf8mb4;\nSHOW CREATE TABLE t1;\n`\n\nOutput\n\n`\nTable	Create Table\nt1	CREATE TABLE t1 (\n  id int(11) DEFAULT NULL,\n  x xmltype CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci\n`\n\nBinary Attribute\n\n`\nCREATE TABLE t1 (a xmltype binary) CHARACTER SET utf8mb4;\nSHOW CREATE TABLE t1;\n`\n\nOutput\n\n`\nTable	Create Table\nt1	CREATE TABLE t1 (\n  a xmltype CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci\n`\n\nBasic Data Insertion and Selection\n\n`\nCREATE TABLE t1(id INT, x xmltype);\nINSERT INTO t1 VALUES (1, ''one''), (2, ''two''), (3, ''three'');\nSELECT  FROM t1;\n`\n\nOutput\n\n`\nid	x\n1	 one\n2	 two\n3	 three\n`\n\nRestrictions and Error Cases\n\nLength Specification Not Permitted\n\nIf a length parameter is provided for XMLTYPE_,_ the system returns an error:\n\n`\nCREATE TABLE t1 (a XMLTYPE(6));\n`\n\nOutput\n\n`\nERROR HY000: Data type ''XMLTYPE'' doesn''t support LENGTH attribute.\n`\n\nREF_SYSTEM_ID Attribute Not Supported\n\n`\nCREATE TABLE t1 (a XMLTYPE REF_SYSTEM_ID=4);\n`\n\nOutput\n\n`\nERROR HY000: Data type ''XMLTYPE'' doesn''t support REF_SYSTEM_ID attribute.\n\n`\n\nLength Parameters in Complex Column Definitions\n\n`\nCREATE TABLE t1(id INT, x xmltype(10, 2));\n`\n\nOutput\n\n`\nERROR HY000: Data type ''xmltype'' doesn''t support LENGTH attribute.\n``\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/xmltype', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/xmltype');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (97, 22, 'TYPE OF', 'Description\n-----------\n\nThis is special declaration only available inside a stored procedure.\n\nExamples\n--------\n\nCREATE TABLE typeof_table(\n  descr VARCHAR(20),\n  val INT\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/type-of', '', 'https://mariadb.com/docs/server/reference/data-types/type-of');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (98, 35, 'Options, System & Status Variables', 'Description\n-----------\n\n -a (--ansii)\n --abort-slave-event-count\n Aborted_clients\n Aborted_connects\n Aborted_connects_preauth\n Access_denied_errors\n Acl_column_grants\n Acl_database_grants\n Acl_function_grants\n Acl_package_body_grants\n Acl_package_spec_grants\n Acl_procedure_grants\n Acl_proxy_users\n Acl_role_grants\n Acl_roles\n Acl_table_grants\n Acl_users\n \\--allow-suspicious-udfs, allow_suspicious_udfs\n alter_algorithm\n analyze_max_length\n analyze_sample_percentage\n \\--ansii\n aria_block_size\n aria_checkpoint_interval\n aria_checkpoint_log_activity\n aria_encrypt_tables\n aria_force_start_after_recovery_failures\n aria_group_commit\n aria_group_commit_interval\n aria_log_dir_path\n aria_log_file_size\n aria_log_purge_type\n aria_max_sort_file_size\n aria_page_checksum\n aria_pagecache_age_threshold\n aria_pagecache_blocks_not_flushed\n aria_pagecache_blocks_unused\n aria_pagecache_blocks_used\n aria_pagecache_buffer_size\n aria_pagecache_division_limit\n aria_pagecache_file_hash_size\n aria_pagecache_read_requests\n aria_pagecache_reads\n aria_pagecache_segments\n aria_pagecache_write_requests\n aria_pagecache_writes\n aria_recover\n aria_recover_options\n aria_repair_threads\n aria_sort_buffer_size\n aria_stats_method\n aria_sync_log_dir\n aria_transaction_log_syncs\n aria_used_for_temp_tables\n autocommit\n auto_increment_increment\n auto_increment_offset\n automatic_sp_privileges\n aws_key_management_key_spec\n aws_key_management_log_level\n aws_key_management_master_key_id\n aws_key_management_mock\n aws_key_management_region\n aws_key_management_request_timeout\n aws_key_management_rotate_key\n back_log\n -b, basedir\n big_tables\n bind_address\n binlog_alter_two_phase\n binlog_annotate_row_events\n Binlog_bytes_written\n Binlog_cache_disk_use\n binlog_cache_size\n Binlog_cache_use\n binlog_checksum\n binlog_commit_wait_count\n binlog_commit_wait_usec\n Binlog_commits\n binlog_direct_non_transactional_updates\n Binlog_disk_use\n --binlog-do-db, binlog_do_db\n binlog_expire_logs_seconds\n binlog_file_cache_size\n binlog_format\n Binlog_group_commits\n Binlog_group_commit_trigger_count\n Binlog_group_commit_trigger_lock_wait\n Binlog_group_commit_trigger_timeout\n binlog_gtid_index\n Binlog_gtid_index_hit\n Binlog_gtid_index_miss\n binlog_gtid_index_page_size\n binlog_gtid_index_span_min\n \\--binlog-ignore-db, binlog_ignore_db\n binlog_large_commit_threshold\n binlog_legacy_event_pos\n binlog_optimize_thread_scheduling\n binlog_row_image\n \\--binlog-row-event-max-size, binlog_row_event_max_size\n binlog_row_metadata\n Binlog_snapshot_file\n Binlog_snapshot_position\n binlog_space_limit\n Binlog_stmt_cache_disk_use\n Binlog_stmt_cache_use\n binlog_stmt_cache_size\n block_encryption_mode\n \\--bootstrap\n bulk_insert_buffer_size\n Busy_time\n Bytes_received\n Bytes_sent\n cassandra_default_thrift_host\n cassandra_failure_retries\n cassandra_insert_batch_size\n cassandra_multiget_batch_size\n Cassandra_multiget_keys_scanned\n Cassandra_multiget_reads\n Cassandra_multiget_rows_read\n Cassandra_network_exceptions\n cassandra_read_consistency\n cassandra_rnd_batch_size\n Cassandra_row_inserts\n Cassandra_row_insert_batches\n Cassandra_timeout_exceptions\n Cassandra_unavailable_exceptions\n cassandra_write_consistency\n character_set_client\n \\--character-set-client-handshake\n character_set_collations\n character_set_connection\n character_set_database\n character_set_filesystem\n character_set_results\n -C, character_set_server\n character_set_system\n character_sets_dir\n check_constraint_checks\n -r, --chroot\n collation_connection\n collation_database\n collation_server\n Column_compressions\n column_compression_threshold\n column_compression_zlib_level\n column_compression_zlib_strategy\n column_compression_zlib_wrap\n Column_decompressions\n Com_admin_commands\n Com_alter_db\n Com_alter_db_upgrade\n Com_alter_event\n Com_alter_function\n Com_alter_procedure\n Com_alter_sequence\n Com_alter_server\n Com_alter_table\n Com_alter_tablespace\n Com_alter_user\n Com_analyze\n Com_assign_to_keycache\n Com_backup\n Com_backup_lock\n Com_backup_table\n Com_begin\n Com_binlog\n Com_call_procedure\n Com_change_db\n Com_change_master\n Com_check\n Com_checksum\n Com_commit\n Com_compound_sql\n Com_create_db\n Com_create_event\n Com_create_function\n Com_create_index\n Com_create_package\n Com_create_package_body\n Com_create_procedure\n Com_create_role\n Com_create_sequence\n Com_create_server\n Com_create_table\n Com_create_temporary_table\n Com_create_trigger\n Com_create_udf\n Com_create_user\n Com_create_view\n Com_dealloc_sql\n Com_delete\n Com_delete_multi\n Com_do\n Com_drop_db\n Com_drop_event\n Com_drop_function\n Com_drop_index\n Com_drop_package\n Com_drop_package_body\n Com_drop_procedure\n Com_drop_role\n Com_drop_sequence\n Com_drop_server\n Com_drop_table\n Com_drop_temporary_table\n Com_drop_trigger\n Com_drop_user\n Com_drop_user\n Com_drop_view\n Com_empty_query\n Com_execute_immediate\n Com_execute_sql\n Com_flush\n Com_get_diagnostics\n Com_grant\n Com_grant_role\n Com_ha_close\n Com_ha_open\n Com_ha_read\n Com_help\n Com_insert\n Com_insert_select\n Com_install_plugin\n Com_kill\n Com_load\n Com_load_master_data\n Com_load_master_table\n Com_lock_tables\n Com_multi\n Com_optimize\n Com_preload_keys\n Com_prepare_sql\n Com_purge\n Com_purge_before_date\n Com_release_savepoint\n Com_rename_table\n Com_rename_user\n Com_repair\n Com_replace\n Com_replace_select\n Com_reset\n Com_resignal\n Com_restore_table\n Com_revoke\n Com_revoke_all\n Com_revoke_grant\n Com_rollback\n Com_rollback_to_savepoint\n Com_savepoint\n Com_select\n Com_set_option\n Com_show_authors\n Com_show_binlog_events\n Com_show_binlogs\n Com_show_charsets\n Com_show_client_statistics\n Com_show_collations\n Com_show_column_types\n Com_show_contributors\n Com_show_create_db\n Com_show_create_event\n Com_show_create_func\n Com_show_create_package\n Com_show_create_package_body\n Com_show_create_proc\n Com_show_create_table\n Com_show_create_trigger\n Com_show_create_user\n Com_show_databases\n Com_show_engine_logs\n Com_show_engine_mutex\n Com_show_engine_status\n Com_show_events\n Com_show_errors\n Com_show_explain\n Com_show_fields\n Com_show_function_status\n Com_show_generic\n Com_show_grants\n Com_show_keys\n Com_show_index_statistics\n Com_show_binlog_status\n Com_show_master_status\n Com_show_new_master\n Com_show_open_tables\n Com_show_package_status\n Com_show_package_body_status\n Com_show_plugins\n Com_show_privileges\n Com_show_procedure_status\n Com_show_processlist\n Com_show_profile\n Com_show_profiles\n Com_show_relaylog_events\n Com_show_slave_hosts\n Com_show_slave_status\n Com_show_status\n Com_show_storage_engines\n Com_show_table_statistics\n Com_show_table_status\n Com_show_tables\n Com_show_triggers\n Com_show_user_statistics\n Com_show_variable\n Com_show_warnings\n Com_shutdown\n Com_signal\n Com_slave_start\n Com_slave_stop\n Com_start_all_slaves\n Com_start_slave\n Com_stop_all_slaves\n Com_stop_slave\n Com_stmt_close\n Com_stmt_execute\n Com_stmt_fetch\n Com_stmt_prepare\n Com_stmt_reprepare\n Com_stmt_reset\n Com_stmt_send_long_data\n Com_truncate\n Com_uninstall_plugin\n Com_unlock_tables\n Com_update\n Com_update_multi\n Com_xa_commit\n Com_xa_end\n Com_xa_prepare\n Com_xa_recover\n Com_xa_rollback\n Com_xa_start\n completion_type\n Compression\n concurrent_insert\n connect_class_path\n connect_cond_push\n connect_conv_size\n connect_default_depth\n connect_default_prec\n connect_enable_mongo\n connect_exact_info\n connect_force_bson\n connect_indx_map\n connect_java_wrapper\n connect_json_all_path\n connect_json_grp_size\n connect_json_null\n connect_jvm_path\n connect_timeout\n connect_type_conv\n connect_use_tempfile\n connect_work_size\n connect_xtrace\n Connection_errors_accept\n Connection_errors_internal\n Connection_errors_max_connections\n Connection_errors_peer_address\n Connection_errors_select\n Connection_errors_tcpwrap\n Connections\n --console\n core_file\n Cpu_time\n \\--cracklib-password-check\n cracklib_password_check-dictionary\n create_tmp_table_binlog_formats\n Created_tmp_disk_tables\n Created_tmp_files\n Created_tmp_tables\n -h, datadir\n date_format\n datetime_format\n deadlock_search_depth_long\n deadlock_search_depth_short\n deadlock_timeout_long\n deadlock_timeout_short\n -#, debug\n --debug-assert-if-crashed-table\n --debug-binlog-fsync-sleep\n --debug-crc-break\n --debug-flush\n --debug-no-sync\n debug_no_thread_alarm\n debug_sync\n --debug-sync-timeout\n \\--default-character-set\n default_master_connection\n default_password_lifetime\n default_regex_flags\n default_storage_engine\n default_table_type\n default_tmp_storage_engine\n \\--default-time-zone\n default_week_format\n \\--defaults-extra-file\n \\--defaults-file\n delay_key_write\n Delayed_errors\n delayed_insert_limit\n Delayed_insert_threads\n delayed_insert_timeout\n delayed_queue_size\n Delayed_writes\n Delete_scan\n \\--des-key-file\n disconnect_on_expired_password\n \\--disconnect-slave-event-count\n \\--disks\n div_precision_increment\n Empty_queries\n encrypt_binlog\n encrypt_tmp_disk_tables\n encrypt_tmp_files\n encryption_algorithm\n enforce_storage_engine\n engine_condition_pushdown\n eq_range_index_dive_limit\n error_count\n event_scheduler\n Executed_events\n Executed_triggers\n -T, --exit-info\n expensive_subquery_limit\n expire_logs_days\n explicit_defaults_for_timestamp\n \\--external-locking\n external_user\n extra_max_connections\n extra_port\n Feature_application_time_periods\n Feature_check_constraint\n Feature_custom_aggregate_functions\n Feature_delay_key_write\n Feature_dynamic_columns\n Feature_fulltext\n Feature_gis\n Feature_insert_returning\n Feature_invisible_columns\n Feature_json\n Feature_locale\n Feature_subquery\n Feature_timezone\n Feature_trigger\n Feature_window_functions\n Feature_xml\n \\--feedback\n feedback_http_proxy\n feedback_send_retry_wait\n feedback_send_timeout\n feedback_server_uid\n feedback_url\n feedback_user_info\n file_key_management_encryption_algorithm\n file_key_management_filekey\n file_key_management_filename\n \\--flashback\n flush\n Flush_commands\n flush_time\n foreign_key_checks\n ft_boolean_syntax\n ft_max_word_len\n ft_min_word_len\n ft_query_expansion_limit\n ft_stopword_file\n \\--gdb\n general_log\n general_log_file\n \\--getopt-prefix-matching\n group_concat_max_len\n gssapi_keytab_path\n gssapi_principal_name\n gssapi_mech_name\n gtid_binlog_pos\n gtid_binlog_state\n gtid_cleanup_batch_size\n gtid_current_pos\n gtid_domain_id\n gtid_ignore_duplicates\n gtid_pos_auto_engines\n gtid_seq_no\n gtid_slave_pos\n gtid_strict_mode\n -h, datadir\n Handler_commit\n Handler_delete\n Handler_discover\n Handler_external_lock\n Handler_icp_attempts\n Handler_icp_match\n Handler_mrr_init\n Handler_mrr_key_refills\n Handler_mrr_rowid_refills\n Handler_prepare\n Handler_read_first\n Handler_read_key\n Handler_read_last\n Handler_read_next\n Handler_read_prev\n Handler_read_retry\n Handler_read_rnd\n Handler_read_rnd_deleted\n Handler_read_rnd_next\n Handler_rollback\n Handler_savepoint\n Handler_savepoint_rollback\n Handler_tmp_delete\n Handler_tmp_update\n Handler_tmp_write\n Handler_update\n Handler_write\n handlersocket_accept_balance\n handlersocket_address\n handlersocket_backlog\n handlersocket_epoll\n handlersocket_plain_secret\n handlersocket_plain_secret_wr\n handlersocket_port\n handlersocket_port_wr\n handlersocket_rcvbuf\n handlersocket_readsize\n handlersocket_sndbuf\n handlersocket_threads\n handlersocket_threads_wr\n handlersocket_timeout\n handlersocket_verbose\n handlersocket_wrlock_timeout\n hashicorp-key-management-cache-timeout\n hashicorp-key-management-cache-version-timeout\n hashicorp-key-management-caching-enabled\n hashicorp-key-management-check-kv-version\n hashicorp-key-management-max-retries\n hashicorp-key-management-timeout\n hashicorp-key-management-token\n hashicorp-key-management-use-cache-on-timeout\n hashicorp-key-management-vault-ca\n hashicorp-key-management-vault-url\n have_compress\n have_crypt\n have_csv\n have_dynamic_loading\n have_geometry\n have_innodb\n have_ndbcluster\n have_openssl\n have_partitioning\n have_profiling\n have_query_cache\n have_rtree_keys\n have_ssl\n have_symlink\n \\--help\n histogram_size\n histogram_type\n host_cache_size\n hostname\n identity\n idle_readonly_transaction_timeout\n idle_transaction_timeout\n idle_write_transaction_timeout\n ignore_db_dirs\n ignore_builtin_innodb\n in_predicate_conversion_threshold\n in_transaction\n init_connect\n init_file\n \\--init-rpl-role\n init_slave\n \\--innodb\n innodb_adaptive_checkpoint\n innodb_adaptive_flushing\n innodb_adaptive_flushing_lwm\n innodb_adaptive_flushing_method\n Innodb_adaptive_hash_cells\n Innodb_adaptive_hash_hash_searches\n Innodb_adaptive_hash_heap_buffers\n innodb_adaptive_hash_index\n innodb_adaptive_hash_index_partitions\n innodb_adaptive_hash_index_parts\n Innodb_adaptive_hash_non_hash_searches\n innodb_adaptive_max_sleep_delay\n innodb_additional_mem_pool_size\n innodb_alter_copy_bulk\n innodb_api_bk_commit_interval\n innodb_api_disable_rowlock\n innodb_api_enable_binlog\n innodb_api_enable_mdl\n innodb_api_trx_level\n Innodb_async_reads_pending\n Innodb_async_reads_queue_size\n Innodb_async_reads_tasks_running\n Innodb_async_reads_total_enqueues\n Innodb_async_reads_total_count\n Innodb_async_reads_wait_slot_sec\n Innodb_async_writes_pending\n Innodb_async_writes_queue_size\n Innodb_async_writes_tasks_running\n Innodb_async_writes_total_enqueues\n Innodb_async_writes_total_count\n Innodb_async_writes_wait_slot_sec\n innodb-auto-lru-dump\n innodb_autoextend_increment\n innodb_autoinc_lock_mode\n Innodb_available_undo_logs\n Innodb_background_log_sync\n innodb_background_scrub_data_check_interval\n innodb_background_scrub_data_compressed\n innodb_background_scrub_data_interval\n innodb_background_scrub_data_uncompressed\n innodb_blocking_buffer_pool_restore\n innodb_buf_dump_status_frequency\n Innodb_buffer_pool_bytes_data\n Innodb_buffer_pool_bytes_dirty\n innodb_buffer_pool_chunk_size\n innodb_buffer_pool_dump_at_shutdown\n innodb_buffer_pool_dump_now\n innodb_buffer_pool_dump_pct\n Innodb_buffer_pool_dump_status\n innodb_buffer_pool_evict\n innodb_buffer_pool_filename\n innodb_buffer_pool_instances\n innodb_buffer_pool_load_abort\n innodb_buffer_pool_load_at_startup\n innodb_buffer_pool_load_now\n Innodb_buffer_pool_load_incomplete\n innodb_buffer_pool_load_pages_abort\n Innodb_buffer_pool_load_status\n Innodb_buffer_pool_pages_data\n Innodb_buffer_pool_pages_dirty\n Innodb_buffer_pool_pages_flushed\n Innodb_buffer_pool_pages_LRU_flushed\n Innodb_buffer_pool_pages_LRU_freed\n Innodb_buffer_pool_pages_free\n Innodb_buffer_pool_pages_made_not_young\n Innodb_buffer_pool_pages_made_young\n Innodb_buffer_pool_pages_misc\n Innodb_buffer_pool_pages_old\n Innodb_buffer_pool_pages_total\n innodb_buffer_pool_populate\n Innodb_buffer_pool_read_ahead\n Innodb_buffer_pool_read_ahead_evicted\n Innodb_buffer_pool_read_ahead_rnd\n Innodb_buffer_pool_read_requests\n Innodb_buffer_pool_reads\n Innodb_buffer_pool_resize_status\n innodb_buffer_pool_restore_at_startup\n innodb_buffer_pool_shm_checksum\n innodb_buffer_pool_shm_key\n innodb_buffer_pool_size\n innodb_buffer_pool_size_auto_min\n innodb_buffer_pool_size_max\n Innodb_buffer_pool_wait_free\n Innodb_buffer_pool_write_requests\n Innodb_buffered_aio_submitted\n innodb_change_buffer_dump\n innodb_change_buffer_max_size\n innodb_change_buffering\n innodb_change_buffering_debug\n Innodb_checkpoint_age\n innodb_checkpoint_age_target\n Innodb_c\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/full-list-of-mariadb-options-system-and-status-variables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (99, 5, 'Authentication Plugin - caching\\_sha2\\_password', 'Description\n-----------\n\nTo aid migrations MariaDB provides MySQL compatible caching_sha2_password authentication plugin. It allows to move users from MySQL to MariaDB without requiring them to change their passwords. It should be only used for migration, otherwise a more secure and convenient PARSEC plugin is recommended.\n\nInstalling the Plugin\n\nThe caching_sha2_password authentication plugin''s shared library is included in MariaDB packages as the auth_mysql_sha2.so or auth_mysql_sha2.dll shared library on systems where it can be built.\n\nAlthough the plugin''s shared library is distributed with MariaDB, the plugin is not actually installed into MariaDB by default. There are two methods that can be used to install the plugin into 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 ''auth_mysql_sha2'';\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 = auth_mysql_sha2\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_mysql_sha2'';\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 must be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nUsing the Plugin\n\nTo create a user in MariaDB that was using caching_sha2_password plugin in MySQL, issue this statement:\n\n`sql\nCREATE USER user@host IDENTIFIED WITH caching_sha2_password USING ''authentication_string'';\n`\n\nHere, authentication_string is taken from the mysql.user table for the corresponding user in MySQL installation. Beware that the authentication string for caching_sha2_password in MySQL can contain non-printable characters and copying it from the terminal window will likely not work.\n\nSystem Variables\n\ncaching_sha2_password_private_key_path\n\n Description: A path to the private RSA key used for authentication.\n Command line: --caching-sha2-password-private-key-path\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: private_key.pem\n Introduced: MariaDB 11.4.9, MariaDB 11.8.4\n\ncaching_sha2_password_public_key_path\n\n Description: A path to the public RSA key used for authentication.\n Command line: --caching-sha2-password-public-key-path\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: public_key.pem\n Introduced: MariaDB 11.4.9, MariaDB 11.8.4\n\ncaching_sha2_password_auto_generate_rsa_keys\n\n Description: Auto generate RSA keys at server startup if key paths are not explicitly set and key files are not present at their default locations.\n Command line: --caching-sha2-password-auto-generate-rsa-keys\n Scope: Global\n Dynamic: No\n Data Type: boolean\n Default Value: ON\n Introduced: MariaDB 11.4.9, MariaDB 11.8.4\n\ncaching_sha2_password_digest_rounds\n\n Description: Number of SHA2 rounds to be performed when computing a password hash.\n Command line: --caching-sha2-password-digest-rounds\n Scope: Global\n Dynamic: No\n Data Type: integer\n Default Value: 5000`\n Introduced: MariaDB 11.4.9, MariaDB 11.8.4\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-caching_sha2_password', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-caching_sha2_password');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (100, 5, 'Authentication Plugin - ed25519', 'Description\n-----------\n\nMySQL has used SHA-1 based authentication since version 4.1. The authentication plugin is called mysql_native_password. Over the years as computers became faster, new attacks on SHA-1 were being developed. Nowadays SHA-1 is no longer considered as secure as it was in 2001. That''s why the ed25519 authentication plugin was created.\n\nThe ed25519 authentication plugin uses Elliptic Curve Digital Signature Algorithm (ECDSA) to securely store users'' passwords and to authenticate users. The ed25519 algorithm is the same one that is used by OpenSSH. It is based on the elliptic curve and code created by Daniel J. Bernstein.\n\nInstalling the Plugin\n\nAlthough the plugin''s shared library is distributed by default with MariaDB, with a file name of auth_ed25519.so (Unix) or auth_ed25519.dll (Windows), 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 ''auth_ed25519'';\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 = auth_ed25519\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_ed25519'';\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, those options must be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nCreating Users\n\nYou can create a user account by executing the CREATE USER statement and providing the IDENTIFIED VIA clause followied by the name of the plugin, ed25519, and providing the USING clause followed by the PASSWORD() function, with the plain-text password as an argument:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA ed25519 USING PASSWORD(''secret'');\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user account via GRANT:\n\n`sql\nGRANT SELECT ON db. TO username@hostname IDENTIFIED VIA ed25519 USING PASSWORD(''secret'');\n`\n\nThe PASSWORD() function and SET PASSWORD statements don''t work with the ed25519 authentication plugin. Instead, you have to use the UDF that comes with the authentication plugin to calculate the password hash:\n\n`sql\nCREATE FUNCTION ed25519_password RETURNS STRING SONAME "auth_ed25519.so";\n`\n\nNow you can calculate a password hash by executing this query:\n\n`sql\nSELECT ed25519_password("secret");\n+---------------------------------------------+\n| SELECT ed25519_password("secret");          |\n+---------------------------------------------+\n| ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY |\n+---------------------------------------------+\n`\n\nNow you can use it to create the user account using the new password hash. As with any password, you should always use a complex password that isn''t easy to guess. If you don''t, if anyone gets access to the stored passwords in the mysql.user table, they could use rainbow tables to figure out the original password.\n\nTo create a user account via CREATE USER, specify the name of the plugin in the IDENTIFIED VIA clause while providing the password hash as the USING clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA ed25519 \n  USING ''ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY'';\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, you can also create the user account via GRANT:\n\n`sql\nGRANT SELECT ON db. TO username@hostname IDENTIFIED VIA ed25519 \n  USING ''ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY'';\n`\n\nNote that users require a password in order to be able to connect. It is possible to create users without specifying a password, but they will be unable to connect.\n\nChanging User Passwords\n\nYou can change a user account''s password by executing the SET PASSWORD statement followed by the PASSWORD() function and providing the plain-text password as an argument:\n\n`sql\nSET PASSWORD =  PASSWORD(''new_secret'')\n`\n\nYou can also change the user account''s password with the ALTER USER statement. You would have to specify the name of the plugin in the IDENTIFIED VIA clause while providing the plain-text password as an argument to the PASSWORD() function in the USING clause:\n\n`sql\nALTER USER username@hostname IDENTIFIED VIA ed25519 USING PASSWORD(''new_secret'');\n`\n\nThe PASSWORD() function and SET PASSWORD statement did not work with the ed25519 authentication plugin. Instead, you would have to use the UDF that comes with the authentication plugin to calculate the password hash:\n\n`sql\nCREATE FUNCTION ed25519_password RETURNS STRING SONAME "auth_ed25519.so";\n`\n\nNow you can calculate a password hash by executing this query:\n\n`sql\nSELECT ed25519_password("secret");\n+---------------------------------------------+\n| SELECT ed25519_password("secret");          |\n+---------------------------------------------+\n| ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY |\n+---------------------------------------------+\n`\n\nNow you can change the user account''s password using the new password hash.\n\nYou can change the user account''s password with the ALTER USER statement. You have to specify the name of the plugin in the IDENTIFIED VIA clause, while providing the password hash as the USING clause:\n\n`sql\nALTER USER username@hostname IDENTIFIED VIA ed25519 \n  USING ''ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY'';\n`\n\nClient Authentication Plugins\n\nFor clients that use the libmysqlclient or MariaDB Connector/C libraries, MariaDB provides one client authentication plugin that is compatible with the ed25519 authentication plugin:\n\n client_ed25519\n\nWhen connecting with a client or utility to a server as a user account that authenticates with the ed25519 authentication plugin, you may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmysql --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nclient_ed25519\n\nThe client_ed25519 client authentication plugin hashes and signs the password using the Elliptic Curve Digital Signature Algorithm (ECDSA) before sending it to the server.\n\nSupport in Client Libraries\n\nUsing the Plugin with MariaDB Connector/C\n\nMariaDB Connector/C supports ed25519 authentication using the client authentication plugins mentioned in the previous section.\n\nUsing the Plugin with MariaDB Connector/ODBC\n\nMariaDB Connector/ODBC supports ed25519 authentication using the client authentication plugins mentioned in the previous section.\n\nUsing the Plugin with MariaDB Connector/J\n\nMariaDB Connector/J supports ed25519 authentication.\n\nUsing the Plugin with MariaDB Connector/Node.js\n\nMariaDB Connector/Node.js supports ed25519 authentication.\n\nUsing the Plugin with MySqlConnector for .NET\n\nMySqlConnector for ADO.NET supports ed25519 authentication.\n\nThe connector implemented support for this authentication plugin in a separate NuGet package called MySqlConnector.Authentication.Ed25519. After the package is installed, your application must call Ed25519AuthenticationPlugin.Install to enable it.\n\nOptions\n\ned25519\n\n Description: Controls how the server should treat the plugin when it 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: --ed25519=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/authentication-plugins/authentication-plugin-ed25519', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-ed25519');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (101, 5, 'Authentication Plugin - GSSAPI', 'Description\n-----------\n\nThe gssapi authentication plugin allows the user to authenticate with services that use the Generic Security Services Application Program Interface (GSSAPI). Windows has a slightly different but very similar API called Security Support Provider Interface (SSPI). The GSSAPI is a standardized API described in RFC2743 and RFC2744. The client and server negotiate using a standardized protocol described in RFC7546.\n\nOn Windows, this authentication plugin supports Kerberos and NTLM authentication. Windows authentication is supported regardless of whether a domain is used in the environment.\n\nOn Unix systems, the most dominant GSSAPI service is Kerberos). However, it is less commonly used on Unix systems than it is on Windows. Regardless, this authentication plugin also supports Kerberos authentication on Unix.\n\nThe gssapi authentication plugin is most often used for authenticating with Microsoft Active Directory.\n\nThis article gives instructions on configuring the gssapi authentication plugin\\\nfor MariaDB for passwordless login.\n\nInstalling the Plugin''s Package\n\nSince MariaDB 10.11, on Windows, the plugin is included in the server. There is no need for separate installation.\n\nThe gssapi authentication plugin''s shared library is included in MariaDB packages as the auth_gssapi.so or auth_gssapi.dll shared library on systems where it can be built.\n\nInstalling on Linux\n\nThe gssapi authentication plugin is included in binary tarballs on Linux.\n\nInstalling with a Package Manager\n\nThe gssapi authentication 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-gssapi-server\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`bash\nsudo apt-get install mariadb-plugin-gssapi-server\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-gssapi-server\n`\n\nInstalling on Windows\n\nBefore MariaDB 10.11, the gssapi authentication plugin is included in MSI and ZIP packages on Windows.\n\nInstalling the Plugin\n\nSince MariaDB 10.11, on Windows, the plugin is included in the server. There is no need for separate installation.\n\nOn Windows, and on other operating systems, although 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 ''auth_gssapi'';\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 = auth_gssapi\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_gssapi'';\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 must be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nConfiguring the Plugin\n\nIf the MariaDB server is running on Unix, then some additional configuration steps will need to be implemented in order to use the plugin.\n\nIf the MariaDB server is running on Windows, then no special configuration steps will need to be implemented in order to use the plugin, as long as the following is true:\n\n The Windows server is joined to a domain.\n The MariaDB server process is running as either a NetworkService Account or a Domain User Account.\n\nCreating a Keytab File on Unix\n\nIf the MariaDB server is running on Unix, then the KDC server will need to create a keytab file for the MariaDB server. The keytab file contains the service principal name, which is the identity that the MariaDB server will use to communicate with the KDC server. The keytab will need to be transferred to the MariaDB server, and the mysqld server process will need read access to this keytab file.\n\nHow this keytab file is generated depends on whether the KDC server is Microsoft Active Directory KDC or MIT Kerberos KDC.\n\nCreating a Keytab File with Microsoft Active Directory\n\nIf you are using Microsoft Active Directory KDC, you may need to create a keytab using the ktpass.exe utility on a Windows host. The service principal will need to be mapped to an existing domain user. To do so, follow the steps listed below.\n\nBe sure to replace the following items in the step below:\n\n Replace ${HOST} with the fully qualified DNS name for the MariaDB server host.\n Replace ${DOMAIN} with the Active Directory domain.\n Replace ${AD_USER} with the existing domain user.\n Replace ${PASSWORD} with the password for the service principal.\n\nTo create the service principal, execute the following command:\n\n`bash\nktpass.exe /princ mariadb/${HOST}@${DOMAIN} /mapuser ${AD_USER} /pass ${PASSWORD} /out mariadb.keytab /crypto all /ptype KRB5_NT_PRINCIPAL /mapop set\n`\n\nCreating a Keytab File with MIT Kerberos\n\nIf you are using MIT Kerberos KDC, then you can create a keytab file using the kadmin utility. To do so, follow the steps listed below.\n\nIn the following steps, be sure to replace ${HOST} with the fully qualified DNS name for the MariaDB server host.\n\nFirst, create the service principal using the kadmin utility:\n\n`bash\nkadmin -q "addprinc -randkey mariadb/${HOST}"\n`\n\nThen, export the newly created user to the keytab file using the kadmin utility:\n\n`bash\nkadmin -q "ktadd -k /path/to/mariadb.keytab mariadb/${HOST}"\n`\n\nMore details can be found at the following links:\n\n MIT Kerberos Documentation: Database administration\n MIT Kerberos Documentation: Application servers\n\nConfiguring the Path to the Keytab File on Unix\n\nIf the MariaDB server is running on Unix, then the path to the keytab file that was previously created can be set by configuring the gssapi_keytab_path 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...\ngssapi_keytab_path=/path/to/mariadb.keytab\n`\n\nConfiguring the Service Principal Name\n\nThe service principal name can be set by configuring the gssapi_principal_name 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...\ngssapi_principal_name=service_principal_name/host.domain.com@REALM\n`\n\nIf a service principal name is not provided, the plugin tries to use mariadb/host.domain.com@REALM by default.\n\nIf the MariaDB server is running on Unix, the plugin needs a service principal name in order to function.\n\nIf the MariaDB server is running on Windows, the plugin does not usually need a service principal in order to function. However, if you want to use one, anyway, it can be created with the setspn utility.\n\nDifferent KDC implementations may use different canonical forms to identify principals. See RFC2744: Section 3.10 to learn what the standard says about principal names.\n\nMore details can be found at the following links:\n\n Active Directory Domain Services: Service Principal Names\n MIT Kerberos Documentation: Realm configuration decisions\n MIT Kerberos Documentation: Principal names and DNS\n\nCreating Users\n\nTo create a user account via CREATE USER, specify the name of the plugin in the IDENTIFIED VIA clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA gssapi;\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user account via GRANT:\n\n`sql\nGRANT SELECT ON db. TO username@hostname IDENTIFIED VIA gssapi;\n`\n\nYou can also specify the user''s realm for MariaDB with the USING clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA gssapi USING ''username@EXAMPLE.COM'';\n`\n\nThe format of the realm depends on the specific authentication mechanism that is used. For example, the format would need to be machine\\\\username for Windows users authenticating with NTLM.\n\nIf the realm is not provided in the user account''s definition, then the realm is not used for comparison. Therefore, ''usr1@EXAMPLE.COM'', ''usr1@EXAMPLE.CO.UK'' and ''mymachine\\usr1'' would all identify as the following user account:\n\n`sql\nCREATE USER usr1@hostname IDENTIFIED VIA gssapi;\n`\n\nCreating Users Identified Via Group Membership or SID (Windows-specific)\n\nOn Windows only, it is possible to login using a AD or local group-membership. This is achieved by using the GROUP prefix in IDENTIFIED ... AS:\n\n`sql\nCREATE USER root IDENTIFIED VIA gssapi AS ''GROUP:Administrators''\nCREATE USER root IDENTIFIED VIA gssapi AS ''GROUP:BUILTIN\\\\Administrators''\n`\n\nThe effect of the above definition is that every user that identifies as a member of group Administrators can log in using the user name root without a password.\n\nUser can also login using own or group SID (Security Identifier):\n\n`sql\nCREATE USER root IDENTIFIED VIA gssapi AS ''SID:S-1-5-32-544''\n`\n\nUsing SIDs will perform slightly faster than using name (since it will spare translation between SID and name which is otherwise done). SIDs are immune against user or group renaming.\n\nPasswordless login on Windows\n\nThis feature is available from MariaDB 10.11.\n\nOn Windows, in addition to the usual authentication with a password, passwordless authentication is permitted when creating the root user during installation. This works in a similar manner to Unix socket authentication. However, since auth_gssapi, unlike unix_socket, requires client support, to avoid failures when MariaDB is used with third-party drivers, authentication on Windows first attempts password-based native_authentication, and only if it fails, falls back to passwordless auth_gssapi.\n\nClient Authentication Plugins\n\nFor clients that use the libmysqlclient or MariaDB Connector/C libraries, MariaDB provides one client authentication plugin that is compatible with the gssapi authentication plugin:\n\n auth_gssapi_client\n\nWhen connecting with a client or utility to a server as a user account that authenticates with the gssapi authentication plugin, you may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmysql --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nauth_gssapi_client\n\nThe auth_gssapi_client client authentication plugin receives the principal name from the server, and then uses either the gss_init_sec_context function (on Unix) or the InitializeSecurityContext function (on Windows) to establish a security context on the client.\n\nSupport in Client Libraries\n\nUsing the Plugin with MariaDB Connector/C\n\nMariaDB Connector/C supports gssapi authentication using the client authentication plugins mentioned in the previous section.\n\nUsing the Plugin with MariaDB Connector/ODBC\n\nMariaDB Connector/ODBC supports gssapi authentication using the client authentication plugins mentioned in the previous section.\n\nUsing the Plugin with MariaDB Connector/J\n\nMariaDB Connector/J supports gssapi authentication. Current documentation can be found here.\n\nUsing the Plugin with MariaDB Connector/Node.js\n\nMariaDB Connector/Node.js does not yet support gssapi authentication. See CONJS-72 for more information.\n\nUsing the Plugin with MySqlConnector for .NET\n\nMySqlConnector for ADO.NET supports gssapi authentication.\n\nThe support is transparent. Normally, the connector only needs to be provided the correct user name, and no other parameters are required.\n\nHowever, this connector also supports the ServerSPN connection string parameter, which can be used for mutual authentication.\n\n.NET specific problems/workarounds\n\nWhen connecting from Unix client to Windows server with ADO.NET, in an Active Directory domain environment, be aware that .NET Core on Unix does not support principal names in UPN(User Principal Name) form, which is default on Windows (e.g machine$@domain.com) . Thus, upon encountering an authentication exception with "server not found in Kerberos database", use one of workarounds below\n\n Force host-based SPN on server side.\n   For example, this can be done by setting the gssapi_principal_name system variable to HOST/machine in a server option group in an option file.\n Pass host-based SPN on client side.\n   For example, this can be done by setting the connector''s ServerSPN connection string parameter to HOST/machine.\n\nSystem Variables\n\ngssapi_keytab_path\n\n Description: Defines the path to the server''s keytab file.\n   This system variable is only meaningful on Unix.\n   See Creating a Keytab File on Unix and Configuring the Path to the Keytab File on Unix for more information.\n Command line: --gssapi-keytab-path\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: ''''\n Introduced: MariaDB 10.1.11\n\ngssapi_principal_name\n\n Description: Name of the service principal.\n   See Configuring the Service Principal Name for more information.\n Command line: --gssapi-principal-name\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: ''''\n Introduced: MariaDB 10.1.11\n\ngssapi_mech_name\n\n Description: Name of the SSPI package used by server. Can be either ''Kerberos'' or ''Negotiate''. Set it to ''Kerberos'', to prevent less secure NTLM in domain environments, but leave it as default (Negotiate) to allow non-domain environments (e.g if server does not run in a domain environment).\n   This system variable is only meaningful on Windows.\n Command line: --gssapi-mech-name\n Scope: Global\n Dynamic: No\n Data Type: enumerated\n Default Value: Negotiate\n Valid Values: Kerberos, Negotiate\n Introduced: MariaDB 10.1.11\n\nOptions\n\ngssapi\n\n Description: Controls how the server should trea\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-gssapi');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (102, 5, 'Authentication Plugin - mysql\\_native\\_password', 'Description\n-----------\n\nThe mysql_native_password authentication plugin is the default authentication plugin that will be used for an account created when no authentication plugin is explicitly mentioned and old_passwords=0 is set. It uses the password hashing algorithm introduced in MySQL 4.1, which is also used by the PASSWORD() function when old_passwords=0 is set. This hashing algorithm is based on SHA-1.\n\nIt is not recommended to use the mysql_native_password authentication plugin for new installations that require high password security. If someone is able to both listen to the connection protocol and get a copy of the mysql.user table, then the person would be able to use this information to connect to the MariaDB server. The ed25519 authentication plugin is a more modern authentication plugin that provides simple password authentication using a more secure algorithm.\n\nInstalling the Plugin\n\nThe mysql_native_password authentication plugin is statically linked into the server, so no installation is necessary.\n\nCreating Users\n\nThe easiest way to create a user account with the mysql_native_password authentication plugin is to make sure that old_passwords=0 is set, and then create a user account via CREATE USER that does not specify an authentication plugin, but does specify a password via the IDENTIFIED BY clause:\n\n``sql\nSET old_passwords=0;\nCREATE USER username@hostname IDENTIFIED BY ''mariadb'';\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user account via GRANT:\n\n`sql\nSET old_passwords=0;\nGRANT SELECT ON db. TO username@hostname IDENTIFIED BY ''mariadb'';\n`\n\nYou can also create the user account by providing a password hash via the IDENTIFIED BY PASSWORD clause, and MariaDB will validate whether the password hash is one that is compatible with mysql_native_password:\n\n`sql\nSET old_passwords=0;\n\nSELECT PASSWORD(''mariadb'');\n+-------------------------------------------+\n| PASSWORD(''mariadb'')                       |\n+-------------------------------------------+\n| 54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n\nCREATE USER username@hostname\n  IDENTIFIED BY PASSWORD ''54958E764CE10E50764C2EECBB71D01F08549980'';\n`\n\nSimilar to all other authentication plugins, you could also specify the name of the plugin in the IDENTIFIED VIA clause while providing the password hash as the USING clause:\n\n`sql\nCREATE USER username@hostname\n  IDENTIFIED VIA mysql_native_password USING ''54958E764CE10E50764C2EECBB71D01F08549980'';\n`\n\nChanging User Passwords\n\nYou can change a user account''s password with the SET PASSWORD statement while providing the plain-text password as an argument to the PASSWORD() function:\n\n`sql\nSET PASSWORD =  PASSWORD(''new_secret'')\n`\n\nYou can also change the user account''s password with the ALTER USER statement. You would have to make sure that old_passwords=0 is set, and then you would have to specify a password via the IDENTIFIED BY clause:\n\n`sql\nSET old_passwords=0;\nALTER USER username@hostname IDENTIFIED BY ''new_secret'';\n`\n\nClient Authentication Plugins\n\nFor clients that use the libmysqlclient or MariaDB Connector/C libraries, MariaDB provides one client authentication plugin that is compatible with the mysql_native_password authentication plugin:\n\n* mysql_native_password\n\nWhen connecting with a client or utility to a server as a user account that authenticates with the mysql_native_password authentication plugin, you may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmysql --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nHowever, the mysql_native_password client authentication plugin is generally statically linked into client libraries like libmysqlclient or MariaDB Connector/C, so this is not usually necessary.\n\nmysql_native_password\n\nThe mysql_native_password client authentication plugin hashes the password before sending it to the server.\n\nSupport in Client Libraries\n\nThe mysql_native_password authentication plugin is one of the conventional authentication plugins, so all client libraries should support it.\n\nKnown Old Issues (Only Relevant for Old Installations)\n\nMismatches Between Password and authentication_string Columns\n\nFor compatibility reasons, the mysql_native_password authentication plugin tries to read the password hash from both the Password and authentication_string columns in the mysql.user table. This has caused issues in the past if one of the columns had a different value than the other.\n\nCREATE USER, ALTER USER, GRANT, and SET PASSWORD set the Password and authentication_string columns in the mysql.user table whenever an account''s password is changed.\n\nCREATE USER, ALTER USER, GRANT, and SET PASSWORD do not set the Password and authentication_string` columns in the mysql.user table whenever an account''s password is changed.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-mysql_native_password', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-mysql_native_password');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (103, 5, 'Authentication Plugin - mysql\\_old\\_password', 'Description\n-----------\n\nThe mysql_old_password authentication plugin is the default authentication plugin that is used for an account created when no authentication plugin is explicitly mentioned and old_passwords=1 is set. It uses the pre-MySQL 4.1 password hashing algorithm, which is also used by the OLD_PASSWORD() function and by the PASSWORD() function when old_passwords=1 is set.\n\nIt is not recommended to use the mysql_old_password authentication plugin for new installations. The password hashing algorithm is no longer secure, and the plugin is primarily provided for backward compatibility. The ed25519 authentication plugin is a more modern authentication plugin that provides simple password authentication.\n\nInstalling the Plugin\n\nThe mysql_old_password authentication plugin is statically linked into the server, so no installation is necessary.\n\nCreating Users\n\nThe easiest way to create a user account with the mysql_old_password authentication plugin is to make sure that old_passwords=1 is set, and create a user account via CREATE USER that does not specify an authentication plugin, but instead specifies a password via the IDENTIFIED BY clause:\n\n``sql\nSET old_passwords=1;\nCREATE USER username@hostname IDENTIFIED BY ''mariadb'';\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user via GRANT:\n\n`sql\nSET old_passwords=1;\nGRANT SELECT ON db. TO username@hostname IDENTIFIED BY ''mariadb'';\n`\n\nYou can also create the user account by providing a password hash via the IDENTIFIED BY PASSWORD clause, and MariaDB validates whether the password hash is one that is compatible with mysql_old_password:\n\n`sql\nSET old_passwords=1;\nQuery OK, 0 rows affected (0.000 sec)\n\nSELECT PASSWORD(''mariadb'');\n+---------------------+\n| PASSWORD(''mariadb'') |\n+---------------------+\n| 021bec665bf663f1    |\n+---------------------+\n1 row in set (0.000 sec)\n\nCREATE USER username@hostname IDENTIFIED BY PASSWORD ''021bec665bf663f1'';\nQuery OK, 0 rows affected (0.000 sec)\n`\n\nSimilar to all other authentication plugins, you could also specify the name of the plugin in the IDENTIFIED VIA clause, while providing the password hash as the USING clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA mysql_old_password USING ''021bec665bf663f1'';\nQuery OK, 0 rows affected (0.000 sec)\n`\n\nChanging User Passwords\n\nYou can change a user account''s password with the SET PASSWORD statement, while providing the plain-text password as an argument to the PASSWORD() function:\n\n`sql\nSET PASSWORD =  PASSWORD(''new_secret'')\n`\n\nYou can also change the user account''s password with the ALTER USER statement. You have to make sure that old_passwords=1 is set, and you have to specify a password via the IDENTIFIED BY clause:\n\n`sql\nSET old_passwords=1;\nALTER USER username@hostname IDENTIFIED BY ''new_secret'';\n`\n\nClient Authentication Plugins\n\nFor clients that use the libmysqlclient or MariaDB Connector/C libraries, MariaDB provides one client authentication plugin that is compatible with the mysql_old_password authentication plugin:\n\n mysql_old_password\n\nWhen connecting with a client or utility to a server as a user account that authenticates with the mysql_old_password authentication plugin. You may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmysql --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nHowever, the mysql_old_password client authentication plugin is generally statically linked into client libraries like libmysqlclient or MariaDB Connector/C, so this is not usually necessary.\n\nmysql_old_password\n\nThe mysql_old_password client authentication plugin hashes the password before sending it to the server.\n\nSupport in Client Libraries\n\nThe mysql_old_password` authentication plugin is one of the conventional authentication plugins, so all client libraries should support it.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-mysql_old_password', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-mysql_old_password');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (104, 5, 'Authentication Plugin - Named Pipe', 'Description\n-----------\n\nThe named_pipe authentication plugin allows the user to use operating system credentials when connecting to MariaDB via named pipe on Windows. Named pipe connections are enabled by the named_pipe system variable.\n\nThe named_pipe authentication plugin works by using named pipe impersonation.aspx) and calling GetUserName() to retrieve the user name of the process that is connected to the named pipe. Once it has the user name, it authenticates the connecting user as the MariaDB account that has the same user name.\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 ''auth_named_pipe'';\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 = auth_named_pipe\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_named_pipe'';\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, those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nCreating Users\n\nTo create a user account via CREATE USER, specify the name of the plugin in the IDENTIFIED VIA clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA named_pipe;\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user account via GRANT:\n\n`sql\nGRANT SELECT ON db.* TO username@hostname IDENTIFIED VIA named_pipe;\n`\n\nClient Authentication Plugins\n\nThe named_pipe authentication plugin does not require any specific client authentication plugins. It should work with all clients.\n\nSupport in Client Libraries\n\nThe named_pipe` authentication plugin does not require any special support in client libraries. It should work with all client libraries.\n\nExamples\n--------\n\nCREATE USER wlad IDENTIFIED VIA named_pipe;\nCREATE USER monty IDENTIFIED VIA named_pipe;\nquit\n\nC:\\>echo %USERNAME%\nwlad\n\nC:\\> mysql --user=wlad --protocol=PIPE\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 4\nServer version: 10.1.12-MariaDB-debug Source distribution\n\nCopyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.\n\nType ''help;'' or ''\\h'' for help. Type ''\\c'' to clear the current input statement.\n\nMariaDB [(none)]> quit\nBye\n\nC:\\> mysql --user=monty  --protocol=PIPE\nERROR 1698 (28000): Access denied for user ''monty''@''localhost''\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-named-pipe', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-named-pipe');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (105, 5, 'Authentication Plugin - PARSEC', 'Description\n-----------\n\n The KDF function is pbkdf2 (supported by everything, including windows native, Java, javascript, PHP, .NET.\n Parameters to the pbkdf2 are stored in with authentication plugin data : hash function (SHA512,SHA256), iteration count, salt, key_length, together with derived key = PBKDF2(func, password, salt, iteration_count, key_length).\n The number of iterations is a power of 2, greater than 9.\n The algorithm is ed25519, "hash" is the public key generated using ed25519 from the PBKDF2(password).\n\nThe authentication string, stored by the server, is this:\n\n``c\nconcat(''P'', conv(log2(iterations)-10, 10, 62), '':'', base64(salt), '':'', base64(hash))\n`\n\nFor example, it looks like this: P0:WW9sXaaL/o:vubFBzIrapbfHct1/J72dnUryz5VS7lA6XHH8sIx4TI\n\n It consists of colon-separated fields.\n The first field is ''P'' (denotes KDF algorithm = PBKDF2) and the number of iterations, ''0'' means 1024, ''1'' means 2048, etc.\n This is followed by the salt.\n This is followed by the password hash.\n\nThe first two fields together are called _ext-salt_, extended salt.\n\nLogin Process, Packet Exchange\n\n1. The server sends an Authentication Switch Request with a 32-byte random scramble.\n2. The client sends an empty packet to the server to request the ext-salt.\n3. The server sends the ext-salt to the client.\n4. The client sends the random 32-byte scramble, and the concat(server scramble, client scramble) ed25519-signed by a secret key generated from the function PBKDF2(password, ext-salt).\n5. The server replies with "ok" or "access denied".\n\nInstalling\n\nIf you run into the error ERROR 1524 (HY000): Plugin ''parsec'' is not loaded it means you need to install the authentication plugin first. You can do it on a running server with:\n\n`sql\nINSTALL SONAME ''auth_parsec'';\n`\n\nThere is no need to pass additional command-line options or have config files to keep the PARSEC authentication method available. Running the INSTALL SONAME` once is enough and the MariaDB Server will remember it even if server is restarted or upgraded.\n\nExamples\n--------\n\nCREATE USER test1@''%'' IDENTIFIED VIA parsec USING PASSWORD(''pwd'');\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-parsec', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-parsec');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (106, 5, 'Authentication Plugin - SHA-256', 'Description\n-----------\n\nBackground\n\nMySQL 5.6 added support for the sha256_password authentication plugin, and MySQL 8.0 also added support for the caching_sha2_password authentication plugin.\n\nThe caching_sha2_password plugin is now the default authentication plugin in MySQL 8.0.4 and above, based on the value of the default_authentication_plugin system variable.\n\nSupport in MariaDB Server\n\nMariaDB Server does not support the sha256_password plugin. A caching_sha2_password authentication plugin was added in MariaDB Community Server 12.1 and Enterprise Server 11.8. See MDEV-9804 for more information.\n\nReasons for not supporting the SHA-256 plugin:\n\n To use the protocol, you have to distribute the server''s public key to all MariaDB users, which can be cumbersome and impractical.\n The server receives the password in clear text, which can cause problems if the user connects to a malicious server.\n\nIf you are migrating from a MySQL instance that is using SHA-256 authentication, you have to change the SHA-256 authentication to mysql_native_authentication :\n\n``sql\nALTER USER user_name IDENTIFIED WITH mysql_native_password BY ''new_password''\n`\n\nSupport in Client Libraries\n\nClient Authentication Plugins\n\nFor clients that use the MariaDB Connector/C library, MariaDB provides client authentication plugins that are compatible with MySQL''s SHA-256 authentication plugins:\n\n sha256_password\n caching_sha256_password\n\nWhen connecting with a client or utility to a server, using a user account that authenticates with the sha256_password or caching_sha256_password authentication plugin, you may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmysql --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nFor clients that use MariaDB''s libmysqlclient library instead of MariaDB Connector/C, those authentication plugins are not supported.\n\nsha256_password\n\nThe sha256_password client authentication plugin is compatible with MySQL''s sha256_password authentication plugin, which was added in MySQL 5.6.\n\ncaching_sha256_password\n\nThe caching_sha256_password client authentication plugin is compatible with MySQL''s caching_sha2_password authentication plugin, which was added in MySQL 8.0.\n\nThe caching_sha2_password plugin is now the default authentication plugin in MySQL 8.0.4 and above, based on the value of the default_authentication_plugin system variable.\n\nUsing the Plugin with MariaDB Connector/C\n\nMariaDB Connector/C supports sha256_password and caching_sha2_password authentication using the client authentication plugins mentioned in the previous section.\n\nIt has supported the sha256_password client authentication plugin since MariaDB Connector/C 3.0.2. See CONC-229 for more information.\n\nIt has supported the caching_sha256_password client authentication plugin since MariaDB Connector/C 3.0.8 and MariaDB Connector/C 3.1.0. See CONC-312 for more information.\n\nUsing Plugins with MariaDB Connector/ODBC\n\nMariaDB Connector/ODBC supports sha256_password and caching_sha2_password authentication using the client authentication plugins mentioned in the previous section.\n\nIt has supported sha256_password and caching_sha2_password authentication since MariaDB Connector/ODBC 3.1.4. See ODBC-241 for more information.\n\nUsing Plugins with MariaDB Connector/J\n\nMariaDB Connector/J supports sha256_password and caching_sha2_password authentication since MariaDB Connector/J 2.5.0. See CONJ-327 and CONJ-663 for more information.\n\nnote: The version 3.x being a rewrite of the connector, only caching_sha2_password is implemented, since sha256_password is only implemented on EOL version.\n\nUsing Plugins with MariaDB Connector/Node.js\n\nMariaDB Connector/Node.js supports sha256_password and caching_sha2_password` authentication since MariaDB Connector/Node.js 2.5.0. See CONJS-76 and CONJS-77 for more information.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-sha-256', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-sha-256');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (107, 5, 'Authentication Plugin - Unix Socket', 'Description\n-----------\n\nThe unix_socket authentication plugin is installed by default, and it is used by the ''root''@''localhost'' user account by default. See Authentication for more information.\n\nThe unix_socket authentication plugin allows the user to use operating system credentials when connecting to MariaDB via the local Unix socket file. This Unix socket file is defined by the socket system variable.\n\nThe unix_socket authentication plugin works by calling the getsockopt system call with the SO_PEERCRED socket option, which allows it to retrieve the uid of the process that is connected to the socket. It is then able to get the user name associated with that uid. Once it has the user name, it will authenticate the connecting user as the MariaDB account that has the same user name.\n\nThe unix_socket authentication plugin is not suited to multiple Unix users accessing a single MariaDB user account.\n\nSecurity\n\nA unix_socket authentication plugin is a passwordless security mechanism. Its security lies in the strength of the access to the Unix user, rather than the complexity and the secrecy of the password.\n\nAs security differs from password security, the strengths and weaknesses need to be considered, and those can differ depending on the specific installation.\n\nStrengths\n\n Access is limited to the Unix user so, for example, a www-data user cannot access root with the unix_socket authentication plugin.\n There is no password which can be cracked by brute force.\n There is no password that can be accidentally exposed by user accident, poor security on backups, or poor security on passwords in configuration files.\n Default Unix user security is usually strong on preventing remote access and password brute force attempts.\n\nWeaknesses\n\nThe strength of a unix_socket authentication plugin is effectively the strength of the security of the Unix users on the system. In most cases, the Unix user default installation is sufficiently secure. However, the following is a non-exhaustive list of potential Unix user security issues that may arise.\n\n Common access areas without screen locks, where an unauthorized user accesses the logged in Unix user of an authorized user.\n Extensive sudo access grants that provide users with access to execute commands of a different Unix user.\n Scripts writable by Unix users other than the Unix user that are executed (via cron or directly) by the Unix user.\n Web pages that are susceptible to command injection, where the Unix user running the web page has elevated privileges in the database that weren''t intended to be used.\n Poor Unix user password practices including weak user passwords, password exposure and password reuse accompanied by an access vulnerability/mechanism of an unauthorized user to exploit this weakness.\n Weak remote access mechanisms and network file system privileges.\n Poor user security behavior including running untrusted scripts and software.\n\nIn some of these scenarios a database password may prevent these security exploits, however it will remove all the strengths of the unix_socket authentication plugin previously mentioned.\n\nDisabling the Plugin\n\nThe unix_socket authentication plugin is installed by default.\n\nIf you do not want it to be available by default, you must disable it.\n\nThe unix_socket authentication plugin is also installed by default in new installations that use the .deb packages provided by Debian''s default repositories and Ubuntu''s default repositories. See Differences in MariaDB in Debian (and Ubuntu) for more information.\n\nThe unix_socket authentication plugin can be disabled by starting the server with the unix_socket option set to OFF. 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...\nunix_socket=OFF\n`\n\nAs an alternative, the unix_socket option can also be set to OFF by pairing the option with the disable option prefix:\n\n`ini\n[mariadb]\n...\ndisable_unix_socket\n`\n\nInstalling the Plugin\n\nThe unix_socket authentication plugin is installed by default in almost all MariaDB server versions. If you work with a version that doesn''t have the plugin installed, you can install it as described in one of the following ways.\n\n 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 ''auth_socket'';\n`\n\n Instruct the server to load the plugin at startup. 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 = auth_socket\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_socket'';\n`\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a server option group in an option file, those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nCreating Users\n\nTo create a user account via CREATE USER, specify the name of the plugin in the IDENTIFIED VIA clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA unix_socket;\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user account via GRANT:\n\n`sql\nGRANT SELECT ON db. TO username@hostname IDENTIFIED VIA unix_socket;\n`\n\nThe authentication string (if present) is compared with the socket''s user name. Authentication proceeds if there''s a match. In this case, the external_user system variable contains the OS user.\n\nConsider an OS user named ''bob'' that has been created like this:\n\n`sql\nCREATE USER A identified via unix_socket as ''bob'';\n\n`\n\nThat user can connect like this:\n\n`bash\nmariadb -uA\n`\n\nAlternatively, accessing the sock file directly, the user can connect like this:\n\n`bash\nmariadb -uA -S /var/run/mysqld/mysqld.sock\n`\n\nOnce connected, you can view that user like this:\n\n`sql\nSELECT USER(),@@external_user;\n+-------------+-----------------+\n| user()      | @@external_user |\n+-------------+-----------------+\n| A@localhost | bob             |\n+-------------+-----------------+\n`\n\nThe plugin only checks whether the OS socket user id matches the MariaDB user name. It ignores the authentication string.\n\nSwitching to Password-Based Authentication\n\nIf Unix socket authentication does not meet your needs, you can switch a user account back to password-based authentication, by telling MariaDB to use a different authentication plugin for the account. The specific authentication plugin is specified with the IDENTIFIED VIA clause. To switch to the mysql_native_password authentication plugin, you need to do this:\n\n`sql\nALTER USER root@localhost IDENTIFIED VIA mysql_native_password;\nSET PASSWORD = PASSWORD(''foo'');\n`\n\nIf you use scripts that require passwordless access to MariaDB, this would cause them to break. You may be able to fix that by setting a password in the [client] option group in your /root/.my.cnf option file.\n\n`ini\n[client]\npassword=foo\n`\n\nClient Authentication Plugins\n\nThe unix_socket authentication plugin does not require any specific client authentication plugins. It should work with all clients.\n\nSupport in Client Libraries\n\nThe unix_socket` authentication plugin does not require any special support in client libraries. It should work with all client libraries.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-unix-socket', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-unix-socket');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (108, 5, 'Authentication Plugin - PAM', 'Description\n-----------\n\nThe pam authentication plugin allows MariaDB to offload user authentication to the system''s Pluggable Authentication Module (PAM) framework. PAM is an authentication framework used by Linux, FreeBSD, Solaris, and other Unix-like operating systems.\n\nNote: Windows does not support PAM, so the pam authentication plugin does not support Windows. However, one can use a MariaDB client on Windows to connect to MariaDB server that is installed on a Unix-like operating system and that is configured to use the pam authentication plugin. For an example of how to do this, see the blog post: MariaDB: Improve Security with Two-Step Verification.\n\nUse Cases\n\nPAM makes it possible to implement various authentication scenarios of different complexity:\n\n Authentication using passwords from /etc/shadow (this is what a default PAM configuration usually does). See the pam_unix PAM module.\n Authentication using LDAP. See the pam_ldap PAM module.\n Authentication using Microsoft''s Active Directory. See the pam_lsass, pam_winbind, and pam_centrifydc PAM modules.\n Authentication using one-time passwords (even with SMS confirmation!). See the pam_google_authenticator and pam_securid PAM modules.\n Authentication using SSH keys. See the pam_ssh PAM module.\n User and group mapping. See the pam_user_map PAM module.\n Combining different authentication modules in interesting ways in a PAM service.\n Password expiration.\n Limiting access by time, date, day of the week, etc. See the pam_time PAM module.\n Logging of every login attempt.\n\nInstalling the Plugin\n\nThe pam authentication plugin''s library is provided in binary packages in all releases on Linux.\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 ''auth_pam'';\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 = auth_pam\n`\n\nInstalling the v1 Plugin\n\nThe auth_pam shared library actually refers to version 2.0 of the pam authentication plugin. Version 1.0 of the plugin as the auth_pam_v1 shared library is also available.\n\nIf you need to install version 1.0 of the authentication plugin instead of version 2.0, install it with INSTALL SONAME or INSTALL PLUGIN:\n\n`sql\nINSTALL SONAME ''auth_pam_v1'';\n`\n\nAlternatively, specify it in a relevant server option group in an option file:\n\n`sql\n[mariadb]\n...\nplugin_load_add = auth_pam_v1\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_pam'';\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, those options must be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nUninstalling the v1 Plugin\n\nIf you installed version 1.0 of the authentication plugin, you can uninstall it by executing a similar statement for auth_pam_v1:\n\n`sql\nUNINSTALL SONAME ''auth_pam_v1'';\n`\n\nConfiguring PAM\n\nThe pam authentication plugin tells MariaDB to delegate the authentication to the PAM authentication framework. How exactly that authentication is performed depends on how PAM is configured.\n\nConfiguring the PAM Service\n\nPAM is divided into services. PAM services are configured by PAM configuration files. Typically, the global PAM configuration file is located at /etc/pam.conf and PAM directory-based configuration files for individual services are located in /etc/pam.d/.\n\nIf you want to use a PAM service called mariadb for your MariaDB PAM authentication, then the PAM configuration file for that service would also be called mariadb, and it would typically be located at /etc/pam.d/mariadb.\n\nFor example, here is a minimal PAM service configuration file that performs simple password authentication with UNIX passwords:\n\n`\nauth required pam_unix.so audit\naccount required pam_unix.so audit\n`\n\nLet''s breakdown this relatively simple PAM service configuration file.\n\nEach line of a PAM service configuration file has the following general format:\n\n`\ntype control module-path module-arguments\n`\n\nIt instructs the PAM authentication framework that for successful authentication (i.e. type=auth), it is required that the pam_unix.so PAM module returns a success. It also instructs the PAM authentication framework that for an account (i.e. type=account) to be valid, it is required that the pam_unix.so PAM module returns a success.\n\nPAM also supports session and password types, but MariaDB''s pam authentication plugin does not support those.\n\nThe above PAM service configuration file also provides the audit module argument to the pam_unix PAM module. The pam_unix manual says that this module argument enables extreme debug logging to the syslog.\n\nOn most systems, you can find many other examples of PAM service configuration files in your /etc/pam.d/ directory.\n\nConfiguring the pam_unix PAM Module\n\nIf you configure PAM to use the pam_unix PAM module (as in the above example), then you might notice on some systems that this will fail by default with errors like the following:\n\n`\nApr 14 12:56:23 localhost unix_chkpwd[3332]: check pass; user unknown\nApr 14 12:56:23 localhost unix_chkpwd[3332]: password check failed for user (alice)\nApr 14 12:56:23 localhost mysqld: pam_unix(mysql:auth): authentication failure; logname= uid=991 euid=991 tty= ruser= rhost=  user=alice\n`\n\nThe problem is that on some systems, the pam_unix PAM module needs access to /etc/shadow in order to function, and most systems only allow root to access that file by default.\n\nNewer versions of PAM do not have this limitation, so you may want to try upgrading your version of PAM to see if that fixes the issue.\n\nIf that does not work, then you can work around this problem by giving the user that runs mysqld access to /etc/shadow. For example, if the mysql user runs mysqld, then you could do the following:\n\n`bash\nsudo groupadd shadow\nsudo usermod -a -G shadow mysql\nsudo chown root:shadow /etc/shadow\nsudo chmod g+r /etc/shadow\n`\n\nAfter configuring, you have to restart the server. The server should now be able to read /etc/shadow.\n\nThe pam authentication plugin uses a setuid wrapper to perform its PAM checks, so it should not need any special workarounds to perform privileged operations, such as reading /etc/shadow when using the pam_unix PAM module. See MDEV-7032 for more information.\n\nCreating Users\n\nTo create a user in MariaDB which uses the pam authentication plugin, execute CREATE USER while specifying the name of the plugin in the IDENTIFIED VIA clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA pam;\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user this way with GRANT:\n\n`sql\nGRANT SELECT ON db. TO username@hostname IDENTIFIED VIA pam;\n`\n\nYou can also specify a PAM service name for MariaDB to use by providing it with the USING clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA pam USING ''mariadb'';\n`\n\nThis line creates a user that needs to be authenticated via the pam authentication plugin using the PAM service name mariadb. As mentioned in a previous section, this service''s configuration file will typically be present in /etc/pam.d/mariadb.\n\nIf no service name is specified, then the plugin will use mysql as the default PAM service name.\n\nClient Authentication Plugins\n\nFor clients that use the libmysqlclient or MariaDB Connector/C libraries, MariaDB provides two client authentication plugins that are compatible with the pam authentication plugin:\n\n dialog\n mysql_clear_password\n\nWhen connecting with a client or utility to a server as a user account that authenticates with the pam authentication plugin, you may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmariadb --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nBoth the dialog and the mysql_clear_password client authentication plugins transmit the password to the server in clear text. Therefore, when you use the pam authentication plugin, it is very important to encrypt client connections using TLS to prevent the clear-text passwords from being seen by unauthorized users.\n\ndialog\n\nUsually the pam authentication plugin uses the dialog client authentication plugin to communicate with the user. This client authentication plugin allows MariaDB to support arbitrarily complex PAM configurations with regular or one-time passwords, challenge-response, multiple questions, or just about anything else. When using a MariaDB client library, there is no need to install or enable anything — the dialog client authentication plugin is loaded by the client library completely automatically and transparently for the application.\n\nThe dialog client authentication plugin was developed by MariaDB, so MySQL''s clients and client libraries as well as third party applications that bundle MySQL''s client libraries do not support the dialog client authentication plugin out of the box. If the server tells an unsupported client to use the dialog client authentication plugin, then the client is likely to throw an error like the following:\n\n`\nERROR 2059 (HY000): Authentication plugin ''dialog'' cannot be loaded: /usr/lib/mysql/plugin/dialog.so: cannot open shared object file: No such file or directory\n`\n\nFor some libraries or applications, this problem can be fixed by copying dialog.so or dialog.dll from a MariaDB client installation that is compatible with the system into the system''s MySQL client authentication plugin directory. However, not all clients are compatible with the dialog client authentication plugin, so this may not work for every client.\n\nIf your client does not support the dialog client authentication plugin, then you may need to use the mysql_clear_password client authentication plugin instead.\n\nThe dialog client authentication plugin transmits the password to the server in clear text. Therefore, when you use the pam authentication plugin, it is incredibly important to encrypt client connections using TLS to prevent the clear-text passwords from being seen by unauthorized users.\n\nmysql_clear_password\n\nUsers can instruct the pam authentication plugin to use the mysql_clear_password client authentication plugin instead of the dialog client authentication plugin by configuring the pam_use_cleartext_plugin system variable on the server. It can be set in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\npam_use_cleartext_plugin\n`\n\nIt is important to note that the mysql_clear_password plugin has very limited functionality.\n\n The mysql_clear_password client authentication plugin only supports PAM services that require password-based authentication.\n The mysql_clear_password client authentication plugin also only supports PAM services that ask the user a single question.\n If the PAM service requires challenge-responses, multiple questions, or other similar complicated authentication schemes, then the PAM service is not compatible with mysql_clear_password client authentication plugin. In that case, the dialog client authentication plugin will have to be used instead.\n\nThe mysql_clear_password client authentication plugin transmits the password to the server in clear text. Therefore, when you use the pam authentication plugin, it is incredibly important to encrypt client connections using TLS to prevent the clear-text passwords from being seen by unauthorized users.\n\nCompatiblity with MySQL Clients and Client Libraries\n\nThe mysql_clear_password client authentication plugin is similar to MySQL''s mysql_clear_password client authentication plugin.\n\nThe mysql_clear_password client authentication plugin is compatible with MySQL clients and most MySQL client libraries, while the dialog client authentication plugin is not always compatible with them. Therefore, the mysql_clear_password client authentication plugin is most useful if you need some kind of MySQL compatibility in your environment, but you still want to use the pam authentication plugin.\n\nEven though the mysql_clear_password client authentication plugin is compatible with MySQL clients and most MySQL client libraries, the mysql_clear_password client authentication plugin may be disabled by default by these clients and client libraries. For example, MySQL''s version of the mysql command-line client has the --enable-cleartext-plugin option that must be set in order to use the mysql_clear_password client authentication plugin:\n\n`bash\nmysql --enable-cleartext-plugin --user=alice -p\n`\n\nOther clients may require other methods to enable the authentication plugin. For example, MySQL Workbench has a checkbox titled Enable Cleartext Authentication Plugin under the Advanced tab on the connection configuration screen.\n\nFor applications that use MySQL''s libmysqlclient, the authentication plugin can be enabled by setting the MYSQL_ENABLE_CLEARTEXT_PLUGIN option with the mysql_options() function:\n\n`ini\nmysql_options(mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN, 1);\n`\n\nFor MySQL compatibility, MariaDB Connector/C also allows applications to set the MYSQL_ENABLE_CLEARTEXT_PLUGIN option with the mysql_optionsv function. However, this option does not actually do anything in MariaDB Connector/C, because the mysql_clear_password client authentication plugin is always enabled for MariaDB clients and client libraries.\n\nSupport in Client Libraries\n\nUsing the Plugin with MariaDB Connector/C\n\nMariaDB Connector/C supports pam authentication using the client authentication plugins, regardless of the value of the pam_use_cleartext_plugin system variable.\n\nUsing the Plugin with MariaDB Connector/ODBC\n\nMariaDB Connector/ODBC supports pam authentication using the client authentication plugins, regardless of the value of the pam_use_cleartext_plugin system variable.\n\nUsing the Plugin with MariaDB Connector/J\n\nMariaDB Connector/J supports pam v1 authentication, regardless of the value of the pam_use_cleartext_plugin system variable.\n\nMariaDB Connector/J supports pam v2 authentication, regardless of the value of the pam_use_cleartext_plugin system variable.\n\nUsing the Plugin with MariaDB Connector/Node.js\n\nMariaDB Connector/Node.js supports pam authentication, regardless of the value of the pam_use_cleartext_plugin system variable.\n\nUsing the Plugin with MySqlConnector for .NET\n\nMySqlConnector for ADO.NET supports pam authentication, but on\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/authentication-plugin-pam');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (109, 5, 'Authentication with JWT, OIDC, and OAuth 2.0 via PAM', 'Description\n-----------\n\nThis draft, intended for technical review under DOCS-5715, requires validation for technical accuracy. It includes generated text and code blocks and needs evaluation by a subject matter expert (SME) in this format. Please refrain from relying on any information on the page.\n\nMariaDB Server supports modern authentication standards—including JSON Web Tokens (JWT), OpenID Connect (OIDC), and OAuth 2.0—through its pluggable authentication architecture.\n\nBy leveraging the operating system''s PAM (Pluggable Authentication Modules) subsystem, MariaDB can integrate with external Identity Providers (IdPs) like AWS Cognito, Google Cloud Identity, and Azure AD without requiring proprietary database plugins. The database delegates the validation of tokens to the underlying OS security layer.\n\nPrerequisites\n\nBefore proceeding, ensure the following components are available:\n\n MariaDB Server (Active and running).\n PAM Module: You must install a third-party PAM module corresponding to your desired authentication method (e.g., pam_oidc.so, pam_oauth2.so, or pam_jwt.so).\n   _Note: These are system-level libraries installed into /lib/security or /lib64/security. Ensure the module you choose is actively maintained and compatible with your OS._\n Identity Provider (IdP): You must have your Issuer URL, Client ID, and Audience values ready from your provider (e.g., Google, Okta, Azure).\n\nConfiguration and Connection Workflow\n\n_How to bridge the operating system''s authentication layer with MariaDB user management._\n\nHow Authentication Works\n\nBefore configuring the system, it is helpful to understand the handshake between the Client, the Database, and the Operating System.\n\n``mermaid\nsequenceDiagram\n    participant Client as Client (User/App)\n    participant DB as MariaDB Server\n    participant Plugin as auth_pam Plugin\n    participant OS as OS PAM Subsystem\n    participant Module as PAM Module (pam_oidc.so)\n\n    Note over Client, DB: Step 3: Connect via Client\n    Client->>DB: Connect(Username, Password=Token)\n    \n    Note over DB, Plugin: Step 2: Configure MariaDB Server\n    DB->>DB: Check User Definition\n    DB->>Plugin: Delegate Auth (User is IDENTIFIED VIA PAM)\n    \n    Note over Plugin, OS: Step 1: Configure PAM Service\n    Plugin->>OS: Authenticate using Service "mariadb"\n    OS->>OS: Read /etc/pam.d/mariadb\n    \n    Note right of OS: This file tells OS to load pam_oidc.so\n    OS->>Module: Invoke pam_oidc.so with Token\n    \n    Module->>Module: Validate Token (Issuer/Audience)\n    Module-->>OS: Return Success/Failure\n    OS-->>Plugin: Return Success/Failure\n    Plugin-->>DB: Return Auth Result\n    DB-->>Client: Connection Accepted/Rejected\n`\n\nConfigure the PAM Service\n\nYou must define a PAM service that loads your chosen module. This file tells the operating system how to validate the credentials passed by MariaDB.\n\nFile: /etc/pam.d/mariadb\n\n_The specific flags below (like issuer or aud) are standard OIDC parameters. Consult your specific PAM module''s documentation for exact flag syntax._\n\n`bash\n/etc/pam.d/mariadb\nGeneric OIDC Configuration Example\n\n1. ''auth'' checks the validity of the token\nauth required pam_oidc.so issuer=https://accounts.google.com aud=YOUR_CLIENT_ID\n\n2. ''account'' checks if the user is allowed to login (often required by PAM)\naccount required pam_oidc.so\n`\n\nEnsure strict validation of the aud (Audience) parameter to confirm that tokens are issued exclusively for your database application, preventing the use of tokens intended for different applications.\n\nConfigure MariaDB Server\n\nOnce the OS is configured, you must enable the PAM plugin in MariaDB and create a user that utilizes it.\n\n1. Log in to MariaDB as root.\n2.  Install the PAM Plugin:\n\n    `sql\n    INSTALL SONAME ''auth_pam'';\n    `\n3.  Create the User: The USING clause specifies the service name (filename) in /etc/pam.d/.\n\n    `sql\n    -- Create a user that maps to the ''sub'' (Subject) claim in the token\n    CREATE USER ''jdoe''@''%'' IDENTIFIED VIA pam USING ''mariadb'';\n    `\n\nConnect via Client\n\nWhen connecting, the "Password" field is used to transmit the JWT or OIDC Token.\n\n`bash\n1. Obtain your token (e.g., via gcloud or your IdP''s CLI)\nexport DB_TOKEN="eyJhbGciOiJSUzI1NiIsImtpZ..."\n\n2. Connect to MariaDB, passing the token as the password\nmariadb --user="jdoe" --password="$DB_TOKEN"\n`\n\nTroubleshooting\n\n   Authentication Failure: Check the system authentication logs.\n\n    `bash\n    sudo tail -f /var/log/auth.log\n    `\n\n    _Look for errors regarding "invalid audience," "expired token," or "issuer mismatch."_\n SELinux/AppArmor: If the database cannot access the PAM configuration, ensure your security context allows mysqld to read from /etc/pam.d/.\n* Username Mapping: By default, the MariaDB username must match the identity in the token (often the sub or emailclaim). Some PAM modules allow you to map these (e.g., mapping user@example.com to user); check your module''s user_template` or mapping documentation.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/authentication-with-jwt-oidc-and-oauth-2.0-via-pam', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/authentication-with-jwt-oidc-and-oauth-2.0-via-pam');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (110, 5, 'Configuring PAM Authentication and User Mapping with LDAP Authen', 'Description\n-----------\n\nIn this article, we will walk through the configuration of PAM authentication using the pam authentication plugin and user and group mapping with the pam_user_map PAM module. The primary authentication will be handled by the pam_ldap PAM module, which performs LDAP authentication. We will also set up an OpenLDAP server.\n\nHypothetical Requirements\n\nIn this walkthrough, we are going to assume the following hypothetical requirements:\n\n The LDAP user foo should be mapped to the MariaDB user bar. (foo: bar)\n Any LDAP user in the LDAP group dba should be mapped to the MariaDB user dba. (@dba: dba)\n\nSetting up the OpenLDAP Server\n\nBefore we can use LDAP authentication, we first need to set up our OpenLDAP Server. This is usually done on a server that is completely separate from the database server.\n\nInstalling the OpenLDAP Server and Client Components\n\nOn the server acting as the OpenLDAP Server, first, we need to install the OpenLDAP components.\n\nOn RHEL, CentOS, and other similar Linux distributions that use RPM packages, that would go like this:\n\n``bash\nsudo yum install openldap openldap-servers openldap-clients nss-pam-ldapd\n`\n\nConfiguring the OpenLDAP Server\n\nNext, let''s to configure the OpenLDAP Server. The easiest way to do that is to copy the template configuration file that is included with the installation. In many installations, that will be at /usr/share/openldap-servers/DB_CONFIG.example:\n\n`bash\nsudo cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG\nsudo chown ldap. /var/lib/ldap/DB_CONFIG\n`\n\nConfiguring the OpenLDAP Port\n\nSometimes it is useful to change the port used by OpenLDAP. For example, some cloud environments block well-known authentication services, so they block the default LDAP port.\n\nOn some systems, the port can be changed by setting SLAPD_URLS in /etc/sysconfig/slapd:\n\n`ini\nSLAPD_URLS="ldapi:/// ldap://0.0.0.0:3306/"\n`\n\nI used 3306 because that is the port that is usually used by mysqld, so I know that it is not blocked.\n\nStarting the OpenLDAP Server\n\nNext, let''s start the OpenLDAP Server and configure it to start on reboot. On systemd systems, that would go like this:\n\n`bash\nsudo systemctl start slapd\nsudo systemctl enable slapd\n`\n\nInstalling the Standard LDAP objectClasses\n\nIn order to use LDAP for authentication, we also need to install some standard objectClasses, such as posixAccount and posixGroup. In LDAP, things like objectClasses are defined in LDIF files. In many installations, these specific objectClasses are defined in /etc/openldap/schema/nis.ldif. nis.ldif also depends on core.ldif and cosine.ldif. However, core.ldif is usually installed by default.\n\nWe can install them with ldapmodify:\n\n`bash\nsudo ldapmodify -a -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif\nsudo ldapmodify -a -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif\n`\n\nCreating the LDAP Directory Manager User\n\nNext, let’s create a directory manager user. We can do this by using OpenLDAP''s olc configuration system to change the olcRootDN directive to the DN of the directory manager user, which means that the user will be a privileged LDAP user that is not subject to access controls. We will also set the root password for the user by changing the olcRootPW directive.\n\nWe will also set the DN suffix for our backend LDAP database by changing the olcSuffix directive.\n\nLet’s use the slappasswd utility to generate a password hash from a clear-text password. Simply execute:\n\n`bash\nslappasswd\n`\n\nThis utility provides a password hash that looks like this: {SSHA}AwT4jrvmokeCkbDrFAnGvzzjCMb7bvEl\n\nOpenLDAP''s olc configuration system also uses LDIF files. Now that we have the password hash, let’s create an LDIF file to create the directory manager user:\n\n`bash\ntee ~/setupDirectoryManager.ldif <<EOF\ndn: olcDatabase={1}monitor,cn=config\nchangetype: modify\nreplace: olcAccess\nolcAccess: {0}to  \n    by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read \n    by dn.base="cn=Manager,dc=support,dc=mariadb,dc=com" read \n    by  none\n\ndn: olcDatabase={2}hdb,cn=config\nchangetype: modify\nreplace: olcSuffix\nolcSuffix: dc=support,dc=mariadb,dc=com\n\ndn: olcDatabase={2}hdb,cn=config\nchangetype: modify\nreplace: olcRootDN\nolcRootDN: cn=Manager,dc=support,dc=mariadb,dc=com\n\ndn: olcDatabase={2}hdb,cn=config\nchangetype: modify\nadd: olcRootPW\nolcRootPW: {SSHA}AwT4jrvmokeCkbDrFAnGvzzjCMb7bvEl\n\ndn: olcDatabase={2}hdb,cn=config\nchangetype: modify\nadd: olcAccess\nolcAccess: {0}to attrs=userPassword,shadowLastChange \n    by   dn="cn=Manager,dc=support,dc=mariadb,dc=com" write \n    by anonymous auth \n    by self write \n    by  none\nolcAccess: {1}to dn.base="" \n    by  read\nolcAccess: {2}to  \n    by dn="cn=Manager,dc=support,dc=mariadb,dc=com" write \n    by  read\nEOF\n`\n\nNote that this is using the dc=support,dc=mariadb,dc=com domain for the directory. You can change it to whatever is relevant to you.\n\nNow let’s run the ldif file with ldapmodify:\n\n`bash\nsudo ldapmodify -Y EXTERNAL -H ldapi:/// -f ~/setupDirectoryManager.ldif\n`\n\nWe will use the new directory manager user to make changes to the LDAP directory after this step.\n\nCreating the Structure of the Directory\n\nNext, let''s create the structure of the directory by creating parts of our tree.\n\n`bash\ntee ~/setupDirectoryStructure.ldif <<EOF\ndn: dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: dcObject\nobjectclass: organization\no: MariaDB Support Team\ndc: support\n\ndn: cn=Manager,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: organizationalRole\ncn: Manager\ndescription: Directory Manager\n\ndn: ou=People,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: organizationalUnit\nou: People\n\ndn: ou=Groups,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: organizationalUnit\nou: Groups\n\ndn: ou=System Users,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: organizationalUnit\nou: System Users\nEOF\n`\n\nNow, let’s use our new directory manager user and run the LDIF file with ldapmodify:\n\n`\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/setupDirectoryStructure.ldif\n`\n\nCreating the LDAP Users and Groups\n\nLet''s go ahead and create the LDAP users and groups that we are using for this scenario.\n\nFirst, let''s create the foo user:\n\n`bash\ntee ~/createFooUser.ldif <<EOF\ndn: uid=foo,ou=People,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: account\nobjectClass: posixAccount\nobjectClass: shadowAccount\ncn: foo\nuid: foo\nuidNumber: 16859\ngidNumber: 100\nhomeDirectory: /home/foo\nloginShell: /bin/bash\ngecos: foo\nuserPassword: {crypt}x\nshadowLastChange: -1\nshadowMax: -1\nshadowWarning: 0\nEOF\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createFooUser.ldif\n`\n\nNext, let''s create a couple of users to go into the dba group:\n\n`bash\ntee ~/createDbaUsers.ldif <<EOF\ndn: uid=gmontee,ou=People,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: account\nobjectClass: posixAccount\nobjectClass: shadowAccount\ncn: gmontee\nuid: gmontee\nuidNumber: 16860\ngidNumber: 100\nhomeDirectory: /home/gmontee\nloginShell: /bin/bash\ngecos: gmontee\nuserPassword: {crypt}x\nshadowLastChange: -1\nshadowMax: -1\nshadowWarning: 0\n\ndn: uid=bstillman,ou=People,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: account\nobjectClass: posixAccount\nobjectClass: shadowAccount\ncn: bstillman\nuid: bstillman\nuidNumber: 16861\ngidNumber: 100\nhomeDirectory: /home/bstillman\nloginShell: /bin/bash\ngecos: bstillman\nuserPassword: {crypt}x\nshadowLastChange: -1\nshadowMax: -1\nshadowWarning: 0\nEOF\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createDbaUsers.ldif\n`\n\nNote that each of these users needs a password, so we can set it for each user with ldappasswd:\n\n`\nldappasswd -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -S uid=foo,ou=People,dc=support,dc=mariadb,dc=com\nldappasswd -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -S uid=gmontee,ou=People,dc=support,dc=mariadb,dc=com\nldappasswd -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -S uid=bstillman,ou=People,dc=support,dc=mariadb,dc=com\n`\n\nNext, let''s create our dba group:\n\n`bash\ntee ~/createDbaGroup.ldif <<EOF\ndn: cn=dba,ou=Groups,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: posixGroup\ngidNumber: 678\nEOF\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createDbaGroup.ldif\n`\n\nNext, let''s add our two users to it:\n\n`bash\ntee ~/addUsersToDbaGroup.ldif <<EOF\ndn: cn=dba,ou=Groups,dc=support,dc=mariadb,dc=com\nchangetype: modify\nadd: memberuid\nmemberuid: gmontee\n\ndn: cn=dba,ou=Groups,dc=support,dc=mariadb,dc=com\nchangetype: modify\nadd: memberuid\nmemberuid: bstillman\nEOF\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/addUsersToDbaGroup.ldif\n`\n\nWe also need to create LDAP users with the same name as the bar and dba MariaDB users. See here to read more about the reasons to do so. No one will be logging in as these users, so they do not need passwords. Instead of the People organizationalUnit, we create them in the System Users organizationalUnit.\n\n`bash\ntee ~/createSystemUsers.ldif <<EOF\ndn: uid=bar,ou=System Users,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: account\nobjectClass: posixAccount\nobjectClass: shadowAccount\ncn: bar\nuid: bar\nuidNumber: 16862\ngidNumber: 100\nhomeDirectory: /home/bar\nloginShell: /bin/bash\ngecos: bar\nuserPassword: {crypt}x\nshadowLastChange: -1\nshadowMax: -1\nshadowWarning: 0\n\ndn: uid=dba,ou=System Users,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: account\nobjectClass: posixAccount\nobjectClass: shadowAccount\ncn: dba\nuid: dba\nuidNumber: 16863\ngidNumber: 100\nhomeDirectory: /home/dba\nloginShell: /bin/bash\ngecos: dba\nuserPassword: {crypt}x\nshadowLastChange: -1\nshadowMax: -1\nshadowWarning: 0\nEOF\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createSystemUsers.ldif\n`\n\nSetting up the MariaDB Server\n\nAt this point, we can move on to setting up the MariaDB Server.\n\nInstalling LDAP and PAM Libraries\n\nFirst, we need to make sure that the LDAP and PAM libraries are installed.\n\nOn RHEL, CentOS, and other similar Linux distributions that use RPM packages, we need to install the following packages:\n\n`bash\nsudo yum install openldap-clients nss-pam-ldapd pam pam-devel\n`\n\nConfiguring LDAP\n\nNext, let''s configure LDAP on the system. We can use authconfig for this:\n\n`bash\nsudo authconfig --enableldap \\\n   --enableldapauth \\\n   --ldapserver="ldap://172.30.0.238:3306" \\\n   --ldapbasedn="dc=support,dc=mariadb,dc=com" \\\n   --enablemkhomedir \\\n   --update\n`\n\nBe sure to replace -–ldapserver and -–ldapbasedn with values that are relevant for your environment.\n\nInstalling the pam_user_map PAM Module\n\nThe pam_user_map PAM module is included in the base install. No installation is needed.\n\nNext, let''s install the pam_user_map PAM module.\n\nBefore the module can be compiled from source, we may need to install some dependencies.\n\nOn RHEL, CentOS, and other similar Linux distributions that use RPM packages, we need to install gcc and pam-devel:\n\n`bash\nsudo yum install gcc pam-devel\n`\n\nOn Debian, Ubuntu, and other similar Linux distributions that use DEB packages, we need to install gcc and libpam0g-dev:\n\n`bash\nsudo apt-get install gcc libpam0g-dev\n`\n\nAnd then we can build and install the library with the following:\n\n`bash\nwget https://raw.githubusercontent.com/MariaDB/server/10.4/plugin/auth_pam/mapper/pam_user_map.c \ngcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so \nsudo install --mode=0755 pam_user_map.so /lib64/security/\n`\n\nConfiguring the pam_user_map PAM Module\n\nNext, let''s configure the pam_user_map PAM module based on our hypothetical requirements.\n\nThe configuration file for the pam_user_map PAM module is /etc/security/user_map.conf. Based on our requirements, ours would look like:\n\n`\nfoo: bar\n@dba:dba\n`\n\nInstalling the PAM Authentication Plugin\n\nNext, let''s install the pam authentication plugin.\n\nLog into the MariaDB Server and execute the following:\n\n`sql\nINSTALL SONAME ''auth_pam'';\n`\n\nConfiguring the PAM Service\n\nFor modern Linux distributions (like RHEL 8 and newer) that use SSSD (System Security Services Daemon) to connect to an LDAP provider, the pam_sss.so module is the modern equivalent of pam_ldap.so. In such a configuration, pam_sss.so replaces pam_ldap.so. For more information, please see the Red Hat Enterprise Linux documentation.\n\nNext, let''s configure the PAM service. We will call our service mariadb, so our PAM service configuration file will be located at /etc/pam.d/mariadb on most systems.\n\nConfiguring PAM to Allow Only LDAP Authentication\n\nSince we are only doing LDAP authentication with the pam_ldap PAM module and group mapping with the pam_user_map PAM module, our configuration file would look like this:\n\n`\nauth required pam_ldap.so\nauth required pam_user_map.so\naccount required pam_ldap.so\n`\n\nConfiguring PAM to Allow LDAP and Local Unix Authentication\n\nIf we want to allow authentication from LDAP users and from local Unix users through pam_unix, while giving priority to the local users, then we could do this instead:\n\n`\nauth [success=1 new_authtok_reqd=1 default=ignore] pam_unix.so audit\nauth required pam_ldap.so try_first_pass\nauth required pam_user_map.so\naccount sufficient pam_unix.so audit\naccount required pam_ldap.so\n`\n\nConfiguring the pam_unix PAM Module\n\nIf you also want to allow authentication from local Unix users, the pam_unix PAM module adds some additional configuration steps on a lot of systems. We basically have to give the user that runs mysqld access to /etc/shadow.\n\nIf the mysql user is running mysqld, then we can do that by executing the following:\n\n`bash\nsudo groupadd shadow\nsudo usermod -a -G shadow mysql\nsudo chown root:shadow /etc/shadow\nsudo chmod g+r /etc/shadow\n`\n\nThe server needs to be restarted for this change to take affect.\n\nCreating MariaDB Users\n\nNext, let''s create the MariaDB users. Remember that our PAM service is called mariadb.\n\nFirst, let''s create the MariaDB user for the user mapping: foo: bar\n\nThat means that we need to create a bar user:\n\n`sql\nCREATE USER ''bar''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''bar''@''%'' ;\n`\n\nAnd then let''s create the MariaDB user for the group mapping: @dba: dba\n\nThat means that we need to create a dba user:\n\n`sql\nCREATE USER ''dba''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''dba''@''%'' ;\n`\n\nAnd then to allow for the user and group mapping, we need to create an anonymous user that authenticates with the pam authentication plugin that is also able to PROXY as the bar and dba users. Before we can create the proxy user, we might need to clean up some defaults:\n\n`sql\nDELETE FROM mysql.db WHERE User='''' AND Host=''%'';\nFLUSH PRIVILEGES;\n`\n\nAnd then let''s create the anonymous proxy user:\n\n`sql\nCREATE USER ''''@''%'' IDENTIFIED VIA pam USING ''mariadb'';\nGRANT PROXY ON ''bar''@''%'' TO ''''@''%'';\nGRANT PROXY ON ''dba''@''%'' TO ''''@''%'';\n`\n\nTesting our Configuration\n\nNext, let''s test our configuration by verifying that mapping\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/configuring-pam-authentication-and-user-mapping-with-ldap-authentication');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (111, 5, 'Configuring PAM Authentication and User Mapping with Unix Authen', 'Description\n-----------\n\nWe walk through the configuration of PAM authentication using the pam authentication plugin and user and group mapping with the pam_user_map PAM module. The primary authentication will be handled by the pam_unix PAM module, which performs standard Unix password authentication.\n\nHypothetical Requirements\n\nIn this walkthrough, we are going to assume the following hypothetical requirements:\n\n The Unix user foo should be mapped to the MariaDB user bar. (foo: bar)\n Any Unix user in the Unix group dba should be mapped to the MariaDB user dba. (@dba: dba)\n\nCreating Our Unix Users and Groups\n\nLet''s go ahead and create the Unix users and groups that we are using for this hypothetical scenario.\n\nFirst, let''s create the foo user and a couple users to go into the dba group. Note that each of these users needs a password.\n\n``bash\nsudo useradd foo\nsudo passwd foo\nsudo useradd alice\nsudo passwd alice\nsudo useradd bob\nsudo passwd bob\n`\n\nNext, let''s create the dba group and add our two users to it:\n\n`bash\nsudo groupadd dba\nsudo usermod -a -G dba alice \nsudo usermod -a -G dba bob\n`\n\nWe also need to create Unix users with the same name as the bar and dba MariaDB users. See here to read more about why. No one will be logging in as these users, so they do not need passwords.\n\n`bash\nsudo useradd bar\nsudo useradd dba -g dba\n`\n\nInstalling the pam_user_map PAM Module\n\nNext, let''s install the pam_user_map PAM module.\n\nBefore the module can be compiled from source, we may need to install some dependencies.\n\nOn RHEL, CentOS, and other similar Linux distributions that use RPM packages, we need to install gcc and pam-devel:\n\n`bash\nsudo yum install gcc pam-devel\n`\n\nOn Debian, Ubuntu, and other similar Linux distributions that use DEB packages, we need to install gcc and libpam0g-dev:\n\n`\nsudo apt-get install gcc libpam0g-dev\n`\n\nAnd then we can build and install the library with the following:\n\n`bash\nwget https://raw.githubusercontent.com/MariaDB/server/10.4/plugin/auth_pam/mapper/pam_user_map.c \ngcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so \nsudo install --mode=0755 pam_user_map.so /lib64/security/\n`\n\nConfiguring the pam_user_map PAM Module\n\nNext, let''s configure the pam_user_map PAM module based on our hypothetical requirements.\n\nThe configuration file for the pam_user_map PAM module is /etc/security/user_map.conf. Based on our hypothetical requirements, ours would look like:\n\n`\nfoo: bar\n@dba:dba\n`\n\nInstalling the PAM Authentication Plugin\n\nNext, let''s install the pam authentication plugin.\n\nLog into the MariaDB Server and execute the following:\n\n`\nINSTALL SONAME ''auth_pam'';\n`\n\nConfiguring the PAM Service\n\nNext, let''s configure the PAM service. We will call our service mariadb, so our PAM service configuration file will be located at /etc/pam.d/mariadb on most systems.\n\nSince we are only doing Unix authentication with the pam_unix PAM module and group mapping with the pam_user_map PAM module, our configuration file would look like this:\n\n`ini\nauth required pam_unix.so audit\nauth required pam_user_map.so\naccount required pam_unix.so audit\n`\n\nConfiguring the pam_unix PAM Module\n\nThe pam_unix PAM module adds some additional configuration steps on a lot of systems. We basically have to give the user that runs mysqld access to /etc/shadow.\n\nIf the mysql user is running mysqld, then we can do that by executing the following:\n\n`bash\nsudo groupadd shadow\nsudo usermod -a -G shadow mysql\nsudo chown root:shadow /etc/shadow\nsudo chmod g+r /etc/shadow\n`\n\nThe server needs to be restarted for this change to take affect.\n\nCreating MariaDB Users\n\nNext, let''s create the MariaDB users. Remember that our PAM service is called mariadb.\n\nFirst, let''s create the MariaDB user for the user mapping: foo: bar . This means we need to create a bar user:\n\n`sql\nCREATE USER ''bar''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''bar''@''%'' ;\n`\n\nNext, let''s create the MariaDB user for the group mapping: @dba: dba . This means that we need to create a dba user:\n\n`sql\nCREATE USER ''dba''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''dba''@''%'' ;\n`\n\nNext, to allow for the user and group mapping, we need to create an anonymous user that authenticates with the pam authentication plugin that is also able to PROXY as the bar and dba users. Before we can create the proxy user, we might need to clean up some defaults:\n\n`sql\nDELETE FROM mysql.db WHERE User='''' AND Host=''%'';\nFLUSH PRIVILEGES;\n`\n\nFinally, let''s create the anonymous proxy user:\n\n`sql\nCREATE USER ''''@''%'' IDENTIFIED VIA pam USING ''mariadb'';\nGRANT PROXY ON ''bar''@''%'' TO ''''@''%'';\nGRANT PROXY ON ''dba''@''%'' TO ''''@''%'';\n`\n\nTesting our Configuration\n\nNext, let''s test out our configuration by verifying that mapping is occurring. We can verify this by logging in as each of our users and comparing the return value of USER(), which is the original user name and the return value of CURRENT_USER(), which is the authenticated user name.\n\nFirst, let''s test our foo user:\n\n`bash\n$ mysql -u foo -h 172.30.0.198\n[mariadb] Password:\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 22\nServer version: 10.3.10-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType ''help;'' or ''\\h'' for help. Type ''\\c'' to clear the current input statement.\n\nMariaDB [(none)]> SELECT USER(), CURRENT_USER();\n+------------------------------------------------+----------------+\n| USER()                                         | CURRENT_USER() |\n+------------------------------------------------+----------------+\n| foo@ip-172-30-0-198.us-west-2.compute.internal | bar@%          |\n+------------------------------------------------+----------------+\n1 row in set (0.000 sec)\n`\n\nWe can verify that our foo Unix user was properly mapped to the bar MariaDB user by looking at the return value of CURRENT_USER().\n\nNext, let''s test our alice user in the dba group:\n\n`bash\n$ mysql -u alice -h 172.30.0.198\n[mariadb] Password:\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 19\nServer version: 10.3.10-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType ''help;'' or ''\\h'' for help. Type ''\\c'' to clear the current input statement.\n\nMariaDB [(none)]> SELECT USER(), CURRENT_USER();\n+--------------------------------------------------+----------------+\n| USER()                                           | CURRENT_USER() |\n+--------------------------------------------------+----------------+\n| alice@ip-172-30-0-198.us-west-2.compute.internal | dba@%          |\n+--------------------------------------------------+----------------+\n1 row in set (0.000 sec)\n`\n\nFinally, let''s test our bob user in the dba group:\n\n`bash\n$ mysql -u bob -h 172.30.0.198\n[mariadb] Password:\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 20\nServer version: 10.3.10-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType ''help;'' or ''\\h'' for help. Type ''\\c'' to clear the current input statement.\n\nMariaDB [(none)]> SELECT USER(), CURRENT_USER();\n+------------------------------------------------+----------------+\n| USER()                                         | CURRENT_USER() |\n+------------------------------------------------+----------------+\n| bob@ip-172-30-0-198.us-west-2.compute.internal | dba@%          |\n+------------------------------------------------+----------------+\n1 row in set (0.000 sec)\n`\n\nWe can verify that our alice and bob Unix users in the dba Unix group were properly mapped to the dba MariaDB user by looking at the return values of CURRENT_USER()`.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/configuring-pam-authentication-and-user-mapping-with-unix-authentication', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/configuring-pam-authentication-and-user-mapping-with-unix-authentication');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (112, 5, 'User and Group Mapping with PAM', 'Description\n-----------\n\nEven when using the pam authentication plugin, the authenticating PAM user account still needs to exist in MariaDB, and the account needs to have privileges in the database. Creating these MariaDB accounts and making sure the privileges are correct can be a lot of work. To decrease the amount of work involved, some users would like to be able to map a PAM user to a different MariaDB user. For example, let’s say that alice and bob are both DBAs. It would be nice if each of them could log into MariaDB with their own PAM username and password, while MariaDB sees both of them as the same dba user. That way, there is only one MariaDB account to keep track of.\n\nAlthough most PAM modules usually do not do things like this, PAM supports the ability to change the user name in the process of authentication.The MariaDB pam authentication plugin fully supports this feature of PAM.\n\nThe pam_user_map PAM Module\n\nRather than building user and group mapping into the pam authentication plugin, MariaDB thought that it would cover the most use cases and offer the most flexibility to offload this functionality to an external PAM module. The pam_user_map PAM module was implemented by MariaDB to facilitate this. This PAM module can be configured in the PAM service used by the pam authentication plugin, just like other PAM modules.\n\nLack of Support for MySQL/Percona Group Mapping Syntax\n\nUnlike MariaDB, MySQL and Percona implemented group mapping in their PAM authentication plugins. If you''ve read through MySQL''s PAM authentication documentation on group mapping or Percona''s PAM authentication documentation on group mapping, you''ve probably seen syntax where the group mappings are provided in the CREATE USER statement like this:\n\n``sql\nCREATE USER ''''@''''\n  IDENTIFIED WITH authentication_pam\n  AS ''mysql, root=developer, users=data_entry'';\n`\n\nSince MariaDB''s user and group mapping is performed by an external PAM module, MariaDB''s pam authentication plugin does not support this syntax. Instead, the user and group mappings for the pam_user_map PAM module are configured in an external configuration file. This is discussed in a later section.\n\nInstalling the pam_user_map PAM Module\n\nThe pam_user_map PAM module gets installed as part of all our MariaDB server packages.\n\nSome Linux distributions have not picked up this change in their own packages yet. When using such an installation, it may be necessary to compile the PAM module from source as described in the next section, or to manually extract it from one of our server packages and copy it to the target system.\n\nInstalling the pam_user_map PAM Module from Source\n\nInstalling Compilation Dependencies\n\nBefore the module can be compiled from source, you may need to install some dependencies.\n\nOn RHEL, CentOS, and other similar Linux distributions that use RPM packages, you need to install gcc, pam-devel and MariaDB-devel:\n\n`bash\nsudo yum install gcc pam-devel MariaDB-devel\n`\n\nOn Debian, Ubuntu, and other similar Linux distributions that use DEB packages, you need to install gcc, libpam0g-dev:\n\n`bash\nsudo apt-get install gcc libpam0g-dev libmariadb-dev\n`\n\nCompiling and Installing the pam_user_map PAM Module\n\nThe pam_user_map PAM module can be built by downloading plugin/auth_pam/mapper/pam_user_map.c file from the MariaDB source tree and compiling it after minor adjustments. Once it is built, it can be installed to the system''s PAM module directory, which is typically /lib64/security/:\n\n`bash\nwget https://raw.githubusercontent.com/MariaDB/server/10.4/plugin/auth_pam/mapper/pam_user_map.c\nsed -ie ''s/config_auth_pam/plugin_auth_common/'' pam_user_map.c\ngcc -I/usr/include/mysql/ pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so\nsudo install --mode=0755 pam_user_map.so /lib64/security/\n`\n\nYou also need to adjust the major version number in the URL on the first line to match your installed MariaDB version, and the #-I include path argument on the gcc line, as depending on operating system and MariaDB server version, the plugin_auth_common.h file may be installed in a directory other than /usr/include/mysql/ .\n\nConfiguring the pam_user_map PAM Module\n\nThe pam_user_map PAM module uses the configuration file at the path /etc/security/user_map.conf to determine its user and group mappings. The file''s format is described below.\n\nTo map a specific PAM user to a specific MariaDB user:\n\n`\norig_pam_user_name: mapped_mariadb_user_name\n`\n\nOr to map any PAM user in a specific PAM group to a specific MariaDB user, the group name is prefixed with @:\n\n`\n@orig_pam_group_name: mapped_mariadb_user_name\n`\n\nFor example, here is an example /etc/security/user_map.conf:\n\n`\n=========================================================\n#comments and empty lines are ignored\njohn: jack\nbob:  admin\ntop:  accounting\n@group_ro: readonly\n`\n\nConfiguring PAM\n\nWith user and group mapping, configuring PAM is done similar to how it is normally done with the pam authentication plugin. However, when configuring the PAM service, you will have to add an auth line for the pam_user_map PAM module to the service''s PAM configuration file:\n\n`\nauth required pam_unix.so audit\nauth required pam_user_map.so\naccount required pam_unix.so audit\n`\n\nCreating Users\n\nWith user and group mapping, creating users is done similar to how it is normally done with the pam authentication plugin. However, one major difference is that you will need to GRANT the PROXY privilege on the mapped user to the original user.\n\nConsider having the following configured in /etc/security/user_map.conf:\n\n`\nfoo: bar\n@dba:dba\n`\n\nThen you could execute the following to grant the relevant privileges:\n\n`sql\nCREATE USER ''bar''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''bar''@''%'' ;\n\nCREATE USER ''dba''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''dba''@''%'' ;\n\nCREATE USER ''''@''%'' IDENTIFIED VIA pam USING ''mariadb'';\nGRANT PROXY ON ''bar''@''%'' TO ''''@''%'';\nGRANT PROXY ON ''dba''@''%'' TO ''''@''%'';\n`\n\nNote that the ''''@''%'' account is a special catch-all anonymous account. Any login by a user that has no more specific account match in the system will be matched by this anonymous account.\n\nAlso note that you might not be able to create the ''''@''%'' anonymous account by default on some systems without doing some extra steps first. See Fixing a Legacy Default Anonymous Account for more information.\n\nVerifying that Mapping is Occurring\n\nIn case any user mapping is performed, the original user name is returned by the SQL function USER(), while the authenticated user name is returned by the SQL function CURRENT_USER(). The latter actually defines what privileges are available to a connected user.\n\nConsider having the following configured:\n\n`\nfoo: bar\n`\n\nThen the following output would verify that it is working properly:\n\n`bash\n$ mysql -u foo -h 172.30.0.198\n[mariadb] Password:\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 22\nServer version: 10.3.10-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType ''help;'' or ''\\h'' for help. Type ''\\c'' to clear the current input statement.\n\nMariaDB [(none)]> SELECT USER(), CURRENT_USER();\n+------------------------------------------------+----------------+\n| USER()                                         | CURRENT_USER() |\n+------------------------------------------------+----------------+\n| foo@ip-172-30-0-198.us-west-2.compute.internal | bar@%          |\n+------------------------------------------------+----------------+\n1 row in set (0.000 sec)\n`\n\nWe can verify that our foo PAM user was properly mapped to the bar MariaDB user by looking at the return value of CURRENT_USER().\n\nLogging\n\nBy default, the pam_user_map PAM module does not perform any logging. However, if you want to enable debug logging, then you can add the debug module argument to the service''s PAM configuration file:\n\n`\nauth required pam_unix.so audit\nauth required pam_user_map.so debug\naccount required pam_unix.so audit\n`\n\nWhen debug logging is enabled, the pam_user_map PAM module will write log entries to the same syslog location as other PAM modules, which is typically /var/log/secure on many systems.\n\nFor example, this debug log output can look like the following:\n\n`\nJan  9 05:42:13 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Opening file ''/etc/security/user_map.conf''.\nJan  9 05:42:13 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Incoming username ''alice''.\nJan  9 05:42:13 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User belongs to 2 groups [alice,dba].\nJan  9 05:42:13 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Check if user is in group ''dba'': YES\nJan  9 05:42:13 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User mapped as ''dba''\nJan  9 05:43:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Opening file ''/etc/security/user_map.conf''.\nJan  9 05:43:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Incoming username ''bob''.\nJan  9 05:43:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User belongs to 2 groups [bob,dba].\nJan  9 05:43:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Check if user is in group ''dba'': YES\nJan  9 05:43:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User mapped as ''dba''\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Opening file ''/etc/security/user_map.conf''.\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Incoming username ''foo''.\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User belongs to 1 group [foo].\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Check if user is in group ''dba'': NO\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Check if username ''foo'': YES\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User mapped as ''bar''\n`\n\nKnown Issues\n\nPAM User with Same Name as Mapped MariaDB User Must Exist\n\nWith user and group mapping, any PAM user or any PAM user in a given PAM group can be mapped to a specific MariaDB user account. However, due to the way PAM works, a PAM user with the same name as the mapped MariaDB user account must exist.\n\nConsider the configuration file for the PAM service file containing the following:\n\n`\nauth required pam_sss.so\nauth required pam_user_map.so debug\naccount sufficient pam_unix.so\naccount sufficient pam_sss.so\n`\n\nConsider etc/security/user_map.conf containing the following:\n\n`\n@dba: dba\n`\n\nIn that case, any PAM user in the PAM group dba are mapped to the MariaDB user account dba. But if a PAM user with the name dba doesn''t exist, the pam_user_map PAM module''s debug logging writes errors to the syslog, like the following:\n\n`\nSep 27 17:17:05 dbserver1 mysqld: pam_user_map(mysql:auth): Opening file ''/etc/security/user_map.conf''.\nSep 27 17:17:05 dbserver1 mysqld: pam_user_map(mysql:auth): Incoming username ''alice''.\nSep 27 17:17:05 dbserver1 mysqld: pam_user_map(mysql:auth): User belongs to 4 groups [dba,mongod,mongodba,mysql].\nSep 27 17:17:05 dbserver1 mysqld: pam_user_map(mysql:auth): Check if user is in group ''mysql'': YES\nSep 27 17:17:05 dbserver1 mysqld: pam_user_map(mysql:auth): User mapped as ''dba''\nSep 27 17:17:05 dbserver1 mysqld: pam_unix(mysql:account): could not identify user (from getpwnam(dba))\nSep 27 17:17:05 dbserver1 mysqld: pam_sss(mysql:account): Access denied for user dba: 10 (User not known to the underlying authentication module)\nSep 27 17:17:05 dbserver1 mysqld: 2018-09-27 17:17:05 72 [Warning] Access denied for user ''alice''@''localhost'' (using password: NO)\n`\n\nIn the above log snippet, notice that both the pam_unix and the pam_sss PAM modules are complaining that the dba PAM user does not appear to exist, and that these complaints cause the PAM authentication process to fail, which causes the MariaDB authentication process to fail as well.\n\nThis can be fixed by creating a PAM user with the same name as the mapped MariaDB user account, which is dba in this case.\n\nYou may also be able to work around this problem by essentially disabling PAM''s account verification for the service with the pam_permit PAM module. For example, in the above case, that would be:\n\n`\nauth required pam_sss.so\nauth required pam_user_map.so debug\naccount required pam_permit.so\n``\n\nSee MDEV-17315 for more information.\n\nTutorials\n\nYou may find the following PAM and user mapping-related tutorials helpful:\n\n Configuring PAM Authentication and User Mapping with Unix Authentication\n Configuring PAM Authentication and User Mapping with LDAP Authentication\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/user-and-group-mapping-with-pam', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/user-and-group-mapping-with-pam');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (113, 5, 'Pluggable Authentication Overview', 'Description\n-----------\n\nWhen a user attempts to log in, the authentication plugin controls how MariaDB Server determines whether the connection is from a legitimate user.\n\nWhen creating or altering a user account with the GRANT, CREATE USER or ALTER USER statements, you can specify the authentication plugin you want the user account to use, by providing the IDENTIFIED VIA clause. By default, when you create a user account without specifying an authentication plugin, MariaDB uses the mysql_native_password plugin.\n\nYou can specify multiple authentication plugins for each user account.\n\nThe root@localhost user created by mariadb-install-db has the ability to use two authentication plugins:\n\n1. It is configured to try to use the unix_socket authentication plugin. This allows the root@localhost user to log in without a password via the local Unix socket file defined by the socket system variable, as long as the login is attempted from a process owned by the operating system root user account.\n2. If authentication fails with the unix_socket authentication plugin, it is configured to try to use the mysql_native_password authentication plugin. However, an invalid password is initially set, so in order to authenticate this way, a password must be set with SET PASSWORD.\n\nSupported Authentication Plugins\n\nThe authentication process is a conversation between the server and a client. MariaDB implements both server-side and client-side authentication plugins.\n\nSupported Server Authentication Plugins\n\nMariaDB provides seven server-side authentication plugins:\n\n mysql_native_password\n mysql_old_password\n ed25519\n gssapi\n pam (Unix only)\n unix_socket (Unix only)\n named_pipe (Windows only)\n\nSupported Client Authentication Plugins\n\nMariaDB provides eight client-side authentication plugins:\n\n mysql_native_password\n mysql_old_password\n client_ed25519\n auth_gssapi_client\n dialog\n mysql_clear_password\n sha256_password\n caching_sha256_password\n\nOptions Related to Authentication Plugins\n\nServer Options Related to Authentication Plugins\n\nMariaDB supports the following server options related to authentication plugins:\n\n| Server Option                                                                                                                             | Description                                                                                                                                                                                                                                                                                                              |\n| ----------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| old_passwords={1 \\| 0}  | If set to 1 (0 is default), MariaDB reverts to using the mysql_old_password authentication plugin by default for newly created users and passwords, instead of the mysql_native_password authentication plugin. |\n| plugin_dir=path            | Path to the plugin directory. For security reasons, either make sure this directory can only be read by the server, or set secure_file_priv.                                                |\n| plugin_maturity=level | The lowest acceptable plugin maturity. MariaDB will not load plugins less mature than the specified level.                                                                                                                                                                                                        |\n| secure_auth               | Connections will be blocked if they use the mysql_old_password authentication plugin.                                                                                                                                                                                   |\n\nClient Options Related to Authentication Plugins\n\nMost clients and utilities support command-line arguments related to client authentication plugins:\n\n| Client Option              | Description                                                                                                                                                                                                   |\n| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| --connect-expired-password | Notify the server that this client is prepared to handle expired password sandbox mode even if --batch was specified.                    |\n| --default-auth=name        | Default authentication client-side plugin to use.                                                                                                                                                             |\n| --plugin-dir=path          | Directory for client-side plugins.                                                                                                                                                                            |\n| --secure-auth              | Refuse to connect to the server if the server uses the mysql_old_password authentication plugin. This mode is off by default, which is different from MySQL. |\n\nDevelopers who are using MariaDB Connector/C can implement similar functionality in their application by setting the following options with the mysql_optionsv function:\n\n MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS\n MYSQL_PLUGIN_DIR\n MYSQL_DEFAULT_AUTH\n MYSQL_SECURE_AUTH\n\nFor example:\n\n``ini\nmysql_optionsv(mysql, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);\nmysql_optionsv(mysql, MYSQL_DEFAULT_AUTH, "name");\nmysql_optionsv(mysql, MYSQL_PLUGIN_DIR, "path");\nmysql_optionsv(mysql, MYSQL_SECURE_AUTH, 1);\n`\n\nInstallation Options Related to Authentication Plugins\n\nmariadb-install-db supports the following installation options related to authentication plugins:\n\n| Installation Option                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| --auth-root-authentication-method={normal \\| socket} | If set to normal (the default), it creates a root@localhost account that authenticates with the mysql_native_password authentication plugin and that has no initial password set, which can be insecure. If set to socket, it creates a root@localhost account that authenticates with the unix_socket authentication plugin. Set to normal by default. |\n| --auth-root-socket-user=USER                         | Used with --auth-root-authentication-method=socket. It specifies the name of the second account to create with SUPER privileges in addition to root, as well as of the system account allowed to access it. Defaults to the value of --user.                                                                                                                          |\n\nExtended SQL Syntax\n\nMariaDB has extended the SQL standard GRANT, CREATE USER, and ALTER USER statements, so that they support specifying different authentication plugins for specific users. An authentication plugin can be specified with these statements by providing the IDENTIFIED VIA clause. Examples:\n\n`sql\nGRANT <privileges> ON <level> TO <user> \n   IDENTIFIED VIA <plugin> [ USING <string> ]\n`\n\n`sql\nCREATE USER <user> \n   IDENTIFIED VIA <plugin> [ USING <string> ]\n`\n\n`sql\nALTER USER <user> \n   IDENTIFIED VIA <plugin> [ USING <string> ]\n`\n\nThe optional USING clause allows users to provide an authentication string to a plugin. The authentication string''s format and meaning is completely defined by the plugin.\n\nFor example, for the mysql_native_password authentication plugin, the authentication string should be a password hash:\n\n`sql\nCREATE USER mysqltest_up1 \n   IDENTIFIED VIA mysql_native_password USING ''E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'';\n`\n\nSince mysql_native_password is the default authentication plugin, the above is just another way of saying the following:\n\n`\nCREATE USER mysqltest_up1 \n   IDENTIFIED BY PASSWORD ''E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'';\n`\n\nIn contrast, for the pam authentication plugin, the authentication string should refer to a PAM service name:\n\n`sql\nCREATE USER mysqltest_up1 \n   IDENTIFIED VIA pam USING ''mariadb'';\n`\n\nA user account can be associated with multiple authentication plugins.\n\nTo configure the root@localhost user account to try the unix_socket authentication plugin, followed by the mysql_native_password authentication plugin as a backup, execute the following query:\n\n`sql\nCREATE USER root@localhost \n   IDENTIFIED VIA unix_socket \n   OR mysql_native_password USING PASSWORD("verysecret");\n`\n\nSee Authentication for more information.\n\nAuthentication Plugins Installed by Default\n\nServer Authentication Plugins Installed by Default\n\nNot all server-side authentication plugins are installed by default. If a specific server-side authentication plugin is not installed by default, then you can find the installation procedure on the documentation page for the specific authentication plugin.\n\nThe following server-side authentication plugins are installed by default:\n\n The mysql_native_password and mysql_old_password authentication plugins authentication plugins are installed by default in all builds.\n The unix_socket authentication plugin is installed by default in all builds on Unix and Linux.\n The named_pipe authentication plugin is installed by default in all builds on Windows.\n\nThe following server-side authentication plugins are installed by default:\n\n The mysql_native_password and mysql_old_password authentication plugins are installed by default in all builds.\n The unix_socket authentication plugin is installed by default in new installations that use the .deb packages provided by Debian''s default repositories and Ubuntu''s default repositories in Ubuntu. See Differences in MariaDB in Debian (and Ubuntu) for more information.\n The named_pipe authentication plugin is installed by default in all builds on Windows.\n\nClient Authentication Plugins Installed by Default\n\nClient-side authentication plugins do not need to be _installed_ in the same way that server-side authentication plugins do. If the client uses either the libmysqlclient or MariaDB Connector/C library, then the library automatically loads client-side authentication plugins from the library''s plugin directory whenever they are needed.\n\nMost clients and utilities support the --plugin-dir command line argument that can be used to set the path to the library''s plugin directory:\n\n| Client Option     | Description                        |\n| ----------------- | ---------------------------------- |\n| --plugin-dir=path | Directory for client-side plugins. |\n\nDevelopers who are using MariaDB Connector/C can implement similar functionality in their application by setting the MYSQL_PLUGIN_DIR option with the mysql_optionsv function. Example:\n\n`c\nmysql_optionsv(mysql, MYSQL_PLUGIN_DIR, "path");\n`\n\nIf your client encounters errors similar to the following error, you may need to set the path to the library''s plugin directory:\n\n`\nERROR 2059 (HY000): Authentication plugin ''dialog'' cannot be loaded: /usr/lib/mysql/plugin/dialog.so: cannot open shared object file: No such file or directory\n`\n\nIf the client does not use either the libmysqlclient or MariaDB Connector/C library, then you will have to determine which authentication plugins are supported by the specific client library used by the client.\n\nIf the client uses either the libmysqlclient or MariaDB Connector/C library, but the client is not bundled with either library''s _optional_ client authentication plugins, then you can only use the conventional authentication plugins (like mysql_native_password and mysql_old_password) and the non-conventional authentication plugins that don''t require special client-side authentication plugins (like unix_socket and named_pipe).\n\nDefault Authentication Plugin\n\nDefault Server Authentication Plugin\n\nThe mysql_native_password authentication plugin is currently the default authentication plugin in all versions of MariaDB if the old_passwords system variable is set to 0, which is the default.\n\nOn a system with the old_passwords system variable set to 0, this means that if you create a user account with either the GRANT or CREATE USERstatements, and if you do not specify an authentication plugin with theIDENTIFIED VIAclause, then MariaDB will use the mysql_native_password authentication plugin for the user account.\n\nCreating a user account like this, it uses the mysql_native_password authentication plugin:\n\n`sql\nCREATE USER username@hostname;\n`\n\nThe same is true for this user account:\n\n`sql\nCREATE USER username@hostname IDENTIFIED BY ''notagoodpassword'';\n`\n\nThe mysql_old_password authentication plugin becomes the default authentication plugin in all versions of MariaDB, if the old_passwords system variable is explicitly set to 1.\n\nThe mysql_old_password authentication plugin is not considered secure. It is recommended to avoid using this authentication plugin. To help prevent undesired use of the mysql_old_password authentication plugin, the server supports the secure_auth system variable that configures the server to refuse connections trying to use the mysql_old_password authentication plugin.\n\nMost clients and utilities support secure_auth.\n\n| Server Option                                                                                                                            | Description                                                                                                                                                                                                                                                                                                              |\n| -----------------\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/pluggable-authentication-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (114, 5, 'Plugin Maturity', 'Description\n-----------\n\nThe following table lists the various plugins included in MariaDB ordered by their maturity. Note that maturity will differ across MariaDB versions - see below for an easy way to get a complete list of plugins and their maturity in your version of MariaDB:\n\n| Plugin                                                                                                                                                                                                        | Version | Maturity                                                     |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------ |\n| Archive                                                                                                                                                   | 3.0     | Stable                                                       |\n| Aria                                                                                                                                                           | 1.6     | Stable                                                       |\n| Audit Plugin                                                                                                                                  | 1.4     | Stable                                                       |\n| aws_key_management                                                    | 1.0     | Stable                                                       |\n| binlog                                                                                                                                       | 2.0     | Stable                                                       |\n| Blackhole                                                                                                                                               | 1.0     | Stable                                                       |\n| Connect                                                                                                                                                     | 1.7     | Stable                                                       |\n| CLIENT_STATISTICS                                                            | 2.0     | Stable                                                       |\n| cracklib_password_check                                                                                                                 | 1.0     | Stable                                                       |\n| CSV                                                                                                                                                             | 1.0     | Stable                                                       |\n| DECLARE BY / associative array                                                                                                       | 1.0     | Gamma                                                        |\n| DISKS                                                                                                                                                                     | 1.1     | Stable                                                       |\n| ed25519                                                                                                                                         | 1.1     | Stable                                                       |\n| FederatedX                                                                                                                                | 2.1     | Stable                                                       |\n| Feedback                                                                                                                                                               | 1.1     | Stable                                                       |\n| file_key_management                                                  | 2.0     | Gamma                                                        |\n| gssapi                                                                                                                                           | 1.0     | Stable                                                       |\n| INDEX_STATISTICS                                                             | 2.0     | Stable                                                       |\n| INET4                                                                                                                                                                            | 1.0     | Gamma                                                        |\n| INET6                                                                                                                                                          | 1.0     | Stable                                                       |\n| InnoDB                                                                                                                                                       | 10.\\*   | Stable                                                       |\n| LOCALES                                                                                          | 1.0     | Stable                                                       |\n| Memory                                                                                                                                      | 1.0     | Stable                                                       |\n| METADATA_LOCK_INFO                                                                                                                                         | 0.1     | Stable                                                       |\n| mhnsw                                                                                                                                                                            | 1.0     | Stable                                                       |\n| MRG_MyISAM                                                                                                                                                 | 1.0     | Stable                                                       |\n| Mroonga                                                                                                                                                     | 7.7     | Stable                                                       |\n| MyISAM                                                                                                                                        | 1.0     | Stable                                                       |\n| MyRocks                                                                                                                                                     | 1.0     | Stable                                                       |\n| mysql_json                                                                                                                                                                 | 0.1     | Stable                                                       |\n| mysql_native_password                                                                                                           | 1.0     | Stable                                                       |\n| mysql_old_password                                                                                                                 | 1.0     | Stable                                                       |\n| named_pipe                                                                                                                                  | 1.0     | Stable                                                       |\n| online_alter_log                                                                                                                                                    | 2.0     | Stable                                                       |\n| pam                                                                                        | 1.0     | Stable                                                       |\n| password_reuse_check                                                                                                                       | 2.0     | <p>Stable<br>(introduced in 10.10.2, 10.9.5, and 10.8.7)</p> |\n| partition                                                                                                                                                                                                   | 1.0     | Stable                                                       |\n| Performance_Schema                                                                                                                                                | 0.1     | Stable                                                       |\n| QUERY_CACHE_INFO                                                                                                                                      | 1.1     | Stable                                                       |\n| query_response_time                                                                                                                                       | 1.0     | Stable                                                       |\n| S3                                                                                                                                                | 1.0     | Stable                                                       |\n| semisync                                                                                                                   | 1.0     | Stable                                                       |\n| Sequence                                                                                                                                  | 1.0     | Stable                                                       |\n| SERVER_AUDIT                                                                                                                                                                     | 2.6     | Stable                                                       |\n| simple_password_check                                                                                                                     | 1.0     | Stable                                                       |\n| Spider                                                                                                                                                       | 3.3     | Stable                                                       |\n| SQL_ERROR_LOG                                                                                                                  | 1.0     | Stable                                                       |\n| SYS_REFCURSOR                                                                                                         | 1.0     | Gamma                                                        |\n| TABLE_STATISTICS                                                             | 2.0     | Stable                                                       |\n| USER_STATISTICS                                                              | 2.0     | Stable                                                       |\n| user_variables                                                                                                                                                  | 1.0     | Stable                                                       |\n| TokuDB                                                                                                                                | 4.0     | <p>Stable<br>(removed in 10.6)</p>                           |\n| unix_socket                                                                                                                                | 1.1     | Stable                                                       |\n| UUID                                                                                                                                                  | 1.0     | <p>Stable<br>(introduced in 10.9.1)</p>                      |\n| uuid_v4                                                                                                                        | 1.0     | Stable                                                       |\n| uuid_v7                                                                                                                        | 1.0     | Stable                                                       |\n| wsrep                                                                                                                               | 1.0     | Stable                                                       |\n| wsrep_connections                                                                                | 1.0     | Stable                                                       |\n| WSREP_INFO                                                                                                                                    | 1.0     | Stable                                                       |\n| wsrep_provider                                                                                                                                   | 1.0     | Stable                                                       |\n| wsrep_thd_info                                                                                    | 1.0     | Stable                                                       |\n| OQGraph                                                                                                                                      | 3.0     | Gamma                                                        |\n| Sphinx                                                                                                                                        | 2.0     | Gamma                                                        |\n| Columnstore                                                                                                                         | 1.0     | Beta                                                         |\n| handlersocket                                                                                                                                                     | 1.0     | Beta                                                         |\n| Cassandra                                                                                                                          | 0.1     |\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/information-on-plugins/list-of-plugins');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (115, 5, 'Audit Plugin Configuration', 'Description\n-----------\n\nAfter the audit plugin has been installed and loaded, there will be some new global variables within MariaDB. These can be used to configure many components, limits, and methods related to auditing the server. You may set these variables related to the logs, such as their location, size limits, rotation parameters, and method of logging information. You may also set what information is logged, such connects, disconnects, and failed attempts to connect. You can also have the audit plugin log queries, read and write access to tables. So as not to overload your logs, the audit plugin can be configured based on lists of users. You can include or exclude the activities of specific users in the logs.\n\nTo see a list of audit plugin-related variables on the server and their values, execute the follow while connected to the server:\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| server_audit_file_path        | server_audit.log      |\n| server_audit_file_rotate_now  | OFF                   |\n| server_audit_file_rotate_size | 1000000               |\n| server_audit_file_rotations   | 9                     |\n| server_audit_incl_users       |                       |\n| server_audit_logging          | OFF                   |\n| server_audit_mode             | 0                     |\n| server_audit_output_type      | file                  |\n| server_audit_query_log_limit  | 1024                  |\n| server_audit_sync_log_file    | OFF                   |\n| server_audit_syslog_facility  | LOG_USER              |\n| server_audit_syslog_ident     | mysql-server_auditing |\n| server_audit_syslog_info      |                       |\n| server_audit_syslog_priority  | LOG_INFO              |\n+-------------------------------+-----------------------+\n17 rows in set (0.003 sec)\n`\n\n`sql\nSHOW GLOBAL VARIABLES LIKE ''server_audit%'';\n\n+-------------------------------+-----------------------+\n| Variable_name                 | Value                 |\n+-------------------------------+-----------------------+\n| server_audit_events           | CONNECT,QUERY,TABLE   |\n| server_audit_excl_users       |                       |\n| server_audit_file_path        | server_audit.log      |\n| server_audit_file_rotate_now  | OFF                   |\n| server_audit_file_rotate_size | 1000000               |\n| server_audit_file_rotations   | 9                     |\n| server_audit_incl_users       |                       |\n| server_audit_logging          | ON                    |\n| server_audit_mode             | 0                     |\n| server_audit_output_type      | file                  |\n| server_audit_query_log_limit  | 1024                  |\n| server_audit_syslog_facility  | LOG_USER              |\n| server_audit_syslog_ident     | mysql-server_auditing |\n| server_audit_syslog_info      |                       |\n| server_audit_syslog_priority  | LOG_INFO              |\n+-------------------------------+-----------------------+\n`\n\nThe values of these variables can be changed by an administrator with the SUPER privilege, using the SET statement. Below is an example of how to disable audit logging:\n\n`sql\nSET GLOBAL server_audit_logging=OFF;\n`\n\nAlthough it is possible to change all of the variables shown above, some of them may be reset when the server restarts. Therefore, you may want set them in the configuration file (e.g., /etc/my.cnf.d/server.cnf) to ensure the values are the same after a restart:\n\n`ini\n[server]\n... \nserver_audit_logging=OFF \n…\n`\n\nFor the reason given in the paragraph above, you would not generally set variables related to the auditing plugin using the SET statement. However, you might do so to test settings before making them more permanent. Since one cannot always restart the server, you would use the SET` statement to change immediately the variables and then include the same settings in the configuration file so that the variables are set again as you prefer when the server is restarted.\n\nConfiguring Logs and Setting Other Variables\n\nOf all of the server variables you can set, you may want to set initially the server_audit_events variable to tell the Audit Plugin which events to log. The Log Settings documentation page describes in detail the choices you have and provides examples of log entries related to them.\n\nYou can see a detailed list of system variables related to the MariaDB Audit Plugin on the System Variables documentation page. Status variables related to the Audit Plugin are listed and explained on the Status Variables documentation page.\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-configuration', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-configuration');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (116, 5, 'Audit Plugin Installation', 'Description\n-----------\n\nThe server_audit plugin logs 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\nLocating the Plugin\n\nThe server_audit plugin''s shared library is included in MariaDB packages as the server_audit.so or server_audit.dll shared library on systems where it can be built.\n\nThe plugin must be located in the plugin directory, the directory containing all plugin libraries for MariaDB. The path to this directory is configured by the plugin_dir system variable. To see the value of this variable and thereby determine the file path of the plugin library, execute the following SQL statement:\n\n``sql\nSHOW GLOBAL VARIABLES LIKE ''plugin_dir'';\n\n+---------------+--------------------------+\n| Variable_name | Value                    |\n+---------------+--------------------------+\n| plugin_dir    | /usr/lib64/mysql/plugin/ |\n+---------------+--------------------------+\n`\n\nCheck the directory returned at the filesystem level to make sure that you have a copy of the plugin library, server_audit.so or server_audit.dll, depending on your system. It''s included in recent installations of MariaDB. If you do not have it, you should upgrade MariaDB.\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 ''server_audit'';\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 = server_audit\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''server_audit'';\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\nProhibiting Uninstallation\n\nThe UNINSTALL SONAME or UNINSTALL PLUGIN statements may be used to uninstall plugins. For the server_audit plugin, you might want to disable this capability. To prevent the plugin from being uninstalled, you could set the server_audit option to FORCE_PLUS_PERMANENT in a relevant server option group in an option file after the plugin is loaded once:\n\n`ini\n[mariadb]\n...\nplugin_load_add = server_audit\nserver_audit=FORCE_PLUS_PERMANENT\n`\n\nOnce you''ve added the option to the server''s option file and restarted the server, the plugin can''t be uninstalled. If someone tries to uninstall the audit plugin, then an error message will be returned. Below is an example of the error message:\n\n`sql\nUNINSTALL PLUGIN server_audit;\n\nERROR 1702 (HY000):\nPlugin ''server_audit'' is force_plus_permanent and can not be unloaded\n`\n\nFor more information on FORCE_PLUS_PERMANENT` and other option values for the server_audit option, see Plugin Overview: Configuring Plugin Activation at Server Startup for more information.\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-installation', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-installation');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (117, 5, 'Audit Plugin Location and Rotation of Logs', 'Description\n-----------\n\nLogs can be written to a separate file or to the system logs. If you prefer to have the logging separated from other system information, the value of the variable server_audit_output_type should be set to file. Incidentally, file is the only option on Windows systems.\n\nYou can force a rotation by enabling the server_audit_file_rotate_now variable like so:\n\n``sql\nSET GLOBAL server_audit_file_rotate_now = ON;\n`\n\nSeparate log files\n\nIn addition to setting server_audit_output_type, you will have to provide the file path and name of the audit file. This is set in the variable server_audit_file_path. You can set the file size limit of the log file with the variable server_audit_file_rotate_size.\n\nSo, if rotation is on and the log file has reached the size limit you set, a copy is created with a consecutive number as extension the original file will be truncated to be used for the auditing again. To limit the number of log files created, set the variable server_audit_file_rotations. You can force log file rotation by setting the variable server_audit_file_rotate_now to a value of ON. When the number of files permitted is reached, the oldest file will be overwritten. Here is how those variables might be set in a server configuration file:\n\n`ini\n[mysqld]\n...\nserver_audit_file_rotate_now=ON \nserver_audit_file_rotate_size=1000000 \nserver_audit_file_rotations=5\n...\n`\n\nSystem logs\n\nFor security reasons, it''s better sometimes to use the system logs instead of a local file owned by the mysql user. To do this, the value of server_audit_output_type needs to be set to syslog. Advanced configurations, such as using a remote syslogd service, are part of the syslogd configuration.\n\nThe variables, server_audit_syslog_ident and server_audit_syslog_info can be used to identify a system log entry made by the audit plugin. If a remote syslogd service is used for several MariaDB servers, these same variables are also used to identify the MariaDB server.\n\nHere is a system log entry taken from a server which had server_audit_syslog_ident set to the default value of mysql­-server_auditing, and server_audit_syslog_info set to <prod1>.\n\n`sql\nAug 717:19:58localhostmysql-­server_auditing: \n<prod1> localhost.localdomain,root,localhost,1,7, \nQUERY, mysql, ''SELECT * FROM user'',0\n`\n\nAlthough the default values for server_audit_syslog_facility and server_audit_syslog_priority should be sufficient in most cases. They can be changed based on the definition in syslog.h for the functions openlog() and syslog()`.\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-location-and-rotation-of-logs', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-location-and-rotation-of-logs');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (118, 5, 'Audit Plugin Log Format', 'Description\n-----------\n\nThe audit plugin logs user access to MariaDB and its objects. The audit trail (that is, the audit log) is a set of records, written as a list of fields to a file in a plain‐text format. The fields in the log are separated by commas. The format used for the plugin''s own log file is slightly different from the format used if it logs to the system log because it has its own standard format.&#x20;\n\nFormal Specification\n\nWhen the MariaDB Audit Plugin (v1) writes to a dedicated file, it uses a comma-separated (CSV) format. For tool developers, it is essential to map the connectionid to the server''s global connection identifier to enable cross-log analysis.\n\nTemplate: <timestamp>,<serverhost>,<username>,<host>,<connectionid>,<queryid>,<operation>,<database>,<object>,<retcode>\n\n| Field | Component      | Data Type      | Standardized Name / Description                                                                                                              |\n| ----- | -------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |\n| 1     | timestamp    | DateTime     | Formatted as %Y%m%d %H:%i:%s (the default), or as specified in server_audit_timestamp_format. |\n| 2     | serverhost   | String       | Hostname of the originating server.                                                                                                          |\n| 5     | connectionid | Unsigned Int | Standardized: Thread ID. Matches the Thread ID in Error, General, and Slow logs.                                                           |\n| 6     | queryid      | Unsigned Int | A unique identifier for the specific query, used to correlate QUERY and TABLE events.                                                    |\n| 7     | operation    | String       | Action type (e.g., CONNECT, QUERY, READ, WRITE).                                                                                     |\n| 10    | retcode      | Integer      | Result code (0 for success).                                                                                                               |\n\nAudit Log Format with Syslog\n\nIf server_audit_output_type is set to SYSLOG, the standard CSV line is prefixed with syslog metadata: <timestamp> <syslog_host> <syslog_ident>: <syslog_info> [Standard CSV Fields]\n\nVarious events result in different audit records. Some events do not return a value for some fields (for instance, when the active database is not set when connecting to the server).\n\nBelow is a generic example of the output for connect events, with placeholders representing data. These are events in which a user connected, disconnected, or tried unsuccessfully to connect to the server.\n\n``ini\n[timestamp],[serverhost],[username],[host],[connectionid],0,CONNECT,[database],,0 \n[timestamp],[serverhost],[username],[host],[connectionid],0,DISCONNECT,,,0 \n[timestamp],[serverhost],[username],[host],[connectionid],0,FAILED_CONNECT,,,[retcode]\n`\n\nHere is the one audit record generated for each query event:\n\n`ini\n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],QUERY,[database],[object], [retcode]\n`\n\nBelow are generic examples of records that are entered in the audit log for each type of table event:\n\n`ini\n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],CREATE,[database],[object], \n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],READ,[database],[object], \n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],WRITE,[database],[object], \n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],ALTER,[database],[object], \n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],RENAME,[database], \n[object_old]|[database_new].[object_new], \n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],DROP,[database],[object],\n`\n\nPasswords are hidden in the log for certain types of queries. They are replaced with asterisks for GRANT, CREATE USER, CREATE MASTER, CREATE SERVER, and ALTER SERVER statements. Passwords, however, are not replaced for the PASSWORD() and OLD_PASSWORD() functions when they are used inside other SQL statements (i.e., SET PASSWORD).\n\nFor Galera Cluster replication applier operations, audit log plugin logs events with a generic name of <wsrep_applier>` .\n\nThis addresses an issue where the user was logged on the primary node, but stripped from other cluster nodes. See MDEV-35511 for details.\n\nFor Galera Cluster replication applier operations, audit log plugin logs events without indicating what user initiates them.\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-log-format', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-log-format');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (119, 5, 'Audit Plugin Log Settings', 'Description\n-----------\n\nEvents that are logged by the MariaDB Audit Plugin are grouped generally into different types: connect, query, and table events. To log based on these types of events, set the variable, server_audit_events to CONNECT, QUERY, or TABLE. To have the Audit Plugin log more than one type of event, put them in a comma-separated list like so:\n\n``sql\nSET GLOBAL server_audit_events = ''CONNECT,QUERY,TABLE'';\n`\n\nYou can put the equivalent of this in the configuration file like so:\n\n`ini\n[mysqld]\n...\nserver_audit_events=connect,query\n`\n\nBy default, logging is set to OFF. To enable it, set the server_audit_logging variable to ON. Note that if the query cache is enabled, and a query is returned from the query cache, no TABLE records will appear in the log since the server didn''t open or access any tables and instead relied on the cached results. So you may want to disable query caching.\n\nThere are a few types of events that may be logged, not just the three common ones mentioned above. A full list of related system variables is detailed on the Server_Audit System Variables page, and status variables on the Server_Audit System Variables page of this documentation. Some of the major ones are highlighted below:\n\n| Type                   | Description                                                                                                                                                                                                                               |\n| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| CONNECT                | Connects, disconnects and failed connects—including the error code.                                                                                                                                                                       |\n| QUERY                  | Queries executed and their results in plain text, including failed queries due to syntax or permission errors.                                                                                                                            |\n| TABLE                  | Tables affected by query execution.                                                                                                                                                                                                       |\n| QUERY_DDL             | Similar to QUERY, but filters only DDL-type queries (CREATE, ALTER, DROP, RENAME and TRUNCATE). There are some exceptions however. RENAME USER is not logged, while CREATE/DROP [PROCEDURE / FUNCTION / USER] are logged. |\n| QUERY_DML             | Similar to QUERY, but filters only DML-type queries (DO, CALL, LOAD DATA/XML, DELETE, INSERT, SELECT, UPDATE, HANDLER , and REPLACE statements).                                                                      |\n| QUERY_DML_NO_SELECT | Similar to QUERY_DML, but doesn''t log SELECT queries.                                                                                                                                                                                 |\n| QUERY_DCL             | Similar to QUERY, but filters only DCL-type queries (CREATE USER, DROP USER, RENAME USER, GRANT, REVOKE and SET PASSWORD statements).                                                                                       |\n\nSince there are other types of queries besides DDL and DML, using the QUERY_DDL and QUERY_DML options together is not equivalent to using QUERY. There is the QUERY_DCL option for logging DCL types of queries (e.g., and GRANT`REVOKEstatements). In the same version, the server_audit_query_log_limit variable was added to be able to set the length of a log record. Previously, a log entry would be truncated due to long query strings.\n\nLogging Connect Events\n\nIf the Audit Plugin has been configured to log connect events, it will log connects, disconnects, and failed connects. For a failed connection, the log includes the error code.\n\nIt''s possible to define a list of users for which events can be excluded or included for tracing their database activities. This list will be ignored, though, for the logging of connect events. This is because auditing standards distinguish between technical and physical users. Connects need to be logged for all types of users; access to objects needs to be logged only for physical users.\n\nLogging Query Events\n\nIf QUERY, QUERY_DDL, QUERY_DML, QUERY_DML_NO_SELECT, and/or QUERY_DCL event types are enabled, then the corresponding types of queries that are executed will be logged for defined users. The queries will be logged exactly as they are executed, in plain text. This is a security vulnerability: anyone who has access to the log files will be able to read the queries. So make sure that only trusted users have access to the log files and that the files are in a protected location. An alternative is to use the⁣TABLE event type instead of the query-related event types.\n\nQueries are also logged if they cannot be executed or if they''re unsuccessful. For example, a query will be logged because of a syntax error or because the user doesn''t have the privileges necessary to access an object. These queries can be parsed by the error code that''s provided in the log.\n\nYou may find failed queries to be more interesting: They can reveal problems with applications (e.g., an SQL statement in an application that doesn''t match the current schema). They can also reveal if a malicious user is guessing at the names of tables and columns to try to get access to data.\n\nBelow is an example in which a user attempts to execute an UPDATE statement on a table for which he does not have permission:\n\n``sql\nUPDATE employees \nSET salary = salary  1.2 \nWHERE emp_id = 18236;\n\nERROR 1142 (42000): \nUPDATE command denied to user ''bob''@''localhost'' for table ''employees''\n`\n\nLooking in the Audit Plugin log (server_audit.log) for this entry, you can see the following entry:\n\n`sql\n20170817 11:07:18,ip-172-30-0-38,bob,localhost,15,46,QUERY,company,''UPDATE employees SET salary = salary  1.2 WHERE emp_id = 18236'',1142\n`\n\nThis log entry contains the date and time of the query, followed by the server host, and the user and host for the account.\n\nFrom MariaDB 12.0, in addition to the host, the audit log also contains the port, where applicable (for instance, connecting via a Unix socket doesn''t use a port).\n\nNext is the connection and query identification numbers (i.e., 15 and 46). After the log event type (i.e., QUERY), the database name (i.e., company), the query, and the error number are recorded.\n\nNotice that the last value in the log entry is 1142. That''s the error number for the query. To find failed queries, you would look for two elements: the notation indicating that it''s an entry QUERY and the last value for the entry. If the query is successful, the value will be0 .\n\nQueries Not Included in Subordinate Query Event Types\n\nNote that the QUERY event type will log queries that are not included in any of the subordinate QUERY_ event types, such as:\n\n CREATE FUNCTION\n DROP FUNCTION\n CREATE PROCEDURE\n DROP PROCEDURE\n SET\n CHANGE MASTER TO\n FLUSH\n KILL\n CHECK\n OPTIMIZE\n LOCK\n UNLOCK\n ANALYZE\n INSTALL PLUGIN\n UNINSTALL PLUGIN\n INSTALL SONAME\n UNINSTALL SONAME\n EXPLAIN\n\nLogging Table Events\n\nMariaDB has the ability to record table events in the logs—this is not a feature of MySQL. This feature is the only way to log which tables have been accessed through a view, a stored procedure, a stored function, or a trigger. Without this feature, a log entry for a query shows only the view, stored procedure or function used, not the underlying tables. Of course, you could create a custom application to parse each query executed to find the SQL statements used and the tables accessed, but that would be a drain on system resources. Table event logging is much simpler: it adds a line to the log for each table accessed, without any parsing. It includes notes as to whether it was a read or a write.\n\nIf you want to monitor user access to specific databases or tables (e.g., mysql.user), you can search the log for them. Then if you want to see a query which accessed a certain table, the audit log entry will include the query identification number. You can use it to search the same log for the query entry. This can be useful when searching a log containing tens of thousands of entries.\n\nBecause of the TABLE option, you may disable query logging and still know who accessed which tables. You might want to disable QUERY event logging to prevent sensitive data from being logged. Since _table_ event logging will log who accessed which table, you can still watch for malicious activities with the log. This is often enough to fulfill auditing requirements.\n\nBelow is an example with both TABLE and QUERY events logging. For this scenario, suppose there is a VIEW in which columns are selected from a few tables in a company database. The underlying tables are related to sensitive employee information, in particular salaries. Although we may have taken precautions to ensure that only certain user accounts have access to those tables, we will monitor the Audit Plugin logs for anyone who queries them—directly or indirectly through a view.\n\n`\n20170817 16:04:33,ip-172-30-0-38,root,localhost,29,913,READ,company,employees,\n20170817 16:04:33,ip-172-30-0-38,root,localhost,29,913,READ,company,employees_salaries,\n20170817 16:04:33,ip-172-30-0-38,root,localhost,29,913,READ,company,ref_job_titles,\n20170817 16:04:33,ip-172-30-0-38,root,localhost,29,913,READ,company,org_departments,\n20170817 16:04:33,ip-172-30-0-38,root,localhost,29,913,QUERY,company,\n''SELECT  FROM employee_pay WHERE title LIKE \\''%Executive%\\''  OR title LIKE \\''%Manager%\\'''',0\n`\n\nAlthough the user executed only one SELECT statement, there are multiple entries to the log: one for each table accessed and one entry for the query on the view, (i.e., employee_pay). We know primarily this is all for one query because they all have the same connection and query identification numbers (i.e., 29 and 913).\n\nLogging User Activities\n\nThe Audit Plugin will log the database activities of all users, or only the users that you specify. A database activity is defined as a _query_ event or a _table_ event. _Connect_ events are logged for all users.\n\nYou may specify users to include in the log with the server_audit_incl_users variable or exclude users with the server_audit_excl_users variable. This can be useful if you would like to log entries, but are not interested in entries from trusted applications and would like to exclude them from the logs.\n\nYou would typically use either the server_audit_incl_users variable or the server_audit_excl_users variable. You may, though, use both variables. If a username is inadvertently listed in both variables, database activities for that user will be logged because server_audit_incl_users takes priority.\n\nAlthough MariaDB considers a user as the combination of the username and hostname, the Audit Plugin logs only based on the username. MariaDB uses both the username and hostname so as to grant privileges relevant to the location of the user. Privileges are not relevant though for tracing the access to database objects. The host name is still recorded in the log, but logging is not determined based on that information.\n\nThe following example shows how to add a new username to the server_audit_incl_users variable without removing previous usernames:\n\n`sql\nSET GLOBAL server_audit_incl_users = CONCAT(@@global.server_audit_incl_users, '',Maria'');\n`\n\nRemember to add also any new users to be included in the logs to the same variable in MariaDB configuration file. Otherwise, when the server restarts it will discard the setting.\n\nExcluding or Including Users\n\nBy default events from all users are logged, but certain users can be excluded from logging by using the server_audit_excl_users variable. For example, to exclude users _valerianus_ and _rocky_ from having their events logged:\n\n`ini\nserver_audit_excl_users=valerianus,rocky\n`\n\nThis option is primarily used to exclude the activities of trusted applications.\n\nAlternatively, server_audit_incl_users can be used to specifically include users. Both variables can be used, but if a user appears on both lists, server_audit_incl_users has a higher priority, and their activities will be logged.\n\nNote that CONNECT` events are always logged for all users, regardless of these two settings. Logging is also based on username only, not the username and hostname combination that MariaDB uses to determine privileges.\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-log-settings', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-log-settings');
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');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (328, 14, 'MASTER\\_POS\\_WAIT', 'Syntax\n------\n\nMASTER_POS_WAIT(log_name,log_pos[,timeout,["connection_name"]])\n\nDescription\n-----------\n\nThis function is useful in replication for controlling master/slave synchronization. It blocks until the slave has read and applied all updates up to the specified position (log_name,log_pos) in the binary log. The return value is the number of log events the slave had to wait for to advance to the specified position. The function returns NULL if the slave SQL thread is not started, the slave''s master information is not initialized, the arguments are incorrect, or an error occurs. It returns -1 if\\\nthe timeout has been exceeded. If the slave SQL thread stops whileMASTER_POS_WAIT() is waiting, the function returns NULL. If the slave is past the specified position, the function returns immediately.\n\nIf a timeout value is specified, MASTER_POS_WAIT() stops waiting when timeout seconds have elapsed. timeout must be greater than 0; a zero or negative timeout means no timeout.\n\nThe connection_name is used when you are using multi-source-replication. If you don''t specify it, it''s set to the value of the default_master_connection system variable.\n\nStatements using the MASTER_POS_WAIT() function are not safe for statement-based replication.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/master_pos_wait', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/master_pos_wait');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (329, 14, 'FORMAT\\_BYTES', 'Syntax\n------\n\nFORMAT_BYTES(double)\n\nDescription\n-----------\n\nGiven a byte count, returns a string consisting of a value and the units in a human-readable format. The units will be in bytes, KiB (kibibytes), MiB (mebibytes), GiB (gibibytes), TiB (tebibytes), PiB (pebibytes) or EiB (exbibytes).\n\nThe binary prefixes (kibi, mebi, gibi, tebi, pebi and exbi) were created in December 1998 by the International Electrotechnical Commission to avoid possible ambiguity, as the widely-used prefixes kilo, mega, giga, tera, peta and exa can be used to refer to both the power-of-10 decimal system multipliers and the power-of-two binary system multipliers.\n\nThis function is similar to the Sys Schema format_bytes function, except that function does not display exbibytes.\n\nExamples\n--------\n\nSELECT FORMAT_BYTES(1000)FORMAT_BYTES(1024);\n+--------------------+--------------------+\n| FORMAT_BYTES(1000) | FORMAT_BYTES(1024) |\n+--------------------+--------------------+\n| 1000 bytes         | 1.00 KiB           |\n+--------------------+--------------------+\n\nSELECT FORMAT_BYTES(1000000),FORMAT_BYTES(1048576);\n+-----------------------+-----------------------+\n| FORMAT_BYTES(1000000) | FORMAT_BYTES(1048576) |\n+-----------------------+-----------------------+\n| 976.56 KiB            | 1.00 MiB              |\n+-----------------------+-----------------------+\n\nSELECT FORMAT_BYTES(1000000000),FORMAT_BYTES(1073741874);\n+--------------------------+--------------------------+\n| FORMAT_BYTES(1000000000) | FORMAT_BYTES(1073741874) |\n+--------------------------+--------------------------+\n| 953.67 MiB               | 1.00 GiB                     |\n+--------------------------+--------------------------+\n\nSELECT FORMAT_BYTES(1000000000000),FORMAT_BYTES(1099511627776);\n+-----------------------------+-----------------------------+\n| FORMAT_BYTES(1000000000000) | FORMAT_BYTES(1099511627776) |\n+-----------------------------+-----------------------------+\n| 931.32 GiB                  | 1.00 TiB                    |\n+-----------------------------+-----------------------------+\n\nSELECT FORMAT_BYTES(1000000000000000),FORMAT_BYTES(1125899906842624);\n+--------------------------------+--------------------------------+\n| FORMAT_BYTES(1000000000000000) | FORMAT_BYTES(1125899906842624) |\n+--------------------------------+--------------------------------+\n| 909.49 TiB                     | 1.00 PiB                       |\n+--------------------------------+--------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/miscellaneous-functions-format_bytes', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/miscellaneous-functions-format_bytes');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (330, 14, 'NAME\\_CONST', 'Syntax\n------\n\nNAME_CONST(name,value)\n\nDescription\n-----------\n\nReturns the given value. When used to produce a result set column,NAME_CONST() causes the column to have the given name. The arguments should be constants.\n\nThis function is used internally when replicating stored procedures. It makes little sense to use it explicitly in SQL statements, and it was not supposed to be used like that.\n\n``sql\nSELECT NAME_CONST(''myname'', 14);\n+--------+\n| myname |\n+--------+\n|     14 |\n+--------+\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/name_const', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/name_const');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (331, 14, 'OLD\\_VALUE', 'Syntax\n------\n\nOLD_VALUE(val)\n\nDescription\n-----------\n\nIn the RETURNING clause of an UPDATE statement, OLD_VALUE() returns the value before the update. The function is meaningful only in this context.\n\nExamples\n--------\n\nUPDATE t SET a=a+1 RETURNING OLD_VALUE(a) AS old, a as new;\n+------+------+\n| old  | new  |\n+------+------+\n|    1 |    2 |\n+------+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/old-value', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/old-value');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (332, 14, 'RELEASE\\_ALL\\_LOCKS', 'Syntax\n------\n\nRELEASE_ALL_LOCKS()\n\nDescription\n-----------\n\nReleases all named locks held by the current session. Returns the number of locks released, or 0 if none were held.\n\nStatements using the RELEASE_ALL_LOCKS function are not safe for statement-based replication.\n\nExamples\n--------\n\nSELECT RELEASE_ALL_LOCKS();\n+---------------------+\n| RELEASE_ALL_LOCKS() | \n+---------------------+\n|                   0 |\n+---------------------+\n\nSELECT GET_LOCK(''lock1'',10);\n+----------------------+\n| GET_LOCK(''lock1'',10) |\n+----------------------+\n|                    1 |\n+----------------------+\n\nSELECT RELEASE_ALL_LOCKS();\n+---------------------+\n| RELEASE_ALL_LOCKS() | \n+---------------------+\n|                   1 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/release_all_locks', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/release_all_locks');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (333, 14, 'RELEASE\\_LOCK', 'Syntax\n------\n\nRELEASE_LOCK(str)\n\nDescription\n-----------\n\nReleases the lock named by the string str that was obtained with GET_LOCK(). Returns 1 if the lock was released, 0 if the lock was not established by this connection (in which case the lock is not released), and NULL if the named lock did not exist. The lock does not exist if it was never obtained by a call to GET_LOCK() or if it has previously been released.\n\nstr is case insensitive. If str is an empty string or NULL, RELEASE_LOCK() returns NULL and does nothing.\n\nStatements using the RELEASE_LOCK function are not safe for statement-based replication.\n\nThe DO statement is convenient to use with RELEASE_LOCK().\n\nExamples\n--------\n\nSELECT GET_LOCK(''lock1'',10);\n+----------------------+\n| GET_LOCK(''lock1'',10) |\n+----------------------+\n|                    1 |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/release_lock', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/release_lock');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (334, 14, 'SLEEP', 'Syntax\n------\n\nSLEEP(duration)\n\nDescription\n-----------\n\nSleeps (pauses) for the number of seconds given by the duration argument, then returns 0. If SLEEP() is interrupted, it returns 1. The duration may have a fractional part given in microseconds.\n\nStatements using the SLEEP() function are not safe for statement-based replication.\n\nExamples\n--------\n\nSELECT SLEEP(5.5);\n+------------+\n| SLEEP(5.5) |\n+------------+\n|          0 |\n+------------+\n1 row in set (5.50 sec)\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/sleep', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/sleep');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (335, 14, 'SYS\\_GUID', 'Syntax\n------\n\nSYS_GUID()\n\nDescription\n-----------\n\nReturns a 16-byte globally unique identifier (GUID), similar to the UUID function, but without the - character.\n\nExamples\n--------\n\nSELECT SYS_GUID();\n+----------------------------------+\n| SYS_GUID()                       |\n+----------------------------------+\n| 2C574E45BA2811EBB265F859713E4BE4 |\n+----------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/sys_guid', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/sys_guid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (336, 14, 'UUID', 'Syntax\n------\n\nUUID()\n\nDescription\n-----------\n\nReturns a Universally Unique Identifier (UUID) version 1. Functions to generate v4 and v7 UUIDs are available from MariaDB 11.7. See UUIDv4 and UUIDv7 respectively.\n\nA UUID is designed as a number that is globally unique in space and time. Two calls to UUID() are expected to generate two different values, even if these calls are performed on two separate computers that are not connected to each other.\n\nUUID() results are intended to be unique, but cannot always be relied upon to be unpredictable and unguessable.\n\nA UUID is a 128-bit number represented by a utf8 string of five hexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format:\n\n The first three numbers are generated from a timestamp.\n The fourth number preserves temporal uniqueness in case the timestamp value\\\n  loses monotonicity (for example, due to daylight saving time).\n* The fifth number is an IEEE 802 node number that provides spatial uniqueness.\\\n  A random number is substituted if the latter is not available (for example,\\\n  because the host computer has no Ethernet card, or we do not know how to find\\\n  the hardware address of an interface on your operating system). In this case,\\\n  spatial uniqueness cannot be guaranteed. Nevertheless, a collision should\\\n  have very low probability.\n\nCurrently, the MAC address of an interface is taken into account only on FreeBSD and Linux. On other operating systems, MariaDB uses a randomly generated 48-bit number.\n\nStatements using the UUID() function are not safe for statement-based replication.\n\nThe function generates a UUIDv1 and the results are generated according to the "DCE 1.1:Remote Procedure Call" (Appendix A) CAE (Common Applications Environment) Specifications published by The Open Group in October 1997 (Document Number C706).\n\nExamples\n--------\n\nSELECT UUID();\n+--------------------------------------+\n| UUID()                               |\n+--------------------------------------+\n| cd41294a-afb0-11df-bc9b-00241dd75637 |\n+--------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (337, 14, 'UUID\\_SHORT', 'Syntax\n------\n\nUUID_SHORT()\n\nDescription\n-----------\n\nReturns a "short" universally unique identifier as a 64-bit unsigned integer (rather than a string-form 128-bit identifier as returned by the UUID() function).\n\nThe value of UUID_SHORT() is guaranteed to be unique if the following conditions hold:\n\n The server_id of the current host is unique among your set of master and slave servers.\n server_id is between 0 and 255.\n You don''t set back your system time for your server between mariadbd restarts.\n You do not invoke UUID_SHORT() on average more than 16 million times per second between mariadbd restarts\n\nThe UUID_SHORT() return value is constructed this way:\n\n``sql\n(server_id & 255) << 56\n+ (server_startup_time_in_seconds << 24)\n+ incremented_variable++;\n``\n\nStatements using the UUID_SHORT() function are not safe for statement-based replication.\n\nExamples\n--------\n\nSELECT UUID_SHORT();\n+-------------------+\n| UUID_SHORT()      |\n+-------------------+\n| 21517162376069120 |\n+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid_short', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid_short');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (338, 14, 'UUID\\_v4', 'Syntax\n------\n\nUUID_v4()\n\nDescription\n-----------\n\nReturns a Universally Unique Identifier (UUID) version 4. To generate a version 1 UUID, see the UUID function. To generate a version 7 UUID, see UUIDv7.\n\nA UUID is designed as a number that is globally unique in space and time. Two calls to UUID() are expected to generate two different values, even if these calls are performed on two separate computers that are not connected to each other.\n\nUUID_v4() results are intended to be unique, but cannot always be relied upon to be unpredictable and unguessable.\n\nA UUID is a 128-bit number represented by a utf8 string of five hexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format.\n\nStatements using the UUID_v4() function are not safe for statement-based replication.\n\nExamples\n--------\n\nSELECT UUID(),UUID_v4(),UUID_v7()\\G \n************************ 1. row ************************\n  UUID(): 63ae8c92-799a-11ef-98b2-f859713e4be4\nUUID_v4(): a2443495-1b94-415b-b6fa-fe8e79ba4812\nUUID_v7(): 01921e85-f198-7490-9b89-7dd0d468543b\n\nCREATE TABLE t1 (a INT PRIMARY KEY NOT NULL, u UUID DEFAULT UUID_v4(), UNIQUE KEY(u));\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid_v4', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid_v4');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (339, 14, 'UUID\\_v7', 'Syntax\n------\n\nUUID_v7()\n\nDescription\n-----------\n\nReturns a Universally Unique Identifier (UUID) version 7. To generate a version 1 UUID, see the UUID function. To generate a version 4 UUID, see UUID_v4.\n\nA UUID is designed as a number that is globally unique in space and time. Two calls to UUID() are expected to generate two different values, even if these calls are performed on two separate computers that are not connected to each other.\n\nA UUID is a 128-bit number represented by a utf8 string of five hexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format.\n\nStatements using the UUID_v7() function are not safe for statement-based replication.\n\nExamples\n--------\n\nSELECT UUID(),UUID_v4(),UUID_v7()\\G \n************************ 1. row ************************\n  UUID(): 63ae8c92-799a-11ef-98b2-f859713e4be4\nUUID_v4(): a2443495-1b94-415b-b6fa-fe8e79ba4812\nUUID_v7(): 01921e85-f198-7490-9b89-7dd0d468543b\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid_v7', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/uuid_v7');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (340, 14, 'VALUES / VALUE', 'Syntax\n------\n\nVALUE(col_name)\n\nDescription\n-----------\n\nIn an INSERT ... ON DUPLICATE KEY UPDATE statement, you can use the VALUES(col_name) function in the UPDATE clause to refer to column values from the INSERT portion of the statement. In other words, VALUES(col_name) in the UPDATE clause refers to the value of col_name that would be inserted, had no duplicate-key conflict occurred. This function is especially useful in multiple-row inserts.\n\nThe VALUES() function is meaningful only in INSERT ... ON DUPLICATE KEY UPDATE statements and returns NULL otherwise.\n\nThis function was renamed to VALUE(), because it''s incompatible with the standard Table Value Constructors syntax.\n\nThe VALUES() function can still be used but only in INSERT ... ON DUPLICATE KEY UPDATE statements; it''s a syntax error otherwise.\n\nExamples\n--------\n\nINSERT INTO t (a,b,c) VALUES (1,2,3),(4,5,6)\n    ON DUPLICATE KEY UPDATE c=VALUE(a)+VALUE(b);\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/values-value', '', 'https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/values-value');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (341, 35, 'COLUMN\\_ADD', 'Syntax\n------\n\nCOLUMN_ADD(dyncol_blob, column_nr, value [as type], [column_nr, value [as type]]...)\nCOLUMN_ADD(dyncol_blob, column_name, value [as type], [column_name, value [as type]]...)\n\nDescription\n-----------\n\nAdds or updates dynamic columns.\n\n dyncol_blob must be either a valid dynamic columns blob (for example, COLUMN_CREATE returns such blob), or an empty string.\n column_name specifies the name of the column to be added. If dyncol_blob already has a column with this name, it will be overwritten.\n value specifies the new value for the column. Passing a NULL value will cause the column to be deleted.\n as type is optional. See #datatypes section for a discussion about types.\n\nThe return value is a dynamic column blob after the modifications.\n\nExamples\n--------\n\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob, "column_name", "value") WHERE id=1;\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_add', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_add');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (342, 35, 'COLUMN\\_CHECK', 'Syntax\n------\n\nCOLUMN_CHECK(dyncol_blob);\n\nDescription\n-----------\n\nCheck if dyncol_blob is a valid packed dynamic columns blob. Return value of 1 means the blob is valid, return value of 0 means it is not.\n\nRationale:\\\nNormally, one works with valid dynamic column blobs. Functions like COLUMN_CREATE, COLUMN_ADD, COLUMN_DELETE always return valid dynamic column blobs. However, if a dynamic column blob is accidentally truncated, or transcoded from one character set to another, it will be corrupted. This function can be used to check if a value in a blob field is a valid dynamic column blob.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_check', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_check');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (343, 35, 'COLUMN\\_CREATE', 'Syntax\n------\n\nCOLUMN_CREATE(column_nr, value [as type], [column_nr, value [as type]]...)\nCOLUMN_CREATE(column_name, value [as type], [column_name, value [as type]]...)\n\nDescription\n-----------\n\nReturns a dynamic columns blob that stores the specified columns with values.\n\nThe return value is suitable for\n\n storing in a table;\n further modification with other dynamic columns functions.\n\nThe as type part allows one to specify the value type. In most cases, this is redundant because MariaDB will be able to deduce the type of the value. Explicit type specification may be needed when the type of the value is not apparent. For example, a literal ''2012-12-01'' has a CHAR type by default, one will need to specify ''2012-12-01'' AS DATE to have it stored as a date. See Dynamic Columns:Datatypes for further details.\n\nExamples\n--------\n\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE("column_name", "value");\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_create', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_create');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (344, 35, 'COLUMN\\_DELETE', 'Syntax\n------\n\nCOLUMN_DELETE(dyncol_blob, column_nr, column_nr...)\nCOLUMN_DELETE(dyncol_blob, column_name, column_name...)\n\nDescription\n-----------\n\nDeletes a dynamic column with the specified name. Multiple names can be given. The return value is a dynamic column blob after the modification.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_delete', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_delete');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (345, 35, 'COLUMN\\_EXISTS', 'Syntax\n------\n\nCOLUMN_EXISTS(dyncol_blob, column_nr)\nCOLUMN_EXISTS(dyncol_blob, column_name)\n\nDescription\n-----------\n\nChecks if a column with name column_name exists in dyncol_blob. If yes, return 1, otherwise return 0. See dynamic columns for more information.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_exists', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_exists');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (346, 35, 'COLUMN\\_GET', 'Syntax\n------\n\nCOLUMN_GET(dyncol_blob, column_nr as type)\nCOLUMN_GET(dyncol_blob, column_name as type)\n\nDescription\n-----------\n\nGets the value of a dynamic column by its name. If no column with the given name exists, NULL will be returned.\n\ncolumn_name as type requires that one specify the datatype of the dynamic column they are reading.\n\nThis may seem counter-intuitive: why would one need to specify which datatype they''re retrieving? Can''t the dynamic columns system figure the datatype from the data being stored?\n\nThe answer is: SQL is a statically-typed language. The SQL interpreter needs to know the datatypes of all expressions before the query is run (for example, when one is using prepared statements and runs "select COLUMN_GET(...)", the prepared statement API requires the server to inform the client about the datatype of the column being read before the query is executed and the server can see what datatype the column actually has).\n\nLengths\n\nSuppose running a query like this:\n\n``sql\nSELECT COLUMN_GET(BLOB, ''colname'' AS CHAR) ...\n`\n\nWithout specifying a maximum length (i.e. using as CHAR, not as CHAR(n)`), MariaDB will report the maximum length of the result set column to be 16,777,216. This may cause excessive memory usage in some client libraries, because they try to pre-allocate a buffer of maximum result set width. To avoid this problem, use CHAR(n) whenever you''re using COLUMN_GET in the select list.\n\nSee Dynamic Columns:Datatypes for more information about datatypes.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_get', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_get');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (347, 35, 'COLUMN\\_JSON', 'Syntax\n------\n\nCOLUMN_JSON(dyncol_blob)\n\nDescription\n-----------\n\nReturns a JSON representation of data in dyncol_blob. Can also be used to display nested columns. See dynamic columns for more information.\n\nExamples\n--------\n\nSELECT item_name, COLUMN_JSON(dynamic_cols) FROM assets;\n+-----------------+----------------------------------------+\n| item_name       | COLUMN_JSON(dynamic_cols)              |\n+-----------------+----------------------------------------+\n| MariaDB T-shirt | {"size":"XL","color":"blue"}           |\n| Thinkpad Laptop | {"color":"black","warranty":"3 years"} |\n+-----------------+----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_json', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_json');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (348, 35, 'COLUMN\\_LIST', 'Syntax\n------\n\nCOLUMN_LIST(dyncol_blob);\n\nDescription\n-----------\n\nReturns a comma-separated list of column names. The names are quoted with backticks.\n\nSee dynamic columns for more information.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_list', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/dynamic-columns-functions/column_list');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (349, 35, 'WSREP\\_LAST\\_SEEN\\_GTID', 'Syntax\n------\n\nWSREP_LAST_SEEN_GTID()\n\nDescription\n-----------\n\nReturns the Global Transaction ID of the most recent write transaction observed by the client.\n\nThe result can be useful to determine the transaction to provide to WSREP_SYNC_WAIT_UPTO_GTID for waiting and unblocking purposes.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/galera-functions/wsrep_last_seen_gtid', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/galera-functions/wsrep_last_seen_gtid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (350, 35, 'WSREP\\_LAST\\_WRITTEN\\_GTID', 'Syntax\n------\n\nWSREP_LAST_WRITTEN_GTID()\n\nDescription\n-----------\n\nReturns the Global Transaction ID of the most recent write transaction performed by the client.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/galera-functions/wsrep_last_written_gtid', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/galera-functions/wsrep_last_written_gtid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (351, 35, 'WSREP\\_SYNC\\_WAIT\\_UPTO\\_GTID', 'Syntax\n------\n\nWSREP_SYNC_WAIT_UPTO_GTID(gtid[,timeout])\n\nDescription\n-----------\n\nBlocks the client until the transaction specified by the given Global Transaction ID is applied and committed by the node.\n\nThe optional _timeout_ argument can be used to specify a block timeout in seconds. If not provided, the timeout will be indefinite.\n\nReturns the node that applied and committed the Global Transaction ID, ER_LOCAL_WAIT_TIMEOUT if the function is timed out before this, or ER_WRONG_ARGUMENTS if the function is given an invalid GTID.\n\nThe result from WSREP_LAST_SEEN_GTID can be useful to determine the transaction to provide to WSREP_SYNC_WAIT_UPTO_GTID for waiting and unblocking purposes.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/galera-functions/wsrep_sync_wait_upto_gtid', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/galera-functions/wsrep_sync_wait_upto_gtid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (352, 35, 'Geographic Functions', 'Description\n-----------\n\nGeographic and geometry functions. See Geographic Features for a full discussion of MariaDB''s spatial extensions.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/geographic-functions', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/geographic-functions');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (353, 35, 'Differences between JSON\\_QUERY and JSON\\_VALUE', 'Description\n-----------\n\nThe primary difference between the two functions is that _JSON_QUERY_ returns an object or an array, while _JSON_VALUE_ returns a scalar.\n\nTake the following JSON document as an example:\n\n``sql\nSET @json=''{ "x": [0,1], "y": "[0,1]", "z": "Monty" }'';\n`\n\nNote that data member "x" is an array, and data members "y" and "z" are strings. The following examples demonstrate the differences between the two functions.\n\n`sql\nSELECT JSON_QUERY(@json,''$''), JSON_VALUE(@json,''$'');\n+--------------------------------------------+-----------------------+\n| JSON_QUERY(@json,''$'')                      | JSON_VALUE(@json,''$'') |\n+--------------------------------------------+-----------------------+\n| { "x": [0,1], "y": "[0,1]", "z": "Monty" } | NULL                  |\n+--------------------------------------------+-----------------------+\n\nSELECT JSON_QUERY(@json,''$.x''), JSON_VALUE(@json,''$.x'');\n+-------------------------+-------------------------+\n| JSON_QUERY(@json,''$.x'') | JSON_VALUE(@json,''$.x'') |\n+-------------------------+-------------------------+\n| [0,1]                   | NULL                    |\n+-------------------------+-------------------------+\n\nSELECT JSON_QUERY(@json,''$.y''), JSON_VALUE(@json,''$.y'');\n+-------------------------+-------------------------+\n| JSON_QUERY(@json,''$.y'') | JSON_VALUE(@json,''$.y'') |\n+-------------------------+-------------------------+\n| NULL                    | [0,1]                   |\n+-------------------------+-------------------------+\n\nSELECT JSON_QUERY(@json,''$.z''), JSON_VALUE(@json,''$.z'');\n+-------------------------+-------------------------+\n| JSON_QUERY(@json,''$.z'') | JSON_VALUE(@json,''$.z'') |\n+-------------------------+-------------------------+\n| NULL                    | Monty                   |\n+-------------------------+-------------------------+\n\nSELECT JSON_QUERY(@json,''$.x[0]''), JSON_VALUE(@json,''$.x[0]'');\n+----------------------------+----------------------------+\n| JSON_QUERY(@json,''$.x[0]'') | JSON_VALUE(@json,''$.x[0]'') |\n+----------------------------+----------------------------+\n| NULL                       | 0                          |\n+----------------------------+----------------------------+\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/differences-between-json_query-and-json_value', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/differences-between-json_query-and-json_value');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (354, 35, 'JSON Validation Function', 'Description\n-----------\n\nThe IS JSON is a variant of IS predicate that checks whether an expression contains valid JSON data, with optional constraints on JSON type (VALUE, ARRAY, OBJECT, SCALAR) and key uniqueness.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json-validation-function', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json-validation-function');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (355, 35, 'JSON\\_ARRAY', 'Syntax\n------\n\nJSON_ARRAY([value[, value2] ...])\n\nDescription\n-----------\n\nReturns a JSON array containing the listed values. The list can be empty.\n\nExamples\n--------\n\nSELECT Json_Array(56, 3.1416, ''My name is "Foo"'', NULL);\n+--------------------------------------------------+\n| Json_Array(56, 3.1416, ''My name is "Foo"'', NULL) |\n+--------------------------------------------------+\n| [56, 3.1416, "My name is \\"Foo\\"", null]         |\n+--------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (356, 35, 'JSON\\_ARRAY\\_APPEND', 'Syntax\n------\n\nJSON_ARRAY_APPEND(json_doc, path, value[, path, value] ...)\n\nDescription\n-----------\n\nAppends values to the end of the specified arrays within a JSON document, returning the result, or NULL if any of the arguments are NULL.\n\nEvaluation is performed from left to right, with the resulting document from the previous pair becoming the new value against which the next pair is evaluated.\n\nIf the json_doc is not a valid JSON document, or if any of the paths are not valid, or contain a  or * wildcard, an error is returned.\n\nExamples\n--------\n\nSET @json = ''[1, 2, [3, 4]]'';\n\nSELECT JSON_ARRAY_APPEND(@json, ''$[0]'', 5)\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, ''$[0]'', 5) |\n+-------------------------------------+\n| [[1, 5], 2, [3, 4]]                 |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_APPEND(@json, ''$[1]'', 6);\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, ''$[1]'', 6) |\n+-------------------------------------+\n| [1, [2, 6], [3, 4]]                 |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_APPEND(@json, ''$[1]'', 6, ''$[2]'', 7);\n+------------------------------------------------+\n| JSON_ARRAY_APPEND(@json, ''$[1]'', 6, ''$[2]'', 7) |\n+------------------------------------------------+\n| [1, [2, 6], [3, 4, 7]]                         |\n+------------------------------------------------+\n\nSELECT JSON_ARRAY_APPEND(@json, ''$'', 5);\n+----------------------------------+\n| JSON_ARRAY_APPEND(@json, ''$'', 5) |\n+----------------------------------+\n| [1, 2, [3, 4], 5]                |\n+----------------------------------+\n\nSET @json = ''{"A": 1, "B": [2], "C": [3, 4]}'';\n\nSELECT JSON_ARRAY_APPEND(@json, ''$.B'', 5);\n+------------------------------------+\n| JSON_ARRAY_APPEND(@json, ''$.B'', 5) |\n+------------------------------------+\n| {"A": 1, "B": [2, 5], "C": [3, 4]} |\n+------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array_append', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array_append');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (357, 35, 'JSON\\_ARRAY\\_INSERT', 'Syntax\n------\n\nJSON_ARRAY_INSERT(json_doc, path, value[, path, value] ...)\n\nDescription\n-----------\n\nInserts a value into a JSON document, returning the modified document, or NULL if any of the arguments are NULL.\n\nEvaluation is performed from left to right, with the resulting document from the previous pair becoming the new value against which the next pair is evaluated.\n\nIf the json_doc is not a valid JSON document, or if any of the paths are not valid, or contain a  or * wildcard, an error is returned.\n\nExamples\n--------\n\nSET @json = ''[1, 2, [3, 4]]'';\n\nSELECT JSON_ARRAY_INSERT(@json, ''$[0]'', 5);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, ''$[0]'', 5) |\n+-------------------------------------+\n| [5, 1, 2, [3, 4]]                   |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_INSERT(@json, ''$[1]'', 6);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, ''$[1]'', 6) |\n+-------------------------------------+\n| [1, 6, 2, [3, 4]]                   |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_INSERT(@json, ''$[1]'', 6, ''$[2]'', 7);\n+------------------------------------------------+\n| JSON_ARRAY_INSERT(@json, ''$[1]'', 6, ''$[2]'', 7) |\n+------------------------------------------------+\n| [1, 6, 7, 2, [3, 4]]                           |\n+------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array_insert', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array_insert');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (358, 35, 'JSON\\_ARRAY\\_INTERSECT', 'Syntax\n------\n\nJSON_ARRAY_INTERSECT(arr1, arr2)\n\nDescription\n-----------\n\nFinds intersection between two json arrays and returns an array of items found in both array.\n\nExamples\n--------\n\nSET @json1= ''[1,2,3]'';\nSET @json2= ''[1,2,4]'';\n\nSELECT json_array_intersect(@json1, @json2); \n+--------------------------------------+\n| json_array_intersect(@json1, @json2) |\n+--------------------------------------+\n| [1, 2]                               |\n+--------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array_intersect', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_array_intersect');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (359, 35, 'JSON\\_ARRAYAGG', 'Syntax\n------\n\nJSON_ARRAYAGG(column_or_expression)\n\nDescription\n-----------\n\nJSON_ARRAYAGG returns a JSON array containing an element for each value in a given set of JSON or SQL values. It acts on a column or an expression that evaluates to a single value.\n\nThe maximum returned length in bytes is determined by the group_concat_max_len server system variable.\n\nReturns NULL in the case of an error, or if the result contains no rows.\n\nJSON_ARRAYAGG cannot currently be used as a window function.\n\nThe full syntax is as follows:\n\n``sql\nJSON_ARRAYAGG([DISTINCT] expr\n             [ORDER BY {unsigned_integer | col_name | expr}\n                 [ASC | DESC] [,col_name ...]]\n             [LIMIT {[offset,] row_count | row_count OFFSET offset}])\n``\n\nExamples\n--------\n\nCREATE TABLE t1 (a INT, b INT);\n\nINSERT INTO t1 VALUES (1, 1),(2, 1), (1, 1),(2, 1), (3, 2),(2, 2),(2, 2),(2, 2);\n\nSELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;\n+-------------------+-------------------+\n| JSON_ARRAYAGG(a)  | JSON_ARRAYAGG(b)  |\n+-------------------+-------------------+\n| [1,2,1,2,3,2,2,2] | [1,1,1,1,2,2,2,2] |\n+-------------------+-------------------+\n\nSELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY b;\n+------------------+------------------+\n| JSON_ARRAYAGG(a) | JSON_ARRAYAGG(b) |\n+------------------+------------------+\n| [1,2,1,2]        | [1,1,1,1]        |\n| [3,2,2,2]        | [2,2,2,2]        |\n+------------------+------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_arrayagg', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_arrayagg');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (360, 35, 'JSON\\_COMPACT', 'Syntax\n------\n\nJSON_COMPACT(json_doc)\n\nDescription\n-----------\n\nRemoves all unnecessary spaces so the json document is as short as possible.\n\nExamples\n--------\n\nSET @j = ''{ "A": 1, "B": [2, 3]}'';\n\nSELECT JSON_COMPACT(@j), @j;\n+-------------------+------------------------+\n| JSON_COMPACT(@j)  | @j                     |\n+-------------------+------------------------+\n| {"A":1,"B":[2,3]} | { "A": 1, "B": [2, 3]} |\n+-------------------+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_compact', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_compact');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (361, 35, 'JSON\\_CONTAINS', 'Syntax\n------\n\nJSON_CONTAINS(json_doc, val[, path])\n\nDescription\n-----------\n\nReturns whether or not the specified value is found in the given JSON document or, optionally, at the specified path within the document. Returns 1 if it does, 0 if not and NULL if any of the arguments are null. An error occurs if the document or path is not valid, or contains the  or * wildcards.\n\nExamples\n--------\n\nSET @json = ''{"A": 0, "B": {"C": 1}, "D": 2}'';\n\nSELECT JSON_CONTAINS(@json, ''2'', ''$.A'');\n+----------------------------------+\n| JSON_CONTAINS(@json, ''2'', ''$.A'') |\n+----------------------------------+\n|                                0 |\n+----------------------------------+\n\nSELECT JSON_CONTAINS(@json, ''2'', ''$.D'');\n+----------------------------------+\n| JSON_CONTAINS(@json, ''2'', ''$.D'') |\n+----------------------------------+\n|                                1 |\n+----------------------------------+\n\nSELECT JSON_CONTAINS(@json, ''{"C": 1}'', ''$.A'');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, ''{"C": 1}'', ''$.A'') |\n+-----------------------------------------+\n|                                       0 |\n+-----------------------------------------+\n\nSELECT JSON_CONTAINS(@json, ''{"C": 1}'', ''$.B'');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, ''{"C": 1}'', ''$.B'') |\n+-----------------------------------------+\n|                                       1 |\n+-----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_contains', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_contains');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (362, 35, 'JSON\\_CONTAINS\\_PATH', 'Syntax\n------\n\nJSON_CONTAINS_PATH(json_doc, return_arg, path[, path] ...)\n\nDescription\n-----------\n\nIndicates whether the given JSON document contains data at the specified path or paths. Returns 1 if it does, 0 if not and NULL if any of the arguments are null.\n\nThe _return_arg_ can be one or all:\n\n one - Returns 1 if at least one path exists within the JSON document.\n all - Returns 1 only if all paths exist within the JSON document.\n\nExamples\n--------\n\nSET @json = ''{"A": 1, "B": [2], "C": [3, 4]}'';\n\nSELECT JSON_CONTAINS_PATH(@json, ''one'', ''$.A'', ''$.D'');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, ''one'', ''$.A'', ''$.D'') |\n+------------------------------------------------+\n|                                              1 |\n+------------------------------------------------+\n1 row in set (0.00 sec)\n\nSELECT JSON_CONTAINS_PATH(@json, ''all'', ''$.A'', ''$.D'');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, ''all'', ''$.A'', ''$.D'') |\n+------------------------------------------------+\n|                                              0 |\n+------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_contains_path', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_contains_path');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (363, 35, 'JSON\\_DEPTH', 'Syntax\n------\n\nJSON_DEPTH(json_doc)\n\nDescription\n-----------\n\nReturns the maximum depth of the given JSON document, or NULL if the argument is null. An error occurs if the argument is an invalid JSON document.\n\n Scalar values or empty arrays or objects have a depth of 1.\n Arrays with only scalar values and objects with only scalar values for all keys have depth of 1.\n* In all other cases, the depth can be 2 or greater.\n\nThere is no maximum depth level — it''s unlimited.\n\nFor more information, see this blog post.\n\nThe maximum depth is 32.\n\nExamples\n--------\n\nSELECT JSON_DEPTH(''[]''), JSON_DEPTH(''true''), JSON_DEPTH(''{}'');\n+------------------+--------------------+------------------+\n| JSON_DEPTH(''[]'') | JSON_DEPTH(''true'') | JSON_DEPTH(''{}'') |\n+------------------+--------------------+------------------+\n|                1 |                  1 |                1 |\n+------------------+--------------------+------------------+\n\nSELECT JSON_DEPTH(''[1, 2, 3]''), JSON_DEPTH(''[[], {}, []]'');\n+-------------------------+----------------------------+\n| JSON_DEPTH(''[1, 2, 3]'') | JSON_DEPTH(''[[], {}, []]'') |\n+-------------------------+----------------------------+\n|                       2 |                          2 |\n+-------------------------+----------------------------+\n\nSELECT JSON_DEPTH(''[1, 2, [3, 4, 5, 6], 7]'');\n+---------------------------------------+\n| JSON_DEPTH(''[1, 2, [3, 4, 5, 6], 7]'') |\n+---------------------------------------+\n|                                     3 |\n+---------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_depth', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_depth');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (364, 35, 'JSON\\_DETAILED', 'Syntax\n------\n\nJSON_DETAILED(json_doc[, tab_size])\nJSON_PRETTY(json_doc[, tab_size])\n\nDescription\n-----------\n\nRepresents JSON in the most understandable way emphasizing nested structures.\n\nJSON_PRETTY is an alias for JSON_DETAILED .\n\nJSON_PRETTY is not available as an alias for JSON_DETAILED .\n\nExamples\n--------\n\nSET @j = ''{ "A":1,"B":[2,3]}'';\n\nSELECT @j;\n+--------------------+\n| @j                 |\n+--------------------+\n| { "A":1,"B":[2,3]} |\n+--------------------+\n\nSELECT JSON_DETAILED(@j);\n+------------------------------------------------------------+\n| JSON_DETAILED(@j)                                          |\n+------------------------------------------------------------+\n| {\n    "A": 1,\n    "B": \n    [\n        2,\n        3\n    ]\n} |\n+------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_detailed', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_detailed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (365, 35, 'JSON\\_EQUALS', 'Syntax\n------\n\nJSON_EQUALS(json1, json2)\n\nDescription\n-----------\n\nChecks if there is equality between two json objects. Returns 1 if it there is, 0 if not, or NULL if any of the arguments are null.\n\nExamples\n--------\n\nSELECT JSON_EQUALS(''{"a"   :[1, 2, 3],"b":[4]}'', ''{"b":[4],"a":[1, 2, 3.0]}'');\n+------------------------------------------------------------------------+\n| JSON_EQUALS(''{"a"   :[1, 2, 3],"b":[4]}'', ''{"b":[4],"a":[1, 2, 3.0]}'') |\n+------------------------------------------------------------------------+\n|                                                                      1 |\n+------------------------------------------------------------------------+\n\nSELECT JSON_EQUALS(''{"a":[1, 2, 3]}'', ''{"a":[1, 2, 3.01]}'');\n+------------------------------------------------------+\n| JSON_EQUALS(''{"a":[1, 2, 3]}'', ''{"a":[1, 2, 3.01]}'') |\n+------------------------------------------------------+\n|                                                    0 |\n+------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_equals', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_equals');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (366, 35, 'JSON\\_EXISTS', 'Syntax\n------\n\nJSON_EXISTS(json_doc, json_path)\n\nDescription\n-----------\n\nDetermines whether json_doc has an element pointed to by path json_path. Returns 1 if the element exists, 0 if not, or NULL if any of the inputs were NULL.\n\nExamples\n--------\n\nSELECT JSON_EXISTS(''{"key1":"xxxx", "key2":[1, 2, 3]}'', "$.key2");\n+------------------------------------------------------------+\n| JSON_EXISTS(''{"key1":"xxxx", "key2":[1, 2, 3]}'', "$.key2") |\n+------------------------------------------------------------+\n|                                                          1 |\n+------------------------------------------------------------+\n\nSELECT JSON_EXISTS(''{"key1":"xxxx", "key2":[1, 2, 3]}'', "$.key3");\n+------------------------------------------------------------+\n| JSON_EXISTS(''{"key1":"xxxx", "key2":[1, 2, 3]}'', "$.key3") |\n+------------------------------------------------------------+\n|                                                          0 |\n+------------------------------------------------------------+\n\nSELECT JSON_EXISTS(''{"key1":"xxxx", "key2":[1, 2, 3]}'', "$.key2[1]");\n+---------------------------------------------------------------+\n| JSON_EXISTS(''{"key1":"xxxx", "key2":[1, 2, 3]}'', "$.key2[1]") |\n+---------------------------------------------------------------+\n|                                                             1 |\n+---------------------------------------------------------------+\n\nSELECT JSON_EXISTS(''{"key1":"xxxx", "key2":[1, 2, 3]}'', "$.key2[10]");\n+----------------------------------------------------------------+\n| JSON_EXISTS(''{"key1":"xxxx", "key2":[1, 2, 3]}'', "$.key2[10]") |\n+----------------------------------------------------------------+\n|                                                              0 |\n+----------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_exists', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_exists');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (367, 35, 'JSON\\_EXTRACT', 'Syntax\n------\n\nJSON_EXTRACT(json_doc, path[, path] ...)\n\nDescription\n-----------\n\nExtracts data from a JSON document. The extracted data is selected from the parts matching the path arguments. Returns all matched values; either as a single matched value, or, if the arguments could return multiple values, a result autowrapped as an array in the matching order.\n\nReturns NULL if no paths match or if any of the arguments are NULL.\n\nAn error occurs if any path argument is not a valid path, or if the json_doc argument is not a valid JSON document.\n\nThe path expression be a JSONPath expression as supported by MariaDB\n\nExamples\n--------\n\nSET @json = ''[1, 2, [3, 4]]'';\n\nSELECT JSON_EXTRACT(@json, ''$[1]'');\n+-----------------------------+\n| JSON_EXTRACT(@json, ''$[1]'') |\n+-----------------------------+\n| 2                           |\n+-----------------------------+\n\nSELECT JSON_EXTRACT(@json, ''$[2]'');\n+-----------------------------+\n| JSON_EXTRACT(@json, ''$[2]'') |\n+-----------------------------+\n| [3, 4]                      |\n+-----------------------------+\n\nSELECT JSON_EXTRACT(@json, ''$[2][1]'');\n+--------------------------------+\n| JSON_EXTRACT(@json, ''$[2][1]'') |\n+--------------------------------+\n| 4                              |\n+--------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_extract', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_extract');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (368, 35, 'JSON\\_INSERT', 'Syntax\n------\n\nJSON_INSERT(json_doc, path, val[, path, val] ...)\n\nDescription\n-----------\n\nInserts data into a JSON document, returning the resulting document or NULL if either of the _json_doc_ or _path_ arguments are null.\n\nAn error occurs if the JSON document is invalid, or if any of the paths are invalid or contain a  or * wildcard.\n\nJSON_INSERT can only insert data, while JSON_REPLACE can only update. JSON_SET can update or insert data.\n\nExamples\n--------\n\nSET @json = ''{ "A": 0, "B": [1, 2]}'';\n\nSELECT JSON_INSERT(@json, ''$.C'', ''[3, 4]'');\n+--------------------------------------+\n| JSON_INSERT(@json, ''$.C'', ''[3, 4]'')  |\n+--------------------------------------+\n| { "A": 0, "B": [1, 2], "C":"[3, 4]"} |\n+--------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_insert', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_insert');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (369, 35, 'JSON\\_KEY\\_VALUE', 'Syntax\n------\n\nJSON_KEY_VALUE(obj, json_path)\n\nDescription\n-----------\n\nJSON_KEY_VALUE extracts key/value pairs from a JSON object. The JSON path parameter is used to only return key/value pairs for matching JSON objects.\n\nExamples\n--------\n\nSELECT JSON_KEY_VALUE(''[[1, {"key1":"val1", "key2":"val2"}, 3], 2, 3]'', ''$[0][1]'');\n+-----------------------------------------------------------------------------+\n| JSON_KEY_VALUE(''[[1, {"key1":"val1", "key2":"val2"}, 3], 2, 3]'', ''$[0][1]'') |\n+-----------------------------------------------------------------------------+\n| [{"key": "key1", "value": "val1"}, {"key": "key2", "value": "val2"}]        |\n+-----------------------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_key_value', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_key_value');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (370, 35, 'JSON\\_KEYS', 'Syntax\n------\n\nJSON_KEYS(json_doc[, path])\n\nDescription\n-----------\n\nReturns the keys as a JSON array from the top-level value of a JSON object or, if the optional path argument is provided, the top-level keys from the path.\n\nExcludes keys from nested sub-objects in the top level value. The resulting array will be empty if the selected object is empty.\n\nReturns NULL if any of the arguments are null, a given path does not locate an object, or if the json_doc argument is not an object.\n\nAn error will occur if JSON document is invalid, the path is invalid or if the path contains a  or * wildcard.\n\nExamples\n--------\n\nSELECT JSON_KEYS(''{"A": 1, "B": {"C": 2}}'');\n+--------------------------------------+\n| JSON_KEYS(''{"A": 1, "B": {"C": 2}}'') |\n+--------------------------------------+\n| ["A", "B"]                           |\n+--------------------------------------+\n\nSELECT JSON_KEYS(''{"A": 1, "B": 2, "C": {"D": 3}}'', ''$.C'');\n+-----------------------------------------------------+\n| JSON_KEYS(''{"A": 1, "B": 2, "C": {"D": 3}}'', ''$.C'') |\n+-----------------------------------------------------+\n| ["D"]                                               |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_keys', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_keys');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (371, 35, 'JSON\\_LENGTH', 'Syntax\n------\n\nJSON_LENGTH(json_doc[, path])\n\nDescription\n-----------\n\nReturns the length of a JSON document, or, if the optional path argument is given, the length of the value within the document specified by the path.\n\nReturns NULL if any of the arguments argument are null or the path argument does not identify a value in the document.\n\nAn error occurs if the JSON document is invalid, the path is invalid or if the path contains a  or  wildcard.\n\nLength will be determined as follow:\n\n A scalar''s length is always 1.\n If an array, the number of elements in the array.\n If an object, the number of members in the object.\n\nThe length of nested arrays or objects are not counted.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_length', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_length');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (372, 35, 'JSON\\_LOOSE', 'Syntax\n------\n\nJSON_LOOSE(json_doc)\n\nDescription\n-----------\n\nAdds spaces to a JSON document to make it look more readable.\n\nExamples\n--------\n\nSET @j = ''{ "A":1,"B":[2,3]}'';\n\nSELECT JSON_LOOSE(@j), @j;\n+-----------------------+--------------------+\n| JSON_LOOSE(@j)        | @j                 |\n+-----------------------+--------------------+\n| {"A": 1, "B": [2, 3]} | { "A":1,"B":[2,3]} |\n+-----------------------+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_loose', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_loose');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (373, 35, 'JSON\\_MERGE', 'Syntax\n------\n\nJSON_MERGE(json_doc, json_doc[, json_doc] ...)\n\nDescription\n-----------\n\nMerges the given JSON documents.\n\nReturns the merged result, or NULL if any argument is NULL.\n\nAn error occurs if any of the arguments are not valid JSON documents.\n\nJSON_MERGE is deprecated. JSON_MERGE_PATCH is an RFC 7396-compliant replacement, and JSON_MERGE_PRESERVE is a synonym.\n\nExamples\n--------\n\nSET @json1 = ''[1, 2]'';\nSET @json2 = ''[3, 4]'';\n\nSELECT JSON_MERGE(@json1,@json2);\n+---------------------------+\n| JSON_MERGE(@json1,@json2) |\n+---------------------------+\n| [1, 2, 3, 4]              |\n+---------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_merge', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_merge');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (374, 35, 'JSON\\_MERGE\\_PATCH', 'Syntax\n------\n\nJSON_MERGE_PATCH(json_doc, json_doc[, json_doc] ...)\n\nDescription\n-----------\n\nMerges the given JSON documents, returning the merged result, or NULL if any argument is NULL.\n\nJSON_MERGE_PATCH is an RFC 7396-compliant replacement for JSON_MERGE, which is deprecated.\n\nUnlike JSON_MERGE_PRESERVE, members with duplicate keys are not preserved.\n\nExamples\n--------\n\nSET @json1 = ''[1, 2]'';\nSET @json2 = ''[2, 3]'';\nSELECT JSON_MERGE_PATCH(@json1,@json2),JSON_MERGE_PRESERVE(@json1,@json2);\n+---------------------------------+------------------------------------+\n| JSON_MERGE_PATCH(@json1,@json2) | JSON_MERGE_PRESERVE(@json1,@json2) |\n+---------------------------------+------------------------------------+\n| [2, 3]                          | [1, 2, 2, 3]                       |\n+---------------------------------+------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_merge_patch', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_merge_patch');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (375, 35, 'JSON\\_MERGE\\_PRESERVE', 'Syntax\n------\n\nJSON_MERGE_PRESERVE(json_doc, json_doc[, json_doc] ...)\n\nDescription\n-----------\n\nMerges the given JSON documents, returning the merged result, or NULL if any argument is NULL.\n\nJSON_MERGE_PRESERVE is a synonym for JSON_MERGE, which has been deprecated.\n\nUnlike JSON_MERGE_PATCH, members with duplicate keys are preserved.\n\nExamples\n--------\n\nSET @json1 = ''[1, 2]'';\nSET @json2 = ''[2, 3]'';\nSELECT JSON_MERGE_PATCH(@json1,@json2),JSON_MERGE_PRESERVE(@json1,@json2);\n+---------------------------------+------------------------------------+\n| JSON_MERGE_PATCH(@json1,@json2) | JSON_MERGE_PRESERVE(@json1,@json2) |\n+---------------------------------+------------------------------------+\n| [2, 3]                          | [1, 2, 2, 3]                       |\n+---------------------------------+------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_merge_preserve', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_merge_preserve');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (376, 35, 'JSON\\_NORMALIZE', 'Syntax\n------\n\nJSON_NORMALIZE(json)\n\nDescription\n-----------\n\nRecursively sorts keys and removes spaces, allowing comparison of json documents for equality.\n\nExamples\n--------\n\nCREATE TABLE t1 (\n id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n val JSON,\n / other columns here /\n PRIMARY KEY (id)\n);\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_normalize', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_normalize');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (377, 35, 'JSON\\_OBJECT', 'Syntax\n------\n\nJSON_OBJECT([key, value[, key, value] ...])\n\nDescription\n-----------\n\nReturns a JSON object containing the given key/value pairs. The key/value list can be empty.\n\nAn error will occur if there are an odd number of arguments, or any key name is NULL.\n\nExamples\n--------\n\nSELECT JSON_OBJECT("id", 1, "name", "Monty");\n+---------------------------------------+\n| JSON_OBJECT("id", 1, "name", "Monty") |\n+---------------------------------------+\n| {"id": 1, "name": "Monty"}            |\n+---------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_object', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_object');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (378, 35, 'JSON\\_OBJECT\\_FILTER\\_KEYS', 'Syntax\n------\n\nJSON_OBJECT_FILTER_KEYS(obj, array_keys)\n\nDescription\n-----------\n\nJSON_OBJECT_FILTER_KEYS returns a JSON object with keys from the object that are also present in the array as string. It is used when one wants to get key-value pair such that the keys are common but the values may not be common.\n\nExamples\n--------\n\nSET @obj1= ''{ "a": 1, "b": 2, "c": 3}'';\nSET @obj2= ''{"b" : 10, "c": 20, "d": 30}'';\nSELECT JSON_OBJECT_FILTER_KEYS (@obj1, JSON_ARRAY_INTERSECT(JSON_KEYS(@obj1), JSON_KEYS(@obj2)));\n+-------------------------------------------------------------------------------------------+\n| JSON_OBJECT_FILTER_KEYS (@obj1, JSON_ARRAY_INTERSECT(JSON_KEYS(@obj1), JSON_KEYS(@obj2))) |\n+-------------------------------------------------------------------------------------------+\n| {"b": 2, "c": 3}                                                                          |\n+-------------------------------------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_object_filter_keys', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_object_filter_keys');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (379, 35, 'JSON\\_OBJECT\\_TO\\_ARRAY', 'Syntax\n------\n\nJSON_OBJECT_TO_ARRAY(Obj)\n\nDescription\n-----------\n\nIt is used to convert all JSON objects found in a JSON document to JSON arrays where each item in the outer array represents a single key-value pair from the object. It is used when we want not just common keys, but also common values. It can be used in conjunction with JSON_ARRAY_INTERSECT().\n\nExamples\n--------\n\nSET @obj1= ''{ "a": [1, 2, 3], "b": { "key1":"val1", "key2": {"key3":"val3"} }}'';\n\nSELECT JSON_OBJECT_TO_ARRAY(@obj1);\n+-----------------------------------------------------------------------+\n| JSON_OBJECT_TO_ARRAY(@obj1)                                           |\n+-----------------------------------------------------------------------+\n| [["a", [1, 2, 3]], ["b", {"key1": "val1", "key2": {"key3": "val3"}}]] |\n+-----------------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_object_to_array', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_object_to_array');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (380, 35, 'JSON\\_OBJECTAGG', 'Syntax\n------\n\nJSON_OBJECTAGG(key, value)\n\nDescription\n-----------\n\nJSON_OBJECTAGG returns a JSON object containing key-value pairs. It takes two expressions that evaluate to a single value, or two column names, as arguments, the first used as a key, and the second as a value.\n\nThe maximum returned length in bytes is determined by the group_concat_max_len server system variable.\n\nReturns NULL in the case of an error, or if the result contains no rows.\n\nJSON_OBJECTAGG cannot currently be used as a window function.\n\nExamples\n--------\n\nSELECT * FROM t1;\n+------+-------+\n| a    | b     |\n+------+-------+\n|    1 | Hello |\n|    1 | World |\n|    2 | This  |\n+------+-------+\n\nSELECT JSON_OBJECTAGG(a, b) FROM t1;\n+----------------------------------------+\n| JSON_OBJECTAGG(a, b)                   |\n+----------------------------------------+\n| {"1":"Hello", "1":"World", "2":"This"} |\n+----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_objectagg', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_objectagg');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (381, 35, 'JSON\\_OVERLAPS', 'Syntax\n------\n\nJSON_OVERLAPS(json_doc1, json_doc2)\n\nDescription\n-----------\n\nJSON_OVERLAPS() compares two json documents and returns true if they have at least one common\\\nkey-value pair between two objects, array element common between two arrays, or array element common with scalar if one of the arguments is a scalar and other is an array. If two json documents are scalars, it returns true if they have same type and value.\n\nIf none of the above conditions are satisfied then it returns false.\n\nExamples\n--------\n\nSELECT JSON_OVERLAPS(''false'', ''false'');\n+---------------------------------+\n| JSON_OVERLAPS(''false'', ''false'') |\n+---------------------------------+\n| 1                               |\n+---------------------------------+\n\nSELECT JSON_OVERLAPS(''true'', ''["abc", 1, 2, true, false]'');\n+----------------------------------------------------+\n| JSON_OVERLAPS(''true'',''["abc", 1, 2, true, false]'') |\n+----------------------------------------------------+\n| 1                                                  |\n+----------------------------------------------------+\n\nSELECT JSON_OVERLAPS(''{"A": 1, "B": {"C":2}}'', ''{"A": 2, "B": {"C":2}}'') AS is_overlap;\n+---------------------+\n| is_overlap          |\n+---------------------+\n| 1                   |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_overlaps', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_overlaps');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (382, 35, 'JSON\\_PRETTY', 'Description\n-----------\n\nJSON_PRETTY is available from MariaDB 10.10.3, 10.9.5, 10.8.7, 10.7.8, 10.6.12, 10.5.19, and 10.4.28.\n\nJSON_PRETTY is an alias for JSON_DETAILED.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_pretty', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_pretty');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (383, 35, 'JSON\\_QUERY', 'Syntax\n------\n\nJSON_QUERY(json_doc, path)\n\nDescription\n-----------\n\nGiven a JSON document, returns an object or array specified by the path. Returns NULL if not given a valid JSON document, or if there is no match.\n\nExamples\n--------\n\nSELECT json_query(''{"key1":{"a":1, "b":[1,2]}}'', ''$.key1'');\n+-----------------------------------------------------+\n| json_query(''{"key1":{"a":1, "b":[1,2]}}'', ''$.key1'') |\n+-----------------------------------------------------+\n| {"a":1, "b":[1,2]}                                  |\n+-----------------------------------------------------+\n\nSELECT json_query(''{"key1":123, "key1": [1,2,3]}'', ''$.key1'');\n+-------------------------------------------------------+\n| json_query(''{"key1":123, "key1": [1,2,3]}'', ''$.key1'') |\n+-------------------------------------------------------+\n| [1,2,3]                                               |\n+-------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_query', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_query');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (384, 35, 'JSON\\_QUOTE', 'Syntax\n------\n\nJSON_QUOTE(json_value)\n\nDescription\n-----------\n\nQuotes a string as a JSON value, usually for producing valid JSON string literals for inclusion in JSON documents. Wraps the string with double quote characters and escapes interior quotes and other special characters, returning a utf8mb4 string.\n\nReturns NULL if the argument is NULL.\n\nExamples\n--------\n\nSELECT JSON_QUOTE(''A''), JSON_QUOTE("B"), JSON_QUOTE(''"C"'');\n+-----------------+-----------------+-------------------+\n| JSON_QUOTE(''A'') | JSON_QUOTE("B") | JSON_QUOTE(''"C"'') |\n+-----------------+-----------------+-------------------+\n| "A"             | "B"             | "\\"C\\""           |\n+-----------------+-----------------+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_quote', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_quote');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (385, 35, 'JSON\\_REMOVE', 'Syntax\n------\n\nJSON_REMOVE(json_doc, path[, path] ...)\n\nDescription\n-----------\n\nRemoves data from a JSON document returning the result, or NULL if any of the arguments are null. If the element does not exist in the document, no changes are made.\n\nThe function returns NULL and throws a warning if the JSON document is invalid, the path is invalid, contains a range, or contains a  or * wildcard.\n\nPath arguments are evaluated from left to right, with the result from the earlier evaluation being used as the value for the next.\n\nExamples\n--------\n\nSELECT JSON_REMOVE(''{"A": 1, "B": 2, "C": {"D": 3}}'', ''$.C'');\n+-------------------------------------------------------+\n| JSON_REMOVE(''{"A": 1, "B": 2, "C": {"D": 3}}'', ''$.C'') |\n+-------------------------------------------------------+\n| {"A": 1, "B": 2}                                      |\n+-------------------------------------------------------+\n\nSELECT JSON_REMOVE(''["A", "B", ["C", "D"], "E"]'', ''$[1]'');\n+----------------------------------------------------+\n| JSON_REMOVE(''["A", "B", ["C", "D"], "E"]'', ''$[1]'') |\n+----------------------------------------------------+\n| ["A", ["C", "D"], "E"]                             |\n+----------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_remove', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_remove');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (386, 35, 'JSON\\_REPLACE', 'Syntax\n------\n\nJSON_REPLACE(json_doc, path, val[, path, val] ...)\n\nDescription\n-----------\n\nReplaces existing values in a JSON document, returning the result, or NULL if any of the arguments are NULL.\n\nAn error will occur if the JSON document is invalid, the path is invalid or if the path contains a  or * wildcard.\n\nPaths and values are evaluated from left to right, with the result from the earlier evaluation being used as the value for the next.\n\nJSON_REPLACE can only update data, while JSON_INSERT can only insert. JSON_SET can update or insert data.\n\nExamples\n--------\n\nSELECT JSON_REPLACE(''{ "A": 1, "B": [2, 3]}'', ''$.B[1]'', 4);\n+-----------------------------------------------------+\n| JSON_REPLACE(''{ "A": 1, "B": [2, 3]}'', ''$.B[1]'', 4) |\n+-----------------------------------------------------+\n| { "A": 1, "B": [2, 4]}                              |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_replace', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_replace');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (387, 35, 'JSON\\_SCHEMA\\_VALID', 'Syntax\n------\n\nJSON_SCHEMA_VALID(schema, json);\n\nDescription\n-----------\n\nJSON_SCHEMA_VALID allows MariaDB to support JSON schema validation. If a given json is valid against a schema it returns true. When JSON does not validate against the schema, it does not return a message about which keyword it failed against and only returns false.\n\nThe function supports JSON Schema Draft 2020 with a few exceptions:\n\n External resources are not supported.\n Hyper schema keywords are not supported.\n Formats like date, email etc are treated as annotations.\n\nExamples\n--------\n\nCREATE TABLE obj_table(val_obj JSON CHECK(JSON_SCHEMA_VALID(''{\n  "type":"object",\n    "properties": {\n      "number1":{\n        "type":"number",\n        "maximum":5,\n        "const":4\n      },\n      "string1":{\n        "type":"string",\n        "maxLength":5,\n        "minLength":3\n      },\n    "object1":{\n      "type":"object",\n       "properties":{\n         "key1": {"type":"string"},\n         "key2":{"type":"array"},\n         "key3":{"type":"number", "minimum":3}\n       },\n       "dependentRequired": { "key1":["key3"] }\n     }\n  },\n  "required":["number1","object1"]\n  }'', val_obj)));\n\nINSERT INTO obj_table VALUES(\n  ''{"number1":4, "string1":"abcd", \n  "object1":{"key1":"val1", "key2":[1,2,3, "string1"], "key3":4}}''\n);\n\nINSERT INTO obj_table VALUES(\n  ''{"number1":3, "string1":"abcd", \n  "object1":{"key1":"val1", "key2":[1,2,3, "string1"], "key3":4}}''\n);\nERROR 4025 (23000): CONSTRAINT obj_table.val_obj failed for test.obj_table\n\nSELECT  FROM obj_table;\n+--------------------------------------------------------------------------------------------------+\n| val_obj                                                                                          |\n+--------------------------------------------------------------------------------------------------+\n| {"number1":4, "string1":"abcd", "object1":{"key1":"val1", "key2":[1,2,3, "string1"], "key3":4}} |\n+--------------------------------------------------------------------------------------------------+\n\nSET @schema= ''{\n  "properties" : {\n    "number1":{ "maximum":10 },\n    "string1" : { "maxLength": 3} \n  }\n}'';\n\nSELECT JSON_SCHEMA_VALID(@schema, ''{ "number1":25, "string1":"ab" }'');\n+----------------------------------------------------------------+\n| JSON_SCHEMA_VALID(@schema, ''{ "number1":25, "string1":"ab" }'') |\n+----------------------------------------------------------------+\n|                                                              0 |\n+----------------------------------------------------------------+\n\nSELECT JSON_SCHEMA_VALID(@schema, ''{ "number1":10, "string1":"ab" }'');\n+----------------------------------------------------------------+\n| JSON_SCHEMA_VALID(@schema, ''{ "number1":10, "string1":"ab" }'') |\n+----------------------------------------------------------------+\n|                                                              1 |\n+----------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_schema_valid', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_schema_valid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (388, 35, 'JSON\\_SEARCH', 'Syntax\n------\n\nJSON_SEARCH(json_doc, return_arg, search_str[, escape_char[, path] ...])\n\nDescription\n-----------\n\nReturns the path to the given string within a JSON document, or NULL if any of _json_doc_, _search_str_ or a path argument is NULL; if the search string is not found, or if no path exists within the document.\n\nA warning will occur if the JSON document is not valid, any of the path arguments are not valid, if _return_arg_ is neither _one_ nor _all_, or if the escape character is not a constant. NULL will be returned.\n\n_return_arg_ can be one of two values:\n\n ''one: Terminates after finding the first match, so will return one path string. If there is more than one match, it is undefined which is considered first.\n all: Returns all matching path strings, without duplicates. Multiple strings are autowrapped as an array. The order is undefined.\n\nExamples\n--------\n\nSET @json = ''["A", [{"B": "1"}], {"C":"AB"}, {"D":"BC"}]'';\n\nSELECT JSON_SEARCH(@json, ''one'', ''AB'');\n+---------------------------------+\n| JSON_SEARCH(@json, ''one'', ''AB'') |\n+---------------------------------+\n| "$[2].C"                        |\n+---------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_search', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_search');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (389, 35, 'JSON\\_SET', 'Syntax\n------\n\nJSON_SET(json_doc, path, val[, path, val] ...)\n\nDescription\n-----------\n\nUpdates or inserts data into a JSON document, returning the result, or NULL if any of the arguments are NULL or the optional path fails to find an object.\n\nAn error will occur if the JSON document is invalid, the path is invalid or if the path contains a  or a wildcard\\\\.\\\\*\n\nJSON_SET can update or insert data, while JSON_REPLACE can only update, and JSON_INSERT only insert.\n\nExamples\n--------\n\nSELECT JSON_SET(Priv, ''$.locked'', ''true'') FROM mysql.global_priv\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_set', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_set');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (390, 35, 'JSON\\_TABLE', 'Syntax\n------\n\nJSON_TABLE(json_doc, \n          context_path COLUMNS (column_list)\n) [AS] alias\n\nDescription\n-----------\n\nJSON_TABLE can be used in contexts where a table reference can be used; in the FROM clause of a SELECT statement, and in multi-table UPDATE/DELETE statements.\n\njson_doc is the JSON document to extract data from. In the simplest case, it is a string literal containing JSON. In more complex cases it can be an arbitrary expression returning JSON. The expression may have references to columns of other tables. However, one can only refer to tables that precede this JSON_TABLE invocation. For RIGHT JOIN, it is assumed that its outer side precedes the inner. All tables in outer selects are also considered preceding.\n\ncontext_path is a JSON Path expression pointing to a collection of nodes in json_doc that will be used as the source of rows.\n\nThe COLUMNS clause declares the names and types of the columns that JSON_TABLE returns, as well as how the values of the columns are produced.\n\nColumn Definitions\n\nThe following types of columns are supported:\n\nPath Columns\n\n``sql\nname type PATH path_str [on_empty] [on_error]\n`\n\nLocates the JSON node pointed to by path_str and returns its value. The path_str is evaluated using the current row source node as the context node.\n\n`sql\nSET @json=''\n[\n  {"name":"Laptop", "color":"black", "price":"1000"},\n  {"name":"Jeans",  "color":"blue"}\n]'';\n\nSELECT  FROM json_table(@json, ''$[]'' \n  COLUMNS(\n   name  VARCHAR(10) path ''$.name'', \n   color VARCHAR(10) path ''$.color'',\n   price DECIMAL(8,2) path ''$.price'' ) \n) AS jt;\n+--------+-------+---------+\n| name   | color | price   |\n+--------+-------+---------+\n| Laptop | black | 1000.00 |\n| Jeans  | blue  |    NULL |\n+--------+-------+---------+\n`\n\nThe on_empty and on_error clauses specify the actions to be performed when the value was not found or there was an error condition. See the ON EMPTY and ON ERROR clauses section for details.\n\nORDINALITY Columns\n\n`sql\nname FOR ORDINALITY\n`\n\nCounts the rows, starting from 1.\n\nExample:\n\n`sql\nset @json=''\n[\n  {"name":"Laptop", "color":"black"},\n  {"name":"Jeans",  "color":"blue"}\n]'';\n\nselect  from json_table(@json, ''$[]'' \n  columns(\n   id for ordinality, \n   name  varchar(10) path ''$.name'')\n) as jt;\n+------+--------+\n| id   | name   |\n+------+--------+\n|    1 | Laptop |\n|    2 | Jeans  |\n+------+--------+\n`\n\nEXISTS PATH Columns\n\n`sql\nname type EXISTS PATH path_str\n`\n\nChecks whether the node pointed to by value_path exists. The value_path is evaluated using the current row source node as the context node.\n\n`sql\nset @json=''\n[\n  {"name":"Laptop", "color":"black", "price":1000},\n  {"name":"Jeans",  "color":"blue"}\n]'';\n\nselect  from json_table(@json, ''$[]'' \n  columns(\n   name  varchar(10) path ''$.name'',\n   has_price integer exists path ''$.price'')\n) as jt;\n+--------+-----------+\n| name   | has_price |\n+--------+-----------+\n| Laptop |         1 |\n| Jeans  |         0 |\n+--------+-----------+\n`\n\nNESTED PATHs\n\nNESTED PATH converts nested JSON structures into multiple rows.\n\n`sql\nNESTED PATH path COLUMNS (column_list)\n`\n\nIt finds the sequence of JSON nodes pointed to by path and uses it to produce rows. For each found node, a row is generated with column values as specified by the NESTED PATH''s COLUMNS clause. If path finds no nodes, only one row is generated with all columns having NULL values.\n\nFor example, consider a JSON document that contains an array of items, and each item, in turn, is expected to have an array of its available sizes:\n\n`json\nSET @json=''\n[\n  {"name":"Jeans",  "sizes": [32, 34, 36]},\n  {"name":"T-Shirt", "sizes":["Medium", "Large"]},\n  {"name":"Cellphone"}\n]'';\n`\n\nNESTED PATH allows one to produce a separate row for each size each item has:\n\n`sql\nselect  from json_table(@json, ''$[]'' \n  columns(\n    name  varchar(10) path ''$.name'', \n    nested path ''$.sizes[]'' columns (\n      size varchar(32) path ''$''\n    )\n  )\n) as jt;\n+-----------+--------+\n| name      | size   |\n+-----------+--------+\n| Jeans     | 32     |\n| Jeans     | 34     |\n| Jeans     | 36     |\n| T-Shirt   | Medium |\n| T-Shirt   | Large  |\n| Cellphone | NULL   |\n+-----------+--------+\n`\n\nNESTED PATH clauses can be nested within one another. They can also be located next to each other. In that case, the nested path clauses will produce records one at a time. The ones that are not producing records will have all columns set to NULL.\n\nExample:\n\n`sql\nset @json=''\n[\n  {"name":"Jeans",  "sizes": [32, 34, 36], "colors":["black", "blue"]}\n]'';\n\nselect  from json_table(@json, ''$[]'' \n  columns(\n    name  varchar(10) path ''$.name'', \n    nested path ''$.sizes[]'' columns (\n      size varchar(32) path ''$''\n    ),\n    nested path ''$.colors[]'' columns (\n      color varchar(32) path ''$''\n    )\n  )\n) as jt;\n\n+-------+------+-------+\n| name  | size | color |\n+-------+------+-------+\n| Jeans | 32   | NULL  |\n| Jeans | 34   | NULL  |\n| Jeans | 36   | NULL  |\n| Jeans | NULL | black |\n| Jeans | NULL | blue  |\n+-------+------+-------+\n`\n\nON EMPTY and ON ERROR Clauses\n\nThe ON EMPTY clause specifies what will be done when the element specified by the search path is missing in the JSON document.\n\n`sql\non_empty:\n    {NULL | DEFAULT string | ERROR} ON EMPTY\n`\n\nWhen ON EMPTY clause is not present, NULL ON EMPTY is implied.\n\n`sql\non_error:\n    {NULL | DEFAULT string | ERROR} ON ERROR\n`\n\nThe ON ERROR clause specifies what should be done if a JSON structure error occurs when trying to extract the value pointed to by the path expression. A JSON structure error here occurs only when one attempts to convert a JSON non-scalar (array or object) into a scalar value. When the ON ERROR clause is not present, NULL ON ERROR is implied.\n\nNote: A datatype conversion error (e.g. attempt to store a non-integer value into an integer field, or a varchar column being truncated) is not considered a JSON error and so will not trigger the ON ERROR behavior. It will produce warnings, in the same way as CAST(value AS datatype) would.\n\nReplication\n\nIn the current code, evaluation of JSON_TABLE is deterministic, that is, for a given input string JSON_TABLE will always produce the same set of rows in the same order. However, one can think of JSON documents that one can consider identical which will produce different output. In order to be future-proof and withstand changes like\n\n sorting JSON object members by name (like MySQL does);\n changing the way duplicate object members are handled the function is marked as unsafe for statement-based replication.\n\nExtracting a Subdocument into a Column\n\n`sql\nSELECT  FROM JSON_TABLE(''{"foo": [1,2,3,4]}'',''$'' columns( jscol json path ''$.foo'') ) AS T;\n+-----------+\n| jscol     |\n+-----------+\n| [1,2,3,4] |\n+-----------+\n`\n\nJSON_TABLE does not allow to extract a JSON "subdocument" into a JSON column.\n\n`sql\nSELECT * FROM JSON_TABLE(''{"foo": [1,2,3,4]}'',''$'' columns( jscol json path ''$.foo'') ) AS T;\n+-------+\n| jscol |\n+-------+\n| NULL  |\n+-------+\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_table', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_table');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (391, 35, 'JSON\\_TYPE', 'Syntax\n------\n\nJSON_TYPE(json_val)\n\nDescription\n-----------\n\nReturns the type of a JSON value (as a string), or NULL if the argument is null.\n\nAn error will occur if the argument is an invalid JSON value.\n\nThe following is a complete list of the possible return types:\n\n| Return type | Value                                                                                         | Example                   |\n| ----------- | --------------------------------------------------------------------------------------------- | ------------------------- |\n| ARRAY       | JSON array                                                                                    | \\[1, 2, {"key": "value"}] |\n| OBJECT      | JSON object                                                                                   | {"key":"value"}           |\n| BOOLEAN     | JSON true/false literals                                                                      | true, false               |\n| DOUBLE      | A number with at least one floating point decimal.                                            | 1.2                       |\n| INTEGER     | A number without a floating point decimal.                                                    | 1                         |\n| NULL        | JSON null literal (this is returned as a string, not to be confused with the SQL NULL value!) | null                      |\n| STRING      | JSON String                                                                                   | "a sample string"         |\n\nExamples\n--------\n\nSELECT JSON_TYPE(''{"A": 1, "B": 2, "C": 3}'');\n+---------------------------------------+\n| JSON_TYPE(''{"A": 1, "B": 2, "C": 3}'') |\n+---------------------------------------+\n| OBJECT                                |\n+---------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_type', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_type');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (392, 35, 'JSON\\_UNQUOTE', 'Syntax\n------\n\nJSON_UNQUOTE(val)\n\nDescription\n-----------\n\nUnquotes a JSON value, returning a string, or NULL if the argument is null.\n\nAn error will occur if the given value begins and ends with double quotes and is an invalid JSON string literal.\n\nIf the given value is not a JSON string, value is passed through unmodified.\n\nCertain character sequences have special meanings within a string. Usually, a backslash is ignored, but the escape sequences in the table below are recognised by MariaDB, unless the SQL Mode is set to NO_BACKSLASH_ESCAPES .\n\n| Escape sequence | Character                          |\n| --------------- | ---------------------------------- |\n| "               | Double quote (")                   |\n| \\b              | Backslash                          |\n| \\f              | Formfeed                           |\n| \\n              | Newline (linefeed)                 |\n| \\r              | Carriage return                    |\n| \\t              | Tab                                |\n| \\\\              | Backslash ()                       |\n| \\uXXXX          | UTF-8 bytes for Unicode value XXXX |\n\nExamples\n--------\n\nSELECT JSON_UNQUOTE(''"Monty"'');\n+-------------------------+\n| JSON_UNQUOTE(''"Monty"'') |\n+-------------------------+\n| Monty                   |\n+-------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_unquote', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_unquote');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (393, 35, 'JSON\\_VALID', 'Syntax\n------\n\nJSON_VALID(value)\n\nDescription\n-----------\n\nIndicates whether the given value is a valid JSON document or not. Returns 1 if valid, 0 if not, and NULL if the argument is NULL.\n\nThe JSON_VALID function is automatically used as a CHECK constraint for the JSON data type alias in order to ensure that a valid json document is inserted.\n\nThe JSON_VALID function is not automatically used as a CHECK constraint for the JSON data type alias.\n\nExamples\n--------\n\nSELECT JSON_VALID(''{"id": 1, "name": "Monty"}'');\n+------------------------------------------+\n| JSON_VALID(''{"id": 1, "name": "Monty"}'') |\n+------------------------------------------+\n|                                        1 |\n+------------------------------------------+\n\nSELECT JSON_VALID(''{"id": 1, "name": "Monty", "oddfield"}'');\n+------------------------------------------------------+\n| JSON_VALID(''{"id": 1, "name": "Monty", "oddfield"}'') |\n+------------------------------------------------------+\n|                                                    0 |\n+------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_valid', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_valid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (394, 35, 'JSON\\_VALUE', 'Syntax\n------\n\nJSON_VALUE(json_doc, path)\n\nDescription\n-----------\n\nGiven a JSON document, returns the scalar specified by the path. Returns NULL if not given a valid JSON document, or if there is no match.\n\nExamples\n--------\n\nSELECT json_value(''{"key1":123}'', ''$.key1'');\n+--------------------------------------+\n| json_value(''{"key1":123}'', ''$.key1'') |\n+--------------------------------------+\n| 123                                  |\n+--------------------------------------+\n\nSELECT json_value(''{"key1": [1,2,3], "key1":123}'', ''$.key1'');\n+-------------------------------------------------------+\n| json_value(''{"key1": [1,2,3], "key1":123}'', ''$.key1'') |\n+-------------------------------------------------------+\n| 123                                                   |\n+-------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_value', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_value');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (395, 35, 'JSONPath Expressions', 'Description\n-----------\n\nA number of JSON functions accept JSON Path expressions. MariaDB defines this path as follows:\n\nJSON Path Syntax\n\n``sql\npath : [''lax''] ''$'' [step]\n`\n\nThe path starts with an optional _path mode_. At the moment, MariaDB supports only the "lax" mode, which is also the mode that is used when it is not explicitly specified.\n\nThe $ symbol represents the context item. The search always starts from the context item; because of that, the path always starts with $.\n\nThen, it is followed by zero or more steps, which select element(s) in the JSON document. A step may be one of the following:\n\n Object member selector.\n Array element selector.\n Wildcard selector.\n\nObject Member Selector\n\nTo select member(s) in a JSON object, one can use one of the following:\n\n .memberName selects the value of the member with name memberName.\n ."memberName" - the same as above but allows one to select a member with a name that''s not a valid identifier (that is, has space, dot, and/or other characters).\n . - selects the values of all members of the object.\n\nIf the current item is an array (instead of an object), nothing will be selected.\n\nArray Element Selector\n\nTo select elements of an array, one can use one of the following:\n\n [N] selects element number N in the array. The elements are counted from zero.\n [] selects all elements in the array.\n\nIf the current item is an object (instead of an array), nothing will be selected.\n\nJSON path supports negative indexes in an array, ''last'' keyword and range notation (''to'' keyword) for accessing array elements. Negative indexes start from -1.\n\n [-N] selects n th element from end.\n [last-N] selects n th element from the last element.\n [M to N] selects range of elements starting from index M to N.\n\nExample:\n\n`sql\nSET @json=''{\n            "A": [0,\n                  [1, 2, 3],\n                  [4, 5, 6],\n                  "seven",\n                   0.8,\n                   true,\n                   false,\n                   "eleven",\n                  [12, [13, 14], {"key1":"value1"},[15]],\n                  true],\n            "B": {"C": 1},\n            "D": 2\n           }'';\nSELECT JSON_EXTRACT(@json, ''$.A[-8][1]'');\n+--------------------------------------------------+\n| JSON_EXTRACT(@json, ''$.A[-8][1]'')                |\n+--------------------------------------------------+\n| 5                                                |\n+--------------------------------------------------+\n\nSELECT JSON_EXTRACT(@json, ''$.A[last-7][1]'');\n+-----------------------------------------------+\n| SELECT JSON_EXTRACT(@json, ''$.A[last-7][1]''); |\n+-----------------------------------------------+\n| 5                                             |\n+-----------------------------------------------+\n\nSET @json= ''[\n             [1, {"key1": "value1"}, 3],\n             [false, 5, 6],\n             [7, 8, [9, {"key2": 2}, 11]],\n             [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],\n             [19, 20],\n             21, 22\n            ]'';\n\nSELECT JSON_EXTRACT(@json, ''$[0 to 3][2]'');\n+-----------------------------------------------+\n| JSON_EXTRACT(@json, ''$[0 to 3][2]'')           |\n+-----------------------------------------------+\n| [3, 6, [9, {"key2": 2}, 11], [14]]            |\n+-----------------------------------------------+\n`\n\nJSON path does not support negative indexes in an array.\n\nThis produces output for first index of eighth from last element of a two dimensional array.\n\nNote: In range notation, when M > N ( when M,N are greater than or equal to 0) or (size of array - M or size of array - N when M, N are less than 0), then it is treated as an impossible range and NULL is returned.\n\n`sql\nSET @json= ''[1, 2, 3, 4, 5]'';\nSELECT JSON_EXTRACT(@json, ''$[4 to 2]'');\n+-----------------------------------+\n| JSON_EXTRACT(@json, ''$[4 to 2]'')  |\n+-----------------------------------+\n| NULL                              |\n+-----------------------------------+\n`\n\nWildcard\n\nThe wildcard step, , recursively selects all child elements of the current element. Both array elements and object members are selected.\n\nThe wildcard step must not be the last step in the JSONPath expression. It must be followed by an array or object member selector step.\n\nFor example, this query selects all object members named price in the document:\n\n`sql\nSELECT json_extract(@json_doc, ''$.price'');\n`\n\nThis query, however, selects the second element in each of the arrays present in the document:\n\n`sql\nSELECT json_extract(@json_doc, ''$[2]'');\n`\n\nCompatibility\n\nMariaDB''s JSONPath syntax supports a subset of JSON Path''s definition in the SQL Standard. The most notable things not supported are the strict mode and filters.\n\nMariaDB''s JSONPath is close to MySQL''s JSONPath. The wildcard step (  ) is a non-standard extension that has the same meaning as in MySQL. The difference between MariaDB and MySQL''s JSONPath is: MySQL doesn''t allow one to specify the mode explicitly (but uses lax` mode implicitly).\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/jsonpath-expressions', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/jsonpath-expressions');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (396, 35, 'CUME\\_DIST', 'Syntax\n------\n\nCUME_DIST() OVER ( \n  [ PARTITION BY partition_expression ] \n  [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nCUME_DIST() is a window function that returns the cumulative distribution of a given row. The following formula is used to calculate the value:\n\n``sql\n(number of rows <= current row) / (total rows)\n``\n\nExamples\n--------\n\ncreate table t1 (\n  pk int primary key,\n  a int,\n  b int\n);\n\ninsert into t1 values\n( 1 , 0, 10),\n( 2 , 0, 10),\n( 3 , 1, 10),\n( 4 , 1, 10),\n( 8 , 2, 10),\n( 5 , 2, 20),\n( 6 , 2, 20),\n( 7 , 2, 20),\n( 9 , 4, 20),\n(10 , 4, 20);\n\nselect pk, a, b,\n    rank() over (order by a) as rank,\n    percent_rank() over (order by a) as pct_rank,\n    cume_dist() over (order by a) as cume_dist\nfrom t1;\n+----+------+------+------+--------------+--------------+\n| pk | a    | b    | rank | pct_rank     | cume_dist    |\n+----+------+------+------+--------------+--------------+\n|  1 |    0 |   10 |    1 | 0.0000000000 | 0.2000000000 |\n|  2 |    0 |   10 |    1 | 0.0000000000 | 0.2000000000 |\n|  3 |    1 |   10 |    3 | 0.2222222222 | 0.4000000000 |\n|  4 |    1 |   10 |    3 | 0.2222222222 | 0.4000000000 |\n|  5 |    2 |   20 |    5 | 0.4444444444 | 0.8000000000 |\n|  6 |    2 |   20 |    5 | 0.4444444444 | 0.8000000000 |\n|  7 |    2 |   20 |    5 | 0.4444444444 | 0.8000000000 |\n|  8 |    2 |   10 |    5 | 0.4444444444 | 0.8000000000 |\n|  9 |    4 |   20 |    9 | 0.8888888889 | 1.0000000000 |\n| 10 |    4 |   20 |    9 | 0.8888888889 | 1.0000000000 |\n+----+------+------+------+--------------+--------------+\n\nselect pk, a, b,\n       percent_rank() over (order by pk) as pct_rank,\n       cume_dist() over (order by pk) as cume_dist\nfrom t1 order by pk;\n+----+------+------+--------------+--------------+\n| pk | a    | b    | pct_rank     | cume_dist    |\n+----+------+------+--------------+--------------+\n|  1 |    0 |   10 | 0.0000000000 | 0.1000000000 |\n|  2 |    0 |   10 | 0.1111111111 | 0.2000000000 |\n|  3 |    1 |   10 | 0.2222222222 | 0.3000000000 |\n|  4 |    1 |   10 | 0.3333333333 | 0.4000000000 |\n|  5 |    2 |   20 | 0.4444444444 | 0.5000000000 |\n|  6 |    2 |   20 | 0.5555555556 | 0.6000000000 |\n|  7 |    2 |   20 | 0.6666666667 | 0.7000000000 |\n|  8 |    2 |   10 | 0.7777777778 | 0.8000000000 |\n|  9 |    4 |   20 | 0.8888888889 | 0.9000000000 |\n| 10 |    4 |   20 | 1.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n\nselect pk, a, b,\n        percent_rank() over (partition by a order by a) as pct_rank,\n        cume_dist() over (partition by a order by a) as cume_dist\nfrom t1;\n+----+------+------+--------------+--------------+\n| pk | a    | b    | pct_rank     | cume_dist    |\n+----+------+------+--------------+--------------+\n|  1 |    0 |   10 | 0.0000000000 | 1.0000000000 |\n|  2 |    0 |   10 | 0.0000000000 | 1.0000000000 |\n|  3 |    1 |   10 | 0.0000000000 | 1.0000000000 |\n|  4 |    1 |   10 | 0.0000000000 | 1.0000000000 |\n|  5 |    2 |   20 | 0.0000000000 | 1.0000000000 |\n|  6 |    2 |   20 | 0.0000000000 | 1.0000000000 |\n|  7 |    2 |   20 | 0.0000000000 | 1.0000000000 |\n|  8 |    2 |   10 | 0.0000000000 | 1.0000000000 |\n|  9 |    4 |   20 | 0.0000000000 | 1.0000000000 |\n| 10 |    4 |   20 | 0.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/cume_dist', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/cume_dist');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (397, 35, 'DENSE\\_RANK', 'Syntax\n------\n\nDENSE_RANK() OVER (\n  [ PARTITION BY partition_expression ]\n  [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nDENSE_RANK() is a window function that displays the number of a given row, starting at one and following the ORDER BY sequence of the window function, with identical values receiving the same result. Unlike the RANK() function, there are no skipped values if the preceding results are identical. It is also similar to the ROW_NUMBER() function except that in that function, identical values will receive a different row number for each result.\n\nExamples\n--------\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(10));\n\nINSERT INTO student VALUES \n  (''Maths'', 60, ''Thulile''),\n  (''Maths'', 60, ''Pritha''),\n  (''Maths'', 70, ''Voitto''),\n  (''Maths'', 55, ''Chun''),\n  (''Biology'', 60, ''Bilal''),\n   (''Biology'', 70, ''Roger'');\n\nSELECT \n  RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS rank, \n  DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank, \n  ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num, \n  course, mark, name \nFROM student ORDER BY course, mark DESC;\n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course  | mark | name    |\n+------+------------+---------+---------+------+---------+\n|    1 |          1 |       1 | Biology |   70 | Roger   |\n|    2 |          2 |       2 | Biology |   60 | Bilal   |\n|    1 |          1 |       1 | Maths   |   70 | Voitto  |\n|    2 |          2 |       2 | Maths   |   60 | Thulile |\n|    2 |          2 |       3 | Maths   |   60 | Pritha  |\n|    4 |          3 |       4 | Maths   |   55 | Chun    |\n+------+------------+---------+---------+------+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/dense_rank', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/dense_rank');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (398, 35, 'FIRST\\_VALUE', 'Syntax\n------\n\nFIRST_VALUE(expr) OVER (\n  [ PARTITION BY partition_expression ]\n  [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nFIRST_VALUE returns the first result from an ordered set, or NULL if no such result exists.\n\nExamples\n--------\n\nCREATE TABLE t1 (\n  pk int primary key,\n  a int,\n  b int,\n  c char(10),\n  d decimal(10, 3),\n  e real\n);\n\nINSERT INTO t1 VALUES\n( 1, 0, 1,    ''one'',    0.1,  0.001),\n( 2, 0, 2,    ''two'',    0.2,  0.002),\n( 3, 0, 3,    ''three'',  0.3,  0.003),\n( 4, 1, 2,    ''three'',  0.4,  0.004),\n( 5, 1, 1,    ''two'',    0.5,  0.005),\n( 6, 1, 1,    ''one'',    0.6,  0.006),\n( 7, 2, NULL, ''n_one'',  0.5,  0.007),\n( 8, 2, 1,    ''n_two'',  NULL, 0.008),\n( 9, 2, 2,    NULL,     0.7,  0.009),\n(10, 2, 0,    ''n_four'', 0.8,  0.010),\n(11, 2, 10,   NULL,     0.9,  NULL);\n\nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n           LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n           FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n           LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n\n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 |         1 |       11 |         11 |        11 |\n| 10 |         1 |       10 |         11 |        10 |\n|  9 |         1 |        9 |         11 |         9 |\n|  8 |         1 |        8 |         11 |         8 |\n|  7 |         1 |        7 |         11 |         7 |\n|  6 |         1 |        6 |         11 |         6 |\n|  5 |         1 |        5 |         11 |         5 |\n|  4 |         1 |        4 |         11 |         4 |\n|  3 |         1 |        3 |         11 |         3 |\n|  2 |         1 |        2 |         11 |         2 |\n|  1 |         1 |        1 |         11 |         1 |\n+----+-----------+----------+------------+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/first_value', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/first_value');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (399, 35, 'LAG', 'Syntax\n------\n\nLAG (expr[, offset]) OVER ( \n  [ PARTITION BY partition_expression ] \n  < ORDER BY order_list >\n)\n\nDescription\n-----------\n\nThe LAG function accesses data from a previous row according to the ORDER BY clause without the need for a self-join. The specific row is determined by the _offset_ (default _1_), which specifies the number of rows behind the current row to use. An offset of _0_ is the current row.\n\nExamples\n--------\n\nCREATE TABLE t1 (pk int primary key, a int, b int, c char(10), d decimal(10, 3), e real);\n\nINSERT INTO t1 VALUES\n ( 1, 0, 1,    ''one'',    0.1,  0.001),\n ( 2, 0, 2,    ''two'',    0.2,  0.002),\n ( 3, 0, 3,    ''three'',  0.3,  0.003),\n ( 4, 1, 2,    ''three'',  0.4,  0.004),\n ( 5, 1, 1,    ''two'',    0.5,  0.005),\n ( 6, 1, 1,    ''one'',    0.6,  0.006),\n ( 7, 2, NULL, ''n_one'',  0.5,  0.007),\n ( 8, 2, 1,    ''n_two'',  NULL, 0.008),\n ( 9, 2, 2,    NULL,     0.7,  0.009),\n (10, 2, 0,    ''n_four'', 0.8,  0.010),\n (11, 2, 10,   NULL,     0.9,  NULL);\n\nSELECT pk, LAG(pk) OVER (ORDER BY pk) AS l,\n  LAG(pk,1) OVER (ORDER BY pk) AS l1,\n  LAG(pk,2) OVER (ORDER BY pk) AS l2,\n  LAG(pk,0) OVER (ORDER BY pk) AS l0,\n  LAG(pk,-1) OVER (ORDER BY pk) AS lm1,\n  LAG(pk,-2) OVER (ORDER BY pk) AS lm2 \nFROM t1;\n+----+------+------+------+------+------+------+\n| pk | l    | l1   | l2   | l0   | lm1  | lm2  |\n+----+------+------+------+------+------+------+\n|  1 | NULL | NULL | NULL |    1 |    2 |    3 |\n|  2 |    1 |    1 | NULL |    2 |    3 |    4 |\n|  3 |    2 |    2 |    1 |    3 |    4 |    5 |\n|  4 |    3 |    3 |    2 |    4 |    5 |    6 |\n|  5 |    4 |    4 |    3 |    5 |    6 |    7 |\n|  6 |    5 |    5 |    4 |    6 |    7 |    8 |\n|  7 |    6 |    6 |    5 |    7 |    8 |    9 |\n|  8 |    7 |    7 |    6 |    8 |    9 |   10 |\n|  9 |    8 |    8 |    7 |    9 |   10 |   11 |\n| 10 |    9 |    9 |    8 |   10 |   11 | NULL |\n| 11 |   10 |   10 |    9 |   11 | NULL | NULL |\n+----+------+------+------+------+------+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/lag', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/lag');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (400, 35, 'LEAD', 'Syntax\n------\n\nLEAD (expr[, offset]) OVER ( \n  [ PARTITION BY partition_expression ] \n  [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nThe LEAD function accesses data from a following row in the same result set without the need for a self-join. The specific row is determined by the _offset_ (default _1_), which specifies the number of rows ahead the current row to use. An offset of _0_ is the current row.\n\nExamples\n--------\n\nCREATE TABLE t1 (pk int primary key, a int, b int, c char(10), d decimal(10, 3), e real);\n\nINSERT INTO t1 VALUES\n ( 1, 0, 1,    ''one'',    0.1,  0.001),\n ( 2, 0, 2,    ''two'',    0.2,  0.002),\n ( 3, 0, 3,    ''three'',  0.3,  0.003),\n ( 4, 1, 2,    ''three'',  0.4,  0.004),\n ( 5, 1, 1,    ''two'',    0.5,  0.005),\n ( 6, 1, 1,    ''one'',    0.6,  0.006),\n ( 7, 2, NULL, ''n_one'',  0.5,  0.007),\n ( 8, 2, 1,    ''n_two'',  NULL, 0.008),\n ( 9, 2, 2,    NULL,     0.7,  0.009),\n (10, 2, 0,    ''n_four'', 0.8,  0.010),\n (11, 2, 10,   NULL,     0.9,  NULL);\n\nSELECT pk, LEAD(pk) OVER (ORDER BY pk) AS l,\n  LEAD(pk,1) OVER (ORDER BY pk) AS l1,\n  LEAD(pk,2) OVER (ORDER BY pk) AS l2,\n  LEAD(pk,0) OVER (ORDER BY pk) AS l0,\n  LEAD(pk,-1) OVER (ORDER BY pk) AS lm1,\n  LEAD(pk,-2) OVER (ORDER BY pk) AS lm2 \nFROM t1;\n+----+------+------+------+------+------+------+\n| pk | l    | l1   | l2   | l0   | lm1  | lm2  |\n+----+------+------+------+------+------+------+\n|  1 |    2 |    2 |    3 |    1 | NULL | NULL |\n|  2 |    3 |    3 |    4 |    2 |    1 | NULL |\n|  3 |    4 |    4 |    5 |    3 |    2 |    1 |\n|  4 |    5 |    5 |    6 |    4 |    3 |    2 |\n|  5 |    6 |    6 |    7 |    5 |    4 |    3 |\n|  6 |    7 |    7 |    8 |    6 |    5 |    4 |\n|  7 |    8 |    8 |    9 |    7 |    6 |    5 |\n|  8 |    9 |    9 |   10 |    8 |    7 |    6 |\n|  9 |   10 |   10 |   11 |    9 |    8 |    7 |\n| 10 |   11 |   11 | NULL |   10 |    9 |    8 |\n| 11 | NULL | NULL | NULL |   11 |   10 |    9 |\n+----+------+------+------+------+------+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/lead', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/lead');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (401, 35, 'MEDIAN', 'Syntax\n------\n\nMEDIAN(median expression) OVER (\n  [ PARTITION BY partition_expression ] \n)\n\nDescription\n-----------\n\nMEDIAN() is a window function that returns the median value of a range of values.\n\nIt is a specific case of PERCENTILE_CONT, with an argument of 0.5 and the ORDER BY column the one in MEDIAN''s argument.\n\n``sql\nMEDIAN(<median-arg>) OVER ( [ PARTITION BY partition_expression] )\n`\n\nIs equivalent to:\n\n`sql\nPERCENTILE_CONT(0.5) WITHIN \n  GROUP (ORDER BY <median-arg>) OVER ( [ PARTITION BY partition_expression ])\n``\n\nExamples\n--------\n\nCREATE TABLE book_rating (name CHAR(30), star_rating TINYINT);\n\nINSERT INTO book_rating VALUES (''Lord of the Ladybirds'', 5);\nINSERT INTO book_rating VALUES (''Lord of the Ladybirds'', 3);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 1);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 2);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 5);\n\nSELECT name, median(star_rating) OVER (PARTITION BY name) FROM book_rating;\n+-----------------------+----------------------------------------------+\n| name                  | median(star_rating) OVER (PARTITION BY name) |\n+-----------------------+----------------------------------------------+\n| Lord of the Ladybirds |                                 4.0000000000 |\n| Lord of the Ladybirds |                                 4.0000000000 |\n| Lady of the Flies     |                                 2.0000000000 |\n| Lady of the Flies     |                                 2.0000000000 |\n| Lady of the Flies     |                                 2.0000000000 |\n+-----------------------+----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/median', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/median');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (402, 35, 'NTH\\_VALUE', 'Syntax\n------\n\nNTH_VALUE (expr[, num_row]) OVER ( \n  [ PARTITION BY partition_expression ] \n  [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nThe NTH_VALUE function returns the value evaluated at row number num_row of the window frame, starting from 1, or NULL if the row does not exist.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/nth_value', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/nth_value');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (403, 35, 'NTILE', 'Syntax\n------\n\nNTILE (expr) OVER ( \n  [ PARTITION BY partition_expression ] \n  [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nNTILE() is a window function that returns an integer indicating which group a given row falls into. The number of groups is specified in the argument (_expr_), starting at one. Ordered rows in the partition are divided into the specified number of groups with as equal a size as possible.\n\nExamples\n--------\n\ncreate table t1 (\n    pk int primary key,\n    a int,\n    b int\n  );\n\ninsert into t1 values\n    (11 , 0, 10),\n    (12 , 0, 10),\n    (13 , 1, 10),\n    (14 , 1, 10),\n    (18 , 2, 10),\n    (15 , 2, 20),\n    (16 , 2, 20),\n    (17 , 2, 20),\n    (19 , 4, 20),\n    (20 , 4, 20);\n\nselect pk, a, b,\n    ntile(1) over (order by pk)\n  from t1;\n+----+------+------+-----------------------------+\n| pk | a    | b    | ntile(1) over (order by pk) |\n+----+------+------+-----------------------------+\n| 11 |    0 |   10 |                           1 |\n| 12 |    0 |   10 |                           1 |\n| 13 |    1 |   10 |                           1 |\n| 14 |    1 |   10 |                           1 |\n| 15 |    2 |   20 |                           1 |\n| 16 |    2 |   20 |                           1 |\n| 17 |    2 |   20 |                           1 |\n| 18 |    2 |   10 |                           1 |\n| 19 |    4 |   20 |                           1 |\n| 20 |    4 |   20 |                           1 |\n+----+------+------+-----------------------------+\n\nselect pk, a, b,\n    ntile(4) over (order by pk)\n from t1;\n+----+------+------+-----------------------------+\n| pk | a    | b    | ntile(4) over (order by pk) |\n+----+------+------+-----------------------------+\n| 11 |    0 |   10 |                           1 |\n| 12 |    0 |   10 |                           1 |\n| 13 |    1 |   10 |                           1 |\n| 14 |    1 |   10 |                           2 |\n| 15 |    2 |   20 |                           2 |\n| 16 |    2 |   20 |                           2 |\n| 17 |    2 |   20 |                           3 |\n| 18 |    2 |   10 |                           3 |\n| 19 |    4 |   20 |                           4 |\n| 20 |    4 |   20 |                           4 |\n+----+------+------+-----------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/ntile', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/ntile');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (404, 35, 'PERCENT\\_RANK', 'Syntax\n------\n\nPERCENT_RANK() OVER (\n  [ PARTITION BY partition_expression ] \n  [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nPERCENT_RANK() is a window function that returns the relative percent rank of a given row. The following formula is used to calculate the percent rank:\n\n``sql\n(rank - 1) / (number of rows in the window or partition - 1)\n``\n\nExamples\n--------\n\ncreate table t1 (\n  pk int primary key,\n  a int,\n  b int\n);\n\ninsert into t1 values\n( 1 , 0, 10),\n( 2 , 0, 10),\n( 3 , 1, 10),\n( 4 , 1, 10),\n( 8 , 2, 10),\n( 5 , 2, 20),\n( 6 , 2, 20),\n( 7 , 2, 20),\n( 9 , 4, 20),\n(10 , 4, 20);\n\nselect pk, a, b,\n    rank() over (order by a) as rank,\n    percent_rank() over (order by a) as pct_rank,\n    cume_dist() over (order by a) as cume_dist\nfrom t1;\n+----+------+------+------+--------------+--------------+\n| pk | a    | b    | rank | pct_rank     | cume_dist    |\n+----+------+------+------+--------------+--------------+\n|  1 |    0 |   10 |    1 | 0.0000000000 | 0.2000000000 |\n|  2 |    0 |   10 |    1 | 0.0000000000 | 0.2000000000 |\n|  3 |    1 |   10 |    3 | 0.2222222222 | 0.4000000000 |\n|  4 |    1 |   10 |    3 | 0.2222222222 | 0.4000000000 |\n|  5 |    2 |   20 |    5 | 0.4444444444 | 0.8000000000 |\n|  6 |    2 |   20 |    5 | 0.4444444444 | 0.8000000000 |\n|  7 |    2 |   20 |    5 | 0.4444444444 | 0.8000000000 |\n|  8 |    2 |   10 |    5 | 0.4444444444 | 0.8000000000 |\n|  9 |    4 |   20 |    9 | 0.8888888889 | 1.0000000000 |\n| 10 |    4 |   20 |    9 | 0.8888888889 | 1.0000000000 |\n+----+------+------+------+--------------+--------------+\n\nselect pk, a, b,\n       percent_rank() over (order by pk) as pct_rank,\n       cume_dist() over (order by pk) as cume_dist\nfrom t1 order by pk;\n+----+------+------+--------------+--------------+\n| pk | a    | b    | pct_rank     | cume_dist    |\n+----+------+------+--------------+--------------+\n|  1 |    0 |   10 | 0.0000000000 | 0.1000000000 |\n|  2 |    0 |   10 | 0.1111111111 | 0.2000000000 |\n|  3 |    1 |   10 | 0.2222222222 | 0.3000000000 |\n|  4 |    1 |   10 | 0.3333333333 | 0.4000000000 |\n|  5 |    2 |   20 | 0.4444444444 | 0.5000000000 |\n|  6 |    2 |   20 | 0.5555555556 | 0.6000000000 |\n|  7 |    2 |   20 | 0.6666666667 | 0.7000000000 |\n|  8 |    2 |   10 | 0.7777777778 | 0.8000000000 |\n|  9 |    4 |   20 | 0.8888888889 | 0.9000000000 |\n| 10 |    4 |   20 | 1.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n\nselect pk, a, b,\n        percent_rank() over (partition by a order by a) as pct_rank,\n        cume_dist() over (partition by a order by a) as cume_dist\nfrom t1;\n+----+------+------+--------------+--------------+\n| pk | a    | b    | pct_rank     | cume_dist    |\n+----+------+------+--------------+--------------+\n|  1 |    0 |   10 | 0.0000000000 | 1.0000000000 |\n|  2 |    0 |   10 | 0.0000000000 | 1.0000000000 |\n|  3 |    1 |   10 | 0.0000000000 | 1.0000000000 |\n|  4 |    1 |   10 | 0.0000000000 | 1.0000000000 |\n|  5 |    2 |   20 | 0.0000000000 | 1.0000000000 |\n|  6 |    2 |   20 | 0.0000000000 | 1.0000000000 |\n|  7 |    2 |   20 | 0.0000000000 | 1.0000000000 |\n|  8 |    2 |   10 | 0.0000000000 | 1.0000000000 |\n|  9 |    4 |   20 | 0.0000000000 | 1.0000000000 |\n| 10 |    4 |   20 | 0.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percent_rank', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percent_rank');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (405, 35, 'PERCENTILE\\_CONT', 'Description\n-----------\n\nPERCENTILE_CONT() (standing for continuous percentile) is a window function which returns a value which corresponds to the given fraction in the sort order. If required, it will interpolate between adjacent input items.\n\nEssentially, the following process is followed to find the value to return:\n\n Get the number of rows in the partition, denoted by N\n RN = p\\(N-1), where p denotes the argument to the PERCENTILE_CONT function\n Calculate FRN as FRN=floor(RN) and CRN as CRN=ceil(RN)\n Look up rows FRN and CRN\n If (CRN = FRN = RN) then the result is (value of expression from row at RN)\n Otherwise the result is\n (CRN - RN) \\ (value of expression for row at FRN) +\n (RN - FRN) \\* (value of expression for row at CRN)\n\nThe MEDIAN function is a specific case of PERCENTILE_CONT, equivalent to PERCENTILE_CONT(0.5).\n\nExamples\n--------\n\nCREATE TABLE book_rating (name CHAR(30), star_rating TINYINT);\n\nINSERT INTO book_rating VALUES (''Lord of the Ladybirds'', 5);\nINSERT INTO book_rating VALUES (''Lord of the Ladybirds'', 3);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 1);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 2);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 5);\n\nSELECT name, PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY star_rating) \n  OVER (PARTITION BY name) AS pc \n  FROM book_rating;\n+-----------------------+--------------+\n| name                  | pc           |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 4.0000000000 |\n| Lord of the Ladybirds | 4.0000000000 |\n| Lady of the Flies     | 2.0000000000 |\n| Lady of the Flies     | 2.0000000000 |\n| Lady of the Flies     | 2.0000000000 |\n+-----------------------+--------------+\n\nSELECT name, PERCENTILE_CONT(1) WITHIN GROUP (ORDER BY star_rating) \n  OVER (PARTITION BY name) AS pc \n  FROM book_rating;\n+-----------------------+--------------+\n| name                  | pc           |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 5.0000000000 |\n| Lord of the Ladybirds | 5.0000000000 |\n| Lady of the Flies     | 5.0000000000 |\n| Lady of the Flies     | 5.0000000000 |\n| Lady of the Flies     | 5.0000000000 |\n+-----------------------+--------------+\n\nSELECT name, PERCENTILE_CONT(0) WITHIN GROUP (ORDER BY star_rating) \n  OVER (PARTITION BY name) AS pc \n  FROM book_rating;\n+-----------------------+--------------+\n| name                  | pc           |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 3.0000000000 |\n| Lord of the Ladybirds | 3.0000000000 |\n| Lady of the Flies     | 1.0000000000 |\n| Lady of the Flies     | 1.0000000000 |\n| Lady of the Flies     | 1.0000000000 |\n+-----------------------+--------------+\n\nSELECT name, PERCENTILE_CONT(0.6) WITHIN GROUP (ORDER BY star_rating) \n  OVER (PARTITION BY name) AS pc \n  FROM book_rating;\n+-----------------------+--------------+\n| name                  | pc           |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 4.2000000000 |\n| Lord of the Ladybirds | 4.2000000000 |\n| Lady of the Flies     | 2.6000000000 |\n| Lady of the Flies     | 2.6000000000 |\n| Lady of the Flies     | 2.6000000000 |\n+-----------------------+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percentile_cont', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percentile_cont');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (406, 35, 'PERCENTILE\\_DISC', 'Description\n-----------\n\nPERCENTILE_DISC() (standing for discrete percentile) is a window function which returns the first value in the set whose ordered position is the same or more than the specified fraction.\n\nEssentially, the following process is followed to find the value to return:\n\n Get the number of rows in the partition.\n Walk through the partition, in order, until finding the first row with CUME_DIST() >= function_argument.\n\nExamples\n--------\n\nCREATE TABLE book_rating (name CHAR(30), star_rating TINYINT);\n\nINSERT INTO book_rating VALUES (''Lord of the Ladybirds'', 5);\nINSERT INTO book_rating VALUES (''Lord of the Ladybirds'', 3);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 1);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 2);\nINSERT INTO book_rating VALUES (''Lady of the Flies'', 5);\n\nSELECT name, PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY star_rating)\n  OVER (PARTITION BY name) AS pc FROM book_rating;\n+-----------------------+------+\n| name                  | pc   |\n+-----------------------+------+\n| Lord of the Ladybirds |    3 |\n| Lord of the Ladybirds |    3 |\n| Lady of the Flies     |    2 |\n| Lady of the Flies     |    2 |\n| Lady of the Flies     |    2 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n\nSELECT name, PERCENTILE_DISC(0) WITHIN GROUP (ORDER BY star_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n+-----------------------+------+\n| name                  | pc   |\n+-----------------------+------+\n| Lord of the Ladybirds |    3 |\n| Lord of the Ladybirds |    3 |\n| Lady of the Flies     |    1 |\n| Lady of the Flies     |    1 |\n| Lady of the Flies     |    1 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n\nSELECT name, PERCENTILE_DISC(1) WITHIN GROUP (ORDER BY star_rating) \n  OVER (PARTITION BY name) AS pc FROM book_rating;\n+-----------------------+------+\n| name                  | pc   |\n+-----------------------+------+\n| Lord of the Ladybirds |    5 |\n| Lord of the Ladybirds |    5 |\n| Lady of the Flies     |    5 |\n| Lady of the Flies     |    5 |\n| Lady of the Flies     |    5 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n\nSELECT name, PERCENTILE_DISC(0.6) WITHIN GROUP (ORDER BY star_rating) \n  OVER (PARTITION BY name) AS pc FROM book_rating;\n+-----------------------+------+\n| name                  | pc   |\n+-----------------------+------+\n| Lord of the Ladybirds |    5 |\n| Lord of the Ladybirds |    5 |\n| Lady of the Flies     |    2 |\n| Lady of the Flies     |    2 |\n| Lady of the Flies     |    2 |\n+-----------------------+------\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percentile_disc', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percentile_disc');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (407, 35, 'RANK', 'Syntax\n------\n\nRANK() OVER (\n  [ PARTITION BY partition_expression ]\n  [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nRANK() is a window function that displays the number of a given row, starting at one and following the ORDER BY sequence of the window function, with identical values receiving the same result. It is similar to the ROW_NUMBER() function except that in that function, identical values will receive a different row number for each result.\n\nExamples\n--------\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(10));\n\nINSERT INTO student VALUES \n  (''Maths'', 60, ''Thulile''),\n  (''Maths'', 60, ''Pritha''),\n  (''Maths'', 70, ''Voitto''),\n  (''Maths'', 55, ''Chun''),\n  (''Biology'', 60, ''Bilal''),\n   (''Biology'', 70, ''Roger'');\n\nSELECT \n  RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS rank, \n  DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank, \n  ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num, \n  course, mark, name \nFROM student ORDER BY course, mark DESC;\n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course  | mark | name    |\n+------+------------+---------+---------+------+---------+\n|    1 |          1 |       1 | Biology |   70 | Roger   |\n|    2 |          2 |       2 | Biology |   60 | Bilal   |\n|    1 |          1 |       1 | Maths   |   70 | Voitto  |\n|    2 |          2 |       2 | Maths   |   60 | Thulile |\n|    2 |          2 |       3 | Maths   |   60 | Pritha  |\n|    4 |          3 |       4 | Maths   |   55 | Chun    |\n+------+------------+---------+---------+------+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/rank', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/rank');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (408, 35, 'ROW\\_NUMBER', 'Syntax\n------\n\nROW_NUMBER() OVER (\n  [ PARTITION BY partition_expression ]\n  [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nROW_NUMBER() is a window function that displays the number of a given row, starting at one and following the ORDER BY sequence of the window function, with identical values receiving different row numbers. It is similar to the RANK() and DENSE_RANK() functions except that in that function, identical values will receive the same rank for each result.\n\nExamples\n--------\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(10));\n\nINSERT INTO student VALUES \n  (''Maths'', 60, ''Thulile''),\n  (''Maths'', 60, ''Pritha''),\n  (''Maths'', 70, ''Voitto''),\n  (''Maths'', 55, ''Chun''),\n  (''Biology'', 60, ''Bilal''),\n   (''Biology'', 70, ''Roger'');\n\nSELECT \n  RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS rank, \n  DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank, \n  ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num, \n  course, mark, name \nFROM student ORDER BY course, mark DESC;\n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course  | mark | name    |\n+------+------------+---------+---------+------+---------+\n|    1 |          1 |       1 | Biology |   70 | Roger   |\n|    2 |          2 |       2 | Biology |   60 | Bilal   |\n|    1 |          1 |       1 | Maths   |   70 | Voitto  |\n|    2 |          2 |       2 | Maths   |   60 | Thulile |\n|    2 |          2 |       3 | Maths   |   60 | Pritha  |\n|    4 |          3 |       4 | Maths   |   55 | Chun    |\n+------+------------+---------+---------+------+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/row_number', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/row_number');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (409, 35, 'Window Frames', 'Description\n-----------\n\nBasic Syntax\n\n``sql\nframe_clause:\n  {ROWS | RANGE} {frame_border | BETWEEN frame_border AND frame_border}\n\nframe_border:\n  | UNBOUNDED PRECEDING\n  | UNBOUNDED FOLLOWING\n  | CURRENT ROW\n  | expr PRECEDING\n  | expr FOLLOWING\n`\n\nHow Window Frames Work\n\nA basic overview of window functions is described in Window Functions Overview. Window frames define which rows contribute to the current result.\n\nWindow frames are used by aggregate window functions. They are defined by the frame clause inside OVER (...).\n\nOVER () uses the whole result set.\n\nFor aggregate window functions, OVER (ORDER BY ...) uses a running frame by default. In MariaDB, that default is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.\n\nFrame Bound Types\n\nCommon frame bounds include:\n\n All rows before the current row (UNBOUNDED PRECEDING), for example RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW .\n All rows after the current row (UNBOUNDED FOLLOWING), for example RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING .\n A set number of rows before the current row (expr PRECEDING), for example RANGE BETWEEN 6 PRECEDING AND CURRENT ROW .\n A set number of rows after the current row (expr FOLLOWING), for example RANGE BETWEEN CURRENT ROW AND 2 FOLLOWING .\n* A specified number of rows both before and after the current row, for example RANGE BETWEEN 6 PRECEDING AND 3 FOLLOWING .\n\nROWS vs RANGE\n\nROWS counts physical rows. RANGE groups peer rows that share the same ORDER BY value.\n\nUse ROWS when you want strict row-by-row stepping. Use RANGE when tied sort values should be treated as one peer group.\n\nAggregate Functions Using Frames\n\nSee list here.\n\nExamples\n--------\n\nCREATE TABLE student_test` (\n  name char(10),\n  test char(10),\n  score tinyint(4)\n);\n\nINSERT INTO student_test 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);\n\nSELECT name, test, score, SUM(score) \n  OVER () AS total_score \n  FROM student_test;\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/window-frames', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/window-frames');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (410, 35, 'ColumnStore Window Functions', 'Description\n-----------\n\nIntroduction\n\nMariaDB ColumnStore provides support for window functions broadly following the SQL 2003 specification. A window function allows for calculations relating to a window of data surrounding the current row in a result set. This capability provides for simplified queries in support of common business questions such as cumulative totals, rolling averages, and top 10 lists.\n\nAggregate functions are utilized for window functions however differ in behavior from a group by query because the rows remain ungrouped. This provides support for cumulative sums and rolling averages, for example.\n\nTwo key concepts for window functions are Partition and Frame:\n\n A Partition is a group of rows, or window, that have the same value for a specific column, for example a Partition can be created over a time period such as a quarter or lookup values.\n The Frame for each row is a subset of the row''s Partition. The frame typically is dynamic allowing for a sliding frame of rows within the Partition. The Frame determines the range of rows for the windowing function. A Frame could be defined as the last X rows and next Y rows all the way up to the entire Partition.\n\nWindow functions are applied after joins, group by, and having clauses are calculated.\n\nSyntax\n\nA window function is applied in the select clause using the following syntax:\n\n``sql\nfunction_name ([expression [, expression ... ]]) OVER ( window_definition )\n`\n\nwhere _window_definition_ is defined as:\n\n`sql\n[ PARTITION BY expression [, ...] ]\n[ ORDER BY expression [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [, ...] ]\n[ frame_clause ]\n`\n\nPARTITION BY:\n\n Divides the window result set into groups based on one or more expressions.\n An expression may be a constant, column, and non window function expressions.\n A query is not limited to a single partition by clause. Different partition clauses can be used across different window function applications.\n The partition by columns do not need to be in the select list but do need to be available from the query result set.\n If there is no PARTITION BY clause, all rows of the result set define the group.\n\nORDER BY:\n\n Defines the ordering of values within the partition.\n Can be ordered by multiple keys which may be a constant, column or non window function expression.\n The order by columns do not need to be in the select list but need to be available from the query result set.\n Use of a select column alias from the query is not supported.\n ASC (default) and DESC options allow for ordering ascending or descending.\n NULLS FIRST and NULL_LAST options specify whether null values come first or last in the ordering sequence. NULLS_FIRST is the default for ASC order, and NULLS_LAST is the default for DESC order.\n\nand the optional _frame_clause_ is defined as:\n\n`sql\n{ RANGE | ROWS } frame_start\n{ RANGE | ROWS } BETWEEN frame_start AND frame_end\n`\n\nand the optional _frame_start_ and _frame_end_ are defined as (value being a numeric expression):\n\n`sql\nUNBOUNDED PRECEDING\nvalue PRECEDING\nCURRENT ROW\nvalue FOLLOWING\nUNBOUNDED FOLLOWING\n`\n\nRANGE/ROWS:\n\n Defines the windowing clause for calculating the set of rows that the function applies to for calculating a given rows window function result.\n Requires an ORDER BY clause to define the row order for the window.\n ROWS specify the window in physical units, i.e. result set rows and must be a constant or expression evaluating to a positive numeric value.\n RANGE specifies the window as a logical offset. If the expression evaluates to a numeric value then the ORDER BY expression must be a numeric or DATE type. If the expression evaluates to an interval value then the ORDER BY expression must be a DATE data type.\n UNBOUNDED PRECEDING indicates the window starts at the first row of the partition.\n UNBOUNDED FOLLOWING indicates the window ends at the last row of the partition.\n CURRENT ROW specifies the window start or ends at the current row or value.\n* If omitted, the default is ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW`.\n\nSupported Functions\n\n| Function               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |\n| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| AVG()                  | The average of all input values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |\n| COUNT()                | Number of input rows.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |\n| CUME_DIST()           | Calculates the cumulative distribution, or relative rank, of the current row to other rows in the same partition. Number of peer or preceding rows / number of rows in partition.                                                                                                                                                                                                                                                                                                                                                  |\n| DENSE_RANK()          | Ranks items in a group leaving no gaps in ranking sequence when there are ties.                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| FIRST_VALUE()         | The value evaluated at the row that is the first row of the window frame (counting from 1); null if no such row.                                                                                                                                                                                                                                                                                                                                                                                                                   |\n| LAG()                  | The value evaluated at the row that is offset rows before the current row within the partition; if there is no such row, instead return default. Both offset and default are evaluated with respect to the current row. If omitted, offset defaults to 1 and default to null. LAG provides access to more than one row of a table at the same time without a self-join. Given a series of rows returned from a query and a position of the cursor, LAG provides access to a row at a given physical offset prior to that position. |\n| LAST_VALUE()          | The value evaluated at the row that is the last row of the window frame (counting from 1); null if no such row.                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| LEAD()                 | Provides access to a row at a given physical offset beyond that position. Returns value evaluated at the row that is offset rows after the current row within the partition; if there is no such row, instead return default. Both offset and default are evaluated with respect to the current row. If omitted, offset defaults to 1 and default to null.                                                                                                                                                                         |\n| MAX()                  | Maximum value of expression across all input values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| MEDIAN()               | An inverse distribution function that assumes a continuous distribution model. It takes a numeric or datetime value and returns the middle value or an interpolated value that would be the middle value once the values are sorted. Nulls are ignored in the calculation.                                                                                                                                                                                                                                                         |\n| MIN()                  | Minimum value of expression across all input values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| NTH_VALUE()           | The value evaluated at the row that is the nth row of the window frame (counting from 1); null if no such row.                                                                                                                                                                                                                                                                                                                                                                                                                     |\n| NTILE()                | Divides an ordered data set into a number of buckets indicated by expr and assigns the appropriate bucket number to each row. The buckets are numbered 1 through expr. The expr value must resolve to a positive constant for each partition. Integer ranging from 1 to the argument value, dividing the partition as equally as possible.                                                                                                                                                                                         |\n| PERCENT_RANK()        | relative rank of the current row: (rank - 1) / (total rows - 1).                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |\n| PERCENTILE_CONT()     | An inverse distribution function that assumes a continuous distribution model. It takes a percentile value and a sort specification, and returns an interpolated value that would fall into that percentile value with respect to the sort specification. Nulls are ignored in the calculation.                                                                                                                                                                                                                                    |\n| PERCENTILE_DISC()     | An inverse distribution function that assumes a discrete distribution model. It takes a percentile value and a sort specification and returns an element from the set. Nulls are ignored in the calculation.                                                                                                                                                                                                                                                                                                                       |\n| RANK()                 | rank of the current row with gaps; same as row_number of its first peer.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |\n| ROW_NUMBER()          | number of the current row within its partition, counting from 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| STDDEV() STDDEV_POP() | Computes the population standard deviation a\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/window-functions-columnstore-window-functions');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (411, 35, 'Window Functions Overview', 'Description\n-----------\n\nWindow Functions\n\nWindow functions calculate across related rows without collapsing them. Unlike GROUP BY, they return one result for each input row.\n\nWhen to Use Window Functions\n\nUse window functions when you need to:\n\n Rank rows inside a group.\n Calculate running totals or moving averages.\n Compare a row with earlier or later rows.\n Return the top _N_ rows per group.\n\nBasic Syntax\n\n``sql\nwindow_function(expr) OVER (\n  [PARTITION BY expr [, ...]]\n  [ORDER BY expr [ASC | DESC] [, ...]]\n  [{ROWS | RANGE} frame_clause]\n)\n\nframe_clause:\n  {frame_border | BETWEEN frame_border AND frame_border}\n\nframe_border:\n  UNBOUNDED PRECEDING\n  | UNBOUNDED FOLLOWING\n  | CURRENT ROW\n  | expr PRECEDING\n  | expr FOLLOWING\n`\n\nYou can also define a named window and reuse it:\n\n`sql\nSELECT\n  SUM(score) OVER w AS running_total,\n  AVG(score) OVER w AS running_avg\nFROM student\nWINDOW w AS (\n  ORDER BY score\n  ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW\n);\n`\n\nWindow Functions vs GROUP BY\n\nUse GROUP BY when you want one output row per group.\n\nUse a window function when you want to keep the original rows and add per-group or per-sequence calculations beside them.\n\n`sql\nSELECT test, AVG(score)\nFROM student\nGROUP BY test;\n`\n\nThis returns one row per test.\n\n`sql\nSELECT\n  name,\n  test,\n  score,\n  AVG(score) OVER (PARTITION BY test) AS avg_by_test\nFROM student;\n`\n\nThis returns every row, plus the average for that row''s test.\n\nHow OVER Works\n\nPARTITION BY\n\nPARTITION BY starts a new calculation for each group.\n\nORDER BY\n\nORDER BY defines the row sequence inside each partition.\n\nFrame\n\nThe frame controls which rows contribute to the current result. Aggregate window functions use frames. Ranking functions such as ROW_NUMBER() and RANK() do not.\n\nOVER () uses the whole result set.\n\nFor aggregate window functions, OVER (ORDER BY ...) uses a running frame by default. In MariaDB, that default is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.\n\nROWS vs RANGE\n\nROWS counts physical rows. RANGE groups peer rows that share the same ORDER BY value.\n\nUse ROWS when you need strict row-by-row stepping. Use RANGE when ties should be treated as one peer group.\n\n`sql\nCREATE TABLE t (score INT);\nINSERT INTO t VALUES (10), (10), (20);\n\nSELECT\n  score,\n  SUM(score) OVER (\n    ORDER BY score\n    ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW\n  ) AS rows_sum,\n  SUM(score) OVER (\n    ORDER BY score\n    RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW\n  ) AS range_sum\nFROM t;\n`\n\nThis produces different results for the duplicate 10 values:\n\n`\n+-------+----------+-----------+\n| score | rows_sum | range_sum |\n+-------+----------+-----------+\n|    10 |       10 |        20 |\n|    10 |       20 |        20 |\n|    20 |       40 |        40 |\n+-------+----------+-----------+\n`\n\nSupported Functions\n\nDedicated window functions include CUME_DIST, DENSE_RANK, FIRST_VALUE, LAG, LAST_VALUE, LEAD, MEDIAN, NTH_VALUE, NTILE, PERCENTILE_CONT, PERCENTILE_DISC, PERCENT_RANK, RANK, and ROW_NUMBER.\n\nAggregate functions that also work with OVER (...) include AVG, BIT_AND, BIT_OR, BIT_XOR, COUNT, MAX, MIN, STD, STDDEV, STDDEV_POP, STDDEV_SAMP, SUM, VAR_POP, VAR_SAMP, and VARIANCE.\n\nAggregate window functions do not support DISTINCT.\n\nAggregate Functions as Window Functions\n\nIt is possible to use aggregate functions as window functions. An aggregate function used as a window function must have the OVER clause. For example, here''s COUNT() used as a window function:\n\n`sql\nSELECT COUNT() OVER (ORDER BY column) FROM table;\n`\n\nCommon Pitfalls\n\n You cannot reference a window function in WHERE.\n Compute the window result in a subquery or CTE first.\n MariaDB does not support GROUPS frames.\n MariaDB does not support frame exclusion.\n MariaDB does not support explicit NULLS FIRST or NULLS LAST.\n RANGE frames do not support DATE or DATETIME arithmetic.\n\nWindow functions are evaluated after WHERE, GROUP BY, and HAVING. Filter the computed result in an outer query or CTE.\n\nOptimization\n\nWindow functions often need sorted input. Query shape can decide whether MariaDB can reuse an existing order or must sort again.\n\nGROUP BY Comes First\n\nIf a query uses both GROUP BY and window functions, MariaDB executes the grouping step first. The window step runs on the grouped result.\n\nThis affects index usage. An index that helps the base table scan does not automatically avoid later sorting for the window stage.\n\nWhen tuning this pattern, optimize the GROUP BY step first. Then check whether the window step still needs its own sort.\n\nSort Reuse Depends on Sort Keys\n\nIf the GROUP BY definition and the window''s PARTITION BY and ORDER BY definition use different sort keys, MariaDB usually needs another sort pass before evaluating the window functions.\n\nFor example, this shape can require an extra sort:\n\n`sql\nSELECT\n  dept,\n  month,\n  SUM(sales) AS monthly_sales,\n  ROW_NUMBER() OVER (\n    PARTITION BY dept\n    ORDER BY month\n  ) AS row_num\nFROM revenue\nGROUP BY month, dept;\n`\n\nThe grouped result is ordered by month, dept. The window step needs dept, month. Those orders do not match.\n\nMultiple Window Functions Can Share One Sort\n\nMultiple window functions can share the same sort pass when they use the same PARTITION BY and ORDER BY clause.\n\n`sql\nSELECT\n  dept,\n  month,\n  sales,\n  ROW_NUMBER() OVER (\n    PARTITION BY dept\n    ORDER BY month\n  ) AS row_num,\n  SUM(sales) OVER (\n    PARTITION BY dept\n    ORDER BY month\n    ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW\n  ) AS running_sales\nFROM revenue;\n`\n\nBoth window functions use the same partitioning and ordering. MariaDB can reuse the same sorted stream for both.\n\nPractical Tuning Tips\n\n Expect GROUP BY to shape the input seen by window functions.\n Align GROUP BY keys with the window sort keys when possible.\n Reuse the same PARTITION BY and ORDER BY` across multiple window functions.\n* Check the execution plan to see whether an extra sort is still present.\n\nExamples\n--------\n\nCREATE TABLE student (\n  name CHAR(10),\n  test CHAR(10),\n  score TINYINT\n);\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\nURL: https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/window-functions-overview', '', 'https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/window-functions-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (412, 37, 'ASCII', 'Syntax\n------\n\nASCII(str)\n\nDescription\n-----------\n\nReturns the numeric ASCII value of the leftmost character of the string argument. Returns 0 if the given string is empty and NULL if it is NULL.\n\nASCII() works for 8-bit characters.\n\nExamples\n--------\n\nSELECT ASCII(9);\n+----------+\n| ASCII(9) |\n+----------+\n|       57 |\n+----------+\n\nSELECT ASCII(''9'');\n+------------+\n| ASCII(''9'') |\n+------------+\n|         57 |\n+------------+\n\nSELECT ASCII(''abc'');\n+--------------+\n| ASCII(''abc'') |\n+--------------+\n|           97 |\n+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/ascii', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/ascii');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (413, 37, 'BIN', 'Syntax\n------\n\nBIN(N)\n\nDescription\n-----------\n\nReturns a string representation of the binary value of the given longlong (that is, BIGINT) number. This is equivalent to CONV(N,10,2). The argument should be positive. If it is a FLOAT, it will be truncated. Returns NULL if the argument is NULL.\n\nExamples\n--------\n\nSELECT BIN(12);\n+---------+\n| BIN(12) |\n+---------+\n| 1100    |\n+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/bin', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/bin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (414, 37, 'BINARY Operator', 'Syntax\n------\n\nBINARY\n\nDescription\n-----------\n\nThe BINARY operator casts the string following it to a binary string. This is an easy way to force a column comparison to be done byte by byte rather than character by character. This causes the comparison to be case sensitive even if the column isn''t defined as BINARY or BLOB.\n\nBINARY also causes trailing spaces to be significant.\n\nExamples\n--------\n\nSELECT ''a'' = ''A'';\n+-----------+\n| ''a'' = ''A'' |\n+-----------+\n|         1 |\n+-----------+\n\nSELECT BINARY ''a'' = ''A'';\n+------------------+\n| BINARY ''a'' = ''A'' |\n+------------------+\n|                0 |\n+------------------+\n\nSELECT ''a'' = ''a '';\n+------------+\n| ''a'' = ''a '' |\n+------------+\n|          1 |\n+------------+\n\nSELECT BINARY ''a'' = ''a '';\n+-------------------+\n| BINARY ''a'' = ''a '' |\n+-------------------+\n|                 0 |\n+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/binary-operator', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/binary-operator');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (415, 37, 'BIT\\_LENGTH', 'Syntax\n------\n\nBIT_LENGTH(str)\n\nDescription\n-----------\n\nReturns the length of the given string argument in bits. If the argument is not a string, it will be converted to string. If the argument is NULL, it returns NULL.\n\nExamples\n--------\n\nSELECT BIT_LENGTH(''text'');\n+--------------------+\n| BIT_LENGTH(''text'') |\n+--------------------+\n|                 32 |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/bit_length', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/bit_length');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (416, 37, 'CAST', 'Syntax\n------\n\nCAST(expr AS type)\n\nDescription\n-----------\n\nThe CAST() function takes a value of one data type and produces a value of another data type, similar to the CONVERT() function.\n\nThe type can be one of the following values:\n\n BINARY\n CHAR\n DATE\n DATETIME\n DECIMAL\n DOUBLE\n FLOAT\n INTEGER (short for SIGNED INTEGER )\n [SIGNED \\[INTEGER\\]](../../data-types/numeric-data-types/integer.md)\n [UNSIGNED \\[INTEGER\\]](../../data-types/numeric-data-types/integer.md)\n TIME\n VARCHAR\n* XMLTYPE (Available starting with MariaDB 12.3)\n\nThe main difference between CAST and CONVERT() is that CONVERT(expr,type) is ODBC syntax, while CAST(expr as type) and CONVERT(... USING ...) are SQL92 syntax.\n\nTo cast a value to a string data type while specifying the character set, use this extended syntax:\n\n``sql\n CAST(expr AS CHAR CHARACTER SET name)\n`\n\nSee the examples for casting to character sets.\n\nUsing an introducer like _utf8mb4''text'' is often more efficient than CAST(''text'' AS CHAR CHARACTER SET utf8mb4), but CAST is necessary when converting data types (like numbers to strings) into a specific encoding. See this example, too.\n\nYou can use the CAST() function with the INTERVAL` keyword.\n\nThis introduced an incompatibility with previous versions of MariaDB, and all versions of MySQL (see the example below).\n\nExamples\n--------\n\nSELECT CAST("abc" AS BINARY);\nSELECT CAST("1" AS UNSIGNED INTEGER);\nSELECT CAST(123 AS CHAR CHARACTER SET utf8)\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/cast', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/cast');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (417, 37, 'CHAR Function', 'Syntax\n------\n\nCHAR(N,... [USING charset_name])\n\nDescription\n-----------\n\nCHAR() interprets each argument as an INT and returns a string consisting of the characters given by the code values of those integers. NULL values are skipped. By default, CHAR() returns a binary string. To produce a string in a given character set, use the optional USING clause:\n\n``sql\nSELECT CHARSET(CHAR(0x65)), CHARSET(CHAR(0x65 USING utf8));\n+---------------------+--------------------------------+\n| CHARSET(CHAR(0x65)) | CHARSET(CHAR(0x65 USING utf8)) |\n+---------------------+--------------------------------+\n| binary              | utf8                           |\n+---------------------+--------------------------------+\n`\n\nIf USING is given and the result string is illegal for the given character set, a warning is issued. Also, if strict SQL mode is enabled, the result from CHAR() becomes NULL`.\n\nExamples\n--------\n\nSELECT CHAR(77,97,114,''105'',97,''68'',66);\n+----------------------------------+\n| CHAR(77,97,114,''105'',97,''68'',66) |\n+----------------------------------+\n| MariaDB                          |\n+----------------------------------+\n\nSELECT CHAR(77,77.3,''77.3'');\n+----------------------+\n| CHAR(77,77.3,''77.3'') |\n+----------------------+\n| MMM                  |\n+----------------------+\n1 row in set, 1 warning (0.00 sec)\n\nWarning (Code 1292): Truncated incorrect INTEGER value: ''77.3''\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/char-function', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/char-function');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (418, 37, 'CHAR\\_LENGTH', 'Syntax\n------\n\nCHAR_LENGTH(str)\nCHARACTER_LENGTH(str)\n\nDescription\n-----------\n\nReturns the length of the given string argument, measured in characters. A multi-byte character counts as a single character. This means that for a string containing five two-byte characters, LENGTH() (or OCTET_LENGTH() in Oracle mode) returns 10, whereas CHAR_LENGTH() returns 5. If the argument is NULL, it returns NULL.\n\nIf the argument is not a string value, it is converted into a string.\n\nIt is synonymous with the CHARACTER_LENGTH() function.\n\nExamples\n--------\n\nSELECT CHAR_LENGTH(''MariaDB'');\n+------------------------+\n| CHAR_LENGTH(''MariaDB'') |\n+------------------------+\n|                      7 |\n+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/char_length', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/char_length');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (419, 37, 'CHARACTER\\_LENGTH', 'Syntax\n------\n\nCHARACTER_LENGTH(str)\n\nDescription\n-----------\n\nCHARACTER_LENGTH() is a synonym for CHAR_LENGTH().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/character_length', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/character_length');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (420, 37, 'CHR', 'Syntax\n------\n\nCHR(N)\n\nDescription\n-----------\n\nCHR() interprets each argument N as an integer and returns a VARCHAR(1) string consisting of the character given by the code values of the integer. The character set and collation of the string are set according to the values of the character_set_database and collation_database system variables.\n\nCHR() is similar to the CHAR() function, but only accepts a single argument.\n\nCHR() is available in all sql_modes.\n\nExamples\n--------\n\nSELECT CHR(67);\n+---------+\n| CHR(67) |\n+---------+\n| C       |\n+---------+\n\nSELECT CHR(''67'');\n+-----------+\n| CHR(''67'') |\n+-----------+\n| C         |\n+-----------+\n\nSELECT CHR(''C'');\n+----------+\n| CHR(''C'') |\n+----------+\n|          |\n+----------+\n1 row in set, 1 warning (0.000 sec)\n\nSHOW WARNINGS;\n+---------+------+----------------------------------------+\n| Level   | Code | Message                                |\n+---------+------+----------------------------------------+\n| Warning | 1292 | Truncated incorrect INTEGER value: ''C'' |\n+---------+------+----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/chr', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/chr');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (421, 37, 'CONCAT', 'Syntax\n------\n\nCONCAT(str1,str2,...)\n\nDescription\n-----------\n\nReturns the string that results from concatenating the arguments. May have one or more arguments. If all arguments are non-binary strings, the result is a non-binary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form; if you want to avoid that, you can use an explicit type cast, as in this example:\n\n``sql\nSELECT CONCAT(CAST(int_col AS CHAR), char_col);\n`\n\nCONCAT() returns NULL if any argument is NULL.\n\nA NULL parameter hides all information contained in other parameters from the result. Sometimes this is not desirable; to avoid this, you can:\n\n Use the CONCAT_WS() function with an empty separator, because that function is NULL-safe.\n Use IFNULL() to turn NULLs into empty strings.\n\nOracle Mode\n\nIn Oracle mode, CONCAT` ignores null.\n\nExamples\n--------\n\nSELECT CONCAT(''Ma'', ''ria'', ''DB'');\n+---------------------------+\n| CONCAT(''Ma'', ''ria'', ''DB'') |\n+---------------------------+\n| MariaDB                   |\n+---------------------------+\n\nSELECT CONCAT(''Ma'', ''ria'', NULL, ''DB'');\n+---------------------------------+\n| CONCAT(''Ma'', ''ria'', NULL, ''DB'') |\n+---------------------------------+\n| NULL                            |\n+---------------------------------+\n\nSELECT CONCAT(42.0);\n+--------------+\n| CONCAT(42.0) |\n+--------------+\n| 42.0         |\n+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/concat', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/concat');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (422, 37, 'CONCAT\\_WS', 'Syntax\n------\n\nCONCAT_WS(separator,str1,str2,...)\n\nDescription\n-----------\n\nCONCAT_WS() stands for Concatenate With Separator and is a special form of CONCAT(). The first argument is the separator for the rest of the arguments. The separator is added between the strings to be concatenated. The separator can be a string, as can the rest of the arguments.\n\nIf the separator is NULL, the result is NULL; all other NULL values are skipped. This makes CONCAT_WS() suitable when you want to concatenate some values and avoid losing all information if one of them is NULL.\n\nExamples\n--------\n\nSELECT CONCAT_WS('','',''First name'',''Second name'',''Last Name'');\n+-------------------------------------------------------+\n| CONCAT_WS('','',''First name'',''Second name'',''Last Name'') |\n+-------------------------------------------------------+\n| First name,Second name,Last Name                      |\n+-------------------------------------------------------+\n\nSELECT CONCAT_WS(''-'',''Floor'',NULL,''Room'');\n+------------------------------------+\n| CONCAT_WS(''-'',''Floor'',NULL,''Room'') |\n+------------------------------------+\n| Floor-Room                         |\n+------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/concat_ws', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/concat_ws');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (423, 37, 'CONVERT', 'Syntax\n------\n\nCONVERT(expr,type), CONVERT(expr USING transcoding_name)\n\nDescription\n-----------\n\nThe CONVERT() and CAST() functions take a value of one type and produce a value of another type.\n\nThe type can be one of the following values:\n\n BINARY\n CHAR\n DATE\n DATETIME\n \\[DECIMAL [(M\\[,D\\])](../../data-types/numeric-data-types/decimal.md)]\n DOUBLE\n FLOAT\n INTEGER\n   Short for SIGNED INTEGER\n SIGNED \\[INTEGER]\n UNSIGNED \\[INTEGER]\n TIME\n* VARCHAR (in Oracle mode)\n\nNote that in MariaDB, INT and INTEGER are the same thing.\n\nBINARY produces a string with the BINARY data type. If the optional length is given, BINARY(N) causes the cast to use no more than N bytes of the argument. Values shorter than the given number in bytes are padded with 0x00 bytes to make them equal the length value.\n\nCHAR(N) causes the cast to use no more than the number of characters given in the argument.\n\nThe main difference between the CAST() and CONVERT() is that CONVERT(expr,type) is ODBC syntax while CAST(expr as type) and CONVERT(... USING ...) are SQL92 syntax.\n\nCONVERT() with USING is used to convert data between different character sets. In MariaDB, transcoding names are the same as the corresponding character set names. For example, this statement converts the string ''abc'' in the default character set to the corresponding string in the utf8 character set:\n\n``sql\nSELECT CONVERT(''abc'' USING utf8);\n``\n\nExamples\n--------\n\nSELECT enum_col FROM tbl_name \nORDER BY CAST(enum_col AS CHAR);\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/convert', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/convert');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (424, 37, 'ELT', 'Syntax\n------\n\nELT(N, str1[, str2, str3,...])\n\nDescription\n-----------\n\nTakes a numeric argument and a series of string arguments. Returns the string that corresponds to the given numeric position. For instance, it returns str1 if N is 1, str2 if N is 2, and so on. If the numeric argument is a FLOAT, MariaDB rounds it to the nearest INTEGER. If the numeric argument is less than 1, greater than the total number of arguments, or not a number, ELT() returns NULL. It must have at least two arguments.\n\nIt is complementary to the FIELD() function.\n\nExamples\n--------\n\nSELECT ELT(1, ''ej'', ''Heja'', ''hej'', ''foo'');\n+------------------------------------+\n| ELT(1, ''ej'', ''Heja'', ''hej'', ''foo'') |\n+------------------------------------+\n| ej                                 |\n+------------------------------------+\n\nSELECT ELT(4, ''ej'', ''Heja'', ''hej'', ''foo'');\n+------------------------------------+\n| ELT(4, ''ej'', ''Heja'', ''hej'', ''foo'') |\n+------------------------------------+\n| foo                                |\n+------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/elt', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/elt');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (425, 37, 'EXPORT\\_SET', 'Syntax\n------\n\nEXPORT_SET(bits, on, off[, separator[, number_of_bits]])\n\nDescription\n-----------\n\nTakes a minimum of three arguments. Returns a string where each bit in the given bits argument is returned, with the string values given for on and off.\n\nBits are examined from right to left, (from low-order to high-order bits). Strings are added to the result from left to right, separated by a separator string (defaults as '',''). You can optionally limit the number of bits the EXPORT_SET() function examines using the number_of_bits option.\n\nIf any of the arguments are set as NULL, the function returns NULL.\n\nExamples\n--------\n\nSELECT EXPORT_SET(5,''Y'',''N'','','',4);\n+-----------------------------+\n| EXPORT_SET(5,''Y'',''N'','','',4) |\n+-----------------------------+\n| Y,N,Y,N                     |\n+-----------------------------+\n\nSELECT EXPORT_SET(6,''1'',''0'','','',10);\n+------------------------------+\n| EXPORT_SET(6,''1'',''0'','','',10) |\n+------------------------------+\n| 0,1,1,0,0,0,0,0,0,0          |\n+------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/export_set', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/export_set');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (426, 37, 'EXTRACTVALUE', 'Syntax\n------\n\nEXTRACTVALUE(xml_frag, xpath_expr)\n\nDescription\n-----------\n\nThe EXTRACTVALUE() function takes two string arguments: a fragment of XML markup and an XPath expression, (also known as a locator). It returns the text (That is, CDDATA), of the first text node which is a child of the element or elements matching the XPath expression.\n\nIn cases where a valid XPath expression does not match any text nodes in a valid XML fragment, (including the implicit /text() expression), the EXTRACTVALUE() function returns an empty string.\n\nInvalid Arguments\n\nWhen either the XML fragment or the XPath expression is NULL, the EXTRACTVALUE() function returns NULL. When the XML fragment is invalid, it raises a warning Code 1525:\n\n``sql\nWarning (Code 1525): Incorrect XML value: ''parse error at line 1 pos 11: unexpected END-OF-INPUT''\n`\n\nWhen the XPath value is invalid, it generates an Error 1105:\n\n`sql\nERROR 1105 (HY000): XPATH syntax error: '')''\n`\n\nExplicit text() Expressions\n\nThis function is the equivalent of performing a match using the XPath expression after appending /text(). In other words:\n\n`sql\nSELECT\n   EXTRACTVALUE(''<cases><case>example</case></cases>'', ''/cases/case'') \n    AS ''Base Example'',\n   EXTRACTVALUE(''<cases><case>example</case></cases>'', ''/cases/case/text()'') \n    AS ''text() Example'';\n+--------------+----------------+\n| Base Example | text() Example |\n+--------------+----------------+\n| example      | example        |\n+--------------+----------------+\n`\n\nCount Matches\n\nWhen EXTRACTVALUE() returns multiple matches, it returns the content of the first child text node of each matching element, in the matched order, as a single, space-delimited string.\n\nBy design, the EXTRACTVALUE() function makes no distinction between a match on an empty element and no match at all. If you need to determine whether no matching element was found in the XML fragment or if an element was found that contained no child text nodes, use the XPath count() function.\n\nFor instance, when looking for a value that exists, but contains no child text nodes, you would get a count of the number of matching instances:\n\n`sql\nSELECT\n   EXTRACTVALUE(''<cases><case/></cases>'', ''/cases/case'') \n    AS ''Empty Example'',\n   EXTRACTVALUE(''<cases><case/></cases>'', ''count(/cases/case)'') \n    AS ''count() Example'';\n+---------------+-----------------+\n| Empty Example | count() Example |\n+---------------+-----------------+\n|               |               1 |\n+---------------+-----------------+\n`\n\nAlternatively, when looking for a value that doesn''t exist, count() returns 0.\n\n`sql\nSELECT\n   EXTRACTVALUE(''<cases><case/></cases>'', ''/cases/person'') \n    AS ''No Match Example'',\n   EXTRACTVALUE(''<cases><case/></cases>'', ''count(/cases/person)'') \n    AS ''count() Example'';\n+------------------+-----------------+\n| No Match Example | count() Example |\n+------------------+-----------------+\n|                  |                0|\n+------------------+-----------------+\n`\n\nMatches\n\nImportant: The EXTRACTVALUE() function only returns CDDATA. It does not return tags that the element might contain or the text that these child elements contain.\n\n`sql\nSELECT \n  EXTRACTVALUE(''<cases><case>Person<email>x@example.com</email></case></cases>'', ''/cases'')\n   AS Case;\n+--------+\n| Case   |\n+--------+\n| Person |\n+--------+\n`\n\nNote, in the above example, while the XPath expression matches to the parent <case> instance, it does not return the contained <email>` tag or its content.\n\nExamples\n--------\n\nSELECT\n    ExtractValue(''<a>ccc<b>ddd</b></a>'', ''/a'')            AS val1,\n    ExtractValue(''<a>ccc<b>ddd</b></a>'', ''/a/b'')          AS val2,\n    ExtractValue(''<a>ccc<b>ddd</b></a>'', ''//b'')           AS val3,\n    ExtractValue(''<a>ccc<b>ddd</b></a>'', ''/b'')            AS val4,\n    ExtractValue(''<a>ccc<b>ddd</b><b>eee</b></a>'', ''//b'') AS val5;\n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5    |\n+------+------+------+------+---------+\n| ccc  | ddd  | ddd  |      | ddd eee |\n+------+------+------+------+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/extractvalue', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/extractvalue');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (427, 37, 'FIELD', 'Syntax\n------\n\nFIELD(pattern, str1[,str2,...])\n\nDescription\n-----------\n\nReturns the index position of the string or number matching the given pattern. Returns 0 in the event that none of the arguments match the pattern. Raises an Error 1582 if not given at least two arguments.\n\nWhen all arguments given to the FIELD() function are strings, they are treated as case-insensitive. When all the arguments are numbers, they are treated as numbers. Otherwise, they are treated as doubles.\n\nIf the given pattern occurs more than once, the FIELD() function only returns the index of the first instance. If the given pattern is NULL, the function returns 0, as a NULL pattern always fails to match.\n\nThis function is complementary to the ELT() function.\n\nExamples\n--------\n\nSELECT FIELD(''ej'', ''Hej'', ''ej'', ''Heja'', ''hej'', ''foo'') \n   AS ''Field Results'';\n+---------------+\n| Field Results | \n+---------------+\n|             2 |\n+---------------+\n\nSELECT FIELD(''fo'', ''Hej'', ''ej'', ''Heja'', ''hej'', ''foo'')\n   AS ''Field Results'';\n+---------------+\n| Field Results | \n+---------------+\n|             0 |\n+---------------+\n\nSELECT FIELD(1, 2, 3, 4, 5, 1) AS ''Field Results'';\n+---------------+\n| Field Results |\n+---------------+\n|             5 |\n+---------------+\n\nSELECT FIELD(NULL, 2, 3) AS ''Field Results'';\n+---------------+\n| Field Results |\n+---------------+\n|             0 |\n+---------------+\n\nSELECT FIELD(''fail'') AS ''Field Results'';\nError 1582 (42000): Incorrect parameter count in call\nto native function ''field''\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/field', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/field');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (428, 37, 'FIND\\_IN\\_SET', 'Syntax\n------\n\nFIND_IN_SET(pattern, strlist)\n\nDescription\n-----------\n\nReturns the index position where the given pattern occurs in a string list. The first argument is the pattern you want to search for. The second argument is a string containing comma-separated variables. If the second argument is of the SET data-type, the function is optimized to use bit arithmetic.\n\nIf the pattern does not occur in the string list or if the string list is an empty string, the function returns 0. If either argument is NULL, the function returns NULL. The function does not return the correct result if the pattern contains a comma (",") character.\n\nExamples\n--------\n\nSELECT FIND_IN_SET(''b'',''a,b,c,d'') AS "Found Results";\n+---------------+\n| Found Results |\n+---------------+\n|             2 |\n+---------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/find_in_set', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/find_in_set');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (429, 37, 'FORMAT', 'Description\n-----------\n\nFormats the given number for display as a string, adding separators to appropriate position and rounding the results to the given decimal position. For instance, it would format 15233.345 to 15,233.35.\n\nIf the given decimal position is 0, it rounds to return no decimal point or fractional part. You can optionally specify a locale value to format numbers to the pattern appropriate for the given region.\n\nExamples\n--------\n\nSELECT FORMAT(1234567890.09876543210, 4) AS ''Format'';\n+--------------------+\n| Format             |\n+--------------------+\n| 1,234,567,890.0988 |\n+--------------------+\n\nSELECT FORMAT(1234567.89, 4) AS ''Format'';\n+----------------+\n| Format         |\n+----------------+\n| 1,234,567.8900 |\n+----------------+\n\nSELECT FORMAT(1234567.89, 0) AS ''Format'';\n+-----------+\n| Format    |\n+-----------+\n| 1,234,568 |\n+-----------+\n\n-- Format number to German number formatting\nSELECT FORMAT(123456789,2,''de_DE'') AS ''Format'';\n+----------------+\n| Format         |\n+----------------+\n| 123.456.789,00 |\n+----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/format', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/format');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (430, 37, 'FROM\\_BASE64', 'Syntax\n------\n\nFROM_BASE64(str)\n\nDescription\n-----------\n\nDecodes the given base-64 encode string, returning the result as a binary string. Returns NULL if the given string is NULL or if it''s invalid.\n\nIt is the reverse of the TO_BASE64 function.\n\nThere are numerous methods to base-64 encode a string. MariaDB uses the following:\n\n It encodes alphabet value 64 as ''+''.\n It encodes alphabet value 63 as ''/''.\n It codes output in groups of four printable characters. Each three byte of data encoded uses four characters. If the final group is incomplete, it pads the difference with the ''='' character.\n It divides long output, adding a new line very 76 characters.\n* In decoding, it recognizes and ignores newlines, carriage returns, tabs and space whitespace characters.\n\n``sql\nSELECT TO_BASE64(''Maria'') AS ''Input'';\n+-----------+\n| Input     |\n+-----------+\n| TWFyaWE=  |\n+-----------+\n\nSELECT FROM_BASE64(''TWFyaWE='') AS ''Output'';\n+--------+\n| Output |\n+--------+\n| Maria  |\n+--------+\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/from_base64', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/from_base64');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (431, 37, 'HEX', 'Description\n-----------\n\nIf N_or_S is a number, returns a string representation of the hexadecimal value of N, where N is a longlong (BIGINT) number. This is equivalent to CONV(N,10,16).\n\nIf N_or_S is a string, returns a hexadecimal string representation ofN_or_S where each byte of each character in N_or_S is converted to two hexadecimal digits. If N_or_S is NULL, returns NULL. The inverse of this operation is performed by the UNHEX()\\\nfunction.\n\nHEX() with an INET6 argument returns a hexadecimal representation of the underlying 16-byte binary string.\n\nExamples\n--------\n\nSELECT HEX(255);\n+----------+\n| HEX(255) |\n+----------+\n| FF       |\n+----------+\n\nSELECT 0x4D617269614442;\n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB          |\n+------------------+\n\nSELECT HEX(''MariaDB'');\n+----------------+\n| HEX(''MariaDB'') |\n+----------------+\n| 4D617269614442 |\n+----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/hex', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/hex');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (432, 37, 'INSERT Function', 'Syntax\n------\n\nINSERT(str,pos,len,newstr)\n\nDescription\n-----------\n\nReturns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr. Returns the original string if pos is not within the length of the string.\\\nReplaces the rest of the string from position pos if len is not within the length of the rest of the string. Returns NULL if any argument is NULL.\n\nExamples\n--------\n\nSELECT INSERT(''Quadratic'', 3, 4, ''What'');\n+-----------------------------------+\n| INSERT(''Quadratic'', 3, 4, ''What'') |\n+-----------------------------------+\n| QuWhattic                         |\n+-----------------------------------+\n\nSELECT INSERT(''Quadratic'', -1, 4, ''What'');\n+------------------------------------+\n| INSERT(''Quadratic'', -1, 4, ''What'') |\n+------------------------------------+\n| Quadratic                          |\n+------------------------------------+\n\nSELECT INSERT(''Quadratic'', 3, 100, ''What'');\n+-------------------------------------+\n| INSERT(''Quadratic'', 3, 100, ''What'') |\n+-------------------------------------+\n| QuWhat                              |\n+-------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/insert-function', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/insert-function');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (433, 37, 'INSTR', 'Syntax\n------\n\nINSTR(str,substr)\n\nDescription\n-----------\n\nReturns the position of the first occurrence of substring _substr_ in string _str_. This is the same as the two-argument form of LOCATE(), except that the order of the arguments is reversed.\n\nINSTR() performs a case-insensitive search.\n\nIf any argument is NULL, returns NULL.\n\nExamples\n--------\n\nSELECT INSTR(''foobarbar'', ''bar'');\n+---------------------------+\n| INSTR(''foobarbar'', ''bar'') |\n+---------------------------+\n|                         4 |\n+---------------------------+\n\nSELECT INSTR(''My'', ''Maria'');\n+----------------------+\n| INSTR(''My'', ''Maria'') |\n+----------------------+\n|                    0 |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/instr', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/instr');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (434, 37, 'LCASE', 'Syntax\n------\n\nLCASE(str)\n\nDescription\n-----------\n\nLCASE() is a synonym for LOWER().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/lcase', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/lcase');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (435, 37, 'LEFT', 'Syntax\n------\n\nLEFT(str,len)\n\nDescription\n-----------\n\nReturns the leftmost len characters from the string str, or NULL if any argument is NULL.\n\nExamples\n--------\n\nSELECT LEFT(''MariaDB'', 5);\n+--------------------+\n| LEFT(''MariaDB'', 5) |\n+--------------------+\n| Maria              |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/left', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/left');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (436, 37, 'LENGTH', 'Syntax\n------\n\nLENGTH(str)\n\nDescription\n-----------\n\nReturns the length of the string str.\n\nIn the default mode, when Oracle mode is not set, the length is measured in bytes. In this case, a multi-byte character counts as multiple bytes. LENGTH() returns the length in bytes, whereas CHAR_LENGTH() returns the number of characters. This means that, for a string containing five two-byte characters, LENGTH() returns 10, whereas CHAR_LENGTH() returns 5.\nWhen running Oracle mode, the length is measured in characters, and LENGTH is a synonym for CHAR_LENGTH().\n\nIf str is not a string value, it is converted into a string. If str is NULL, the function returns NULL.\n\nExamples\n--------\n\nSELECT LENGTH(''MariaDB'');\n+-------------------+\n| LENGTH(''MariaDB'') |\n+-------------------+\n|                 7 |\n+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/length', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/length');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (437, 37, 'LENGTHB', 'Syntax\n------\n\nLENGTHB(str)\n\nDescription\n-----------\n\nLENGTHB() returns the length of the given string, in bytes. When Oracle mode is not set, this is a synonym for LENGTH.\n\nA multi-byte character counts as multiple bytes. This means that for a string containing five two-byte characters, LENGTHB() returns 10, whereas CHAR_LENGTH() returns 5.\n\nIf str is not a string value, it is converted into a string. If str is NULL, the function returns NULL.\n\nExamples\n--------\n\nSELECT CHAR_LENGTH(''π''), LENGTH(''π''), LENGTHB(''π''), OCTET_LENGTH(''π'');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(''π'')  | LENGTH(''π'')  | LENGTHB(''π'')  | OCTET_LENGTH(''π'')  |\n+-------------------+--------------+---------------+--------------------+\n|                 1 |            2 |             2 |                  2 |\n+-------------------+--------------+---------------+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/lengthb', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/lengthb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (438, 37, 'LIKE', 'Description\n-----------\n\nTests whether _expr_ matches the pattern _pat_. Returns either 1 (TRUE) or 0 (FALSE).\\\nBoth _expr_ and _pat_ may be any valid expression and are evaluated to strings.\\\nPatterns may use the following wildcard characters:\n\n % matches any number of characters, including zero.\n _ matches any single character.\n\nUse NOT LIKE to test if a string does not match a pattern. This is equivalent to using\\\nthe NOT operator on the entire LIKE expression.\n\nIf either the expression or the pattern is NULL, the result is NULL.\n\nLIKE performs case-insensitive substring matches if the collation for the expression and pattern is case-insensitive. For case-sensitive matches, declare either argument to use a binary collation using collate, or coerce either of them to a BINARY string using CAST. Use SHOW COLLATION to get a list of\\\navailable collations. Collations ending in _bin are case-sensitive.\n\nNumeric arguments are coerced to binary strings.\n\nThe _ wildcard matches a single character, not byte. It will only match a multi-byte character\\\nif it is valid in the expression''s character set. For example, _ will match _utf8"€", but it\\\nwill not match _latin1"€" because the Euro sign is not a valid latin1 character. If necessary,\\\nuse CONVERT to use the expression in a different character set.\n\nIf you need to match the characters _ or %, you must escape them. By default, you can prefix the wildcard characters the backslash character \\ to escape them. The backslash is used both to encode special characters like newlines when a string is parsed as well as to escape wildcards in a pattern after parsing. Thus, to match an actual backslash, you sometimes need to double-escape it as "\\\\\\\\".\n\nTo avoid difficulties with the backslash character, you can change the wildcard escape character using ESCAPE in a LIKE expression. The argument to ESCAPE must be a single-character string.\n\nExamples\n--------\n\nCREATE TABLE t1 (d VARCHAR(16));\nINSERT INTO t1 VALUES \n  ("Monday"), ("Tuesday"), ("Wednesday"), \n  ("Thursday"), ("Friday"), ("Saturday"), ("Sunday");\nSELECT * FROM t1 WHERE d LIKE "T%";\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/like', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/like');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (439, 37, 'LOAD\\_FILE', 'Syntax\n------\n\nLOAD_FILE(file_name)\n\nDescription\n-----------\n\nReads the file and returns the file contents as a string. To use this function, the file must be located on the server host, you must specify the full path name to the file, and you must have the FILE privilege. The file must be readable by all and it must be less than the size, in bytes, of the max_allowed_packet system variable. If the secure_file_priv system variable is set to a non-empty directory name, the file to be loaded must be located in that directory.\n\nIf the file does not exist or cannot be read because one of the preceding conditions is not satisfied, the function returns NULL.\n\nThe character_set_filesystem system variable has controlled interpretation of file names that are given as literal strings.\n\nStatements using the LOAD_FILE() function are not safe for statement based replication. This is because the slave will execute the LOAD_FILE() command itself. If the file doesn''t exist on the slave, the function will return NULL.\n\nExamples\n--------\n\nUPDATE t SET blob_col=LOAD_FILE(''/tmp/picture'') WHERE id=1;\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/load_file', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/load_file');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (440, 37, 'LOCATE', 'Syntax\n------\n\nLOCATE(substr,str), LOCATE(substr,str,pos)\n\nDescription\n-----------\n\nThe first syntax returns the position of the first occurrence of substring substr in string str. The second syntax returns the position of the first occurrence of substring substr in string str, starting at position pos. Returns 0 if substr is not in str.\n\nLOCATE() performs a case-insensitive search.\n\nIf any argument is NULL, returns NULL.\n\nINSTR() is the same as the two-argument form of LOCATE(), except that the order of the arguments is reversed.\n\nExamples\n--------\n\nSELECT LOCATE(''bar'', ''foobarbar'');\n+----------------------------+\n| LOCATE(''bar'', ''foobarbar'') |\n+----------------------------+\n|                          4 |\n+----------------------------+\n\nSELECT LOCATE(''My'', ''Maria'');\n+-----------------------+\n| LOCATE(''My'', ''Maria'') |\n+-----------------------+\n|                     0 |\n+-----------------------+\n\nSELECT LOCATE(''bar'', ''foobarbar'', 5);\n+-------------------------------+\n| LOCATE(''bar'', ''foobarbar'', 5) |\n+-------------------------------+\n|                             7 |\n+-------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/locate', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/locate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (441, 37, 'LOWER', 'Syntax\n------\n\nLOWER(str)\nLCASE(str)\n\nDescription\n-----------\n\nReturns the string str with all characters changed to lowercase according to the current character set mapping. The default is latin1 (cp1252 West European).\n\nLCASE is a synonym for LOWER .\n\nExamples\n--------\n\nSELECT LOWER(''QUADRATICALLY'');\n+------------------------+\n| LOWER(''QUADRATICALLY'') |\n+------------------------+\n| quadratically          |\n+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/lower', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/lower');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (442, 37, 'LPAD', 'Syntax\n------\n\nLPAD(str, len [,padstr])\n\nDescription\n-----------\n\nReturns the string str, left-padded with the string padstr to a length of len characters. If str is longer than len, the return value is shortened to len characters. If padstr is omitted, the LPAD function pads spaces.\n\nReturns NULL if given a NULL argument. If the result is empty (zero length), returns either an empty string or with SQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode by using LPAD_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT LPAD(''hello'',10,''.'');\n+----------------------+\n| LPAD(''hello'',10,''.'') |\n+----------------------+\n| .....hello           |\n+----------------------+\n\nSELECT LPAD(''hello'',2,''.'');\n+---------------------+\n| LPAD(''hello'',2,''.'') |\n+---------------------+\n| he                  |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/lpad', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/lpad');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (443, 37, 'LTRIM', 'Syntax\n------\n\nLTRIM(str)\n\nDescription\n-----------\n\nReturns the string str with leading space characters removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either an empty string, or with SQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode by using LTRIM_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT QUOTE(LTRIM(''   MariaDB   ''));\n+-------------------------------+\n| QUOTE(LTRIM(''   MariaDB   '')) |\n+-------------------------------+\n| ''MariaDB   ''                  |\n+-------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/ltrim', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/ltrim');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (444, 37, 'MAKE\\_SET', 'Syntax\n------\n\nMAKE_SET(bits,str1,str2,...)\n\nDescription\n-----------\n\nReturns a set value (a string containing substrings separated by "," characters) consisting of the strings that have the corresponding bit in bits set. _str1_ corresponds to bit 0, _str2_ to bit 1, and so on. NULL\\\nvalues in _str1_, _str2_, ... are not appended to the result.\n\nExamples\n--------\n\nSELECT MAKE_SET(1,''a'',''b'',''c'');\n+-------------------------+\n| MAKE_SET(1,''a'',''b'',''c'') |\n+-------------------------+\n| a                       |\n+-------------------------+\n\nSELECT MAKE_SET(1 | 4,''hello'',''nice'',''world'');\n+----------------------------------------+\n| MAKE_SET(1 | 4,''hello'',''nice'',''world'') |\n+----------------------------------------+\n| hello,world                            |\n+----------------------------------------+\n\nSELECT MAKE_SET(1 | 4,''hello'',''nice'',NULL,''world'');\n+---------------------------------------------+\n| MAKE_SET(1 | 4,''hello'',''nice'',NULL,''world'') |\n+---------------------------------------------+\n| hello                                       |\n+---------------------------------------------+\n\nSELECT QUOTE(MAKE_SET(0,''a'',''b'',''c''));\n+--------------------------------+\n| QUOTE(MAKE_SET(0,''a'',''b'',''c'')) |\n+--------------------------------+\n| ''''                             |\n+--------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/make_set', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/make_set');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (445, 37, 'MATCH AGAINST', 'Syntax\n------\n\nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n\nDescription\n-----------\n\nA special construct used to perform a fulltext search on a fulltext index.\n\nSee Fulltext Index Overview for a full description, and Full-text Indexes for more articles on the topic.\n\nExamples\n--------\n\nCREATE TABLE ft_myisam(copy TEXT,FULLTEXT(copy)) ENGINE=MyISAM;\n\nINSERT INTO ft_myisam(copy) VALUES (''Once upon a time''), (''There was a wicked witch''), \n (''Who ate everybody up'');\n\nSELECT * FROM ft_myisam WHERE MATCH(copy) AGAINST(''wicked'');\n+--------------------------+\n| copy                     |\n+--------------------------+\n| There was a wicked witch |\n+--------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/match-against', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/match-against');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (446, 37, 'MID', 'Syntax\n------\n\nMID(str,pos,len)\n\nDescription\n-----------\n\nMID(str,pos,len) is a synonym for SUBSTRING(str,pos,len)!\n\nExamples\n--------\n\nSELECT MID(''abcd'',4,1);\n+-----------------+\n| MID(''abcd'',4,1) |\n+-----------------+\n| d               |\n+-----------------+\n\nSELECT MID(''abcd'',2,2);\n+-----------------+\n| MID(''abcd'',2,2) |\n+-----------------+\n| bc              |\n+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/mid', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/mid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (447, 37, 'NATURAL\\_SORT\\_KEY', 'Syntax\n------\n\nNATURAL_SORT_KEY(str)\n\nDescription\n-----------\n\nThe NATURAL_SORT_KEY function is used for sorting that is closer to natural sorting. Strings are sorted in alphabetical order, while numbers are treated in a way such that, for example, 10 is greater than 2, whereas in other forms of sorting, 2 would be greater than 10, just like z is greater than ya.\n\nThere are multiple natural sort implementations, differing in the way they handle leading zeroes, fractions, i18n, negatives, decimals and so on.\n\nMariaDB''s implementation ignores leading zeroes when performing the sort.\n\nYou can use also use NATURAL_SORT_KEY with generated columns. The value is not stored permanently in the table. When using a generated column, the virtual column must be longer than the base column to cater for embedded numbers in the string and MDEV-24582.\n\nExamples\n--------\n\nCREATE TABLE t1 (c TEXT);\n\nINSERT INTO t1 VALUES (''b1''),(''a2''),(''a11''),(''a1'');\n\nSELECT c FROM t1;\n+------+\n| c    |\n+------+\n| b1   |\n| a2   |\n| a11  |\n| a1   |\n+------+\n\nSELECT c FROM t1 ORDER BY c;\n+------+\n| c    |\n+------+\n| a1   |\n| a11  |\n| a2   |\n| b1   |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/natural_sort_key', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/natural_sort_key');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (448, 37, 'NOT LIKE', 'Syntax\n------\n\nexpr NOT LIKE pat [ESCAPE ''escape_char'']\n\nDescription\n-----------\n\nThis is the same as [NOT (expr LIKE pat \\[ESCAPE ''escape_char''\\])](../../sql-structure/operators/logical-operators/not.md).\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/not-like', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/not-like');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (449, 37, 'NOT REGEXP', 'Syntax\n------\n\nexpr NOT REGEXP pat, expr NOT RLIKE pat\n\nDescription\n-----------\n\nThis is the same as NOT (expr REGEXP pat).\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/not-regexp', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/not-regexp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (450, 37, 'OCTET\\_LENGTH', 'Description\n-----------\n\nOCTET_LENGTH() returns the length of the given string, in octets (bytes). This is a synonym for LENGTHB(), and, when Oracle mode is not set, a synonym for LENGTH().\n\nA multi-byte character counts as multiple bytes. This means that for a string containing five two-byte characters, OCTET_LENGTH() returns 10, whereas CHAR_LENGTH() returns 5.\n\nIf str is not a string value, it is converted into a string. If str is NULL, the function returns NULL.\n\nExamples\n--------\n\nSELECT CHAR_LENGTH(''π''), LENGTH(''π''), LENGTHB(''π''), OCTET_LENGTH(''π'');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(''π'')  | LENGTH(''π'')  | LENGTHB(''π'')  | OCTET_LENGTH(''π'')  |\n+-------------------+--------------+---------------+--------------------+\n|                 1 |            2 |             2 |                  2 |\n+-------------------+--------------+---------------+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/octet_length', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/octet_length');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (451, 37, 'ORD', 'Syntax\n------\n\nORD(str)\n\nDescription\n-----------\n\nIf the leftmost character of the string str is a multi-byte character, returns the code for that character, calculated from the numeric values of its constituent bytes using this formula:\n\n``sql\n(1st byte code)\n+ (2nd byte code x 256)\n+ (3rd byte code x 256 x 256) ...\n`\n\nIf the leftmost character is not a multi-byte character, ORD()` returns the same value as the ASCII() function.\n\nExamples\n--------\n\nSELECT ORD(''2'');\n+----------+\n| ORD(''2'') |\n+----------+\n|       50 |\n+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/ord', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/ord');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (452, 37, 'POSITION', 'Syntax\n------\n\nPOSITION(substr IN str)\n\nDescription\n-----------\n\nPOSITION(substr IN str) is a synonym for LOCATE(substr,str).\n\nThe function is part of ODBC 3.0.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/position', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/position');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (453, 37, 'QUOTE', 'Syntax\n------\n\nQUOTE(str)\n\nDescription\n-----------\n\nQuotes a string to produce a result that can be used as a properly escaped data value in an SQL statement. The string is returned enclosed by single quotes and with each instance of single quote ("''"), backslash ("\\"),ASCII NUL, and Control-Z preceded by a backslash. If the argument is NULL, the return value is the word "NULL" without enclosing single quotes.\n\nExamples\n--------\n\nSELECT QUOTE("Don''t!");\n+-----------------+\n| QUOTE("Don''t!") |\n+-----------------+\n| ''Don\\''t!''       |\n+-----------------+\n\nSELECT QUOTE(NULL); \n+-------------+\n| QUOTE(NULL) |\n+-------------+\n| NULL        |\n+-------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/quote', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/quote');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (454, 37, 'PCRE - Perl Compatible Regular Expressions', 'Description\n-----------\n\nPCRE Versions\n\n| PCRE Version                         | Introduced                                                                                                                                                                                                                                                                                                                               | Maturity |\n| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |\n| PCRE2 10.34 | MariaDB 10.5.1                                                                                                                                                                                                                               | Stable   |\n| PCRE 8.43                            | MariaDB 10.1.39                                                                                                                                                                                                                             | Stable   |\n| PCRE 8.42                            | MariaDB 10.2.15, MariaDB 10.1.33, MariaDB 10.0.35 | Stable   |\n| PCRE 8.41                            | MariaDB 10.2.8, MariaDB 10.1.26, MariaDB 10.0.32   | Stable   |\n| PCRE 8.40                            | MariaDB 10.2.5, MariaDB 10.1.22, MariaDB 10.0.30   | Stable   |\n| PCRE 8.39                            | MariaDB 10.1.15, MariaDB 10.0.26                                                                                                               | Stable   |\n| PCRE 8.38                            | MariaDB 10.1.10, MariaDB 10.0.23                                                                                                               | Stable   |\n| PCRE 8.37                            | MariaDB 10.1.5, MariaDB 10.0.18                                                                                                                 | Stable   |\n| PCRE 8.36                            | MariaDB 10.1.2, MariaDB 10.0.15                                                                                                                 | Stable   |\n| PCRE 8.35                            | MariaDB 10.1.0, MariaDB 10.0.12                                                                                                                 | Stable   |\n| PCRE 8.34                            | MariaDB 10.0.8                                                                                                                                                                                                                               | Stable   |\n\nPCRE Enhancements\n\nMariaDB uses the PCRE library, which significantly improves the power of the REGEXP/RLIKE operator.\n\nThe switch to PCRE added a number of features, including recursive patterns, named capture, look-ahead and look-behind assertions, non-capturing groups, non-greedy quantifiers, Unicode character properties, extended syntax for characters and character classes, multi-line matching, and many other.\n\nThese functions work with regular expressions: REGEXP_REPLACE(), REGEXP_INSTR(), and REGEXP_SUBSTR().\n\nAlso, REGEXP/RLIKE, and the new functions, work correctly with all multi-byte character sets supported by MariaDB, including East-Asian character sets (big5, gb2313, gbk, eucjp, eucjpms, cp932, ujis, euckr), and Unicode character sets (utf8, utf8mb4, ucs2, utf16, utf16le, utf32).\n\nNew Regular Expression Functions\n\n REGEXP_REPLACE(subject, pattern, replace) - Replaces all occurrences of a pattern.\n REGEXP_INSTR(subject, pattern) - Position of the first appearance of a regex.\n REGEXP_SUBSTR(subject,pattern) - Returns the matching part of a string.\n\nSee the individual articles for more details and examples.\n\nPCRE Syntax\n\nIn most cases PCRE is backward compatible with the old POSIX 1003.2 compliant regexp library (see Regular Expressions Overview), so you won''t need to change your applications that use SQL queries with the REGEXP/RLIKE predicate.\n\nThis section briefly describes the most important extended PCRE features. For more details, please refer to the documentation on the PCRE site, or to the documentation which is bundled in the /pcre/doc/html/ directory of a MariaDB sources distribution. The pages pcresyntax.html and pcrepattern.html should be a good start. Regular-Expressions.Info is another good resource to learn about PCRE and regular expressions generally.\n\nSpecial Characters\n\nPCRE supports the following escape sequences to match special characters:\n\n| Sequence  | Description                                 |\n| --------- | ------------------------------------------- |\n| \\a        | 0x07 (BEL)                                  |\n| \\cx       | "control-x", where x is any ASCII character |\n| \\e        | 0x1B (escape)                               |\n| \\f        | 0x0C (form feed)                            |\n|           | 0x0A (newline)                              |\n|           | 0x0D (carriage return)                      |\n|           | 0x09 (TAB)                                  |\n| \\ddd      | character with octal code ddd               |\n| \\xhh      | character with hex code hh                  |\n| \\x{hhh..} | character with hex code hhh..               |\n\nNote, the backslash characters (here, and in all examples in the sections below) must be escaped with another backslash, unless you''re using the SQL_MODE NO_BACKSLASH_ESCAPES.\n\nThis example tests if a character has hex code 0x61:\n\n``sql\nSELECT ''a'' RLIKE ''\\\\x{61}'';\n-> 1\n`\n\nCharacter Classes\n\nPCRE supports the standard POSIX character classes such as alnum, alpha, blank, cntrl, digit, graph, lower, print, punct, space, upper, xdigit, with the following additional classes:\n\n| Class | Description                                                |\n| ----- | ---------------------------------------------------------- |\n| ascii | any ASCII character (0x00..0x7F)                           |\n| word  | any "word" character (a letter, a digit, or an underscore) |\n\nThis example checks if the string consists of ASCII characters only:\n\n`\nSELECT ''abc'' RLIKE ''^[[:ascii:]]+$'';\n-> 1\n`\n\nGeneric Character Types\n\nGeneric character types complement the POSIX character classes and serve to simplify writing patterns:\n\n| Class | Description                                                |\n| ----- | ---------------------------------------------------------- |\n| \\d    | a decimal digit (same as \\[:digit:])                       |\n| \\D    | a character that is not a decimal digit                    |\n| \\h    | a horizontal white space character                         |\n| \\H    | a character that is not a horizontal white space character |\n|       | a character that is not a new line                         |\n|       | a newline sequence                                         |\n| \\s    | a white space character                                    |\n| \\S    | a character that is not a white space character            |\n| \\v    | a vertical white space character                           |\n| \\V    | a character that is not a vertical white space character   |\n| \\w    | a "word" character (same as \\[:word:])                     |\n| \\W    | a "non-word" character                                     |\n\nThis example checks if the string consists of "word" characters only:\n\n`sql\nSELECT ''abc'' RLIKE ''^\\\\w+$'';\n-> 1\n`\n\nUnicode Character Properties\n\n\\p{xx} is a character with the xx property, and \\P{xx} is a character without the xx property.\n\nThe property names represented by xx above are limited to the Unicode script names, the general category properties, and "Any", which matches any character (including newline). Those that are not part of an identified script are lumped together as "Common".\n\nGeneral Category Properties For \\p and \\P\n\n| Property | Description           |\n| -------- | --------------------- |\n| C        | Other                 |\n| Cc       | Control               |\n| Cf       | Format                |\n| Cn       | Unassigned            |\n| Co       | Private use           |\n| Cs       | Surrogate             |\n| L        | Letter                |\n| Ll       | Lower case letter     |\n| Lm       | Modifier letter       |\n| Lo       | Other letter          |\n| Lt       | Title case letter     |\n| Lu       | Upper case letter     |\n| L&       | Ll, Lu, or Lt         |\n| M        | Mark                  |\n| Mc       | Spacing mark          |\n| Me       | Enclosing mark        |\n| Mn       | Non-spacing mark      |\n| N        | Number                |\n| Nd       | Decimal number        |\n| Nl       | Letter number         |\n| No       | Other number          |\n| P        | Punctuation           |\n| Pc       | Connector punctuation |\n| Pd       | Dash punctuation      |\n| Pe       | Close punctuation     |\n| Pf       | Final punctuation     |\n| Pi       | Initial punctuation   |\n| Po       | Other punctuation     |\n| Ps       | Open punctuation      |\n| S        | Symbol                |\n| Sc       | Currency symbol       |\n| Sk       | Modifier symbol       |\n| Sm       | Mathematical symbol   |\n| So       | Other symbol          |\n| Z        | Separator             |\n| Zl       | Line separator        |\n| Zp       | Paragraph separator   |\n| Zs       | Space separator       |\n\nThis example checks if the string consists only of characters with property N (number):\n\n`sql\nSELECT ''1¼①'' RLIKE ''^\\\\p{N}+$'';\n-> 1\n`\n\nSpecial Category Properties For \\p and \\P\n\n| Property | Description                                                       |\n| -------- | ----------------------------------------------------------------- |\n| Xan      | Alphanumeric: union of properties L and N                         |\n| Xps      | POSIX space: property Z or tab, NL, VT, FF, CR                    |\n| Xsp      | Perl space: property Z or tab, NL, FF, CR                         |\n| Xuc      | A character than can be represented by a Universal Character Name |\n| Xwd      | Perl word: property Xan or underscore                             |\n\nThe property Xuc matches any character that can be represented by a Universal Character Name (in C++ and other programming languages). These include $, @, \\\\\\, and all characters with Unicode code points greater than U+00A0, excluding the surrogates U+D800..U+DFFF.\n\nScript Names For \\p and \\P\n\nArabic, Armenian, Avestan, Balinese, Bamum, Batak, Bengali, Bopomofo, Brahmi, Braille, Buginese, Buhid, Canadian_Aboriginal, Carian, Chakma, Cham, Cherokee, Common, Coptic, Cuneiform, Cypriot, Cyrillic, Deseret, Devanagari, Egyptian_Hieroglyphs, Ethiopic, Georgian, Glagolitic, Gothic, Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hiragana, Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscriptional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li, Kharoshthi, Khmer, Lao, Latin, Lepcha, Limbu, Linear_B, Lisu, Lycian, Lydian, Malayalam, Mandaic, Meetei_Mayek, Meroitic_Cursive, Meroitic_Hieroglyphs, Miao, Mongolian, Myanmar, New_Tai_Lue, Nko, Ogham, Old_Italic, Old_Persian, Old_South_Arabian, Old_Turkic, Ol_Chiki, Oriya, Osmanya, Phags_Pa, Phoenician, Rejang, Runic, Samaritan, Saurashtra, Sharada, Shavian, Sinhala, Sora_Sompeng, Sundanese, Syloti_Nagri, Syriac, Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet, Takri, Tamil, Telugu, Thaana, Thai, Tibetan, Tifinagh, Ugaritic, Vai, Yi.\n\nThis example checks if the string consists only of Greek characters:\n\n``sql\nSELECT ''ΣΦΩ'' RLIKE ''^\\\\p{Greek}+$'';\n-> 1\n`\n\nExtended Unicode Grapheme Sequence\n\nThe \\X escape sequence matches a character sequence that makes an "extended grapheme cluster", i.e. a composite character that consists of multiple Unicode code points.\n\nOne of the examples of a composite character can be a letter followed by non-spacing accent marks. This example demonstrates that U+0045 LATIN CAPITAL LETTER E followed by U+0302 COMBINING CIRCUMFLEX ACCENT followed by U+0323 COMBINING DOT BELOW together form an extended grapheme cluster:\n\n`sql\nSELECT _ucs2 0x004503020323 RLIKE ''^\\\\X$'';\n-> 1\n`\n\nSee the PCRE documentation for the other types of extended grapheme clusters.\n\nSimple Assertions\n\nAn assertion specifies a certain condition that must match at a particular point, but without consuming characters from the subject string. In addition to the standard POSIX simple assertions ^ (that matches at the beginning of a line) and $ (that matches at the end of a line), PCRE supports a number of other assertions:\n\n| Assertion | Description                                                                                |\n| --------- | ------------------------------------------------------------------------------------------ |\n| \\b        | matches at a word boundary                                                                 |\n| \\B        | matches when not at a word boundary                                                        |\n| \\A        | matches at the start of the subject                                                        |\n| \\Z        | matches at the end of the subject, also matches before a newline at the end of the subject |\n| \\z        | matches only at the end of the subject                                                     |\n| \\G        | matches at the first matching position in the subject                                      |\n\nThis example cuts a word that consists only of 3 characters from a string:\n\n`sql\nSELECT REGEXP_SUBSTR(''---abcd---xyz---'', ''\\\\b\\\\w{3}\\\\b'');\n-> xyz\n`\n\nNotice that the two \\b assertions checked the word boundaries but did not get into the matching pattern.\n\nThe \\b assertions work well in the beginning and the end of the subject string:\n\n`sql\nSELECT REGEXP_SUBSTR(''xyz'', ''\\\\b\\\\w{3}\\\\b'');\n-> xyz\n`\n\nBy default, the ^ and $ assertions have the same meaning with \\A, \\Z, and \\z. However, the meanings of ^ and $ can change in multiline mode (see below). By contrast, the meanings of \\A, \\Z, and \\z are always the same; they are independent of the multiline mode.\n\nOption Setting\n\nA number of options that control the default match behavior can be changed within the pattern by a sequence of option letters enclosed between (? and ).\n\n| Option  | Description                                                              |\n| ------- | ------------------------------------------------------------------------ |\n| (?i)    | case insensitive match                                                   |\n| (?m)    | multiline mode                                                           |\n| (?s)    | dotall mode (dot matches newline characters)                             |\n| (?x)    | extended (ignore white space)                                            |\n| (?U)    | ungreedy (lazy) ma\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/pcre');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (455, 37, 'REGEXP', 'Syntax\n------\n\nexpr REGEXP pat, expr RLIKE pat\n\nDescription\n-----------\n\nPerforms a pattern match of a string expression expr against a patternpat. The pattern can be an extended regular expression. See Regular Expressions Overview for details on the syntax for\\\nregular expressions (see also PCRE Regular Expressions).\n\nReturns 1 if expr matches pat or 0 if it doesn''t match. If either expr or pat are NULL, the result is NULL.\n\nThe negative form NOT REGEXP also exists, as an alias for NOT (string REGEXP pattern). RLIKE and NOT RLIKE are synonyms for REGEXP and NOT REGEXP, originally provided for mSQL compatibility.\n\nThe pattern need not be a literal string. For example, it can be specified as a string expression or table column.\n\nNote: Because MariaDB uses the C escape syntax in strings (for example, "\\n" to represent the newline character), you must double any "" that you use in your REGEXP strings.\n\nREGEXP is not case sensitive, except when used with binary strings.\n\nThe default_regex_flags variable addresses the remaining compatibilities between PCRE and the old regex library.\n\nExamples\n--------\n\nSELECT ''Monty!'' REGEXP ''m%y%%'';\n+-------------------------+\n| ''Monty!'' REGEXP ''m%y%%'' |\n+-------------------------+\n|                       0 |\n+-------------------------+\n\nSELECT ''Monty!'' REGEXP ''.'';\n+----------------------+\n| ''Monty!'' REGEXP ''.'' |\n+----------------------+\n|                    1 |\n+----------------------+\n\nSELECT ''new\\nline'' REGEXP ''new\\\\.\\\\line'';\n+---------------------------------------+\n| ''new\\nline'' REGEXP ''new\\\\.\\\\line'' |\n+---------------------------------------+\n|                                     1 |\n+---------------------------------------+\n\nSELECT ''a'' REGEXP ''A'', ''a'' REGEXP BINARY ''A'';\n+----------------+-----------------------+\n| ''a'' REGEXP ''A'' | ''a'' REGEXP BINARY ''A'' |\n+----------------+-----------------------+\n|              1 |                     0 |\n+----------------+-----------------------+\n\nSELECT ''a'' REGEXP ''^[a-d]'';\n+---------------------+\n| ''a'' REGEXP ''^[a-d]'' |\n+---------------------+\n|                   1 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (456, 37, 'REGEXP\\_INSTR', 'Description\n-----------\n\nSyntax\n\n``sql\nREGEXP_INSTR(subject, pattern)\n`\n\nReturns the position of the first occurrence of the regular expression pattern in the string subject, or 0 if pattern was not found.\n\nThe positions start with 1 and are measured in characters (i.e. not in bytes), which is important for multi-byte character sets. You can cast a multi-byte character set to BINARY to get offsets in bytes.\n\nThe function follows the case sensitivity rules of the effective collation. Matching is performed case insensitively for case insensitive collations, and case sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i) PCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular expression performance, and REGEXP_INSTR` was introduced as part of this enhancement.\n\nExamples\n--------\n\nSELECT REGEXP_INSTR(''abc'',''b'');\n-> 2\n\nSELECT REGEXP_INSTR(''abc'',''x'');\n-> 0\n\nSELECT REGEXP_INSTR(''BJÖRN'',''N'');\n-> 5\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_instr', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_instr');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (457, 37, 'REGEXP\\_REPLACE', 'Syntax\n------\n\nREGEXP_REPLACE(subject, pattern, replace)\n\nDescription\n-----------\n\nREGEXP_REPLACE returns the string subject with all occurrences of the regular expression pattern replaced by the string replace. If no occurrences are found, then subject is returned as is.\n\nThe replace string can have backreferences to the subexpressions in the form \\N, where N is a number from 1 to 9.\n\nThe function follows the case sensitivity rules of the effective collation. Matching is performed case insensitively for case insensitive collations, and case sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i) PCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular expression performance, and REGEXP_REPLACE was introduced as part of this enhancement.\n\nThe default_regex_flags variable addresses the remaining compatibilities between PCRE and the old regex library.\n\nExamples\n--------\n\nSELECT REGEXP_REPLACE(''ab12cd'',''[0-9]'','''') AS remove_digits;\n-> abcd\n\nSELECT REGEXP_REPLACE(''<html><head><title>title</title><body>body</body></htm>'', ''<.+?>'','' '')\nAS strip_html;\n-> title  body\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_replace', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_replace');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (458, 37, 'REGEXP\\_SUBSTR', 'Syntax\n------\n\nREGEXP_SUBSTR(subject,pattern)\n\nDescription\n-----------\n\nReturns the part of the string subject that matches the regular expression pattern, or an empty string if pattern was not found.\n\nThe function follows the case sensitivity rules of the effective collation. Matching is performed case insensitively for case insensitive collations, and case sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i) PCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular expression performance, and REGEXP_SUBSTR was introduced as part of this enhancement.\n\nThe default_regex_flags variable addresses the remaining compatibilities between PCRE and the old regex library.\n\nExamples\n--------\n\nSELECT REGEXP_SUBSTR(''ab12cd'',''[0-9]+'');\n-> 12\n\nSELECT REGEXP_SUBSTR(\n  ''See https://mariadb.org/en/foundation/ for details'',\n  ''https?://[^/]*'');\n-> https://mariadb.org\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_substr', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_substr');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (459, 37, 'Regular Expressions Overview', 'Description\n-----------\n\nRegular Expressions allow MariaDB to perform complex pattern matching on a string. In many cases, the simple pattern matching provided by LIKE is sufficient. LIKE performs two kinds of matches:\n\n _ - the underscore, matching a single character\n % - the percentage sign, matching any number of characters.\n\nIn other cases you may need more control over the returned matches, and will need to use regular expressions.\n\nRegular expression matches are performed with the REGEXP function. RLIKE is a synonym for REGEXP.\n\nComparisons are performed on the byte value, so characters that are treated as equivalent by a collation, but do not have the same byte-value, such as accented characters, could evaluate as unequal.\n\nWithout any special characters, a regular expression match is true if the characters match. The match is case-insensitive, except in the case of BINARY strings.\n\n``sql\nSELECT ''Maria'' REGEXP ''Maria'';\n+------------------------+\n| ''Maria'' REGEXP ''Maria'' |\n+------------------------+\n|                      1 |\n+------------------------+\n\nSELECT ''Maria'' REGEXP ''maria'';\n+------------------------+\n| ''Maria'' REGEXP ''maria'' |\n+------------------------+\n|                      1 |\n+------------------------+\n\nSELECT BINARY ''Maria'' REGEXP ''maria'';\n+-------------------------------+\n| BINARY ''Maria'' REGEXP ''maria'' |\n+-------------------------------+\n|                             0 |\n+-------------------------------+\n`\n\nNote that the word being matched must match the whole pattern:\n\n`sql\nSELECT ''Maria'' REGEXP ''Mari'';\n+-----------------------+\n| ''Maria'' REGEXP ''Mari'' |\n+-----------------------+\n|                     1 |\n+-----------------------+\n\nSELECT ''Mari'' REGEXP ''Maria'';\n+-----------------------+\n| ''Mari'' REGEXP ''Maria'' |\n+-----------------------+\n|                     0 |\n+-----------------------+\n`\n\nThe first returns true because the pattern "Mari" exists in the expression "Maria". When the order is reversed, the result is false, as the pattern "Maria" does not exist in the expression "Mari"\n\nA match can be performed against more than one word with the | character. For example:\n\n`sql\nSELECT ''Maria'' REGEXP ''Monty|Maria'';\n+------------------------------+\n| ''Maria'' REGEXP ''Monty|Maria'' |\n+------------------------------+\n|                            1 |\n+------------------------------+\n`\n\nSpecial Characters\n\nThe above examples introduce the syntax, but are not very useful on their own. It''s the special characters that give regular expressions their power.\n\n^\n\n^ matches the beginning of a string (inside square brackets it can also mean NOT - see below):\n\n`sql\nSELECT ''Maria'' REGEXP ''^Ma'';\n+----------------------+\n| ''Maria'' REGEXP ''^Ma'' |\n+----------------------+\n|                    1 |\n+----------------------+\n`\n\n$\n\n$ matches the end of a string:\n\n`sql\nSELECT ''Maria'' REGEXP ''ia$'';\n+----------------------+\n| ''Maria'' REGEXP ''ia$'' |\n+----------------------+\n|                    1 |\n+----------------------+\n`\n\n.\n\n. matches any single character:\n\n`sql\nSELECT ''Maria'' REGEXP ''Ma.ia'';\n+------------------------+\n| ''Maria'' REGEXP ''Ma.ia'' |\n+------------------------+\n|                      1 |\n+------------------------+\n\nSELECT ''Maria'' REGEXP ''Ma..ia'';\n+-------------------------+\n| ''Maria'' REGEXP ''Ma..ia'' |\n+-------------------------+\n|                       0 |\n+-------------------------+\n`\n\n\\\n\nx matches zero or more of a character x. In the examples below, it''s the r character.\n\n`sql\nSELECT ''Maria'' REGEXP ''Maria'';\n+-------------------------+\n| ''Maria'' REGEXP ''Maria'' |\n+-------------------------+\n|                       1 |\n+-------------------------+\n\nSELECT ''Maia'' REGEXP ''Maria'';\n+------------------------+\n| ''Maia'' REGEXP ''Maria'' |\n+------------------------+\n|                      1 |\n+------------------------+\n\nSELECT ''Marrria'' REGEXP ''Maria'';\n+---------------------------+\n| ''Marrria'' REGEXP ''Maria'' |\n+---------------------------+\n|                         1 |\n+---------------------------+\n`\n\n+\n\nx+ matches one or more of a character x. In the examples below, it''s the r character.\n\n`sql\nSELECT ''Maria'' REGEXP ''Mar+ia'';\n+-------------------------+\n| ''Maria'' REGEXP ''Mar+ia'' |\n+-------------------------+\n|                       1 |\n+-------------------------+\n\nSELECT ''Maia'' REGEXP ''Mar+ia'';\n+------------------------+\n| ''Maia'' REGEXP ''Mar+ia'' |\n+------------------------+\n|                      0 |\n+------------------------+\n\nSELECT ''Marrria'' REGEXP ''Mar+ia'';\n+---------------------------+\n| ''Marrria'' REGEXP ''Mar+ia'' |\n+---------------------------+\n|                         1 |\n+---------------------------+\n`\n\n?\n\nx? matches zero or one of a character x. In the examples below, it''s the r character.\n\n`sql\nSELECT ''Maria'' REGEXP ''Mar?ia'';\n+-------------------------+\n| ''Maria'' REGEXP ''Mar?ia'' |\n+-------------------------+\n|                       1 |\n+-------------------------+\n\nSELECT ''Maia'' REGEXP ''Mar?ia'';\n+------------------------+\n| ''Maia'' REGEXP ''Mar?ia'' |\n+------------------------+\n|                      1 |\n+------------------------+\n\nSELECT ''Marrria'' REGEXP ''Mar?ia'';\n+---------------------------+\n| ''Marrria'' REGEXP ''Mar?ia'' |\n+---------------------------+\n|                         0 |\n+---------------------------+\n`\n\n()\n\n(xyz) - combine a sequence, for example (xyz)+ or (xyz)\n\n`sql\nSELECT ''Maria'' REGEXP ''(ari)+'';\n+-------------------------+\n| ''Maria'' REGEXP ''(ari)+'' |\n+-------------------------+\n|                       1 |\n+-------------------------+\n`\n\n{}\n\nx{n} and x{m,n}\\\nThis notation is used to match many instances of the x. In the case of x{n} the match must be exactly that many times. In the case of x{m,n}, the match can occur from m to n times. For example, to match zero or one instance of the string ari (which is identical to (ari)?), the following can be used:\n\n`sql\nSELECT ''Maria'' REGEXP ''(ari){0,1}'';\n+-----------------------------+\n| ''Maria'' REGEXP ''(ari){0,1}'' |\n+-----------------------------+\n|                           1 |\n+-----------------------------+\n`\n\n\\[]\n\n[xy] groups characters for matching purposes. For example, to match either the p or the r character:\n\n`sql\nSELECT ''Maria'' REGEXP ''Ma[pr]ia'';\n+---------------------------+\n| ''Maria'' REGEXP ''Ma[pr]ia'' |\n+---------------------------+\n|                         1 |\n+---------------------------+\n`\n\nThe square brackets also permit a range match, for example, to match any character from a-z, [a-z] is used. Numeric ranges are also permitted.\n\n`sql\nSELECT ''Maria'' REGEXP ''Ma[a-z]ia'';\n+----------------------------+\n| ''Maria'' REGEXP ''Ma[a-z]ia'' |\n+----------------------------+\n|                          1 |\n+----------------------------+\n`\n\nThe following does not match, as r falls outside of the range a-p.\n\n`sql\nSELECT ''Maria'' REGEXP ''Ma[a-p]ia'';\n+----------------------------+\n| ''Maria'' REGEXP ''Ma[a-p]ia'' |\n+----------------------------+\n|                          0 |\n+----------------------------+\n`\n\n^\n\nThe ^ character means does NOT match, for example:\n\n`sql\nSELECT ''Maria'' REGEXP ''Ma[^p]ia'';\n+---------------------------+\n| ''Maria'' REGEXP ''Ma[^p]ia'' |\n+---------------------------+\n|                         1 |\n+---------------------------+\n\nSELECT ''Maria'' REGEXP ''Ma[^r]ia'';\n+---------------------------+\n| ''Maria'' REGEXP ''Ma[^r]ia'' |\n+---------------------------+\n|                         0 |\n+---------------------------+\n`\n\nThe [ and ] characters on their own can be literally matched inside a [] block, without escaping, as long as they immediately match the opening bracket:\n\n`sql\nSELECT ''[Maria'' REGEXP ''[[]'';\n+-----------------------+\n| ''[Maria'' REGEXP ''[[]'' |\n+-----------------------+\n|                     1 |\n+-----------------------+\n\nSELECT ''[Maria'' REGEXP ''[]]'';\n+-----------------------+\n| ''[Maria'' REGEXP ''[]]'' |\n+-----------------------+\n|                     0 |\n+-----------------------+\n\nSELECT '']Maria'' REGEXP ''[]]'';\n+-----------------------+\n| '']Maria'' REGEXP ''[]]'' |\n+-----------------------+\n|                     1 |\n+-----------------------+\n\nSELECT '']Maria'' REGEXP ''[]a]'';\n+------------------------+\n| '']Maria'' REGEXP ''[]a]'' |\n+------------------------+\n|                      1 |\n+------------------------+\n`\n\nIncorrect order, so no match:\n\n`sql\nSELECT '']Maria'' REGEXP ''[a]]'';\n+------------------------+\n| '']Maria'' REGEXP ''[a]]'' |\n+------------------------+\n|                      0 |\n+------------------------+\n`\n\nThe - character can also be matched in the same way:\n\n`sql\nSELECT ''-Maria'' REGEXP ''[1-10]'';\n+--------------------------+\n| ''-Maria'' REGEXP ''[1-10]'' |\n+--------------------------+\n|                        0 |\n+--------------------------+\n\nSELECT ''-Maria'' REGEXP ''[-1-10]'';\n+---------------------------+\n| ''-Maria'' REGEXP ''[-1-10]'' |\n+---------------------------+\n|                         1 |\n+---------------------------+\n`\n\nWord boundaries\n\nThe :<: and :>: patterns match the beginning and the end of a word respectively. For example:\n\n`sql\nSELECT ''How do I upgrade MariaDB?'' REGEXP ''[[:<:]]MariaDB[[:>:]]'';\n+------------------------------------------------------------+\n| ''How do I upgrade MariaDB?'' REGEXP ''[[:<:]]MariaDB[[:>:]]'' |\n+------------------------------------------------------------+\n|                                                          1 |\n+------------------------------------------------------------+\n\nSELECT ''How do I upgrade MariaDB?'' REGEXP ''[[:<:]]Maria[[:>:]]'';\n+----------------------------------------------------------+\n| ''How do I upgrade MariaDB?'' REGEXP ''[[:<:]]Maria[[:>:]]'' |\n+----------------------------------------------------------+\n|                                                        0 |\n+----------------------------------------------------------+\n`\n\nCharacter Classes\n\nThere are a number of shortcuts to match particular preset character classes. These are matched with the [:character_class:] pattern (inside a [] set). The following character classes exist:\n\n| Character Class | Description                              |\n| --------------- | ---------------------------------------- |\n| alnum           | Alphanumeric                             |\n| alpha           | Alphabetic                               |\n| blank           | Whitespace                               |\n| cntrl           | Control characters                       |\n| digit           | Digits                                   |\n| graph           | Graphic characters                       |\n| lower           | Lowercase alphabetic                     |\n| print           | Graphic or space characters              |\n| punct           | Punctuation                              |\n| space           | Space, tab, newline, and carriage return |\n| upper           | Uppercase alphabetic                     |\n| xdigit          | Hexadecimal digit                        |\n\nFor example:\n\n`sql\nSELECT ''Maria'' REGEXP ''Mar[[:alnum:]]'';\n+--------------------------------+\n| ''Maria'' REGEXP ''Mar[:alnum:]'' |\n+--------------------------------+\n|                              1 |\n+--------------------------------+\n`\n\nRemember that matches are by default case-insensitive, unless a binary string is used, so the following example, specifically looking for an uppercase, counter-intuitively matches a lowercase character:\n\n`sql\nSELECT ''Mari'' REGEXP ''Mar[[:upper:]]+'';\n+---------------------------------+\n| ''Mari'' REGEXP ''Mar[[:upper:]]+'' |\n+---------------------------------+\n|                               1 |\n+---------------------------------+\n\nSELECT BINARY ''Mari'' REGEXP ''Mar[[:upper:]]+'';\n+----------------------------------------+\n| BINARY ''Mari'' REGEXP ''Mar[[:upper:]]+'' |\n+----------------------------------------+\n|                                      0 |\n+----------------------------------------+\n`\n\nCharacter Names\n\nThere are also number of shortcuts to match particular preset character names. These are matched with the [.character.] pattern (inside a [] set). The following character classes exist:\n\n| Name                 | Character |\n| -------------------- | --------- |\n| NUL                  | 0         |\n| SOH                  | 001       |\n| STX                  | 002       |\n| ETX                  | 003       |\n| EOT                  | 004       |\n| ENQ                  | 005       |\n| ACK                  | 006       |\n| BEL                  | 007       |\n| alert                | 007       |\n| BS                   | 010       |\n| backspace            | ''\\b''      |\n| HT                   | 011       |\n| tab                  | ''\\t''      |\n| LF                   | 012       |\n| newline              | ''\\n''      |\n| VT                   | 013       |\n| vertical-tab         | ''\\v''      |\n| FF                   | 014       |\n| form-feed            | ''\\f''      |\n| CR                   | 015       |\n| carriage-return      | ''\\r''      |\n| SO                   | 016       |\n| SI                   | 017       |\n| DLE                  | 020       |\n| DC1                  | 021       |\n| DC2                  | 022       |\n| DC3                  | 023       |\n| DC4                  | 024       |\n| NAK                  | 025       |\n| SYN                  | 026       |\n| ETB                  | 027       |\n| CAN                  | 030       |\n| EM                   | 031       |\n| SUB                  | 032       |\n| ESC                  | 033       |\n| IS4                  | 034       |\n| FS                   | 034       |\n| IS3                  | 035       |\n| GS                   | 035       |\n| IS2                  | 036       |\n| RS                   | 036       |\n| IS1                  | 037       |\n| US                   | 037       |\n| space                | '' ''       |\n| exclamation-mark     | ''!''       |\n| quotation-mark       | ''"''       |\n| number-sign          | ''#''       |\n| dollar-sign          | ''$''       |\n| percent-sign         | ''%''       |\n| ampersand            | ''&''       |\n| apostrophe           | ''''''       |\n| left-parenthesis     | ''(''       |\n| right-parenthesis    | '')''       |\n| asterisk             | ''\\''      |\n| plus-sign            | ''+''       |\n| comma                | '',''       |\n| hyphen               | ''-''       |\n| hyphen-minus         | ''-''       |\n| period               | ''.''       |\n| full-stop            | ''.''       |\n| slash                | ''/''       |\n| solidus              | ''/''       |\n| zero                 | ''0''       |\n| one                  | ''1''       |\n| two                  | ''2''       |\n| three                | ''3''       |\n| four                 | ''4''       |\n| five                 | ''5''       |\n| six                  | ''6''       |\n| seven                | ''7''       |\n| eight                | ''8''       |\n| nine                 | ''9''       |\n| colon                | '':''       |\n| semicolon            | '';''       |\n| less-than-sign       | ''<''       |\n| equals-sign          | ''=''       |\n| greater-than-sign    | ''>''       |\n| question-mark        | ''?''       |\n| commercial-at        | ''@''       |\n| left-square-bracket  | ''\\[''      |\n| backslash            | ''''        |\n| reverse-solidus      | ''''        |\n| right-square-bracket | '']''\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regular-expressions-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (460, 37, 'RLIKE', 'Syntax\n------\n\nexpr REGEXP pat, expr RLIKE pat\n\nDescription\n-----------\n\nRLIKE is a synonym for REGEXP.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/rlike', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/rlike');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (461, 37, 'REPEAT Function', 'Syntax\n------\n\nREPEAT(str,count)\n\nDescription\n-----------\n\nReturns a string consisting of the string str repeated count times. Ifcount is less than 1, returns an empty string. Returns NULL if str orcount are NULL.\n\nExamples\n--------\n\nSELECT QUOTE(REPEAT(''MariaDB '',4));\n+------------------------------------+\n| QUOTE(REPEAT(''MariaDB '',4))        |\n+------------------------------------+\n| ''MariaDB MariaDB MariaDB MariaDB '' |\n+------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/repeat-function', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/repeat-function');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (462, 37, 'REPLACE Function', 'Syntax\n------\n\nREPLACE(str,from_str,to_str)\n\nDescription\n-----------\n\nReturns the string str with all occurrences of the string from_str replaced by the string to_str. REPLACE() performs a case-sensitive match when searching for from_str. If any argument is NULL, the function returns NULL.\n\nExamples\n--------\n\nSELECT REPLACE(''www.mariadb.org'', ''w'', ''Ww'');\n+---------------------------------------+\n| REPLACE(''www.mariadb.org'', ''w'', ''Ww'') |\n+---------------------------------------+\n| WwWwWw.mariadb.org                    |\n+---------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/replace-function', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/replace-function');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (463, 37, 'REVERSE', 'Syntax\n------\n\nREVERSE(str)\n\nDescription\n-----------\n\nReturns the string str with the order of the characters reversed. If the input string is NULL, the function returns NULL.\n\nExamples\n--------\n\nSELECT REVERSE(''desserts'');\n+---------------------+\n| REVERSE(''desserts'') |\n+---------------------+\n| stressed            |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/reverse', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/reverse');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (464, 37, 'RIGHT', 'Syntax\n------\n\nRIGHT(str,len)\n\nDescription\n-----------\n\nReturns the rightmost _len_ characters from the string _str_, or NULL if any argument is NULL.\n\nExamples\n--------\n\nSELECT RIGHT(''MariaDB'', 2);\n+---------------------+\n| RIGHT(''MariaDB'', 2) |\n+---------------------+\n| DB                  |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/right', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/right');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (465, 37, 'RPAD', 'Syntax\n------\n\nRPAD(str, len [, padstr])\n\nDescription\n-----------\n\nReturns the string str, right-padded with the string padstr to a length of len characters. If str is longer than len, the return value is shortened to len characters. If padstr is omitted, the RPAD function pads spaces.\n\nReturns NULL if given a NULL argument. If the result is empty (a length of zero), returns either an empty string, or, with SQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode by using RPAD_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT RPAD(''hello'',10,''.'');\n+----------------------+\n| RPAD(''hello'',10,''.'') |\n+----------------------+\n| hello.....           |\n+----------------------+\n\nSELECT RPAD(''hello'',2,''.'');\n+---------------------+\n| RPAD(''hello'',2,''.'') |\n+---------------------+\n| he                  |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/rpad', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/rpad');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (466, 37, 'RTRIM', 'Syntax\n------\n\nRTRIM(str)\n\nDescription\n-----------\n\nReturns the string str with trailing space characters removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either an empty string, or, with SQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode by using RTRIM_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT QUOTE(RTRIM(''MariaDB    ''));\n+-----------------------------+\n| QUOTE(RTRIM(''MariaDB    '')) |\n+-----------------------------+\n| ''MariaDB''                   |\n+-----------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/rtrim', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/rtrim');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (467, 37, 'SFORMAT', 'Description\n-----------\n\nThe SFORMAT function takes an input string and a formatting specification and returns the string formatted using the rules the user passed in the specification.\n\nIt uses the fmtlib library for Python-like (as well as Rust, C++20, etc) string formatting.\n\nOnly fmtlib 7.0.0+ is supported.\n\nThere is no native support for temporal and decimal values:\n\n TIME_RESULT is handled as STRING_RESULT.\n DECIMAL_RESULT is handled as REAL_RESULT.\n\nExamples\n--------\n\nSELECT SFORMAT("The answer is {}.", 42);\n+----------------------------------+\n| SFORMAT("The answer is {}.", 42) |\n+----------------------------------+\n| The answer is 42.                |\n+----------------------------------+\n\nCREATE TABLE test_sformat(mdb_release char(6), mdev int, feature char(20));\n\nINSERT INTO test_sformat VALUES(''10.7.0'', 25015, ''Python style sformat''), \n  (''10.7.0'', 4958, ''UUID'');\n\nSELECT * FROM test_sformat;\n+-------------+-------+----------------------+\n| mdb_release | mdev  | feature              |\n+-------------+-------+----------------------+\n| 10.7.0      | 25015 | Python style sformat |\n| 10.7.0      |  4958 | UUID                 |\n+-------------+-------+----------------------+\n\nSELECT SFORMAT(''MariaDB Server {} has a preview for MDEV-{} which is about {}'', \n  mdb_release, mdev, feature) AS ''Preview Release Examples''\n  FROM test_sformat;\n+----------------------------------------------------------------------------------------+\n| Preview Release Examples                                                               |\n+----------------------------------------------------------------------------------------+\n| MariaDB Server 10.7.0 has a preview for MDEV-25015 which is about Python style sformat |\n| MariaDB Server 10.7.0 has a preview for MDEV-4958 which is about UUID                  |\n+----------------------------------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/sformat', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/sformat');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (468, 37, 'SOUNDEX', 'Syntax\n------\n\nSOUNDEX(str)\n\nDescription\n-----------\n\nReturns a soundex string from _str_. Two strings that sound almost the same should have identical soundex strings. A standard soundex string is four characters long, but the SOUNDEX() function returns an arbitrarily long string. You can use SUBSTRING() on the result to get a standard soundex string. All non-alphabetic characters in _str_ are ignored. All international alphabetic characters outside the A-Z range are treated as vowels.\n\nImportant: When using SOUNDEX(), you should be aware of the following details:\n\n This function, as currently implemented, is intended to work well with strings that are in the English language only. Strings in other languages may not produce reasonable results.\n This function implements the original Soundex algorithm, not the more popular enhanced version (also described by D. Knuth). The difference is that original version discards vowels first and duplicates second, whereas the enhanced version discards duplicates first and vowels second.\n\nExamples\n--------\n\nSOUNDEX(''Hello'');\n+------------------+\n| SOUNDEX(''Hello'') |\n+------------------+\n| H400             |\n+------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/soundex', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/soundex');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (469, 37, 'SOUNDS LIKE', 'Syntax\n------\n\nexpr1 SOUNDS LIKE expr2\n\nDescription\n-----------\n\nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2).\n\nExamples\n--------\n\nSELECT givenname, surname FROM users WHERE givenname SOUNDS LIKE "robert";\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto   | Castro  |\n+-----------+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/sounds-like', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/sounds-like');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (470, 37, 'SPACE', 'Syntax\n------\n\nSPACE(N)\n\nDescription\n-----------\n\nReturns a string consisting of _N_ space characters. If N is NULL, returns NULL.\n\nExamples\n--------\n\nSELECT QUOTE(SPACE(6));\n+-----------------+\n| QUOTE(SPACE(6)) |\n+-----------------+\n| ''      ''        |\n+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/space', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/space');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (471, 37, 'STRCMP', 'Syntax\n------\n\nSTRCMP(expr1,expr2)\n\nDescription\n-----------\n\nSTRCMP() returns 0 if the strings are the same, -1 if the first argument is smaller than the second according to the current sort order, and 1 if the strings are otherwise not the same. Returns NULL is either argument is NULL.\n\nExamples\n--------\n\nSELECT STRCMP(''text'', ''text2'');\n+-------------------------+\n| STRCMP(''text'', ''text2'') |\n+-------------------------+\n|                      -1 |\n+-------------------------+\n\nSELECT STRCMP(''text2'', ''text'');\n+-------------------------+\n| STRCMP(''text2'', ''text'') |\n+-------------------------+\n|                       1 |\n+-------------------------+\n\nSELECT STRCMP(''text'', ''text'');\n+------------------------+\n| STRCMP(''text'', ''text'') |\n+------------------------+\n|                      0 |\n+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/strcmp', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/strcmp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (472, 37, 'SUBSTR', 'Description\n-----------\n\nSUBSTR() is a synonym for SUBSTRING().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/substr', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/substr');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (473, 37, 'SUBSTRING', 'Description\n-----------\n\nThe forms without a _len_ argument return a substring from string _str_ starting at position _pos_.\n\nThe forms with a _len_ argument return a substring _len_ characters long from string _str_, starting at position _pos_.\n\nThe forms that use _FROM_ are standard SQL syntax.\n\nIt is also possible to use a negative value for _pos_. In this case, the beginning of the substring is _pos_ characters from the end of the string, rather than the beginning. A negative value may be used for _pos_ in any of the forms of this function.\n\nBy default, the position of the first character in the string from which the substring is to be extracted is 1. If the value of _pos_ is 0, the result is empty string. For Oracle compatibility, when sql_mode is set to ''oracle'', position 0 is treated as position 1.\n\nIf any argument is NULL, returns NULL.\n\nThe optimizer can make use of an index for conditions like SUBSTR(indexed_column, 1, n) = const_string.\n\nThe optimizer cannot make use of an index if an indexed column is an argument of SUBSTR().\n\nExamples\n--------\n\nSELECT SUBSTRING(''Knowledgebase'',5);\n+------------------------------+\n| SUBSTRING(''Knowledgebase'',5) |\n+------------------------------+\n| ledgebase                    |\n+------------------------------+\n\nSELECT SUBSTRING(''MariaDB'' FROM 6);\n+-----------------------------+\n| SUBSTRING(''MariaDB'' FROM 6) |\n+-----------------------------+\n| DB                          |\n+-----------------------------+\n\nSELECT SUBSTRING(''Knowledgebase'',3,7);\n+--------------------------------+\n| SUBSTRING(''Knowledgebase'',3,7) |\n+--------------------------------+\n| owledge                        |\n+--------------------------------+\n\nSELECT SUBSTRING(''Knowledgebase'', -4);\n+--------------------------------+\n| SUBSTRING(''Knowledgebase'', -4) |\n+--------------------------------+\n| base                           |\n+--------------------------------+\n\nSELECT SUBSTRING(''Knowledgebase'', 0);\n+--------------------------------+\n| SUBSTRING(''Knowledgebase'', 0)  |\n+--------------------------------+\n|                                |\n+--------------------------------+\n\nSELECT SUBSTRING(''Knowledgebase'', -8, 4);\n+-----------------------------------+\n| SUBSTRING(''Knowledgebase'', -8, 4) |\n+-----------------------------------+\n| edge                              |\n+-----------------------------------+\n\nSELECT SUBSTRING(''Knowledgebase'' FROM -8 FOR 4);\n+------------------------------------------+\n| SUBSTRING(''Knowledgebase'' FROM -8 FOR 4) |\n+------------------------------------------+\n| edge                                     |\n+------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/substring', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/substring');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (474, 37, 'SUBSTRING\\_INDEX', 'Syntax\n------\n\nSUBSTRING_INDEX(str,delim,count)\n\nDescription\n-----------\n\nReturns the substring from string _str_ before count occurrences of the delimiter _delim_. If _count_ is positive, everything to the left of the final delimiter (counting from the left) is returned. If _count_ is negative, everything to the right of the final delimiter (counting from the right) is returned. SUBSTRING_INDEX() performs a case-sensitive match when searching for _delim_.\n\nIf any argument is NULL, returns NULL.\n\nFor example:\n\n``sql\nSUBSTRING_INDEX(''www.mariadb.org'', ''.'', 2)\n``\n\nIt means "Return all of the characters up to the 2nd occurrence of ."\n\nExamples\n--------\n\nSELECT SUBSTRING_INDEX(''www.mariadb.org'', ''.'', 2);\n+--------------------------------------------+\n| SUBSTRING_INDEX(''www.mariadb.org'', ''.'', 2) |\n+--------------------------------------------+\n| www.mariadb                                |\n+--------------------------------------------+\n\nSELECT SUBSTRING_INDEX(''www.mariadb.org'', ''.'', -2);\n+---------------------------------------------+\n| SUBSTRING_INDEX(''www.mariadb.org'', ''.'', -2) |\n+---------------------------------------------+\n| mariadb.org                                 |\n+---------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/substring_index', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/substring_index');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (475, 37, 'TO\\_BASE64', 'Syntax\n------\n\nTO_BASE64(str)\n\nDescription\n-----------\n\nConverts the string argument str to its base-64 encoded form, returning the result as a character string in the connection character set and collation.\n\nThe argument str will be converted to string first if it is not a string. A NULL argument will return a NULL result.\n\nThe reverse function, FROM_BASE64(), decodes an encoded base-64 string.\n\nThere are a numerous different methods to base-64 encode a string. The following are used by MariaDB and MySQL:\n\n Alphabet value 64 is encoded as ''+''.\n Alphabet value 63 is encoded as ''/''.\n Encoding output is made up of groups of four printable characters, with each three bytes of data encoded using four characters. If the final group is not complete, it is padded with ''='' characters to make up a length of four.\n To divide long output, a newline is added after every 76 characters.\n* Decoding will recognize and ignore newlines, carriage returns, tabs, and spaces.\n\nExamples\n--------\n\nSELECT TO_BASE64(''Maria'');\n+--------------------+\n| TO_BASE64(''Maria'') |\n+--------------------+\n| TWFyaWE=           |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/to_base64', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/to_base64');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (476, 37, 'TO\\_CHAR', 'Syntax\n------\n\nTO_CHAR(expr[, fmt])\n\nDescription\n-----------\n\nThe TO_CHAR function converts an _expr_ of type date, datetime, time or timestamp to a string. The optional _fmt_ argument supports YYY/YYY/YY/RRRR/RR/MM/MON/MONTH/MI/DD/DY/HH/HH12/HH24/SS and special characters. The default value is YYYY-MM-DD HH24:MI:SS. TO_CHAR also accepts FM in the format string, which disables padding of all components following it.\n\nFM can be specified multiple times, with each time disabling the previous state:\n\n An odd number of FMs disables padding.\n An even number of FMs enables padding.\n\nThese additional formats (for _fmt_) are available:\n\n FF[1-6] – Fractional seconds\n DDD – Day (1-366)\n IW – Week 1-53 according to ISO 8601\n I – 1-digit year according to ISO 8601\n IY – 2-digit year according to ISO 8601\n IYY – 3-digit year according to ISO 8601\n IYYY – 4-digit year according to ISO 8601\n SYYY – 4-digit year according to ISO 8601 (Oracle can use signed years)\n\nThe TO_CHAR function converts an _expr_ of type date, datetime, time or timestamp to a string. The optional _fmt_ argument supports YYY/YYY/YY/RRRR/RR/MM/MON/MONTH/MI/DD/DY/HH/HH12/HH24/SS and special characters. The default value is YYYY-MM-DD HH24:MI:SS. TO_CHAR also accepts FM in the format string, which disables padding of all components following it.\n\nFM can be specified multiple times, with each time disabling the previous state:\n\n An odd number of FMs disables padding.\n An even number of FMs enables padding.\n\nThe TO_CHAR function converts an _expr_ of type date, datetime, time or timestamp to a string. The optional _fmt_ argument supports YYY/YYY/YY/RRRR/RR/MM/MON/MONTH/MI/DD/DY/HH/HH12/HH24/SS and special characters. The default value is YYYY-MM-DD HH24:MI:SS.\n\nIn Oracle, TO_CHAR can also be used to convert numbers to strings, but this is not supported in MariaDB and gives an error.\n\nExamples\n--------\n\nSELECT TO_CHAR(''1980-01-11 04:50:39'', ''YYYY-MM-DD'');\n+----------------------------------------------+\n| TO_CHAR(''1980-01-11 04:50:39'', ''YYYY-MM-DD'') |\n+----------------------------------------------+\n| 1980-01-11                                   |\n+----------------------------------------------+\n\nSELECT TO_CHAR(''1980-01-11 04:50:39'', ''HH24-MI-SS'');\n+----------------------------------------------+\n| TO_CHAR(''1980-01-11 04:50:39'', ''HH24-MI-SS'') |\n+----------------------------------------------+\n| 04-50-39                                     |\n+----------------------------------------------+\n\nSELECT TO_CHAR(''00-01-01 00:00:00'', ''YY-MM-DD HH24:MI:SS'');\n+-----------------------------------------------------+\n| TO_CHAR(''00-01-01 00:00:00'', ''YY-MM-DD HH24:MI:SS'') |\n+-----------------------------------------------------+\n| 00-01-01 00:00:00                                   |\n+-----------------------------------------------------+\n\nSELECT TO_CHAR(''99-12-31 23:59:59'', ''YY-MM-DD HH24:MI:SS'');\n+-----------------------------------------------------+\n| TO_CHAR(''99-12-31 23:59:59'', ''YY-MM-DD HH24:MI:SS'') |\n+-----------------------------------------------------+\n| 99-12-31 23:59:59                                   |\n+-----------------------------------------------------+\n\nSELECT TO_CHAR(''9999-12-31 23:59:59'', ''YY-MM-DD HH24:MI:SS'');\n+-------------------------------------------------------+\n| TO_CHAR(''9999-12-31 23:59:59'', ''YY-MM-DD HH24:MI:SS'') |\n+-------------------------------------------------------+\n| 99-12-31 23:59:59                                     |\n+-------------------------------------------------------+\n\nSELECT TO_CHAR(''21-01-03 08:30:00'', ''Y-MONTH-DY HH:MI:SS'');\n+-----------------------------------------------------+\n| TO_CHAR(''21-01-03 08:30:00'', ''Y-MONTH-DY HH:MI:SS'') |\n+-----------------------------------------------------+\n| 1-January  -Sun 08:30:00                            |\n+-----------------------------------------------------+\n\nFrom MariaDB 12.0, FM removes following padding:\n\nSELECT CONCAT(''/'', TO_CHAR(''2020-01-06 10:11:12'', ''DAY''), ''/'');\n+---------------------------------------------------------+\n| CONCAT(''/'', TO_CHAR(''2020-01-06 10:11:12'', ''DAY''), ''/'') |\n+---------------------------------------------------------+\n| /Monday   /                                             |\n+---------------------------------------------------------+\n\nSELECT CONCAT(''/'', TO_CHAR(''2020-01-06 10:11:12'', ''FMDAY''), ''/'');\n+-----------------------------------------------------------+\n| CONCAT(''/'', TO_CHAR(''2020-01-06 10:11:12'', ''FMDAY''), ''/'') |\n+-----------------------------------------------------------+\n| /Monday/                                                  |\n+-----------------------------------------------------------+\n\nEven numbers of FM enable padding, while odd numbers disable it:\n\nSELECT CONCAT(''/'', TO_CHAR(''2020-01-06 10:11:12'', ''FMFMDAY''), ''/'');\n+-------------------------------------------------------------+\n| CONCAT(''/'', TO_CHAR(''2020-01-06 10:11:12'', ''FMFMDAY''), ''/'') |\n+-------------------------------------------------------------+\n| /Monday   /                                                 |\n+-------------------------------------------------------------+\n\nSELECT CONCAT(''/'', TO_CHAR(''2020-01-06 10:11:12'', ''FMFMFMDAY''), ''/'');\n+---------------------------------------------------------------+\n| CONCAT(''/'', TO_CHAR(''2020-01-06 10:11:12'', ''FMFMFMDAY''), ''/'') |\n+---------------------------------------------------------------+\n| /Monday/                                                      |\n+---------------------------------------------------------------+\n\nFM only suppresses following padding:\n\nSELECT CONCAT(''/'', TO_CHAR(''2020-01-06 10:11:12'', ''DAYFM''), ''/'');\n+-----------------------------------------------------------+\n| CONCAT(''/'', TO_CHAR(''2020-01-06 10:11:12'', ''DAYFM''), ''/'') |\n+-----------------------------------------------------------+\n| /Monday   /                                               |\n+-----------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/to_char', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/to_char');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (477, 37, 'TRIM', 'Syntax\n------\n\nTRIM_ORACLE([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr FROM] str)\n\nDescription\n-----------\n\nReturns the string str with all remstr prefixes or suffixes removed. If none of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is assumed. remstr is optional and, if not specified, spaces are removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either an empty string, or, with SQL_MODE=Oracle, NULL. SQL_MODE=Oracle is not set by default.\n\nThe Oracle mode version of the function can be accessed in any mode by using TRIM_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT TRIM(''  bar   '')\\G\n************************ 1. row *********************\nTRIM(''  bar   ''): bar\n\nSELECT TRIM(LEADING ''x'' FROM ''xxxbarxxx'')\\G\n********************* 1. row *********************\nTRIM(LEADING ''x'' FROM ''xxxbarxxx''): barxxx\n\nSELECT TRIM(BOTH ''x'' FROM ''xxxbarxxx'')\\G\n********************* 1. row *********************\nTRIM(BOTH ''x'' FROM ''xxxbarxxx''): bar\n\nSELECT TRIM(TRAILING ''xyz'' FROM ''barxxyz'')\\G\n********************* 1. row ************************\nTRIM(TRAILING ''xyz'' FROM ''barxxyz''): barx\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/trim', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/trim');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (478, 37, 'TRIM\\_ORACLE', 'Description\n-----------\n\nTRIM_ORACLE is a synonym for the Oracle mode version of the TRIM function, and is available in all modes.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/trim_oracle', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/trim_oracle');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (479, 37, 'Type Conversion', 'Description\n-----------\n\nImplicit type conversion takes place when MariaDB is using operands or different types, in order to make the operands compatible.\n\nIt is best practice not to rely upon implicit conversion; rather use CAST to explicitly convert types.\n\nRules for Conversion on Comparison\n\n If either argument is NULL, the result of the comparison is NULL unless the NULL-safe <=> equality comparison operator is used.\n If both arguments are integers, they are compared as integers.\n If both arguments are strings, they are compared as strings.\n If one argument is decimal and the other argument is decimal or integer, they are compared as decimals.\n If one argument is decimal and the other argument is a floating point, they are compared as floating point values.\n If one argument is string and the other argument is integer, they are compared as decimals.\n If a hexadecimal argument is not compared to a number, it is treated as a binary string.\n If a constant is compared to a TIMESTAMP or DATETIME, the constant is converted to a timestamp, unless used as an argument to the IN function.\n In other cases, arguments are compared as floating point, or real, numbers.\n\nNote that if a string column is being compared with a numeric value, MariaDB will not use the index on the column, as there are numerous alternatives that may evaluate as equal (see examples below).\n\nComparison Examples\n\nConverting a string to a number:\n\n``sql\nSELECT 15+''15'';\n+---------+\n| 15+''15'' |\n+---------+\n|      30 |\n+---------+\n`\n\nConverting a number to a string:\n\n`sql\nSELECT CONCAT(15,''15'');\n+-----------------+\n| CONCAT(15,''15'') |\n+-----------------+\n| 1515            |\n+-----------------+\n`\n\nFloating point number errors:\n\n`sql\nSELECT ''9746718491924563214'' = 9746718491924563213;\n+---------------------------------------------+\n| ''9746718491924563214'' = 9746718491924563213 |\n+---------------------------------------------+\n|                                           1 |\n+---------------------------------------------+\n`\n\nNumeric equivalence with strings:\n\n`sql\nSELECT ''5'' = 5;\n+---------+\n| ''5'' = 5 |\n+---------+\n|       1 |\n+---------+\n\nSELECT ''   5'' = 5;\n+------------+\n| ''   5'' = 5 |\n+------------+\n|          1 |\n+------------+\n\nSELECT ''   5  '' = 5;\n+--------------+\n| ''   5  '' = 5 |\n+--------------+\n|            1 |\n+--------------+\n1 row in set, 1 warning (0.000 sec)\n\nSHOW WARNINGS;\n+-------+------+--------------------------------------------+\n| Level | Code | Message                                    |\n+-------+------+--------------------------------------------+\n| Note  | 1292 | Truncated incorrect DOUBLE value: ''   5  '' |\n+-------+------+--------------------------------------------+\n`\n\nAs a result of the above, MariaDB cannot use the index when comparing a string with a numeric value in the example below:\n\n`sql\nCREATE TABLE t (a VARCHAR(10), b VARCHAR(10), INDEX idx_a (a));\n\nINSERT INTO t VALUES \n  (''1'', ''1''), (''2'', ''2''), (''3'', ''3''), \n  (''4'', ''4''), (''5'', ''5''), (''1'', ''5'');\n\nEXPLAIN SELECT  FROM t WHERE a = ''3'' \\G\n************************ 1. row ***********************\n           id: 1\n  select_type: SIMPLE\n        table: t\n         type: ref\npossible_keys: idx_a\n          key: idx_a\n      key_len: 13\n          ref: const\n         rows: 1\n        Extra: Using index condition\n\nEXPLAIN SELECT  FROM t WHERE a = 3 \\G\n************************ 1. row ***********************\n           id: 1\n  select_type: SIMPLE\n        table: t\n         type: ALL\npossible_keys: idx_a\n          key: NULL\n      key_len: NULL\n          ref: NULL\n         rows: 6\n        Extra: Using where\n`\n\nRules for Conversion on Dyadic Arithmetic Operations\n\nImplicit type conversion also takes place on dyadic arithmetic operations (+,-,\\,/). MariaDB chooses the minimum data type that is guaranteed to fit the result and converts both arguments to the result data type.\n\nFor addition (+), subtraction (-) and multiplication (\\), the result data type is chosen as follows:\n\n If either of the arguments is an approximate number (float, double), the result is double.\n If either of the arguments is a string (char, varchar, text), the result is double.\n If either of the arguments is a decimal number, the result is decimal.\n If either of the arguments is of a temporal type with a non-zero fractional second precision (time(N), datetime(N), timestamp(N)), the result is decimal.\n If either of the arguments is of a temporal type with a zero fractional second precision (time(0), date, datetime(0), timestamp(0)), the result may vary between int, int unsigned, bigint or bigint unsigned, depending on the exact data type combination.\n If both arguments are integer numbers (tinyint, smallint, mediumint, bigint), the result may vary between int, int unsigned, bigint or bigint unsigned, depending of the exact data types and their signs.\n\nFor division (/), the result data type is chosen as follows:\n\n If either of the arguments is an approximate number (float, double), the result is double.\n If either of the arguments is a string (char, varchar, text), the result is double.\n Otherwise, the result is decimal.\n\nArithmetic Examples\n\nNote, the above rules mean that when an argument of a temporal data type appears in addition or subtraction, it''s treated as a number by default.\n\n`sql\nSELECT TIME''10:20:30'' + 1;\n+--------------------+\n| TIME''10:20:30'' + 1 |\n+--------------------+\n|             102031 |\n+--------------------+\n`\n\nIn order to do temporal addition or subtraction instead, use the DATE_ADD() or DATE_SUB() functions, or an INTERVAL expression as the second argument:\n\n`sql\nSELECT TIME''10:20:30'' + INTERVAL 1 SECOND;\n+------------------------------------+\n| TIME''10:20:30'' + INTERVAL 1 SECOND |\n+------------------------------------+\n| 10:20:31                           |\n+------------------------------------+\n`\n\n`sql\nSELECT "2.2" + 3;\n+-----------+\n| "2.2" + 3 |\n+-----------+\n|       5.2 |\n+-----------+\n\nSELECT 2.2 + 3;\n+---------+\n| 2.2 + 3 |\n+---------+\n| 5.2     |\n+---------+\n\nSELECT 2.2 / 3;\n+---------+\n| 2.2 / 3 |\n+---------+\n| 0.73333 |\n+---------+\n\nSELECT "2.2" / 3;\n+--------------------+\n| "2.2" / 3          |\n+--------------------+\n| 0.7333333333333334 |\n+--------------------+\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/type-conversion', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/type-conversion');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (480, 37, 'UCASE', 'Syntax\n------\n\nUCASE(str)\n\nDescription\n-----------\n\nUCASE() is a synonym for UPPER().\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/ucase', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/ucase');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (481, 37, 'UNHEX', 'Syntax\n------\n\nUNHEX(str)\n\nDescription\n-----------\n\nPerforms the inverse operation of HEX(str). That is, it interprets each pair of hexadecimal digits in the argument as a number and converts it to the character represented by the number. The resulting\\\ncharacters are returned as a binary string.\n\nIf str is NULL, UNHEX() returns NULL.\n\nExamples\n--------\n\nSELECT HEX(''MariaDB'');\n+----------------+\n| HEX(''MariaDB'') |\n+----------------+\n| 4D617269614442 |\n+----------------+\n\nSELECT UNHEX(''4D617269614442'');\n+-------------------------+\n| UNHEX(''4D617269614442'') |\n+-------------------------+\n| MariaDB                 |\n+-------------------------+\n\nSELECT 0x4D617269614442;\n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB          |\n+------------------+\n\nSELECT UNHEX(HEX(''string''));\n+----------------------+\n| UNHEX(HEX(''string'')) |\n+----------------------+\n| string               |\n+----------------------+\n\nSELECT HEX(UNHEX(''1267''));\n+--------------------+\n| HEX(UNHEX(''1267'')) |\n+--------------------+\n| 1267               |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/unhex', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/unhex');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (482, 37, 'UPDATEXML', 'Syntax\n------\n\nUpdateXML(xml_target, xpath_expr, new_xml)\n\nDescription\n-----------\n\nThis function replaces a single portion of a given fragment of XML markupxml_target with a new XML fragment new_xml, and then returns the changed XML. The portion of xml_target that is replaced matches an XPath expression xpath_expr supplied by the user. If no expression matching xpath_expr is found, or if multiple matches are found, the function returns the original xml_target XML fragment. All three arguments should be strings.\n\nExamples\n--------\n\nSELECT\n    UpdateXML(''<a><b>ccc</b><d></d></a>'', ''/a'', ''<e>fff</e>'') AS val1,\n    UpdateXML(''<a><b>ccc</b><d></d></a>'', ''/b'', ''<e>fff</e>'') AS val2,\n    UpdateXML(''<a><b>ccc</b><d></d></a>'', ''//b'', ''<e>fff</e>'') AS val3,\n    UpdateXML(''<a><b>ccc</b><d></d></a>'', ''/a/d'', ''<e>fff</e>'') AS val4,\n    UpdateXML(''<a><d></d><b>ccc</b><d></d></a>'', ''/a/d'', ''<e>fff</e>'') AS val5\n    \\G\n************************ 1. row ************************\nval1: <e>fff</e>\nval2: <a><b>ccc</b><d></d></a>\nval3: <a><e>fff</e><d></d></a>\nval4: <a><b>ccc</b><e>fff</e></a>\nval5: <a><d></d><b>ccc</b><d></d></a>\n1 row in set (0.00 sec)\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/updatexml', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/updatexml');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (483, 37, 'UPPER', 'Syntax\n------\n\nUPPER(str)\nUCASE(str)\n\nDescription\n-----------\n\nReturns the string str with all characters changed to uppercase according to the current character set mapping. The default is latin1 (cp1252 West European).\nThe result may depend on the collation and character set used.\nUCASE is a synonym.\n\n``sql\nSELECT UPPER(surname), givenname FROM users ORDER BY surname;\n+----------------+------------+\n| UPPER(surname) | givenname  |\n+----------------+------------+\n| ABEL           | Jacinto    |\n| CASTRO         | Robert     |\n| COSTA          | Phestos    |\n| MOSCHELLA      | Hippolytos |\n+----------------+------------+\n`\n\nUPPER()` is ineffective when applied to binary strings (BINARY, VARBINARY, BLOB). The description of LOWER() shows how to perform lettercase conversion of binary strings.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/upper', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/upper');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (484, 37, 'WEIGHT\\_STRING', 'Syntax\n------\n\nWEIGHT_STRING(str [AS {CHAR|BINARY}(N)] [LEVEL levels] [flags])\n  levels: N [ASC|DESC|REVERSE] [, N [ASC|DESC|REVERSE]] ...\n\nDescription\n-----------\n\nReturns a binary string representing the string''s sorting and comparison value. A string with a lower result means that for sorting purposes the string appears before a string with a higher result.\n\nWEIGHT_STRING() is particularly useful when adding new collations, for testing purposes.\n\nIf str is a non-binary string (CHAR, VARCHAR or TEXT), WEIGHT_STRING returns the string''s collation weight. If str is a binary string (BINARY, VARBINARY or BLOB), the return value is simply the input value, since the weight for each byte in a binary string is the byte value.\n\nWEIGHT_STRING() returns NULL if given a NULL input.\n\nThe optional AS clause permits casting the input string to a binary or non-binary string, as well as to a particular length.\n\nAS BINARY(N) measures the length in bytes rather than characters, and right pads with 0x00 bytes to the desired length.\n\nAS CHAR(N) measures the length in characters, and right pads with spaces to the desired length.\n\nN has a minimum value of 1, and if it is less than the length of the input string, the string is truncated without warning.\n\nThe optional LEVEL clause specifies that the return value should contain weights for specific collation levels. The levels specifier can either be a single integer, a comma-separated list of integers, or a range of integers separated by a dash (whitespace is ignored). Integers can range from 1 to a maximum of 6, dependent on the collation, and need to be listed in ascending order.\n\nIf the LEVEL clause is no provided, a default of 1 to the maximum for the collation is assumed.\n\nIf the q is specified without using a range, an optional modifier is permitted.\n\nASC, the default, returns the weights without any modification.\n\nDESC returns bitwise-inverted weights.\n\nREVERSE returns the weights in reverse order.\n\nExamples\n--------\n\nSELECT HEX(WEIGHT_STRING(''x''));\n+-------------------------+\n| HEX(WEIGHT_STRING(''x'')) |\n+-------------------------+\n| 0058                    |\n+-------------------------+\n\nSELECT HEX(WEIGHT_STRING(''x'' AS BINARY(4)));\n+--------------------------------------+\n| HEX(WEIGHT_STRING(''x'' AS BINARY(4))) |\n+--------------------------------------+\n| 78000000                             |\n+--------------------------------------+\n\nSELECT HEX(WEIGHT_STRING(''x'' AS CHAR(4)));\n+------------------------------------+\n| HEX(WEIGHT_STRING(''x'' AS CHAR(4))) |\n+------------------------------------+\n| 0058002000200020                   |\n+------------------------------------+\n\nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1));\n+--------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1)) |\n+--------------------------------------+\n| AA22EE                               |\n+--------------------------------------+\n\nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 DESC));\n+-------------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 DESC)) |\n+-------------------------------------------+\n| 55DD11                                    |\n+-------------------------------------------+\n\nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 REVERSE));\n+----------------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 REVERSE)) |\n+----------------------------------------------+\n| EE22AA                                       |\n+----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/weight_string', '', 'https://mariadb.com/docs/server/reference/sql-functions/string-functions/weight_string');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (485, 35, 'VEC\\_DISTANCE\\_COSINE', 'Syntax\n------\n\nVEC_DISTANCE_COSINE(v, s)\n\nDescription\n-----------\n\nVEC_Distance_Cosine is an SQL function that calculates the Cosine distance between two (not necessarily normalized) vectors.\n\nVectors must be of the same length. A distance between two vectors of different lengths is not defined, and VEC_Distance_Cosine will return NULL in such cases.\n\nIf the vector index was not built for the cosine function (see CREATE TABLE with Vectors), the index is not used — a full table scan is performed instead. The VEC_DISTANCE function is a generic function that behaves either as VEC_DISTANCE_EUCLIDEAN or VEC_DISTANCE_COSINE, depending on the underlying index type.\n\nExamples\n--------\n\nSELECT VEC_DISTANCE_COSINE(vec_fromtext(''[1,2,3]''), vec_fromtext(''[3,5,7]''));\n+-----------------------------------------------------------------------+\n| VEC_DISTANCE_COSINE(vec_fromtext(''[1,2,3]''), vec_fromtext(''[3,5,7]'')) |\n+-----------------------------------------------------------------------+\n|                                                   0.00258509695694209 |\n+-----------------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_distance_cosine', '', 'https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_distance_cosine');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (486, 35, 'VEC\\_DISTANCE\\_EUCLIDEAN', 'Syntax\n------\n\nVEC_DISTANCE_EUCLIDEAN(v, s)\n\nDescription\n-----------\n\nVEC_Distance_Euclidean is an SQL function that calculates a Euclidean (L2) distance between two points.\n\nVectors must be of the same length, a distance between two vectors of different lengths is not defined and VEC_Distance_Euclidean returns NULL in such cases.\n\nIf the vector index was not built for the euclidean function (see CREATE TABLE with Vectors), the index is not used, and a full table scan performed instead. The VEC_DISTANCE function is a generic function that behaves either as VEC_DISTANCE_EUCLIDEAN or VEC_DISTANCE_COSINE, depending on the underlying index type.\n\nExamples\n--------\n\nINSERT INTO v VALUES \n     (1, x''e360d63ebe554f3fcdbc523f4522193f5236083d''),\n     (2, x''f511303f72224a3fdd05fe3eb22a133ffae86a3f''),\n     (3,x''f09baa3ea172763f123def3e0c7fe53e288bf33e''),\n     (4,x''b97a523f2a193e3eb4f62e3f2d23583e9dd60d3f''),\n     (5,x''f7c5df3e984b2b3e65e59d3d7376db3eac63773e''),\n     (6,x''de01453ffa486d3f10aa4d3fdd66813c71cb163f''),\n     (7,x''76edfc3e4b57243f10f8423fb158713f020bda3e''),\n     (8,x''56926c3fdf098d3e2c8c5e3d1ad4953daa9d0b3e''),\n     (9,x''7b713f3e5258323f80d1113d673b2b3f66e3583f''),\n     (10,x''6ca1d43e9df91b3fe580da3e1c247d3f147cf33e'');\n\nSELECT id FROM v \n  ORDER BY VEC_Distance_Euclidean(v, x''6ca1d43e9df91b3fe580da3e1c247d3f147cf33e'');\n+----+\n| id |\n+----+\n| 10 |\n|  7 |\n|  3 |\n|  9 |\n|  2 |\n|  1 |\n|  5 |\n|  4 |\n|  6 |\n|  8 |\n+----+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_distance_euclidean', '', 'https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_distance_euclidean');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (487, 35, 'VEC\\_FromText', 'Syntax\n------\n\nVEC_FromText(s)\n\nDescription\n-----------\n\nVEC_FromText converts a text representation of the vector (json array of numbers) to a vector (little-endian IEEE float sequence of bytes, 4 bytes per float).\n\nExamples\n--------\n\nSELECT HEX(vec_fromtext(''[1,2,3]'')); \n+------------------------------+\n| HEX(vec_fromtext(''[1,2,3]'')) |\n+------------------------------+\n| 0000803F0000004000004040     |\n+------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_fromtext', '', 'https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_fromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (488, 35, 'VEC\\_ToText', 'Syntax\n------\n\nVEC_ToText(v)\n\nDescription\n-----------\n\nVEC_ToText converts a binary vector into a json array of numbers (floats). Returns NULL and throws a warning Error 4201 if given an invalid vector.\n\nExamples\n--------\n\nSELECT VEC_ToText(x''e360d63ebe554f3fcdbc523f4522193f5236083d'');\n+---------------------------------------------------------+\n| VEC_ToText(x''e360d63ebe554f3fcdbc523f4522193f5236083d'') |\n+---------------------------------------------------------+\n| [0.418708,0.809902,0.823193,0.598179,0.033255]          |\n+---------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_totext', '', 'https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_totext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (489, 35, 'VEC\\_DISTANCE', 'Syntax\n------\n\nVEC_DISTANCE(v, s)\n\nDescription\n-----------\n\nVEC_DISTANCE is a generic function that behaves either as VEC_DISTANCE_EUCLIDEAN, calculating the Euclidean (L2) distance between two points. Or VEC_DISTANCE_COSINE, calculating the Cosine distance between two vectors, depending on the underlying index type.\n\nIf the underlying index cannot be determined, an error 4206 is returned:\n\n``sql\nERROR 4206 (HY000): Cannot determine distance type for VEC_DISTANCE, index is not found\n``\n\nExamples\n--------\n\nINSERT INTO v VALUES \n     (1, x''e360d63ebe554f3fcdbc523f4522193f5236083d''),\n     (2, x''f511303f72224a3fdd05fe3eb22a133ffae86a3f''),\n     (3,x''f09baa3ea172763f123def3e0c7fe53e288bf33e''),\n     (4,x''b97a523f2a193e3eb4f62e3f2d23583e9dd60d3f''),\n     (5,x''f7c5df3e984b2b3e65e59d3d7376db3eac63773e''),\n     (6,x''de01453ffa486d3f10aa4d3fdd66813c71cb163f''),\n     (7,x''76edfc3e4b57243f10f8423fb158713f020bda3e''),\n     (8,x''56926c3fdf098d3e2c8c5e3d1ad4953daa9d0b3e''),\n     (9,x''7b713f3e5258323f80d1113d673b2b3f66e3583f''),\n     (10,x''6ca1d43e9df91b3fe580da3e1c247d3f147cf33e'');\n\nSELECT id FROM v \n  ORDER BY VEC_DISTANCE(v, x''6ca1d43e9df91b3fe580da3e1c247d3f147cf33e'');\n+----+\n| id |\n+----+\n| 10 |\n|  7 |\n|  3 |\n|  9 |\n|  2 |\n|  1 |\n|  5 |\n|  4 |\n|  6 |\n|  8 |\n+----+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vector-functions-vec_distance', '', 'https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vector-functions-vec_distance');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (490, 35, 'SQL Statements', 'Description\n-----------\n\ndata-definition\n\ndata-manipulation\n\naccount-management-sql-statements\n\nadministrative-sql-statements\n\nsql-functions\n\nprepared-statements\n\nprogrammatic-compound-statements\n\nstored-routines\n\ntable-statements\n\ntransactions\n\ncomment-syntax.md\n\nhelp-command.md\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/README', '', 'https://mariadb.com/docs/server/reference/sql-statements/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (491, 10, 'ALTER USER', 'Syntax\n------\n\nALTER USER [IF EXISTS] \n user_specification [,user_specification] ...\n  [REQUIRE {NONE | tls_option [[AND] tls_option] ...}]\n  [WITH resource_option [resource_option] ...]\n  [lock_option] [password_option] \n\nuser_specification:\n  username [authentication_option]\n\nauthentication_option:\n  IDENTIFIED BY ''password'' \n  | IDENTIFIED BY PASSWORD ''password_hash''\n  | IDENTIFIED {VIA|WITH} authentication_rule [OR authentication_rule] ... \n \nauthentication_rule:\n  authentication_plugin\n  | authentication_plugin {USING|AS} ''authentication_string''\n  | authentication_plugin {USING|AS} PASSWORD(''password'')\n\ntls_option\n  SSL \n  | X509\n  | CIPHER ''cipher''\n  | ISSUER ''issuer''\n  | SUBJECT ''subject''\n\nresource_option\n  MAX_QUERIES_PER_HOUR COUNT\n  | MAX_UPDATES_PER_HOUR COUNT\n  | MAX_CONNECTIONS_PER_HOUR COUNT\n  | MAX_USER_CONNECTIONS COUNT\n  | MAX_STATEMENT_TIME TIME\n\npassword_option:\n  PASSWORD EXPIRE\n  | PASSWORD EXPIRE DEFAULT\n  | PASSWORD EXPIRE NEVER\n  | PASSWORD EXPIRE INTERVAL N DAY\n\nlock_option:\n    ACCOUNT LOCK\n  | ACCOUNT UNLOCK\n}\n\nDescription\n-----------\n\nThe ALTER USER statement modifies existing MariaDB accounts. To use it, you must have the global CREATE USER privilege or the UPDATE privilege for the mysql database. The global READ_ONLY ADMIN privilege is also required if the read_only system variable is enabled.\n\nIf any of the specified user accounts do not yet exist, an error results. If an error occurs, ALTER USER will still modify the accounts that do not result in an error. Only one error is produced for all users which have not been modified.\n\nFor renaming an existing account (user name and/or host), see RENAME USER.\n\nIF EXISTS\n\nWhen the IF EXISTS clause is used, MariaDB will return a warning instead of an error for each specified user that does not exist.\n\nAccount Names\n\nFor ALTER USER statements, account names are specified as the username argument in the same way as they are for CREATE USER statements. See account names from the CREATE USER page for details on how account names are specified.\n\nCURRENT_USER or CURRENT_USER() can also be used to alter the account logged into the current session. For example, to change the current user''s password to mariadb:\n\n``sql\nALTER USER CURRENT_USER() IDENTIFIED BY ''mariadb'';\n`\n\nAuthentication Options\n\nFrom MariaDB 10.4, it is possible to use more than one authentication plugin for each user account. For example, this can be useful to slowly migrate users to the more secure ed25519 authentication plugin over time, while allowing the old mysql_native_password authentication plugin as an alternative for the transitional period. See Authentication from MariaDB 10.4 for more.\n\nWhen running ALTER USER, not specifying an authentication option in the IDENTIFIED VIA clause will remove that authentication method. (However this was not the case before MariaDB 10.4.13, see MDEV-21928)\n\nFor example, a user is created with the ability to authenticate via both a password and unix_socket:\n\n`sql\nCREATE USER ''bob''@''localhost'' \n  IDENTIFIED VIA mysql_native_password USING PASSWORD(''pwd'') \n  OR unix_socket;\n\nSHOW CREATE USER ''bob''@''localhost''\\G\n`\n\n`\n************************ 1. row ***********************\nCREATE USER for bob@localhost: CREATE USER bob@localhost \n  IDENTIFIED VIA mysql_native_password \n  USING ''975B2CD4FF9AE554FE8AD33168FBFC326D2021DD'' \n  OR unix_socket\n`\n\nIf the user''s password is updated, but unix_socket authentication is not specified in the IDENTIFIED VIA clause, unix_socket authentication will no longer be permitted.\n\n`sql\nALTER USER ''bob''@''localhost'' IDENTIFIED VIA mysql_native_password \n  USING PASSWORD(''pwd2'');\n\nSHOW CREATE USER ''bob''@''localhost''\\G\n`\n\n`\n************************ 1. row ***********************\nCREATE USER for bob@localhost: CREATE USER bob@localhost \n  IDENTIFIED BY PASSWORD ''38366FDA01695B6A5A9DD4E428D9FB8F7EB75512''\n`\n\nIDENTIFIED BY ''password''\n\nThe optional IDENTIFIED BY clause can be used to provide an account with a password. The password should be specified in plain text. It will be hashed by the PASSWORD function prior to being stored in the mysql.user view.\n\nFor example, if our password is mariadb, then we can set the account''s password with:\n\n`sql\nALTER USER foo2@test IDENTIFIED BY ''mariadb'';\n`\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user\\\nwill be able to connect without a password. A blank password is not a wildcard\\\nto match any password. The user must connect without providing a password if no\\\npassword is set.\n\nThe only authentication plugins that this clause supports are mysql_native_password and mysql_old_password.\n\nIDENTIFIED BY PASSWORD ''password_hash''\n\nThe optional IDENTIFIED BY PASSWORD clause can be used to provide an account with a password that has already been hashed. The password should be specified as a hash that was provided by the PASSWORD#function. It will be stored in the mysql.user view as-is.\n\nFor example, if our password is mariadb, then we can find the hash with:\n\n`sql\nSELECT PASSWORD(''mariadb'');\n`\n\n`\n+-------------------------------------------+\n| PASSWORD(''mariadb'')                       |\n+-------------------------------------------+\n| 54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n`\n\nAnd then we can set an account''s password with the hash:\n\n`sql\nALTER USER foo2@test \n  IDENTIFIED BY PASSWORD ''54958E764CE10E50764C2EECBB71D01F08549980'';\n`\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user\\\nwill be able to connect without a password. A blank password is not a wildcard\\\nto match any password. The user must connect without providing a password if no password is set.\n\nThe only authentication plugins that this clause supports are mysql_native_password and mysql_old_password.\n\nIDENTIFIED {VIA|WITH} authentication_plugin\n\nThe optional IDENTIFIED VIA authentication_plugin allows you to specify that the account should be authenticated by a specific authentication plugin. The plugin name must be an active authentication plugin as per SHOW PLUGINS. If it doesn''t show up in that output, then you will need to install it with INSTALL PLUGIN or INSTALL SONAME.\n\nFor example, this could be used with the PAM authentication plugin:\n\n`sql\nALTER USER foo2@test IDENTIFIED VIA pam;\n`\n\nSome authentication plugins allow additional arguments to be specified after a USING or AS keyword. For example, the PAM authentication plugin accepts a service name:\n\n`sql\nALTER USER foo2@test IDENTIFIED VIA pam USING ''mariadb'';\n`\n\nThe exact meaning of the additional argument would depend on the specific authentication plugin.\n\nThe USING or AS keyword can also be used to provide a plain-text password to a plugin if it''s provided as an argument to the PASSWORD() function. This is only valid for authentication plugins that have implemented a hook for the PASSWORD() function. For example, the ed25519 authentication plugin supports this:\n\n`sql\nALTER USER safe@''%'' IDENTIFIED VIA ed25519 USING PASSWORD(''secret'');\n`\n\nThe USING or AS keyword cannot be used to provide a plain-text password to a plugin if it''s provided as an argument to the PASSWORD() function.\n\nTLS Options\n\nBy default, MariaDB transmits data between the server and clients without encrypting it. This is generally acceptable when the server and client run on the same host or in networks where security is guaranteed through other means. However, in cases where the server and client exist on separate networks or they are in a high-risk network, the lack of encryption does introduce security concerns as a malicious actor could potentially eavesdrop on the traffic as it is sent over the network between them.\n\nTo mitigate this concern, MariaDB allows you to encrypt data in transit between the server and clients using the Transport Layer Security (TLS) protocol. TLS was formerly known as Secure Socket Layer (SSL), but strictly speaking the SSL protocol is a predecessor to TLS and, that version of the protocol is now considered insecure. The documentation still uses the term SSL often and for compatibility reasons TLS-related server system and status variables still use the prefix ssl_, but internally, MariaDB only supports its secure successors.\n\nSee Secure Connections Overview for more information about how to determine whether your MariaDB server has TLS support.\n\nYou can set certain TLS-related restrictions for specific user accounts. For instance, you might use this with user accounts that require access to sensitive data while sending it across networks that you do not control. These restrictions can be enabled for a user account with the CREATE USER, ALTER USER, or GRANT statements. The following options are available:\n\n| Option                    | Description                                                                                                                                                                                                                                                                                         |\n| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| REQUIRE NONE              | TLS is not required for this account, but can still be used.                                                                                                                                                                                                                                        |\n| REQUIRE SSL               | The account must use TLS, but no valid X509 certificate is required. This option cannot be combined with other TLS options.                                                                                                                                                                         |\n| REQUIRE X509              | The account must use TLS and must have a valid X509 certificate. This option implies REQUIRE SSL. This option cannot be combined with other TLS options.                                                                                                                                            |\n| REQUIRE ISSUER ''issuer''   | The account must use TLS and must have a valid X509 certificate. Also, the Certificate Authority must be the one specified via the string issuer. This option implies REQUIRE X509. This option can be combined with the SUBJECT, and CIPHER options in any order.                                  |\n| REQUIRE SUBJECT ''subject'' | The account must use TLS and must have a valid X509 certificate. Also, the certificate''s Subject must be the one specified via the string subject. This option implies REQUIRE X509. This option can be combined with the ISSUER, and CIPHER options in any order.                                  |\n| REQUIRE CIPHER ''cipher''   | The account must use TLS, but no valid X509 certificate is required. Also, the encryption used for the connection must use a specific cipher method specified in the string cipher. This option implies REQUIRE SSL. This option can be combined with the ISSUER, and SUBJECT options in any order. |\n\nThe REQUIRE keyword must be used only once for all specified options, and the AND keyword can be used to separate individual options, but it is not required.\n\nFor example, you can alter a user account to require these TLS options with the following:\n\n`sql\nALTER USER ''alice''@''%''\n REQUIRE SUBJECT ''/CN=alice/O=My Dom, Inc./C=US/ST=Oregon/L=Portland'' AND\n ISSUER ''/C=FI/ST=Somewhere/L=City/ O=Some Company/CN=Peter Parker/emailAddress=p.parker@marvel.com''\n AND CIPHER ''SHA-DES-CBC3-EDH-RSA'';\n`\n\nIf any of these options are set for a specific user account, then any client who tries to connect with that user account will have to be configured to connect with TLS.\n\nSee Securing Connections for Client and Server for information on how to enable TLS on the client and server.\n\nResource Limit Options\n\nIt is possible to set per-account limits for certain server resources. The following table shows the values that can be set per account:\n\n| Limit Type                  | Description                                                                                                                                                                                                                     |\n| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| MAX_QUERIES_PER_HOUR     | Number of statements that the account can issue per hour (including updates)                                                                                                                                                    |\n| MAX_UPDATES_PER_HOUR     | Number of updates (not queries) that the account can issue per hour                                                                                                                                                             |\n| MAX_CONNECTIONS_PER_HOUR | Number of connections that the account can start per hour                                                                                                                                                                       |\n| MAX_USER_CONNECTIONS      | Number of simultaneous connections that can be accepted from the same account; if it is 0, max_connections will be used instead; if max_connections is 0, there is no limit for this account''s simultaneous connections.      |\n| MAX_STATEMENT_TIME        | Timeout, in seconds, for statements executed by the user. See also Aborting Statements that Exceed a Certain Time to Execute. |\n\nIf any of these limits are set to 0, then there is no limit for that resource for that user.\n\nHere is an example showing how to set an account''s resource limits:\n\n`sql\nALTER USER ''someone''@''localhost'' WITH\n    MAX_USER_CONNECTIONS 10\n    MAX_QUERIES_PER_HOUR 200;\n`\n\nThe resources are tracked per account, which means ''user''@''server''; not per user name or per connection.\n\nThe count can be reset for all users using FLUSH USER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.\n\nPer account resource limits are stored in the user table, in the mysql database. Columns used for resources limits are named max_questions, max_updates, max_connections (for MAX_CONNECTIONS_PER_HOUR), and max_user_connections (for MAX_USER_CONNECTIONS).\n\nPassword Expiry\n\nBesides automatic password expiry, as determined by default_password_lifetime, password expiry times can be set on an individual user basis, overriding the global setting, for example:\n\n`sql\nALTER USER ''monty''@''localhost'' PASSWORD EXPIRE INTERVAL 120 DAY;\nALTER USER ''monty''@''localhost'' PASSWORD EXPIRE NEVER;\nALTER USER ''monty''\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/alter-user');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (492, 10, 'CREATE ROLE', 'Description\n-----------\n\nThe CREATE ROLE statement creates one or more MariaDB roles. To use it, you must have the global CREATE USER privilege or the INSERT privilege for the mysql database. For each account, CREATE ROLE creates a new row in the mysql.user table that has no privileges, and with the corresponding is_role field set to Y. It also creates a record in the mysql.roles_mapping table.\n\nIf any of the specified roles already exist, ERROR 1396 (HY000) results. If an error occurs, CREATE ROLE will still create the roles that do not result in an error. The maximum length for a role is 128 characters. Role names can be quoted, as explained in the Identifier names page. Only one error is produced for all roles which have not been created:\n\n``\nERROR 1396 (HY000): Operation CREATE ROLE failed for ''a'',''b'',''c''\n`\n\nFailed CREATE or DROP operations, for both users and roles, produce the same error code.\n\nPUBLIC and NONE are reserved, and cannot be used as role names. NONE is used to unset a role and PUBLIC has a special use in other systems, such as Oracle, so is reserved for compatibility purposes.\n\nFor valid identifiers to use as role names, see Identifier Names.\n\nWITH ADMIN\n\nThe optional WITH ADMIN clause determines whether the current user, the current role or another user or role has use of the newly created role. If the clause is omitted, WITH ADMIN CURRENT_USER` is treated as the default, which means that the current user will be able to GRANT this role to users.\n\nExamples\n--------\n\nCREATE ROLE developer WITH ADMIN lorinda@localhost;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/create-role', '', 'https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/create-role');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (493, 10, 'CREATE USER', 'Description\n-----------\n\nThe CREATE USER statement creates new MariaDB accounts. To use it, you must have the global CREATE USER privilege or the INSERT privilege for the mysql database.\n\nFor each account, CREATE USER creates a new row in the mysql.user view (and the underlying mysql.global_priv table) that has no privileges.\n\nFor each account, CREATE USER creates a new row in mysql.user table that has no privileges.\n\nIf any of the specified accounts, or any permissions for the specified accounts, already exist, then the server returns ERROR 1396 (HY000). If an error occurs, CREATE USER will still create the accounts that do not result in an error. Only one error is produced for all users which have not been created:\n\n``\nERROR 1396 (HY000): \n  Operation CREATE USER failed for ''u1''@''%'',''u2''@''%''\n`\n\nCREATE USER, DROP USER, CREATE ROLE, and DROP ROLE all produce the same error code when they fail.\n\nSee Account Names below for details on how account names are specified.\n\nOne can also create users with GRANT if SQL_MODE does not have NO_AUTO_CREATE_USER set. NO_AUTO_CREATE_USER is set by default.\n\nOR REPLACE\n\nIf the optional OR REPLACE clause is used, it is basically a shortcut for:\n\n`sql\nDROP USER IF EXISTS name;\nCREATE USER name ...;\n`\n\nFor example:\n\n`sql\nCREATE USER foo2@test IDENTIFIED BY ''password'';\nERROR 1396 (HY000): Operation CREATE USER failed for ''foo2''@''test''\n\nCREATE OR REPLACE USER foo2@test IDENTIFIED BY ''password'';\nQuery OK, 0 rows affected (0.00 sec)\n`\n\nIF NOT EXISTS\n\nWhen the IF NOT EXISTS clause is used, MariaDB will return a warning instead of an error if the specified user already exists.\n\nFor example:\n\n`sql\nCREATE USER foo2@test IDENTIFIED BY ''password'';\nERROR 1396 (HY000): Operation CREATE USER failed for ''foo2''@''test''\n\nCREATE USER IF NOT EXISTS foo2@test IDENTIFIED BY ''password'';\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+----------------------------------------------------+\n| Level | Code | Message                                            |\n+-------+------+----------------------------------------------------+\n| Note  | 1973 | Can''t create user ''foo2''@''test''; it already exists |\n+-------+------+----------------------------------------------------+\n`\n\nAuthentication Options\n\nIf more than one authentication mechanism is declared using the OR keyword, the mechanisms are attempted in the order they are declared in the CREATE USER statement. As soon as one of the authentication mechanisms is successful, authentication is complete. If none of them is successful, the authentication has failed.\n\nIDENTIFIED BY ''password''\n\nThe optional IDENTIFIED BY clause can be used to provide an account with a password. The password should be specified in plain text. It will be hashed by the PASSWORD function prior to being stored in the mysql.user/mysql.global_priv_table table.\n\nFor example, if our password is mariadb, then we can create the user with:\n\n`sql\nCREATE USER foo2@test IDENTIFIED BY ''mariadb'';\n`\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user\\\nwill be able to connect without a password. A blank password is not a wildcard\\\nto match any password. The user must connect without providing a password if no\\\npassword is set.\n\nThe only authentication plugins that this clause supports are mysql_native_password and mysql_old_password.\n\nIDENTIFIED BY PASSWORD ''password_hash''\n\nThe optional IDENTIFIED BY PASSWORD clause can be used to provide an account with a password that has already been hashed. The password should be specified as a hash that was provided by the PASSWORD function. It will be stored in the mysql.user/mysql.global_priv_table table as-is.\n\nFor example, if our password is mariadb, then we can find the hash with:\n\n`sql\nSELECT PASSWORD(''mariadb'');\n+-------------------------------------------+\n| PASSWORD(''mariadb'')                       |\n+-------------------------------------------+\n| 54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n`\n\nAnd then we can create a user with the hash:\n\n`sql\nCREATE USER foo2@test IDENTIFIED BY PASSWORD ''54958E764CE10E50764C2EECBB71D01F08549980'';\n`\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user will be able to connect without a password. A blank password is not a wildcard to match any password. The user must connect without providing a password if no password is set.\n\nThe only authentication plugins that this clause supports are mysql_native_password and mysql_old_password.\n\nIDENTIFIED {VIA|WITH} authentication_plugin\n\nThe optional IDENTIFIED VIA authentication_plugin allows you to specify that the account should be authenticated by a specific authentication plugin. The plugin name must be an active authentication plugin as per SHOW PLUGINS. If it doesn''t show up in that output, then you will need to install it with INSTALL PLUGIN or INSTALL SONAME.\n\nVIA and WITH are synonyms.\n\nFor example, this could be used with the PAM authentication plugin:\n\n`sql\nCREATE USER foo2@test IDENTIFIED VIA pam;\n`\n\nSome authentication plugins allow additional arguments to be specified after a USING or AS keyword. For example, the PAM authentication plugin accepts a service name:\n\n`sql\nCREATE USER foo2@test IDENTIFIED VIA pam USING ''mariadb'';\n`\n\nThe exact meaning of the additional argument would depend on the specific authentication plugin.\n\nThe USING or AS keyword can also be used to provide a plain-text password to a plugin if it''s provided as an argument to the PASSWORD() function. This is only valid for authentication plugins that have implemented a hook for the PASSWORD() function. For example, the ed25519 authentication plugin supports this:\n\n`sql\nCREATE USER safe@''%'' IDENTIFIED VIA ed25519 USING PASSWORD(''secret'');\n`\n\nOne can specify many authentication plugins, they all work as alternatives ways of authenticating a user:\n\n`sql\nCREATE USER safe@''%'' IDENTIFIED VIA ed25519 USING PASSWORD(''secret'') OR unix_socket;\n`\n\nBy default, when you create a user without specifying an authentication plugin, MariaDB uses the mysql_native_password plugin.\n\nTLS Options\n\nMariaDB allows you to encrypt data in transit between the server and clients using the Transport Layer Security (TLS) protocol. TLS was formerly known as Secure Socket Layer (SSL), but strictly speaking the SSL protocol is a predecessor to TLS and, that version of the protocol is now considered insecure. The documentation still uses the term SSL often and for compatibility reasons TLS-related server system and status variables still use the prefix ssl_, but internally, MariaDB only supports its secure successors.\n\nBy default, MariaDB transmits data between the server and clients without encrypting it. This is generally acceptable when the server and client run on the same host or in networks where security is guaranteed through other means. However, in cases where the server and client exist on separate networks or they are in a high-risk network, the lack of encryption does introduce security concerns as a malicious actor could potentially eavesdrop on the traffic as it is sent over the network between them.\n\nTo mitigate this concern, MariaDB allows you to encrypt data in transit between the server and clients using the Transport Layer Security (TLS) protocol. TLS was formerly known as Secure Socket Layer (SSL), but strictly speaking the SSL protocol is a predecessor to TLS and, that version of the protocol is now considered insecure. The documentation still uses the term SSL often and for compatibility reasons TLS-related server system and status variables still use the prefix ssl_, but internally, MariaDB only supports its secure successors.\n\nSee Secure Connections Overview for more information about how to determine whether your MariaDB server has TLS support.\n\nYou can set certain TLS-related restrictions for specific user accounts. For instance, you might use this with user accounts that require access to sensitive data while sending it across networks that you do not control. These restrictions can be enabled for a user account with the CREATE USER, ALTER USER, or GRANT statements. The following options are available:\n\n| Option                    | Description                                                                                                                                                                                                                                                                                         |\n| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| REQUIRE NONE              | TLS is not required for this account, but can still be used.                                                                                                                                                                                                                                        |\n| REQUIRE SSL               | The account must use TLS, but no valid X509 certificate is required. This option cannot be combined with other TLS options.                                                                                                                                                                         |\n| REQUIRE X509              | The account must use TLS and must have a valid X509 certificate. This option implies REQUIRE SSL. This option cannot be combined with other TLS options.                                                                                                                                            |\n| REQUIRE ISSUER ''issuer''   | The account must use TLS and must have a valid X509 certificate. Also, the Certificate Authority must be the one specified via the string issuer. This option implies REQUIRE X509. This option can be combined with the SUBJECT, and CIPHER options in any order.                                  |\n| REQUIRE SUBJECT ''subject'' | The account must use TLS and must have a valid X509 certificate. Also, the certificate''s Subject must be the one specified via the string subject. This option implies REQUIRE X509. This option can be combined with the ISSUER, and CIPHER options in any order.                                  |\n| REQUIRE CIPHER ''cipher''   | The account must use TLS, but no valid X509 certificate is required. Also, the encryption used for the connection must use a specific cipher method specified in the string cipher. This option implies REQUIRE SSL. This option can be combined with the ISSUER, and SUBJECT options in any order. |\n\nThe REQUIRE keyword must be used only once for all specified options, and the AND keyword can be used to separate individual options, but it is not required.\n\nFor example, you can create a user account that requires these TLS options with the following:\n\n`sql\nCREATE USER ''alice''@''%''\n REQUIRE SUBJECT ''/CN=alice/O=My Dom, Inc./C=US/ST=Oregon/L=Portland''\n AND ISSUER ''/C=FI/ST=Somewhere/L=City/ O=Some Company/CN=Peter Parker/emailAddress=p.parker@marvel.com''\n AND CIPHER ''SHA-DES-CBC3-EDH-RSA'';\n`\n\nIf any of these options are set for a specific user account, then any client who tries to connect with that user account will have to be configured to connect with TLS.\n\nSee Securing Connections for Client and Server for information on how to enable TLS on the client and server.\n\nResource Limit Options\n\nIt is possible to set per-account limits for certain server resources. The following table shows the values that can be set per account:\n\n| Limit Type                  | Decription                                                                                                                                                                                                                      |\n| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| MAX_QUERIES_PER_HOUR     | Number of statements that the account can issue per hour (including updates)                                                                                                                                                    |\n| MAX_UPDATES_PER_HOUR     | Number of updates (not queries) that the account can issue per hour                                                                                                                                                             |\n| MAX_CONNECTIONS_PER_HOUR | Number of connections that the account can start per hour                                                                                                                                                                       |\n| MAX_USER_CONNECTIONS      | Number of simultaneous connections that can be accepted from the same account; if it is 0, max_connections will be used instead; if max_connections is 0, there is no limit for this account''s simultaneous connections.      |\n| MAX_STATEMENT_TIME        | Timeout, in seconds, for statements executed by the user. See also Aborting Statements that Exceed a Certain Time to Execute. |\n\nIf any of these limits are set to 0, then there is no limit for that resource for that user.\n\nHere is an example showing how to create a user with resource limits:\n\n`sql\nCREATE USER ''someone''@''localhost'' WITH\n    MAX_USER_CONNECTIONS 10\n    MAX_QUERIES_PER_HOUR 200;\n`\n\nThe resources are tracked per account, which means ''user''@''server''; not per user name or per connection.\n\nThe count can be reset for all users using FLUSH USER_RESOURCES, FLUSH PRIVILEGES or mariadb-admin reload.\n\nPer account resource limits are stored in the user table, in the mysql database. Columns used for resources limits are named max_questions, max_updates, max_connections (for MAX_CONNECTIONS_PER_HOUR), and max_user_connections (for MAX_USER_CONNECTIONS).\n\nAccount Names\n\nAccount names have both a user name component and a host name component, and are specified as ''user_name''@''host_name''.\n\nThe user name and host name may be unquoted, quoted as strings using double quotes (") or\\\nsingle quotes (''), or quoted as identifiers using backticks (\\\\\\). You must use quotes\\\nwhen using special characters (such as a hyphen) or wildcard characters. If you quote, you\\\nmust quote the user name and host name separately (for example ''user_name''@''host_name'').\n\nHost Name Component\n\nIf the host name is not provided, it is assumed to be ''%''.\n\nHost names may contain the wildcard characters % and _. They are matched as if by\\\nthe LIKE clause. If you need to use a wildcard character literally (for example, to\\\nmatch a domain name with an underscore), prefix the character with a backslash. See LIKE\\\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/create-user');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (494, 10, 'DROP ROLE', 'Description\n-----------\n\nThe DROP ROLE statement removes one or more MariaDB roles. To use this statement, you must have the global CREATE USER privilege or the DELETE privilege for the mysql database.\n\nDROP ROLE does not disable roles for connections which selected them with SET ROLE. If a role has previously been set as a default role, DROP ROLE does not remove the record of the default role from the mysql.user table. If the role is subsequently recreated and granted, it will again be the user''s default. Use SET DEFAULT ROLE NONE to explicitly remove this.\n\nIf any of the specified user accounts do not exist, ERROR 1396 (HY000)results. If an error occurs, DROP ROLE will still drop the roles that do not result in an error. Only one error is produced for all roles which have not been dropped:\n\n``bnf\nERROR 1396 (HY000): Operation DROP ROLE failed for ''a'',''b'',''c''\n`\n\nFailed CREATE or DROP operations, for both users and roles, produce the same error code.\n\nIF EXISTS\n\nIf the IF EXISTS` clause is used, MariaDB will return a warning instead of an error if the role does not exist.\n\nExamples\n--------\n\nDROP ROLE journalist;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/drop-role', '', 'https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/drop-role');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (495, 10, 'DROP USER', 'Syntax\n------\n\nDROP USER [IF EXISTS] user_name [, user_name] ... [FORCE]\n\nDescription\n-----------\n\nThe DROP USER statement removes one or more MariaDB accounts. It removes privilege rows for the account from all grant tables. To use this statement, you must have the global CREATE USER privilege or the DELETE privilege for the mysql database. Each account is named using the same format as for the CREATE USER statement; for example, ''jeffrey''@''localhost''. If you specify only the user name part of the account name, a host name part of ''%'' is used. For additional information about specifying account names, see CREATE USER.\n\nIf you specify an account that is currently connected, it is deleted, but the statement completes with a warning:\n\n``sql\nDropped users ''user''@''host[,...]'' have active connections. Use KILL CONNECTION if they should not be used anymore.\n`\n\nThis means that the user account with all its privileges is still active until the connection is terminated. As the warning implies, use a KILL CONNECTION statement to terminate a connection, or (more proactively) use the FORCE clause to forcibly close connections of the users named in the DROP USER statement. This ends connections, and immediately deletes the users.\n\nIn Oracle mode, if a user is connected, the DROP USER statement fails with an error:\n\n`sql\nOperation DROP USER failed for ''foo''@''localhost''.\n`\n\nAgain, use the FORCE clause to prevent that error.\n\nIf you specify an account that is currently connected, it is not deleted until the connection is closed. The connection is not automatically closed.\n\nHowever, a deleted user cannot initiate new connections any more.\n\nIf any of the specified user accounts do not exist, ERROR 1396 (HY000) results. If an error occurs, DROP USER still drops the accounts that do not result in an error. Only one error is produced for all users which have not been dropped:\n\n`bnf\nERROR 1396 (HY000): Operation DROP USER failed for ''u1''@''%'',''u2''@''%''\n`\n\nFailed CREATE or DROP operations, for both users and roles, produce the same error.\n\nIF EXISTS\n\nIf the IF EXISTS clause is used, MariaDB returns a note instead of an error if the user does not exist.\n\nThe CREATE USER statement creates new MariaDB accounts. To use it, you must have the global CREATE USER privilege or the INSERT privilege for the mysql database.\n\nIf the IF EXISTS` clause is used, MariaDB returns a note instead of an error if the user does not exist.\n\nExamples\n--------\n\nDROP USER bob;\n\nDROP USER foo2@localhost,foo2@''127.%'';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/drop-user', '', 'https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/drop-user');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (496, 10, 'GRANT', 'Description\n-----------\n\nThe GRANT statement allows you to grant privileges or roles to accounts. To use GRANT, you must have the GRANT OPTION privilege, and you must have the privileges that you are granting.\n\nUse the REVOKE statement to revoke privileges granted with the GRANT statement.\n\nUse the SHOW GRANTS statement to determine what privileges an account has.\n\nAccount Names\n\nFor GRANT statements, account names are specified as the username argument in the same way as they are for CREATE USER statements. See account names from the CREATE USER page for details on how account names are specified.\n\nImplicit Account Creation\n\nThe GRANT statement also allows you to implicitly create accounts in some cases.\n\nIf the account does not yet exist, then GRANT can implicitly create it. To implicitly create an account with GRANT, a user is required to have the same privileges that would be required to explicitly create the account with the CREATE USER statement.\n\nIf the NO_AUTO_CREATE_USER SQL_MODE is set, then accounts can only be created if authentication information is specified, or with a CREATE USER statement. If no authentication information is provided, GRANT will produce an error when the specified account does not exist, for example:\n\n``sql\nSHOW VARIABLES LIKE ''%sql_mode%'' ;\n`\n\n<pre><code><strong>+---------------+--------------------------------------------+\n</strong>| Variable_name | Value                                      |\n+---------------+--------------------------------------------+\n| sql_mode      | NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |\n+---------------+--------------------------------------------+\n</code></pre>\n\n`sql\nGRANT USAGE ON . TO ''user123''@''%'' IDENTIFIED BY '''';\n`\n\n`\nERROR 1133 (28000): Can''t find any matching row in the user table\n`\n\n`sql\nGRANT USAGE ON . TO ''user123''@''%'' \n  IDENTIFIED VIA PAM using ''mariadb'' require ssl ;\nQuery OK, 0 rows affected (0.00 sec)\n`\n\n`sql\nSELECT host, user FROM mysql.user WHERE user=''user123'' ;\n`\n\n`\n+------+----------+\n| host | user     |\n+------+----------+\n| %    | user123 |\n+------+----------+\n`\n\nPrivilege Levels\n\nPrivileges can be set globally, for an entire database, for a table or routine, or for individual columns in a table. Certain privileges can only be set at certain levels.\n\nGlobal privileges do not take effect immediately and are only applied to connections created after the GRANT statement was executed.\n\n Global privileges priv_type are granted using . for priv_level. Global privileges include privileges to administer the database and manage user accounts, as well as privileges for all tables, functions, and procedures. Global privileges are stored in mysql.global_priv table.\n Database privileges priv_type are granted using db_name. for priv_level, or using just  to use the current database. Database privileges include privileges to create tables and functions, as well as privileges for all tables, functions, and procedures in the database. Database privileges are stored in the mysql.db table.\n Table privileges priv_type are granted using db_name.tbl_namefor priv_level, or using just tbl_name to specify a table in the current database. The TABLE keyword is optional. Table privileges include the ability to select and change data in the table. Certain table privileges can be granted for individual columns.\n Column privileges priv_type are granted by specifying a table for priv_level and providing a column list after the privilege type. They allow you to control exactly which columns in a table users can select and change.\n Function privileges priv_type are granted using FUNCTION db_name.routine_name for priv_level, or using just FUNCTION routine_name to specify a function in the current database.\n Procedure privileges priv_type are granted using PROCEDURE db_name.routine_name for priv_level, or using just PROCEDURE routine_name to specify a procedure in the current database.\n\nThe USAGE Privilege\n\nThe USAGE privilege grants no real privileges. The SHOW GRANTS statement will show a global USAGE privilege for a newly-created user. You can use USAGE with the GRANT statement to change options like GRANT OPTIONand MAX_USER_CONNECTIONS without changing any account privileges.\n\nThe ALL PRIVILEGES Privilege\n\nThe ALL PRIVILEGES privilege grants all available privileges. Granting all privileges only affects the given privilege level. For example, granting all privileges on a table does not grant any privileges on the database or globally.\n\nUsing ALL PRIVILEGES does not grant the special GRANT OPTION privilege.\n\nYou can use ALL instead of ALL PRIVILEGES.\n\nThe GRANT OPTION Privilege\n\nUse the WITH GRANT OPTION clause to give users the ability to grant privileges to other users at the given privilege level. Users with the GRANT OPTION privilege can only grant privileges they have. They cannot grant privileges at a higher privilege level than they have the GRANT OPTION privilege.\n\nThe GRANT OPTION privilege cannot be set for individual columns. If you use WITH GRANT OPTION when specifying column privileges, the GRANT OPTION privilege will be granted for the entire table.\n\nUsing the WITH GRANT OPTION clause is equivalent to listing GRANT OPTION as a privilege.\n\nGlobal Privileges\n\nThe following table lists the privileges that can be granted globally. You can also grant all database, table, and function privileges globally. When granted globally, these privileges apply to all databases, tables, or functions, including those created later.\n\nTo set a global privilege, use . for _priv_level_.\n\nBINLOG ADMIN\n\nEnables administration of the binary log, including the PURGE BINARY LOGS statement and setting the system variables:\n\n binlog_annotate_row_events\n binlog_cache_size\n binlog_commit_wait_count\n binlog_commit_wait_usec\n binlog_direct_non_transactional_updates\n binlog_expire_logs_seconds\n binlog_file_cache_size\n binlog_format\n binlog_row_image\n binlog_row_metadata\n binlog_stmt_cache_size\n expire_logs_days\n log_bin_compress\n log_bin_compress_min_len\n log_bin_trust_function_creators\n max_binlog_cache_size\n max_binlog_size\n max_binlog_stmt_cache_size\n sql_log_bin and\n sync_binlog.\n\nBINLOG ADMIN isn''t available.\n\nBINLOG MONITOR\n\nNew name for REPLICATION CLIENT. REPLICATION CLIENT can still be used, though.\n\nUse REPLICATION CLIENT instead. SHOW SLAVE STATUS isn''t included in this privilege, and SLAVE MONITOR is required.\n\nPermits running SHOW commands related to the binary log, in particular the SHOW BINLOG STATUS and SHOW BINARY LOGS statements.\n\nBINLOG REPLAY\n\nEnables replaying the binary log with the BINLOG statement (generated by mariadb-binlog), executing SET timestamp when secure_timestamp is set to replication, and setting the session values of system variables usually included in BINLOG output, in particular:\n\n gtid_domain_id\n gtid_seq_no\n pseudo_thread_id\n server_id.\n\nBINLOG REPLAY isn''t available.\n\nCONNECTION ADMIN\n\nEnables administering connection resource limit options. This includes ignoring the limits specified by max_user_connections and max_password_errors, and allowing one extra connection over max_connections\n\nThe statements specified in init_connect are not executed, killing connections and queries owned by other users is permitted. The following connection-related system variables can be changed:\n\n connect_timeout\n disconnect_on_expired_password\n extra_max_connections\n init_connect\n max_connections\n max_connect_errors\n max_password_errors\n proxy_protocol_networks\n secure_auth\n slow_launch_time\n thread_pool_exact_stats\n thread_pool_dedicated_listener\n thread_pool_idle_timeout\n thread_pool_max_threads\n thread_pool_min_threads\n thread_pool_oversubscribe\n thread_pool_prio_kickup_timer\n thread_pool_priority\n thread_pool_size, and\n thread_pool_stall_limit.\n\nCREATE USER\n\nCreate a user using the CREATE USER statement, or implicitly create a user with the GRANT statement.\n\nFEDERATED ADMIN\n\nExecute CREATE SERVER, ALTER SERVER, and DROP SERVER statements.\n\nFEDERATED ADMIN is not available.\n\nFILE\n\nRead and write files on the server, using statements like LOAD DATA INFILE or functions like LOAD_FILE(). Also needed to create CONNECT outward tables. MariaDB server must have the permissions to access those files.\n\nGRANT OPTION\n\nGrant global privileges. You can only grant privileges that you have.\n\nPROCESS\n\nShow information about the active processes, for example via SHOW PROCESSLIST or mariadb-admin processlist. If you have the PROCESS privilege, you can see all threads. Otherwise, you can see only your own threads (that is, threads associated with the MariaDB account that you are using).\n\nREAD_ONLY ADMIN\n\nUser ignores the read_only system variable, and can perform write operations even when the read_only option is active.\n\nA user with that privilege can also change the (global) value of read_only.\n\nThe READ_ONLY ADMIN privilege has been removed from SUPER. The benefit of this is that one can remove the READ_ONLY ADMIN privilege from all users and ensure that no one can make any changes on any non-temporary tables. This is useful on slaves when one wants to ensure that the slave is kept identical to the master.\n\nUser ignores the read_only system variable, and can perform write operations even when the read_only option is active.\n\nA user with that privilege can also change the (global) value of read_only.\n\nThe READ_ONLY ADMIN privilege is included in SUPER.\n\nREAD_ONLY ADMIN isn''t available.\n\nRELOAD\n\nExecute FLUSH statements or equivalent mariadb-admin commands.\n\nREPLICATION CLIENT\n\nExecute SHOW MASTER STATUS and SHOW BINARY LOGS informative statements. Renamed to BINLOG MONITOR (but still supported as an alias for compatibility reasons).\n\nExecute SHOW MASTER STATUS and SHOW BINARY LOGS informative statements. SHOW SLAVE STATUS is part of REPLICATION CLIENT.\n\nExecute SHOW MASTER STATUS and SHOW BINARY LOGS informative statements. Using BINLOG MONITOR instead is still supported as an alias.\n\nExecute SHOW MASTER STATUS and SHOW BINARY LOGS informative statements. Renamed to BINLOG MONITOR in MariaDB 10.5.2 (but still supported as an alias for compatibility reasons). SHOW SLAVE STATUS was part of REPLICATION CLIENT prior to MariaDB 10.5.\n\nREPLICATION MASTER ADMIN\n\nPermits administration of master servers, including the SHOW SLAVE HOSTS statement, and setting the gtid_binlog_state, gtid_domain_id, master_verify_checksum and server_id system variables.\n\nREPLICATION MASTER ADMIN is not available.\n\nSLAVE MONITOR\n\nPermit SHOW REPLICA STATUS and SHOW RELAYLOG EVENTS.\n\nSee _Reasoning_ tab as to why this was implemented.\n\nWhen a user would upgrade from an older major release to a MariaDB 10.5 minor release prior to MariaDB 10.5.9, certain user accounts would lose capabilities. For example, a user account that had the REPLICATION CLIENT privilege in older major releases could run SHOW REPLICA STATUS, but after upgrading to a MariaDB 10.5 minor release prior to MariaDB 10.5.9, they could no longer run SHOW REPLICA STATUS, because that statement was changed to require the REPLICATION SLAVE ADMIN privilege.\n\nThis issue is fixed in MariaDB 10.5.9 with this new privilege, which now grants the user the ability to execute SHOW [ALL] (SLAVE | REPLICA) STATUS.\n\nWhen a database is upgraded from an older major release to MariaDB Server 10.5.9 or later, any user accounts with the REPLICATION CLIENT or REPLICATION SLAVE privileges will automatically be granted the new SLAVE MONITOR privilege. The privilege fix occurs when the server is started up, not when mariadb-upgrade is performed.\n\nHowever, when a database is upgraded from an early 10.5 minor release to 10.5.9 and later, the user will have to fix any user account privileges manually.\n\nSLAVE MONITOR is not available.\n\nREPLICATION REPLICA\n\nSynonym for REPLICATION SLAVE.\n\nREPLICATION REPLICA is not available.\n\nREPLICATION SLAVE\n\nAccounts used by slave servers on the master need this privilege. This is needed to get the updates made on the master. REPLICATION REPLICA is an alias for REPLICATION SLAVE.\n\nAccounts used by slave servers on the master need this privilege. This is needed to get the updates made on the master.\n\nREPLICATION SLAVE ADMIN\n\nPermits administering slave servers, including START REPLICA/SLAVE, STOP REPLICA/SLAVE, CHANGE MASTER, SHOW REPLICA/SLAVE STATUS, SHOW RELAYLOG EVENTS statements, replaying the binary log with the BINLOG statement (generated by mariadb-binlog), and setting the system variables:\n\n gtid_cleanup_batch_size\n gtid_ignore_duplicates\n gtid_pos_auto_engines\n gtid_slave_pos\n gtid_strict_mode\n init_slave\n read_binlog_speed_limit\n relay_log_purge\n relay_log_recovery\n replicate_do_db\n replicate_do_table\n replicate_events_marked_for_skip\n replicate_ignore_db\n replicate_ignore_table\n replicate_wild_do_table\n replicate_wild_ignore_table\n slave_compressed_protocol\n slave_ddl_exec_mode\n slave_domain_parallel_threads\n slave_exec_mode\n slave_max_allowed_packet\n slave_net_timeout\n slave_parallel_max_queued\n slave_parallel_mode\n slave_parallel_threads\n slave_parallel_workers\n slave_run_triggers_for_rbr\n slave_sql_verify_checksum\n slave_transaction_retry_interval\n slave_type_conversions\n sync_master_info\n sync_relay_log, and\n sync_relay_log_info.\n\nREPLICATION SLAVE ADMIN is not available.\n\nSET USER\n\nEnables setting the DEFINER when creating triggers, views, stored functions and stored procedures.\n\nSET USER isn''t available.\n\nSHOW DATABASES\n\nList all databases using the SHOW DATABASES statement. Without the SHOW DATABASES privilege, you can still issue the SHOW DATABASES statement, but it will only list databases containing tables on which you have privileges.\n\nSHUTDOWN\n\nShut down the server using SHUTDOWN or the mariadb-admin shutdown command.\n\nSUPER\n\nExecute superuser statements: CHANGE MASTER TO, KILL (users who do not have this privilege can only KILL their own threads), PURGE LOGS, SET global system variables, or the mariadb-admin debug command. Also, this permission allows the user to write data even if the read_only startup option is set, enable or disable logging, enable or disable replication on slave, specify a DEFINER for statements that support that clause, connect once reaching the MAX_CONNECTIONS. If a statement has been specified for the init-connect mariadbd option, that command will not be executed when a user with SUPER privileges connects to the server.\n\nThe SUPER privilege has been split into multiple smaller privileges to allow for more fine-grained privileges (MDEV-21743). The privileges are:\n\n SET USER\n FEDERATED ADMIN\n CONNECTION ADMIN\n REPLICATION SLAVE ADMIN\n BINLOG ADMIN\n BINLOG REPLAY\n SLAVE MONITOR\n BINLOG MONITOR\n REPLICATION MASTER ADMIN\n READ_ONLY ADMIN\n\nThese grants are no longer a part of SUPER and need to be granted separately.\n\nThe READ_ONLY ADMIN privilege has been removed from SUPER. The benefit of this is that one can remove the READ_ONLY ADMIN privilege from all users and ensure that no one can make any changes on any non-temporary tables. This is useful on\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/grant');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (497, 10, 'RENAME USER', 'Description\n-----------\n\nThe RENAME USER statement renames existing MariaDB accounts. To use it, you must have the global CREATE USER privilege or the UPDATE privilege for the mysql database. Each account is named using the same format as for the CREATE USER statement; for example, ''jeffrey''@''localhost''.\\\nIf you specify only the user name part of the account name, a host name part of ''%'' is used.\n\nIf any of the old user accounts do not exist or any of the new user accounts already exist, ERROR 1396 (HY000) results. If an error occurs, RENAME USERwill still rename the accounts that do not result in an error.\n\nFor modifying an existing account, see ALTER USER.\n\nExamples\n--------\n\nCREATE USER ''donald'', ''mickey'';\nRENAME USER ''donald'' TO ''duck''@''localhost'', ''mickey'' TO ''mouse''@''localhost'';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/rename-user', '', 'https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/rename-user');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (498, 10, 'REVOKE', 'Description\n-----------\n\nThe REVOKE statement enables system administrators to revoke privileges (or roles - see section below) from MariaDB accounts. Each account is named using the same format as for the GRANT statement; for example, jeffrey@localhost. If you specify only the user name part of the account name, a host name part of % is used. For details on the levels at which privileges exist, the available priv_type and priv_level values, and the syntax for specifying users and passwords, see GRANT.\n\nTo use the first syntax (REVOKE ... ON ... FROM ...), you must have the GRANT OPTION privilege, and you must have the privileges that you are revoking. Also, remember to specify the ON clause (in many cases, ON . to revoke privileges for all objects):\n\n``sql\nREVOKE ALL ON . FROM ''myuser''@''localhost'';\n`\n\nThis leaves the USAGE privilege, and can leave other privileges, too. For that reason, the second syntax (REVOKE ALL PRIVILEGES, GRANT OPTION FROM ...) is preferable, which drops all global, database, table, column, and routine privileges for the named user or users:\n\n`sql\nREVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...\n`\n\nTo use this REVOKE syntax, you must have the global CREATE USER privilege or the UPDATE privilege for the mysql database. See GRANT. For that syntax, the ON . clause must not be used (it yields an error).\n\nRevoking all privileges doesn''t remove _all_ privileges, not even with the second syntax. The user still keeps the USAGE privilege, making it possible to connect to the server (but nothing else). To remove that privilege, too, remove the user entirely with a DROP USER` statement.\n\nExamples\n--------\n\nREVOKE SUPER ON . FROM ''myuser''@''localhost'';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/revoke', '', 'https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/revoke');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (499, 10, 'SET DEFAULT ROLE', 'Description\n-----------\n\nThe SET DEFAULT ROLE statement sets a default role for a specified (or current) user. A default role is automatically enabled when a user connects (an implicit SET ROLE statement is executed immediately after a connection is established).\n\nTo be able to set a role as a default, the role must already have been granted to that user, and one needs the privileges to enable this role (if you cannot do SET ROLE X, you won''t be able to do SET DEFAULT ROLE X). To set a default role for another user one needs to have write access to the mysql database.\n\nTo remove a user''s default role, use SET DEFAULT ROLE NONE [ FOR user@host ]. The record of the default role is not removed if the role is dropped or revoked, so if the role is subsequently re-created or granted, it will again be the user''s default role.\n\nThe default role is stored in the default_role column in the mysql.user table/view, as well as in the Information Schema APPLICABLE_ROLES table, so these can be viewed to see which role has been assigned to a user as the default.\n\nExamples\n--------\n\nSET DEFAULT ROLE journalist;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/set-default-role', '', 'https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/set-default-role');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (500, 10, 'SET PASSWORD', 'Syntax\n------\n\nSET PASSWORD [FOR user] =\n    {\n        PASSWORD(''some password'')\n      | OLD_PASSWORD(''some password'')\n      | ''encrypted password''\n    }\n\nDescription\n-----------\n\nThe SET PASSWORD statement assigns a password to an existing MariaDB user account.\n\nIf the password is specified using the PASSWORD() or OLD_PASSWORD() function, the literal text of the password should be given. If the password is specified without using either function, the password should be the already-encrypted password value as returned by PASSWORD().\n\nOLD_PASSWORD() should only be used if your MariaDB/MySQL clients are very old (< 4.0.0).\n\nWith no FOR clause, this statement sets the password for the current user. Any client that has connected to the server using a non-anonymous account can change the password for that account.\n\nWith a FOR clause, this statement sets the password for a specific account on the current server host. Only clients that have the UPDATE privilege for the mysql database can do this. The user value should be given in user_name@host_name format, where user_name and host_name are exactly as they are listed in the User and Host columns of the mysql.user table (or view in current versions) entry.\n\nThe argument to PASSWORD() and the password given to MariaDB clients can be of arbitrary length.\n\nAuthentication Plugin Support\n\nSET PASSWORD (with or without PASSWORD()) works for accounts authenticated via any authentication plugin that supports passwords stored in the mysql.global_priv table.\n\nThe ed25519, mysql_native_password, and mysql_old_password authentication plugins store passwords in the mysql.global_priv table.\n\nIf you run SET PASSWORD on an account that authenticates with one of these authentication plugins that stores passwords in the mysql.global_priv table, then the PASSWORD() function is evaluated by the specific authentication plugin used by the account. The authentication plugin hashes the password with a method that is compatible with that specific authentication plugin.\n\nThe unix_socket, named_pipe, gssapi, and pam authentication plugins do not store passwords in the mysql.global_priv table. These authentication plugins rely on other methods to authenticate the user.\n\nIf you attempt to run SET PASSWORD on an account that authenticates with one of these authentication plugins that doesn''t store a password in the mysql.global_priv table, then MariaDB Server will issue an error like the following:\n\n``\nSET PASSWORD IS ignored FOR users authenticating via unix_socket plugin\n``\n\nSee Authentication from MariaDB 10.4 for an overview of authentication changes in MariaDB.\n\nPasswordless User Accounts\n\nUser accounts do not always require passwords to login.\n\nThe unix_socket , named_pipe and gssapi authentication plugins do not require a password to authenticate the user.\n\nThe pam authentication plugin may or may not require a password to authenticate the user, depending on the specific configuration.\n\nThe mysql_native_password and mysql_old_password authentication plugins require passwords for authentication, but the password can be blank. In that case, no password is required.\n\nIf you provide a password while attempting to log into the server as an account that doesn''t require a password, then MariaDB server will simply ignore the password.\n\nA user account can be defined to use multiple authentication plugins in a specific order of preference. This specific scenario may be more noticeable in these versions, since an account could be associated with some authentication plugins that require a password, and some that do not.\n\nExamples\n--------\n\nSET PASSWORD FOR ''bob''@''%.loc.gov'' = PASSWORD(''newpass'');\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/set-password', '', 'https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/set-password');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (501, 10, 'SET ROLE', 'Description\n-----------\n\nOnly one role can be current at a time. Executing SET ROLE replaces the current role; it does not add to a list of current roles. This is SQL Standard compliant behavior which differs from MySQL, where you may have several current roles at a time.\n\nThe SET ROLE statement switches the current role for the session, enabling its associated permissions. To have no current role, set NONE.\n\nIf a role that doesn''t exist, or to which the user has not been assigned, is specified, an ERROR 1959 (OP000): Invalid role specification error occurs.\n\nAn automatic SET ROLE is implicitly performed when a user connects if that user has been assigned a default role. See SET DEFAULT ROLE.\n\nExamples\n--------\n\n--Checking the current role status\nSELECT CURRENT_ROLE;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/set-role', '', 'https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/set-role');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (502, 26, 'ANALYZE FORMAT=JSON', 'Description\n-----------\n\nANALYZE FORMAT=JSON is a mix of the EXPLAIN FORMAT=JSON and ANALYZE statement features. The ANALYZE FORMAT=JSON $statement will execute $statement, and then print the output of EXPLAIN FORMAT=JSON, amended with data from the query execution.\n\nBasic Execution Data\n\nYou can get the following also from tabular ANALYZE statement form:\n\n r_rows is provided for any node that reads rows. It shows how many rows were read, on average.\n r_filtered is provided whenever there is a condition that is checked. It shows the percentage of rows left after checking the condition.\n\nAdvanced Execution Data\n\nThe most important data not available in the regular tabular ANALYZE statement are:\n\n r_loops field. This shows how many times the node was executed. Most query plan elements have this field.\n r_total_time_ms field. It shows how much time in total, in milliseconds, was spent executing this node. If the node has subnodes, their execution time is included.\n   For UPDATE and DELETE statements, top-level query_block.r_total_time_ms does include the time to make row deletions/updates but does NOT include the time to commit the changes.\n r_buffer_size field. Query plan nodes that make use of buffers report the size of buffer that was used.\n\nInnoDB engine statistics\n\nStarting from MariaDB 10.6.15, MariaDB 10.8.8, MariaDB 10.9.8, MariaDB 10.10.6, MariaDB 10.11.5, MariaDB 11.0.3, MariaDB 11.1.2 and MariaDB 11.2.1 (MDEV-31577), the following statistics are reported for InnoDB tables:\n\n``json\n"r_engine_stats": {\n        "pages_accessed":  integer,\n        "pages_updated": integer,\n        "pages_read_count": integer,\n        "pages_prefetch_read_count": integer,\n        "pages_read_time_ms": double,\n        "old_rows_read": integer\n      }\n`\n\nOnly non-zero members are printed.\n\n pages_accessed is the total number of buffer pool pages accessed when reading this table.\n pages_updated is the total number of buffer pool pages that were modified during the execution of the statement.\n pages_read_count is the number of pages that InnoDB had to read from disk for this table. If the query touches "hot" data in the InnoDB buffer pool, this value will be 0 and not present.\n pages_prefetch_read_count Number of pages for which read-ahead was initiated. Not all such pages will necessarily be accessed.\n pages_read_time_ms is the total time spent reading the table.\n old_rows_read is the number of old row versions that InnoDB had to read. Old row version is the version of the row that is not visible to this transaction.\n\nSHOW ANALYZE FORMAT=JSON\n\nMariaDB starting with 10.9\n\nSHOW ANALYZE FORMAT=JSON for <connection_id>\\\nextends ANALYZE [FORMAT=JSON] <select> to allow one to analyze a query currently running in another connection.\n\nData About Individual Query Plan Nodes\n\n filesort node reports whether sorting was done with LIMIT n parameter, and how many rows were in the sort result.\n block-nl-join node has r_loops field, which allows to tell whether Using join buffer was efficient.\n range-checked-for-each-record reports counters that show the result of the check.\n expression-cache is used for subqueries, and it reports how many times the cache was used, and what cache hit ratio was.\n* union_result node has r_rows` so one can see how many rows were produced after UNION operation and so forth.\n\nUse Cases\n\nSee Examples of ANALYZE FORMAT=JSON.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/analyze-format-json', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/analyze-format-json');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (503, 26, 'ANALYZE FORMAT=JSON Examples', 'Examples\n--------\n\nANALYZE FORMAT=JSON\nSELECT COUNT()\nFROM customer\nWHERE\n  (SELECT SUM(o_totalprice) FROM orders WHERE o_custkey=c_custkey) > 10001000;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/analyze-formatjson-examples', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/analyze-formatjson-examples');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (504, 26, 'ANALYZE: Interpreting rows and filtered members', 'Description\n-----------\n\nThis article describes how to interpret r_rows and r_filtered members in ANALYZE FORMAT=JSON when an index-based access method is used.\n\nIndex-based access method\n\nIndex-based access method may employ some or all of the following:\n\n Index Condition Pushdown\n Rowid Filtering\n attached_condition checking\n\nConsider a table access which does all three:\n\n``json\n"table": {\n    "table_name": "t1",\n    "access_type": "range",\n    "possible_keys": ...,\n    "key": "INDEX1",\n    ...\n    "rowid_filter": {\n      ...\n      "r_selectivity_pct": n.nnn,\n    },\n    ...\n    "rows": 123,\n    "r_rows": 125,\n    ...\n    "filtered": 8.476269722,\n    "r_filtered": 100,\n    "index_condition": "cond1",\n    "attached_condition": "cond2"\n  }\n`\n\nThe access is performed as follows:\n\nAccess diagram\n\n!index-read-diagram-3\n\nStatistics values in MariaDB before 11.5\n\nIn MariaDB versions before 11.5, the counters were counted as follows:\n\n!index-read-stats-old\n\nthat is,\n\n r_rows is counted after Index Condition Pushdown check and Rowid Filter check.\n r_filtered only counts selectivity of the attached_condition.\n selectivity of the Rowid Filter is in rowid_filter.r_selectivity_pct.\n\nStatistics values in MariaDB 11.5 and later versions\n\nStarting from MariaDB 11.5 (MDEV-18478), the row counters are:\n\n r_index_rows counts the number of enumerated index tuples, before any checks are made\n r_rows is the same as before - number of rows after index checks.\n\nThe selectivity counters are:\n\n r_icp_filtered is the percentage of records left after pushed index condition check.\n rowid_filter.r_selectivity_pct shows selectivity of Rowid Filter, as before.\n r_filtered is the selectivity of attached_condition check, as before.\n r_total_filtered is the combined selectivity of all checks.\n\n!index-read-stats-new\n\nANALYZE output members\n\nin ANALYZE FORMAT=JSON output these members are placed as follows:\n\n`json\n"table": {\n    "table_name": ...,\n\n    "rows": 426,\n    "r_index_rows": 349,\n    "r_rows": 34,\n`\n\nWhenever applicable, r_index_rows is shown. It is comparable with rows - both are numbers of rows to enumerate before any filtering is done.\\\nIf r_index_rows is not shown, r_rows shows the number of records enumerated.\n\nThen, filtering members:\n\n`json\n...\n    "filtered": 8.476269722,\n    "r_total_filtered": 9.742120344,\n`\n\nfiltered is comparable with r_total_filtered: both show total amount of filtering.\n\n`json\n...\n    "index_condition": "lineitem.l_quantity > 47",\n    "r_icp_filtered": 100,\n`\n\nICP and its observed filtering. The optimizer doesn''t compute an estimate for this currently.\n\n`json\n...\n    "attached_condition": "lineitem.l_shipDATE between ''1997-01-01'' and ''1997-06-30''",\n    "r_filtered": 100\n`\n\nattached_condition` and its observed filtering.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/analyze-interpreting-rows-and-filtered-members', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/analyze-interpreting-rows-and-filtered-members');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (505, 26, 'ANALYZE Statement', 'Description\n-----------\n\nThe ANALYZE statement is similar to the EXPLAIN statement. ANALYZE statement will invoke the optimizer, execute the statement, and then produce EXPLAIN output instead of the result set. The EXPLAIN output will be annotated with statistics from statement execution.\n\nThis lets one check how close the optimizer''s estimates about the query plan are to the reality. ANALYZE produces an overview, while the ANALYZE FORMAT=JSON command provides a more detailed view of the query plan and the query execution.\n\nThe syntax is\n\n``sql\nANALYZE explainable_statement;\n`\n\nwhere the statement is any statement for which one can run EXPLAIN.\n\nCommand Output\n\nConsider an example:\n\n`sql\nANALYZE SELECT  FROM tbl1 \nWHERE key1 \n  BETWEEN 10 AND 200 AND \n  col1 LIKE ''foo%''\\G\n`\n\n`\n*********************** 1. row ***********************\n           id: 1\n  select_type: SIMPLE\n        table: tbl1\n         type: range\npossible_keys: key1\n          key: key1\n      key_len: 5\n          ref: NULL\n         rows: 181\n       r_rows: 181\n     filtered: 100.00\n   r_filtered: 10.50\n        Extra: Using index condition; Using where\n`\n\nCompared to EXPLAIN, ANALYZE produces two extra columns:\n\n r_rows is an observation-based counterpart of the rows column. It shows how many rows were actually read from the table.\n r_filtered is an observation-based counterpart of the filtered column. It shows which fraction of rows was left after applying the WHERE condition.\n\n> These r_rows and r_filtered columns are also included in the EXPLAIN output written to the slow query log in MariaDB 10.1.0 and later. This explains why, even though they are not displayed by a standard EXPLAIN statement, some columns may appear in slow query log data.\n\nInterpreting the Output\n\nJoins\n\nLet''s consider a more complicated example.\n\n`sql\nANALYZE SELECT \nFROM orders, customer \nWHERE\n  customer.c_custkey=orders.o_custkey AND\n  customer.c_acctbal < 0 AND\n  orders.o_totalprice > 2001000\n`\n\n`\n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n| id | select_type | table    | type | possible_keys | key         | key_len | ref                | rows   | r_rows | filtered | r_filtered | Extra       |\n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n|  1 | SIMPLE      | customer | ALL  | PRIMARY,...   | NULL        | NULL    | NULL               | 149095 | 150000 |    18.08 |       9.13 | Using where |\n|  1 | SIMPLE      | orders   | ref  | i_o_custkey   | i_o_custkey | 5       | customer.c_custkey |      7 |     10 |   100.00 |      30.03 | Using where |\n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n`\n\nHere, one can see that\n\n For table customer, customer.rows=149095, customer.r_rows=150000. The estimate for number of rows we will read was fairly precise\n customer.filtered=18.08, customer.r_filtered=9.13. The optimizer somewhat overestimated the number of records that will match selectivity of condition attached to customer table (in general, when you have a full scan and r_filtered is less than 15%, it''s time to consider adding an appropriate index).\n For table orders, orders.rows=7, orders.r_rows=10. This means that on average, there are 7 orders for a given c_custkey, but in our case there were 10, which is close to the expectation (when this number is consistently far from the expectation, it may be time to run ANALYZE TABLE, or even edit the table statistics manually to get better query plans).\n orders.filtered=100, orders.r_filtered=30.03. The optimizer didn''t have any way to estimate which fraction of records will be left after it checks the condition that is attached to table orders (it''s orders.o_totalprice > 200\\1000). So, it used 100%. In reality, it is 30%. 30% is typically not selective enough to warrant adding new indexes. For joins with many tables, it might be worth to collect and use column statistics for columns in question, this may help the optimizer to pick a better query plan.\n\nMeaning of NULL in r_rows and r_filtered\n\nLet''s modify the previous example slightly\n\n`sql\nANALYZE SELECT  \nFROM orders, customer \nWHERE\n  customer.c_custkey=orders.o_custkey AND\n  customer.c_acctbal < -0 AND \n  customer.c_comment LIKE ''%foo%'' AND\n  orders.o_totalprice > 2001000;\n`\n\n`\n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n| id | select_type | table    | type | possible_keys | key         | key_len | ref                | rows   | r_rows | filtered | r_filtered | Extra       |\n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n|  1 | SIMPLE      | customer | ALL  | PRIMARY,...   | NULL        | NULL    | NULL               | 149095 | 150000 |    18.08 |       0.00 | Using where |\n|  1 | SIMPLE      | orders   | ref  | i_o_custkey   | i_o_custkey | 5       | customer.c_custkey |      7 |   NULL |   100.00 |       NULL | Using where |\n+----+-------------+----------+------+---------------+-------------+---------+--------------------+--------+--------+----------+------------+-------------+\n`\n\nThe output of orders.r_rows=NULL and orders.r_filtered=NULL shows that the table orders was never scanned. Indeed, we can also see customer.r_filtered=0.00. This shows that a part of WHERE attached to table customer was never satisfied (or, satisfied in less than 0.01% of cases).\n\nANALYZE FORMAT=JSON\n\nANALYZE FORMAT=JSON produces JSON output. It produces much more information than tabular ANALYZE.\n\nNotes\n\n ANALYZE UPDATE or ANALYZE DELETE will actually make updates/deletes (ANALYZE SELECT will perform the select operation and then discard the resultset).\n PostgreSQL has a similar command, EXPLAIN ANALYZE.\n* The EXPLAIN in the slow query log feature allows MariaDB to have ANALYZE` output of slow queries printed into the slow query log (see MDEV-6388).\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/analyze-statement', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/analyze-statement');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (506, 26, 'EXPLAIN ANALYZE', 'Description\n-----------\n\nOutdated syntax\n\nThe syntax for the EXPLAIN ANALYZE feature was changed to ANALYZE statement, available since MariaDB 10.1.0. See ANALYZE statement.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/explain-analyze', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/explain-analyze');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (507, 26, 'EXPLAIN FORMAT=JSON', 'Description\n-----------\n\nSynopsis\n\nEXPLAIN FORMAT=JSON is a variant of EXPLAIN command that produces output in JSON form. The output always has one row which has only one column titled "JSON". The contents are a JSON representation of the query plan:\n\n``sql\nEXPLAIN FORMAT=JSON SELECT  FROM t1 WHERE col1=1\\G\n`\n\n`\n*********************** 1. row ***********************\nEXPLAIN: {\n  "query_block": {\n    "select_id": 1,\n    "table": {\n      "table_name": "t1",\n      "access_type": "ALL",\n      "rows": 1000,\n      "filtered": 100,\n      "attached_condition": "(t1.col1 = 1)"\n    }\n  }\n}\n`\n\nOutput is different from MySQL\n\nThe output of MariaDB''s EXPLAIN FORMAT=JSON is different from EXPLAIN FORMAT=JSON in MySQL. The reasons for that are:\n\n MySQL''s output has deficiencies.\n The output of MySQL''s EXPLAIN FORMAT=JSON` is not defined. Even MySQL Workbench has trouble parsing it (see this blog post).\n MariaDB has query optimizations that MySQL does not have. This means that MariaDB generates query plans that MySQL does not generate.\n\nOutput Format\n\nTODO: MariaDB''s output format description.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/explain-format-json', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/explain-format-json');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (508, 26, 'EXPLAIN', 'Syntax\n------\n\nEXPLAIN tbl_name [col_name | wildcard]\n\nDescription\n-----------\n\nThe EXPLAIN statement can be used either as a synonym for DESCRIBE, or as a way to obtain information about how MariaDB executes a SELECT, UPDATE or DELETE statement:\n\n ''EXPLAIN tbl_name'' is synonymous with DESCRIBE or SHOW COLUMNS ... FROM _mytable_.\n When you precede a SELECT, UPDATE or a DELETE statement with the keyword EXPLAIN, MariaDB displays information from the optimizer about the query execution plan. That is, MariaDB explains how it would process the SELECT, UPDATE or DELETE, including information about how tables are joined and in which order. EXPLAIN EXTENDED can be used to provide additional information.\n EXPLAIN PARTITIONS is useful only when examining queries involving partitioned tables. For details, see Partition pruning and selection.\n The ANALYZE statement is similar to EXPLAIN, but it runs the query rather than only estimating the execution path. Hence, the ANALYZE statement provides both estimated and real execution statistics. This includes the r_rows and r_filtered columns, which reflect the actual number of rows evaluated and filtered during query execution.\n EXPLAIN output can be printed in the slow query log. See EXPLAIN in the Slow Query Log for details.\n EXPLAIN FOR CONNECTION is an alias for SHOW EXPLAIN FOR.\n\nSHOW EXPLAIN shows the output of a running statement. In some cases, its output can be closer to reality than EXPLAIN.\n\nThe ANALYZE statement runs a statement and returns information about its execution plan. It also shows additional columns, to check how much the optimizer''s estimation about filtering and found rows are close to reality.\n\nThere is an online EXPLAIN Analyzer that you can use to share EXPLAIN and EXPLAIN EXTENDED output with others.\n\nEXPLAIN can acquire metadata locks in the same way that SELECT does, as it needs to know table metadata and, sometimes, data as well.\n\nColumns in EXPLAIN ... SELECT\n\n| Column name    | Description                                                                                         |\n| -------------- | --------------------------------------------------------------------------------------------------- |\n| id             | Sequence number that shows in which order tables are joined.                                        |\n| select_type   | What kind of SELECT the table comes from.                                                         |\n| table          | Alias name of table. Materialized temporary tables for sub queries are named <subquery#>          |\n| type           | How rows are found from the table (join type).                                                      |\n| possible_keys | keys in table that could be used to find rows in the table                                          |\n| key            | The name of the key that is used to retrieve rows. NULL means no key was used.                    |\n| key_len       | How many bytes of the key that was used (shows if we are using only parts of the multi-column key). |\n| ref            | The reference that is used as the key value.                                                        |\n| rows           | An estimate of how many rows we will find in the table for each key lookup.                         |\n| Extra          | Extra information about this join.                                                                  |\n\nHere are descriptions of the values for some of the more complex columns in EXPLAIN ... SELECT:\n\nSelect_type Column\n\nThe select_type column can have the following values:\n\n| Value                | Description                                                                                                                                                                                     | Comment                                                                                                                                                                              |\n| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| DEPENDENT SUBQUERY   | The SUBQUERY is DEPENDENT.                                                                                                                                                                  |                                                                                                                                                                                      |\n| DEPENDENT UNION      | The UNION is DEPENDENT.                                                                                                                                                                     |                                                                                                                                                                                      |\n| DERIVED              | The SELECT is DERIVED from the PRIMARY.                                                                                                                                                   |                                                                                                                                                                                      |\n| MATERIALIZED         | The SUBQUERY is MATERIALIZED.                     | Materialized tables will be populated at first access and will be accessed by the primary key (= one key lookup). Number of rows in EXPLAIN shows the cost of populating the table |\n| PRIMARY              | The SELECT is in the outermost query, but there is also a SUBQUERY within it.                                                                                                               |                                                                                                                                                                                      |\n| SIMPLE               | It is a simple SELECT query without any SUBQUERY or UNION.                                                                                                                                |                                                                                                                                                                                      |\n| SUBQUERY             | The SELECT is a SUBQUERY of the PRIMARY.                                                                                                                                                  |                                                                                                                                                                                      |\n| UNCACHEABLE SUBQUERY | The SUBQUERY is UNCACHEABLE.                                                                                                                                                                |                                                                                                                                                                                      |\n| UNCACHEABLE UNION    | The UNION is UNCACHEABLE.                                                                                                                                                                   |                                                                                                                                                                                      |\n| UNION                | The SELECT is a UNION of the PRIMARY.                                                                                                                                                     |                                                                                                                                                                                      |\n| UNION RESULT         | The result of the UNION.                                                                                                                                                                      |                                                                                                                                                                                      |\n| LATERAL DERIVED      | The SELECT uses a Lateral Derived optimization |                                                                                                                                                                                      |\n\nType Column\n\nThis column contains information on how the table is accessed.\n\n| Value            | Description                                                                                                                                                                                                                      |\n| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| ALL              | A full table scan is done for the table (all rows are read). This is bad if the table is large and the table is joined against a previous table! This happens when the optimizer could not find any usable index to access rows. |\n| const            | There is only one possibly matching row in the table. The row is read before the optimization phase and all columns in the table are treated as constants.                                                                       |\n| eq_ref          | A unique index is used to find the rows. This is the best possible plan to find the row.                                                                                                                                         |\n| filter           | A second index is being used with the Rowid Filtering Optimization.                                                |\n| fulltext         | A fulltext index is used to access the rows.                                                                                                                                                                                     |\n| index_merge     | A ''range'' access is done for several index and the found rows are merged. The key column shows which keys are used.                                                                                                              |\n| index_subquery  | This is similar as ref, but used for sub queries that are transformed to key lookups.                                                                                                                                            |\n| index            | A full scan over the used index. Better than ALL but still bad if index is large and the table is joined against a previous table.                                                                                             |\n| range            | The table will be accessed with a key over one or more value ranges.                                                                                                                                                             |\n| ref_or_null    | Like ''ref'' but in addition another search for the ''null'' value is done if the first value was not found. This happens usually with sub queries.                                                                                  |\n| ref              | A non unique index or prefix of an unique index is used to find the rows. Good if the prefix doesn''t match many rows.                                                                                                            |\n| system           | The table has 0 or 1 rows.                                                                                                                                                                                                       |\n| unique_subquery | This is similar as eq_ref, but used for sub queries that are transformed to key lookups                                                                                                                                         |\n\nExtra Column\n\nThis column consists of one or more of the following values, separated by '';''\n\n_Note that some of these values are detected after the optimization phase._\n\nThe optimization phase can do the following changes to the WHERE clause:\n\n Add the expressions from the ON and USING clauses to the WHERE clause.\n Constant propagation: If there is column=constant, replace all column instances with this constant.\n Replace all columns from ''const'' tables with their values.\n Remove the used key columns from the WHERE (as this will be tested as part of the key lookup).\n Remove impossible constant sub expressions. For example WHERE ''(a=1 and a=2) OR b=1'' becomes ''b=1''.\n Replace columns with other columns that has identical values: Example: WHERE a=b and a=c may be treated as ''WHERE a=b and a=c and b=c''.\n Add extra conditions to detect impossible row conditions earlier. This happens mainly with OUTER JOIN where we in some cases add detection of NULL values in the WHERE (Part of ''Not exists'' optimization). This can cause an unexpected ''Using where'' in the Extra column.\n For each table level we remove expressions that have already been tested when we read the previous row. Example: When joining tables t1 with t2 using the following WHERE ''t1.a=1 and t1.a=t2.b'', we don''t have to test ''t1.a=1'' when checking rows in t2 as we already know that this expression is true.\n\n| Value                                                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                          |\n| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| const row not found\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/explain');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (509, 26, 'Using Buffer UPDATE Algorithm', 'Description\n-----------\n\nThis article explains the UPDATE statement''s _Using Buffer_ algorithm.\n\nConsider the following table and query:\n\n| Name      | Salary |\n| --------- | ------ |\n| Babatunde | 1000   |\n| Jolana    | 1050   |\n| Pankaja   | 1300   |\n\n``sql\nUPDATE employees SET salary = salary+100 WHERE salary < 2000;\n`\n\nSuppose the _employees_ table has an index on the _salary_ column, and the optimizer decides to use a range scan on that index.\n\nThe optimizer starts a range scan on the _salary_ index. We find the first record _Babatunde, 1000_. If we do an on-the-fly update, we immediately instruct the storage engine to change this record to be _Babatunde, 1000+100=1100_.\n\nThen we proceed to search for the next record, and find _Jolana, 1050_. We instruct the storage engine to update it to be _Jolana, 1050+100=1150_.\n\nThen we proceed to search for the next record ... and what happens next depends on the storage engine. In some storage engines, data changes are visible immediately, so we will find the _Babatunde, 1100_ record that we wrote at the first step, modifying it again, giving Babatunde an undeserved raise. Then we will see Babatunde again and again, looping continually.\n\nIn order to prevent such situations, the optimizer checks whether the UPDATE statement is going to change key values for the keys it is using. In that case, it will use a different algorithm:\n\n1. Scan everyone with "salary<2000", remembering the rowids of the rows in a buffer.\n2. Read the buffer and apply the updates.\n\nThis way, each row will be updated only once.\n\nThe Using buffer` EXPLAIN output indicates that the buffer as described above will be used.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/using-buffer-update-algorithm', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/using-buffer-update-algorithm');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (510, 26, 'BACKUP LOCK', 'Description\n-----------\n\nBACKUP LOCK blocks a table from DDL statements. This is mainly intended to be used by tools like mariadb-backup that need to ensure there are no DDL[^1] statements on a table while the table files are opened. For example, for an Aria table that stores data in 3 files with extensions .frm, .MAI and .MAD. Normal read/write operations can continue as normal.\n\nSyntax\n\nTo lock a table:\n\n``sql\nBACKUP LOCK table_name\n`\n\nTo unlock a table:\n\n`sql\nBACKUP UNLOCK\n`\n\nUsage in a Backup Tool\n\n`sql\nBACKUP LOCK [database.]table_name;\n - Open all files related to a table (for example, t.frm, t.MAI and t.MYD)\nBACKUP UNLOCK;\n- Copy data\n- Close files\n`\n\nThis ensures that all files are from the same generation, that is created at the same time by the MariaDB server. This works, because the open files will point to the original table files which will not be affected if there is any ALTER TABLE while copying the files.\n\nPrivileges\n\nBACKUP LOCK requires the database LOCK TABLES privileges.\n\nBACKUP LOCK requires the RELOAD privilege.\n\nBACKUP LOCK requires the RELOAD privilege.\n\nNotes\n\n The idea is that the BACKUP LOCK should be held for as short a time as possible by the backup tool. The time to take an uncontested lock is very short! One can easily do 50,000 locks/unlocks per second on low end hardware.\n One should use different connections for BACKUP STAGE commands and BACKUP LOCK.\n\nImplementation\n\n* Internally, BACKUP LOCK is implemented by taking an MDLSHARED_HIGH_PRIO` MDL lock on the table object, which protects the table from any DDL operations.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/backup-commands/backup-lock', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/backup-commands/backup-lock');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (511, 26, 'BACKUP STAGE', 'Description\n-----------\n\nThe BACKUP STAGE commands are a set of commands to make it possible to make an efficient external backup tool.\n\nSyntax\n\n``sql\nBACKUP STAGE [START | FLUSH | BLOCK_DDL | BLOCK_COMMIT | END ]\n`\n\nIn the following text, a transactional table means InnoDB, or specifically an InnoDB-like engine with redo log that can lock redo purges and can be copied without locks by an outside process.\n\nGoals with BACKUP STAGE Commands\n\n To be able to do a majority of the backup with the minimum possible server locks. Especially for transactional tables (InnoDB, MyRocks etc) there is only need for a very short block of new commits while copying statistics and log tables.\n DDL are only needed to be blocked for a very short duration of the backup while mariadb-backup is copying the tables affected by DDL during the initial part of the backup.\n Most non transactional tables (those that are not in use) will be copied during BACKUP STAGE START. The exceptions are system statistic and log tables that are not blocked during the backup until BLOCK_COMMIT.\n Should work efficiently with backup tools that use disk snapshots.\n Should work as efficiently as possible for all table types that store data on the local disks.\n As little copying as possible under higher level stages/locks. For example, .frm (dictionary) and .trn (trigger) files should be copying while copying the table data.\n\nBACKUP STAGE Commands\n\nBACKUP STAGE START\n\nThe START stage is designed for the following tasks:\n\n Blocks purge of redo files for storage engines that needs this (Aria).\n Start logging of DDL commands into _datadir_/ddl.log. This may take a short time as the command has to wait until there are no active DDL commands.\n\nBACKUP STAGE FLUSH\n\nThe FLUSH stage is designed for the following tasks:\n\n FLUSH all changes for inactive non-transactional tables, except for statistics and log tables.\n Close all tables that are not in use, to ensure they are marked as closed for the backup.\n BLOCK all new write locks for all non transactional tables (except statistics and log tables). The command will not wait for tables that are in use by read-only transactions.\n\nDDLs don''t have to be blocked at this stage as they can''t cause the table to be in an inconsistent state. This is true also for non-transactional tables.\n\nBACKUP STAGE BLOCK_DDL\n\nThe BLOCK_DDL stage is designed for the following tasks:\n\n Wait for all statements using write locked non-transactional tables to end.\n Blocks CREATE TABLE, DROP TABLE, TRUNCATE TABLE, and RENAME TABLE.\n Blocks also start off a new ALTER TABLE and the final rename phase of ALTER TABLE. Running ALTER TABLES are not blocked.\n\nBACKUP STAGE BLOCK_COMMIT\n\nThe BLOCK_COMMIT stage is designed for the following tasks:\n\n Lock the binary log and commit/rollback to ensure that no changes are committed to any tables. If there are active commits or data to be copied to the binary log this will be allowed to finish. Active transactions will not affect BLOCK_COMMIT.\n This doesn''t lock temporary tables that are not used by replication. However these will be blocked when it''s time to write to the binary log.\n Lock system log tables and statistics tables, flush them and mark them closed.\n\nWhen the BLOCK_COMMIT''s stages return, this is the ''backup time''. Everything committed will be in the backup and everything not committed will roll back.\n\nTransactional engines will continue to do changes to the redo log during the BLOCK COMMIT stage, but this is not important as all of these will roll back later as the changes will not be committed.\n\nBACKUP STAGE END\n\nThe END stage is designed for the following tasks:\n\n End DDL logging\n Free resources\n\nUsing BACKUP STAGE Commands with Backup Tools\n\nUsing BACKUP STAGE Commands with mariadb-backup\n\nThe BACKUP STAGE statements are a set of statements that make it possible to make an efficient external backup tool.\n\nThe BACKUP STAGE statements are a set of statements that make it possible to make an efficient external backup tool. How mariadb-backup uses these statements depends on which version you are using. It depends on whether you are using the version that is bundled with MariaDB Community Server or the version that is bundled with MariaDB Enterprise Server.\n\nThe BACKUP STAGE statements are a set of statements that make it possible to make an efficient external backup tool. How mariadb-backup uses these statements depends on which version you are using. It depends on whether you are using the version that is bundled with MariaDB Community Server or the version that is bundled with MariaDB Enterprise Server.\n\nSee mariadb-backup and BACKUP STAGE Commands for some examples on how mariadb-backup uses these commands.\n\nUsing BACKUP STAGE Commands with Storage Snapshots\n\nThe BACKUP STAGE commands are a set of commands to make it possible to make an efficient external backup tool. These commands could even be used by tools that perform backups by taking a snapshot of a file system, SAN, or some other kind of storage device. See Storage Snapshots and BACKUP STAGE Commands for some examples on how to use each BACKUP STAGE command in an efficient way.\n\nPrivileges\n\nBACKUP STAGE requires the RELOAD privilege.\n\nNotes\n\n Only one connection can run BACKUP STAGE START. If a second connection tries, it will wait until the first one has executed BACKUP STAGE END.\n If the user skips a BACKUP STAGE, then all intermediate backup stages will automatically be run. This will allow us to add new stages within the BACKUP STAGE hierarchy in the future with even more precise locks without causing problems for tools using an earlier version of the BACKUP STAGE implementation.\n One can use the max_statement_time or lock_wait_timeout system variables to ensure that a BACKUP STAGE` command doesn''t block the server too long.\n DDL logging is available from MariaDB 10.11.8, MariaDB 11.0.6, MariaDB 11.1.5 and MariaDB 11.2.4, and in MariaDB Enterprise Server.\n A disconnect automatically releases backup stages.\n* There is no easy way to see what the current stage is.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/backup-commands/backup-stage', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/backup-commands/backup-stage');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (512, 26, 'Storage Snapshots and BACKUP STAGE Statements', 'Description\n-----------\n\nThe BACKUP STAGE statements are a set of statements to make it possible to make an efficient external backup tool. These commands could even be used by tools that perform backups by taking a snapshot of a file system, SAN, or some other kind of storage device.\n\nGeneric Backup Process with Storage Snapshots\n\nA tool that backs up MariaDB by taking a snapshot of a file system, SAN, or some other kind of storage device could use each BACKUP STAGE command in the following way:\n\n First, execute the following:\n\n``sql\nBACKUP STAGE START\nBACKUP STAGE BLOCK_COMMIT\n`\n\n Then, take the snapshot.\n* Then, execute the following:\n\n`sql\nBACKUP STAGE END\n`\n\nThe above ensures that all non-transactional tables are properly flushed to disk before the snapshot is done. Using BACKUP STAGE commands is also more efficient than using the FLUSH TABLES WITH READ LOCK command as the above set of commands will not block or be blocked by write operations to transactional tables.\n\nNote that when the backup is completed, one should delete all files with the "#sql" prefix, as these are files used by concurrent running ALTER TABLE`. Note that InnoDB will on server restart automatically delete any tables with the "#sql" prefix.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/backup-commands/storage-snapshots-and-backup-stage-commands', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/backup-commands/storage-snapshots-and-backup-stage-commands');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (513, 26, 'BINLOG', 'Syntax\n------\n\nBINLOG ''str''\n\nDescription\n-----------\n\nBINLOG is an internal-use statement. It is generated by the mariadb-binlog program as the printable representation of certain events in binary log files. The ''str'' value is a base 64-encoded\\\nstring that the server decodes to determine the data change indicated by the\\\ncorresponding event.\n\nThis statement requires the BINLOG REPLAY privilege.\n\nThis statement requires the SUPER privilege.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/binlog', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/binlog');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (514, 26, 'CACHE INDEX', 'Syntax\n------\n\nCACHE INDEX                      \n  tbl_index_list [, tbl_index_list] ...\n  IN key_cache_name                    \n\ntbl_index_list:\n  tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]\n\nDescription\n-----------\n\nThe CACHE INDEX statement assigns table indexes to a specific key\\\ncache. It is used only for MyISAM tables.\n\nA default key cache exists and cannot be destroyed. To create more key caches, the key_buffer_size server system variable.\n\nThe associations between tables indexes and key caches are lost on server restart. To recreate them automatically, it is necessary to configure caches in a configuration file and include some CACHE INDEX (and optionally LOAD INDEX) statements in the init file.\n\nExamples\n--------\n\nCACHE INDEX t1, t2, t3 IN hot_cache;\n+---------+--------------------+----------+----------+\n| Table   | Op                 | Msg_type | Msg_text |\n+---------+--------------------+----------+----------+\n| test.t1 | assign_to_keycache | status   | OK       |\n| test.t2 | assign_to_keycache | status   | OK       |\n| test.t3 | assign_to_keycache | status   | OK       |\n+---------+--------------------+----------+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/cache-index', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/cache-index');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (515, 26, 'DESCRIBE', 'Syntax\n------\n\n{DESCRIBE | DESC} tbl_name [col_name | wild]\n\nDescription\n-----------\n\nDESCRIBE provides information about the columns in a table.It is a shortcut for SHOW COLUMNS FROM.These statements also display information for views.\n\ncol_name can be a column name, or a string containing theSQL "%" and "_" wildcard characters toobtain output only for the columns with names matching the string. There is noneed to enclose the string within quotes unless it contains spaces or otherspecial characters.\n\n``sql\nDESCRIBE city;\n+------------+----------+------+-----+---------+----------------+\n| Field      | Type     | Null | Key | Default | Extra          |\n+------------+----------+------+-----+---------+----------------+\n| Id         | int(11)  | NO   | PRI | NULL    | auto_increment |\n| Name       | char(35) | YES  |     | NULL    |                |\n| Country    | char(3)  | NO   | UNI |         |                |\n| District   | char(20) | YES  | MUL |         |                |\n| Population | int(11)  | YES  |     | NULL    |                |\n+------------+----------+------+-----+---------+----------------+\n``\n\nThe description for SHOW COLUMNS providesmore information about the output columns.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/describe', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/describe');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (516, 26, 'FLUSH QUERY CACHE', 'Description\n-----------\n\nYou can defragment the query cache to better utilize its memory with the FLUSH QUERY CACHE statement. The statement does not remove any queries from the cache.\n\nThe RESET QUERY CACHE statement removes all query results from the query cache.\\\nThe FLUSH TABLES statement also does this.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush-query-cache', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush-query-cache');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (517, 26, 'FLUSH TABLES FOR EXPORT', 'Syntax\n------\n\nFLUSH TABLE[S] table_name [, table_name] FOR EXPORT\n\nDescription\n-----------\n\nFLUSH TABLES ... FOR EXPORT flushes changes to the specified tables to disk so that binary copies can be made while the server is still running. This works for Archive, Aria, CSV, InnoDB, MyISAM and MERGE tables.\n\nThe table is read locked until you issue UNLOCK TABLES.\n\nIf a storage engine does not support FLUSH TABLES FOR EXPORT, a 1031 error (SQLSTATE ''HY000'') is produced.\n\nIf FLUSH TABLES ... FOR EXPORT is in effect in the session, the following statements will produce an error if attempted:\n\n FLUSH TABLES WITH READ LOCK\n FLUSH TABLES ... WITH READ LOCK\n FLUSH TABLES ... FOR EXPORT\n Any statement trying to update any table\n\nIf any of the following statements is in effect in the session, attempting FLUSH TABLES ... FOR EXPORT will produce an error.\n\n FLUSH TABLES ... WITH READ LOCK\n FLUSH TABLES ... FOR EXPORT\n LOCK TABLES ... READ\n LOCK TABLES ... WRITE\n\nFLUSH FOR EXPORT is not written to the binary log.\n\nThis statement requires the RELOAD and the LOCK TABLES privileges.\n\nIf one of the specified tables cannot be locked, none of the tables will be locked.\n\nIf a table does not exist, an error like the following will be produced:\n\n``\nERROR 1146 (42S02): Table ''test.xxx'' doesn''t exist\n`\n\nIf a table is a view, an error like the following will be produced:\n\n`\nERROR 1347 (HY000): ''test.v'' is not BASE TABLE\n``\n\nExamples\n--------\n\nFLUSH TABLES test.t1 FOR EXPORT;\nCopy files related to the table (see below)\nUNLOCK TABLES;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush-tables-for-export', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush-tables-for-export');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (518, 26, 'FLUSH', 'Syntax\n------\n\nFLUSH [NO_WRITE_TO_BINLOG | LOCAL]\n    flush_option [, flush_option] ...\n\nDescription\n-----------\n\nThe FLUSH statement clears or reloads various internal caches used by MariaDB. To execute FLUSH, you must have the RELOAD privilege. See GRANT.\n\nThe RESET statement is similar to FLUSH. See RESET.\n\nYou cannot issue a FLUSH statement from within a stored function or a trigger. Doing so within a stored procedure is permitted, as long as it is not called by a stored function or trigger. See Stored Routine Limitations, Stored Function Limitations and Trigger Limitations.\n\nIf a listed table is a view, an error like the following will be produced:\n\n``\nERROR 1347 (HY000): ''test.v'' is not BASE TABLE\n`\n\nBy default, FLUSH statements are written to the binary log and will be replicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) ensures that the statement is not written to the binary log. The different flush options are:\n\n| Option                                              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |\n| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| CHANGED_PAGE_BITMAPS                              | XtraDB only. Internal command used for backup purposes. See the Information Schema CHANGED_PAGE_BITMAPS Table.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| CLIENT_STATISTICS                                  | Reset client statistics (see SHOW CLIENT_STATISTICS).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |\n| DES_KEY_FILE                                      | Reloads the DES key file (Specified with the --des-key-file startup option).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |\n| HOSTS                                               | Flush the hostname cache (used for converting ip to host names and for unblocking blocked hosts. See max_connect_errors and performance_schema.host_cache                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |\n| INDEX_STATISTICS                                   | Reset index statistics (see SHOW INDEX_STATISTICS).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |\n| ERROR                                               | Closes and reopens the error log file to which the server is writing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| \\[ERROR \\| ENGINE \\| GENERAL \\| SLOW \\| RELAY] LOGS | Close and reopen the specified log type, or all log types if none are specified. FLUSH RELAY LOGS [connection-name] can be used to flush the relay logs for a specific connection. Only one connection can be specified per FLUSH command. See multi-source replication. FLUSH ENGINE LOGS deletes all unneeded Aria redo logs. FLUSH BINARY LOGS DELETE_DOMAIN_ID=(list-of-domains) can be used to discard obsolete GTID domains from the server''s binary log state. In order for this to be successful, no event group from the listed GTID domains can be present in existing binary log files. If some still exist, then they must be purged prior to executing this statement. If the statement completes successfully,  it also rotates the binary log. |\n| BINARY LOGS                                         | FLUSH BINARY LOGS rotates the current binary log.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n| BINARY LOGS DELETE_DOMAIN_ID=_list-of-domains_    | FLUSH BINARY LOGS DELETE_DOMAIN_ID can be used to discard obsolete GTID domains from the server''s binary log state. In order for this to be successful, no event group from the listed GTID domains can be present in existing binary log files. If some still exist, then they must be purged prior to executing this command. If the command completes successfully, then it also rotates the binary log.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| MASTER                                              | Deprecated option, use RESET MASTER instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |\n| PRIVILEGES                                          | Reload all privileges from the privilege tables in the mysql database. If the server is started with --skip-grant-table option, this will activate the privilege tables again.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |\n| QUERY CACHE                                         | Defragment the query cache to better utilize its memory. If you want to reset the query cache, you can do it with RESET QUERY CACHE.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n| QUERY_RESPONSE_TIME                               | See the QUERY_RESPONSE_TIME plugin.\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (519, 26, 'HELP Command', 'Syntax\n------\n\nHELP search_string\n\nDescription\n-----------\n\nThe HELP command can be used in any MariaDB client, such as the mariadb command-line client, to get basic syntax help and a short description for most commands and functions.\n\nIf you provide an argument to the HELP command, the mariadb client uses it as a search string to access server-side help. The proper operation of this command requires that the help tables in the mysql database be initialized with help topic information.\n\nIf there is no match for the search string, the search fails. Use HELP contents to see a list of the help categories:\n\n``sql\nHELP contents\nYou asked for help about help category: "Contents"\nFor more information, type ''help <item>'', where <item> is one of the following\ncategories:\n   Account Management\n   Administration\n   Compound Statements\n   Data Definition\n   Data Manipulation\n   Data Types\n   Functions\n   Functions and Modifiers for Use with GROUP BY\n   Geographic Features\n   Help Metadata\n   Language Structure\n   Plugins\n   Procedures\n   Sequences\n   Table Maintenance\n   Transactions\n   User-Defined Functions\n   Utility\n`\n\nIf a search string matches multiple items, MariaDB shows a list of matching topics:\n\n`sql\nHELP drop\nMany help items for your request exist.\nTo make a more specific request, please type ''help <item>'',\nwhere <item> is one of the following\ntopics:\n   ALTER TABLE\n   DROP DATABASE\n   DROP EVENT\n   DROP FUNCTION\n   DROP FUNCTION UDF\n   DROP INDEX\n   DROP PACKAGE\n   DROP PACKAGE BODY\n   DROP PROCEDURE\n   DROP ROLE\n   DROP SEQUENCE\n   DROP SERVER\n   DROP TABLE\n   DROP TRIGGER\n   DROP USER\n   DROP VIEW\n`\n\nThen you can enter a topic as the search string to see the help entry for that topic.\n\nThe help is provided with the MariaDB server and makes use of four help tables found in the mysql database: help_relation, help_topic, help_category and help_keyword. These tables are populated by the mariadb-install-db or fill_help_table.sql` scripts.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/help-command', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/help-command');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (520, 26, 'KILL', 'Syntax\n------\n\nKILL [HARD | SOFT] { {CONNECTION|QUERY} thread_id | QUERY ID query_id | USER user_name }\n\nDescription\n-----------\n\nEach connection to mariadbd runs in a separate thread. You can see which threads are running with the SHOW PROCESSLIST statement and kill a thread with the KILL thread_id statement.KILL allows the optional CONNECTION orQUERY modifier:\n\n KILL CONNECTION is the same as KILL with no modifier: It terminates the connection associated with the given thread or query id.\n KILL QUERY terminates the statement that the connection thread_id is currently executing, but leaves the connection itself intact.\n KILL QUERY ID terminates the query by query_id, leaving the connection intact.\n\nIf a connection is terminated that has an active transaction, the transaction  is rolled back. If only a query is killed, the current transaction stays active. See also idle_transaction_timeout.\n\nIf you have the PROCESS privilege, you can see all threads.\n\nIf you have the CONNECTION ADMIN privilege, you can kill all threads and statements. Otherwise, you can see and kill only your own threads and statements.\n\nIf you have the SUPER privilege, the CONNECTION ADMIN privilege, you can kill all threads and statements. Otherwise, you can see and kill only your own threads and statements.\n\nKilling queries that repair or create indexes on MyISAM and Aria tables may result in corrupted tables. Use the SOFT option to avoid this.\n\nThe HARD option (default) kills a statement as soon as possible. If you useSOFT,  critical operations that may leave a table in an inconsistent state are not interrupted. Such operations include REPAIR and INDEX creation for MyISAM and Aria tables (REPAIR TABLE, OPTIMIZE TABLE).\n\nKILL ... USER username kills all connections and queries for a given user. USER can be specified in one of the following ways:\n\n username (kill without regard to hostname)\n username@hostname\n CURRENT_USER or CURRENT_USER()\n\nIf you specify a thread id and that thread does not exist, you get the following error:\n\n``\nERROR 1094 (HY000): Unknown thread id: <thread_id>\n`\n\nIf you specify a query id that doesn''t exist, you get the following error:\n\n`\nERROR 1957 (HY000): Unknown query id: <query_id>\n`\n\nHowever, if you specify a user name, no error is issued for non-connected (or even non-existing) users. To check if the connection/query has been killed, you can use the ROW_COUNT() function.\n\nA client whose connection is killed receives the following error:\n\n`\nERROR 1317 (70100): Query execution was interrupted\n`\n\nTo obtain a list of existing sessions, use the SHOW PROCESSLIST statement or query the Information Schema PROCESSLIST table.\n\nYou cannot use KILL with the Embedded MariaDB Server library because the embedded server merely runs inside the threads of the host application. It does not create any connection threads of its own.\n\nNote: You can also use mariadb-admin kill thread_id [,thread_id...] to kill connections. To get a list of running queries,use mariadb-admin processlist`. See mariadb-admin.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/kill', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/kill');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (521, 26, 'INSTALL PLUGIN', 'Syntax\n------\n\nINSTALL PLUGIN [IF NOT EXISTS] plugin_name SONAME ''plugin_library''\n\nDescription\n-----------\n\nThis statement installs an individual plugin from the specified library. To install the whole library (which could be required), use INSTALL SONAME. See also Installing a Plugin.\n\nplugin_name is the name of the plugin as defined in theplugin declaration structure contained in the library file. Plugin names arenot case sensitive. For maximal compatibility, plugin names should be limitedto ASCII letters, digits, and underscore, because they are used in C sourcefiles, shell command lines, M4 and Bourne shell scripts, and SQL environments.\n\nplugin_library is the name of the shared library thatcontains the plugin code. The file name extension can be omitted (which makes the statement look the same on all architectures).\n\nThe shared library must be located in the plugin directory (that is,the directory named by the plugin_dir system variable). The library must be in the plugin directory itself, not in a subdirectory. Bydefault, plugin_dir is plugin directory under the directory named bythe pkglibdir configuration variable, but it can be changed by settingthe value of plugin_dir at server startup. For example, setits value in a my.cnf file:\n\n``ini\n[mariadbd]\nplugin_dir=/path/to/plugin/directory\n`\n\nIf the value of plugin_dir is a relative path name, it istaken to be relative to the base directory (the value of the basedir system variable).\n\nINSTALL PLUGIN adds a line to the mysql.plugin table thatdescribes the plugin. This table contains the plugin name and library filename.\n\nINSTALL PLUGIN causes the server to readoption (my.cnf) files just as during server startup. This enables the plugin topick up any relevant options from those files. It is possible to add pluginoptions to an option file even before loading a plugin (if the loose prefix isused). It is also possible to uninstall a plugin, edit my.cnf, and install theplugin again. Restarting the plugin this way enables it to the new optionvalues without a server restart.\n\nINSTALL PLUGIN also loads and initializes the plugin code tomake the plugin available for use. A plugin is initialized by executing itsinitialization function, which handles any setup that the plugin must performbefore it can be used.\n\nTo use INSTALL PLUGIN, you must have the INSERT privilege for the mysql.plugin table.\n\nAt server startup, the server loads and initializes any plugin that islisted in the mysql.plugin table. This means that a plugin is installedwith INSTALL PLUGIN only once, not every time the serverstarts. Plugin loading at startup does not occur if the server is started withthe --skip-grant-tables option.\n\nWhen the server shuts down, it executes the de-initialization functionfor each plugin that is loaded so that the plugin has a chance toperform any final cleanup.\n\nIf you need to load plugins for a single server startup when the--skip-grant-tables option is given (which tells the servernot to read system tables), use the--plugin-load mariadbd option.\n\nIF NOT EXISTS\n\nWhen the IF NOT EXISTS` clause is used, MariaDB will return a note instead of an error if the specified plugin already exists. See SHOW WARNINGS.\n\nExamples\n--------\n\nINSTALL PLUGIN sphinx SONAME ''ha_sphinx.so'';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/plugin-sql-statements/install-plugin', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/plugin-sql-statements/install-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (522, 26, 'INSTALL SONAME', 'Syntax\n------\n\nINSTALL SONAME ''plugin_library''\n\nDescription\n-----------\n\nThis statement is a variant of INSTALL PLUGIN. It installs all plugins from a given plugin_library. See INSTALL PLUGIN for details.\n\nplugin_library is the name of the shared library thatcontains the plugin code. The file name extension (forexample, libmyplugin.so or libmyplugin.dll) can be omitted (which makes the statement look the same on all architectures).\n\nThe shared library must be located in the plugin directory (that is,the directory named by the plugin_dir system variable). The library must be in the plugin directory itself, not in a subdirectory. Bydefault, plugin_dir is plugin directory under the directory named bythe pkglibdir configuration variable, but it can be changed by settingthe value of plugin_dir at server startup. For example, setits value in a my.cnf file:\n\n``ini\n[mariadbd]\nplugin_dir=/path/to/plugin/directory\n`\n\nIf the value of plugin_dir is a relative path name, it istaken to be relative to the MySQL base directory (the value of the basedirsystem variable).\n\nINSTALL SONAME adds one or more lines to the mysql.plugin table thatdescribes the plugin. This table contains the plugin name and library filename.\n\nINSTALL SONAME causes the server to readoption (my.cnf) files just as during server startup. This enables the plugin topick up any relevant options from those files. It is possible to add pluginoptions to an option file even before loading a plugin (if the loose prefix isused). It is also possible to uninstall a plugin, edit my.cnf, and install theplugin again. Restarting the plugin this way enables it to the new optionvalues without a server restart.\n\nINSTALL SONAME also loads and initializes the plugin code tomake the plugin available for use. A plugin is initialized by executing itsinitialization function, which handles any setup that the plugin must performbefore it can be used.\n\nTo use INSTALL SONAME, you must have the INSERT privilege for the mysql.plugin table.\n\nAt server startup, the server loads and initializes any plugin that islisted in the mysql.plugin table. This means that a plugin is installedwith INSTALL SONAME only once, not every time the serverstarts. Plugin loading at startup does not occur if the server is started withthe --skip-grant-tables option.\n\nWhen the server shuts down, it executes the de-initialization functionfor each plugin that is loaded so that the plugin has a chance toperform any final cleanup.\n\nIf you need to load plugins for a single server startup when the--skip-grant-tables option is given (which tells the servernot to read system tables), use the--plugin-load` mariadbd option.\n\nIf you need to install only one plugin from a library, use the INSTALL PLUGIN statement.\n\nExamples\n--------\n\nINSTALL SONAME ''locales'';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/plugin-sql-statements/install-soname', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/plugin-sql-statements/install-soname');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (523, 26, 'UNINSTALL PLUGIN', 'Syntax\n------\n\nUNINSTALL PLUGIN [IF EXISTS] plugin_name\n\nDescription\n-----------\n\nThis statement removes a single installed plugin. To uninstall the whole library which contains the plugin, use UNINSTALL SONAME. You cannot uninstall a plugin if any table that uses it is open.\n\nplugin_name must be the name of some plugin that is listedin the mysql.plugin table. The server executes the plugin''s deinitializationfunction and removes the row for the plugin from the mysql.plugintable, so that subsequent server restarts will not load and initializethe plugin. UNINSTALL PLUGIN does not remove the plugin''sshared library file.\n\nTo use UNINSTALL PLUGIN, you must have the DELETE privilege for the mysql.plugin table.\n\nIF EXISTS\n\nIf the IF EXISTS clause is used, MariaDB will return a note instead of an error if the plugin does not exist. See SHOW WARNINGS.\n\nExamples\n--------\n\nUNINSTALL PLUGIN example;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/plugin-sql-statements/uninstall-plugin', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/plugin-sql-statements/uninstall-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (524, 26, 'UNINSTALL SONAME', 'Syntax\n------\n\nUNINSTALL SONAME  [IF EXISTS] ''plugin_library''\n\nDescription\n-----------\n\nThis statement is a variant of UNINSTALL PLUGIN statement, that removes all plugins belonging to a specified plugin_library. See UNINSTALL PLUGIN for details.\n\nplugin_library is the name of the shared library thatcontains the plugin code. The file name extension (forexample, libmyplugin.so or libmyplugin.dll) can be omitted (which makes the statement look the same on all architectures).\n\nTo use UNINSTALL SONAME, you must have the DELETE privilege for the mysql.plugin table.\n\nIF EXISTS\n\nIf the IF EXISTS clause is used, MariaDB will return a note instead of an error if the plugin library does not exist. See SHOW WARNINGS.\n\nExamples\n--------\n\nUNINSTALL SONAME ''ha_xtradb'';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/plugin-sql-statements/uninstall-soname', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/plugin-sql-statements/uninstall-soname');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (525, 26, 'PURGE BINARY LOGS', 'Syntax\n------\n\nPURGE { BINARY | MASTER } LOGS\n    { TO ''log_name'' | BEFORE datetime_expr }\n\nDescription\n-----------\n\nThe PURGE BINARY LOGS statement deletes all the binary log files listed in the log index file prior to the specified log file name ordate. BINARY and MASTER are synonyms.Deleted log files also are removed from the list recorded in the index file, sothat the given log file becomes the first in the list.\n\nThe datetime expression is in the format ''YYYY-MM-DD hh:mm:ss''.\n\nIf a slave is active but has yet to read from a binary log file you attempt to delete, the statement will fail with an error. However, if the slave is not connected and has yet to read from a log file you delete, the file will be deleted, but the slave will be unable to continue replicating once it connects again.\n\nThis statement has no effect if the server was not started with the --log-bin option to enable binary logging.\n\nTo list the binary log files on the server, use SHOW BINARY LOGS. To see which files they are reading, use SHOW SLAVE STATUS. You can only delete the files that are older than the oldest file that is used by the slaves.\n\nTo list the binary log files on the server, use SHOW BINARY LOGS. To see which files they are reading, use SHOW SLAVE STATUS. You can only delete the files that are older than the oldest file that is used by the slaves.\n\nTo delete all binary log files, use RESET MASTER.To move to a new log file (for example if you want to remove the current log file), use FLUSH LOGS before you execute PURGE LOGS.\n\nIf the expire_logs_days server system variable is not set to 0, the server automatically deletes binary log files after the given number of days. From MariaDB 10.6, the binlog_expire_logs_seconds variable allows more precise control over binlog deletion, and takes precedence if both are non-zero.\n\nRequires the BINLOG ADMIN privilege.\n\nRequires the SUPER privilege.\n\nExamples\n--------\n\nPURGE BINARY LOGS TO ''mariadb-bin.000063'';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/purge-binary-logs', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/purge-binary-logs');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (526, 26, 'Replication Statements', 'Description\n-----------\n\nThe terms _master_ and _slave_ have historically been used in replication, and MariaDB has begun the process of adding _primary_ and _replica_ synonyms. The old terms will continue to be used to maintain backward compatibility - see MDEV-18777 to follow progress on this effort.\n\nchange-master-to.md\n\nreset-master.md\n\nreset-replica.md\n\nset-global-sql_slave_skip_counter.md\n\nstart-replica.md\n\nstop-replica.md\n\nlegacy-replication-statements\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/README', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (527, 26, 'CHANGE MASTER TO', 'Description\n-----------\n\nThe CHANGE MASTER TO statement sets up a replication slave server to connect to a specific master server and defines the replication coordinates (binary log file and position or GTID) and connection parameters (host, user, password, port, SSL options, etc.). When executed, the slave updates its internal replication metadata accordingly.\n\nSyntax\n\n``sql\nCHANGE MASTER [''connection_name''] TO master_def  [, master_def] ... \n  [FOR CHANNEL ''channel_name'']\n\nmaster_def:\n    MASTER_BIND = ''interface_name''\n  | MASTER_HOST = ''host_name''\n  | MASTER_USER = ''user_name''\n  | MASTER_PASSWORD = ''password''\n  | MASTER_PORT = port_num\n  | MASTER_CONNECT_RETRY = {interval | DEFAULT}\n  | MASTER_HEARTBEAT_PERIOD = {interval | DEFAULT}\n  | MASTER_LOG_FILE = ''master_log_name''\n  | MASTER_LOG_POS = master_log_pos\n  | RELAY_LOG_FILE = ''relay_log_name''\n  | RELAY_LOG_POS = relay_log_pos\n  | MASTER_DELAY = interval\n  | MASTER_SSL = {0 | 1 | DEFAULT}\n  | MASTER_SSL_CA = {''ca_file_name'' | DEFAULT}\n  | MASTER_SSL_CAPATH = {''ca_directory_name'' | DEFAULT}\n  | MASTER_SSL_CERT = {''cert_file_name'' | DEFAULT}\n  | MASTER_SSL_CRL = {''crl_file_name'' | DEFAULT}\n  | MASTER_SSL_CRLPATH = {''crl_directory_name'' | DEFAULT}\n  | MASTER_SSL_KEY = {''key_file_name'' | DEFAULT}\n  | MASTER_SSL_CIPHER = {''cipher_list'' | DEFAULT}\n  | MASTER_SSL_VERIFY_SERVER_CERT = {0 | 1 | DEFAULT}\n  | MASTER_USE_GTID = {current_pos | slave_pos | no | DEFAULT}\n  | MASTER_DEMOTE_TO_SLAVE = bool\n  | IGNORE_SERVER_IDS = (server_id_list)\n  | DO_DOMAIN_IDS = ([N,..])\n  | IGNORE_DOMAIN_IDS = ([N,..])\n  | MASTER_RETRY_COUNT = {long | DEFAULT}\n`\n\nNote: The value is extracted from the corresponding server option or system variable that support DEFAULT. This allows you to reset a replication configuration parameter to its server-level configuration without providing an explicit value.\n\nReplication Configuration\n\nCHANGE MASTER is used on a slave to set up or change replication settings for connecting to the master.\n\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical to using the channel_name directly after CHANGE MASTER.\n\nFOR CHANNEL is not available.\n\nMulti-Source Replication\n\nIf you are using multi-source replication, then you need to specify a connection name when you execute CHANGE MASTER. There are two ways to do this:\n\n Setting the default_master_connection system variable prior to executing CHANGE MASTER.\n Setting the connection_name parameter when executing CHANGE MASTER.\n\ndefault_master_connection\n\n`sql\nSET default_master_connection = ''gandalf'';\nSTOP SLAVE;\nCHANGE MASTER TO \n   MASTER_PASSWORD=''new3cret'';\nSTART SLAVE;\n`\n\nconnection_name\n\n`sql\nSTOP SLAVE ''gandalf'';\nCHANGE MASTER ''gandalf'' TO \n   MASTER_PASSWORD=''new3cret'';\nSTART SLAVE ''gandalf'';\n`\n\nOptions\n\nUsing Configurable Defaults\n\nStarting with MariaDB 12.3, replication connection parameters can be set at the server level (for example, in configuration files like my.cnf or via command-line options) and reused across replication channels.\n\nWhen an option in CHANGE MASTER TO is set to DEFAULT, the value is obtained from the corresponding server option (e.g., options defined in configuration files like my.cnf or provided on the command line). Instead of keeping a fixed value, the replication channel derives the value from the appropriate server option when DEFAULT is selected.\n\n<table><thead><tr><th width="224">CHANGE MASTER Option</th><th width="230">System Variable</th><th>Description</th></tr></thead><tbody><tr><td><code>MASTER_CONNECT_RETRY</code></td><td><code>--master-connect-retry</code></td><td>The interval to wait between connection retry attempts.</td></tr><tr><td><code>MASTER_RETRY_COUNT</code></td><td><code>--master-retry-count</code></td><td>Number of connection attempts before stopping.</td></tr><tr><td><code>MASTER_HEARTBEAT_PERIOD</code></td><td><code>--master-heartbeat-period</code></td><td>Interval between replication heartbeats.</td></tr><tr><td><code>MASTER_SSL</code></td><td><code>--master-ssl</code></td><td>Enables or disables TLS for the connection.</td></tr><tr><td><code>MASTER_SSL_CA</code></td><td><code>--master-ssl-ca</code></td><td>Path to the Certificate Authority (CA) file.</td></tr><tr><td><code>MASTER_SSL_CERT</code></td><td><code>--master-ssl-cert</code></td><td>Path to the client certificate file.</td></tr><tr><td><code>MASTER_SSL_KEY</code></td><td><code>--master-ssl-key</code></td><td>Path to the client private key file.</td></tr><tr><td><code>MASTER_SSL_CAPATH</code></td><td><code>--master-ssl-capath</code></td><td>Path to the directory containing CA certificates.</td></tr><tr><td><code>MASTER_SSL_VERIFY_SERVER_CERT</code></td><td><code>--master-ssl-verify-server-cert</code></td><td>Enable verification of the master''s certificate.</td></tr><tr><td><code>MASTER_SSL_CRL</code></td><td><code>--master-ssl-crl</code></td><td>Path to the Certificate Revocation List (CRL) file.</td></tr><tr><td><code>MASTER_SSL_CRLPATH</code></td><td><code>--master-ssl-crlpath</code></td><td>Path to the directory containing CRL files.</td></tr><tr><td><code>MASTER_SSL_CIPHER</code></td><td><code>--master-ssl-cipher</code></td><td>List of permitted TLS ciphers.</td></tr><tr><td><code>MASTER_USE_GTID</code></td><td><code>--master-use-gtid</code></td><td>Setting for Global Transaction ID (GTID) mode.</td></tr></tbody></table>\n\nFor example, a configuration file can specify default values:\n\n`\nDefaults replication connection options\nmaster_ssl_ca   = /etc/mysql/ssl/ca.pem\nmaster_ssl_cert = /etc/mysql/ssl/client-cert.pem\nmaster_ssl_key  = /etc/mysql/ssl/client-key.pem\nmaster_use_gtid = slave_pos\n`\n\nThese values can then be reused by specifying DEFAULT:\n\n`\n-- Setting up a specific channel using global defaults\nCHANGE MASTER ''primary_node_1'' TO\n  MASTER_HOST = ''10.0.0.5'',\n  MASTER_SSL_CA = DEFAULT,\n  MASTER_SSL_CERT = DEFAULT,\n  MASTER_SSL_KEY = DEFAULT,\n  MASTER_USE_GTID = DEFAULT;\n\nSTART SLAVE ''primary_node_1'';\n`\n\nIf an option is explicitly set in CHANGE MASTER TO, the value overrides the corresponding server option. The replication channel receives the current server-level value if DEFAULT is used.\n\nValues set to DEFAULT are fixed dynamically, thus changes to server options (for example, after a restart) are automatically reflected, whereas explicitly defined values remain unchanged.\n\nBehavior and Persistence\n\nWhen DEFAULT is used, the option is stored in the replication metadata as DEFAULT instead of a specific value. The new value will be used automatically if the corresponding server option changes (for instance, after a server restart).\n\nChanges to server settings have no effect on an explicit value that is provided instead of DEFAULT. When a CHANGE MASTER option is not explicitly set, it acts as DEFAULT.\n\nConfiguration Precedence\n\nValues explicitly defined in CHANGE MASTER TO take precedence over server settings.\n\nThe replication channel can inherit values from server-level configuration rather than overriding them when the DEFAULT keyword is used.\n\nAutoset Options\n\nThe following options can override manual defaults:\n\n --autoset-master-heartbeat-period\n --autoset-master-use-gtid\n\nThese options determine values automatically and may override --master- settings.\n\nConnection Options\n\nMASTER_USER\n\nThe MASTER_USER option for CHANGE MASTER defines the user account that the slave will use to connect to the master.\n\nThis user account will need the REPLICATION SLAVE privilege on the master.\n\nThis user account will need the REPLICATION SLAVE privilege on the master.\n\nFor example:\n\n`sql\nSTOP SLAVE;\nCHANGE MASTER TO\n   MASTER_USER=''repl'',\n   MASTER_PASSWORD=''new3cret'';\nSTART SLAVE;\n`\n\nThe maximum length of the MASTER_USER string is 128 characters.\n\nThe maximum length of the MASTER_USER string is 96 characters.\n\nMASTER_PASSWORD\n\nThe MASTER_PASSWORD option for CHANGE MASTER defines the password that the slave will use to connect to the master as the user account defined by the MASTER_USER option.\n\nFor example:\n\n`sql\nSTOP SLAVE;\nCHANGE MASTER TO \n   MASTER_PASSWORD=''new3cret'';\nSTART SLAVE;\n`\n\nThe maximum length of the MASTER_PASSWORD string is 32 characters. The effective maximum length of the string depends on how many bytes are used per character and can be up to 96 characters.\n\nDue to MDEV-29994, the password can be silently truncated to 41 characters when MariaDB is restarted. For this reason, it is recommended to use a password that is shorter than this.\n\nMASTER_HOST\n\nThe MASTER_HOST option for CHANGE MASTER defines the hostname or IP address of the master.\n\nIf you set the value of the MASTER_HOST option to the empty string, then that is not the same as not setting the option''s value at all. If you set the value of the MASTER_HOST option to the empty string, then the CHANGE MASTER command will fail with an error.\n\nIf you set the value of the MASTER_HOST option to the empty string, then that is not the same as not setting the option''s value at all. If you set the value of the MASTER_HOST option to the empty string, then the CHANGE MASTER command will fail with an error. In MariaDB 5.3 and before, if you set the value of the MASTER_HOST option to the empty string, then the CHANGE MASTER command would succeed, but the subsequent START SLAVE command would fail.\n\nFor example:\n\n`sql\nSTOP SLAVE;\nCHANGE MASTER TO\n   MASTER_HOST=''dbserver1.example.com'',\n   MASTER_USER=''repl'',\n   MASTER_PASSWORD=''new3cret'',\n   MASTER_USE_GTID=slave_pos;\nSTART SLAVE;\n`\n\nIf you set the value of the MASTER_HOST option in a CHANGE MASTER command, then the slave assumes that the master is different from before, even if you set the value of this option to the same value it had previously. In this scenario, the slave will consider the old values for the master''s binarylog file name and position to be invalid for the new master. As a side effect, if you do not explicitly set the values of the MASTER_LOG_FILE and MASTER_LOG_POS options in the statement, then the statement will be implicitly appended with MASTER_LOG_FILE='''' and MASTER_LOG_POS=4. However, if you enable GTID mode for replication by setting the MASTER_USE_GTID option to some value other than no in the statement, then these values will effectively be ignored anyway.\n\nSlaves cannot connect to primaries using Unix socket files or Windows named pipes. The slave must connect to the master using TCP/IP.\n\nThe maximum length of the MASTER_HOST string is 255 characters.\n\nThe maximum length of the MASTER_HOST string is 60 characters.\n\nMASTER_PORT\n\nThe MASTER_PORT option for CHANGE MASTER defines the TCP/IP port of the master.\n\nFor example:\n\n`sql\nSTOP SLAVE;\nCHANGE MASTER TO\n   MASTER_HOST=''dbserver1.example.com'',\n   MASTER_PORT=3307,\n   MASTER_USER=''repl'',\n   MASTER_PASSWORD=''new3cret'',\n   MASTER_USE_GTID=slave_pos;\nSTART SLAVE;\n`\n\nIf you set the value of the MASTER_PORT option in a CHANGE MASTER command, then the slave assumes that the master is different from before, even if you set the value of this option to the same value it had previously. In this scenario, the slave will consider the old values for the master''s binary log file name and position to be invalid for the new master. As a side effect, if you do not explicitly set the values of the MASTER_LOG_FILE and MASTER_LOG_POS options in the statement, then the statement will be implicitly appended with MASTER_LOG_FILE='''' and MASTER_LOG_POS=4. However, if you enable GTID mode for replication by setting the MASTER_USE_GTID option to some value other than no in the statement, then these values will effectively be ignored anyway.\n\nSlaves cannot connect to primaries using Unix socket files or Windows named pipes. The slave must connect to the master using TCP/IP.\n\nMASTER_CONNECT_RETRY\n\nThe MASTER_CONNECT_RETRY option for CHANGE MASTER defines how many seconds that the slave will wait between connection retries. The default is 60.\n\n`sql\nSTOP SLAVE;\nCHANGE MASTER TO \n   MASTER_CONNECT_RETRY=20;\nSTART SLAVE;\n`\n\n> Starting with MariaDB 12.3, this option accepts the DEFAULT keyword. When set to DEFAULT, the value is taken from the corresponding server option (for example, --master-connect-retry defined in the configuration files or on the command line).\\\n> \\\n> The option can now be set to 0, which disables the wait between connection retries.\n\nMASTER_RETRY_COUNT\n\nThe MASTER_RETRY_COUNT option limits the number of connection attempts (i.e., Connects_Tried in SHOW SLAVE STATUS). For example:\n\n`sql\nSTOP SLAVE;\nCHANGE MASTER TO\n  MASTER_RETRY_COUNT=1; # attempt only once; do not retry if it fails\nSTART SLAVE;\n`\n\nSetting this option resets the Connects_Tried statistic in SHOW SLAVE STATUS to 0.\n\nThe default is the --master-retry-count option, which can be set either on the command-line or in a server option group in an option file prior to starting up the server. For example:\n\nThe MASTER_RETRY_COUNT option for CHANGE MASTER is only supported by MariaDB 12.0.1 and later and by MySQL. Please use the --master-retry-count option instead, which be set either on the command-line or in a server option group in an option file prior to starting up the server. For example:\n\n`ini\n[mariadb]\n...\nmaster_retry_count=4294967295\n`\n\nThe maximum value is 18446744073709551615 (64-bit). Before MariaDB 12.3, the maximum value for Windows was 4294967295.\n\n> Starting with MariaDB 12.3, this option accepts the DEFAULT keyword. When set to DEFAULT, the value is taken from the corresponding server option (for example, --master-retry-count).\n>\n> The option can now be set to 0, allowing the slave to retry indefinitely.\n> \\\n> When it is set to 1, the connection attempt is only made once, hence disabling retries.\n\nMASTER_BIND\n\nThe MASTER_BIND option for CHANGE MASTER is only supported by MySQL 5.6.2 and later and by MySQL NDB Cluster 7.3.1 and later. This option is not supported by MariaDB. See MDEV-19248 for more information.\n\nThe MASTER_BIND option for CHANGE MASTER can be used on slaves that have multiple network interfaces to choose which network interface the slave will use to connect to the master.\n\nMASTER_HEARTBEAT_PERIOD\n\nThe MASTER_HEARTBEAT_PERIOD option for CHANGE MASTER can be used to set the interval in seconds between replication heartbeats. Whenever the master''s binary log is updated with an event, the waiting period for the next heartbeat is reset.\n\nThis option''s _interval_ argument has the following characteristics:\n\n It is a decimal value with a range of 0 to 4294967.295 seconds.\n It has a resolution of hundredths of a second.\n Its smallest valid non-zero value is 0.001.\n Its default value is the value of the slave_net_timeout system variable divided by 2.\n If it''s set to 0, then heartbeats are disabled.\n\nHeartbeats are sent by the master only if there are no unsent events in the binary log file for a period longer than the interval.\n\n> Starting with MariaDB 12.3, this option accepts the DEFAULT keyword. When set to DEFAULT, the value is taken from the corresponding server opti\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/change-master-to');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (528, 26, 'RESET REPLICA', 'Description\n-----------\n\nAlias for RESET SLAVE\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/legacy-replication-statements/legacy-commands-reset-slave', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/legacy-replication-statements/legacy-commands-reset-slave');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (529, 26, 'SHOW REPLICA HOSTS', 'Description\n-----------\n\nAlias for SHOW SLAVE HOSTS\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/legacy-replication-statements/legacy-commands-show-slave-hosts', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/legacy-replication-statements/legacy-commands-show-slave-hosts');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (530, 26, 'SHOW REPLICA STATUS', 'Description\n-----------\n\nAlias for SHOW SLAVE STATUS\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/legacy-replication-statements/legacy-commands-show-slave-status', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/legacy-replication-statements/legacy-commands-show-slave-status');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (531, 26, 'START REPLICA', 'Description\n-----------\n\nAlias for START SLAVE\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/legacy-replication-statements/legacy-commands-start-slave', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/legacy-replication-statements/legacy-commands-start-slave');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (532, 26, 'STOP REPLICA', 'Description\n-----------\n\nAlias for STOP SLAVE\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/legacy-replication-statements/legacy-commands-stop-slave', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/legacy-replication-statements/legacy-commands-stop-slave');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (533, 26, 'RESET MASTER', 'Description\n-----------\n\n``sql\nRESET MASTER [TO #]\n`\n\nDeletes all binary log files listed in the index file, resets the binary log index file to be empty, and creates a new binary log file with a suffix of .000001.\n\nIf TO #` is given, then the first new binary log file will start from number #.\n\nThis statement is for use only when the master is started for the first time and should never be used if any slaves are actively replicating from the binary log.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/reset-master', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/reset-master');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (534, 26, 'RESET SLAVE', 'Syntax\n------\n\nRESET { SLAVE | REPLICA } ["connection_name"] [ALL]  [FOR CHANNEL "connection_name"].\n\nDescription\n-----------\n\nRESET SLAVE makes the slave forget its replication position in the master''s binary log. This statement is meant to be used for a clean start. It deletes the master.info and relay-log.info files, all the relay log files, and starts a new relay log file. To use RESET SLAVE, the slave threads must be stopped (use STOP SLAVE if necessary).\n\nNote: All relay log files are deleted, even if they have not been completely executed by the slave SQL thread. (This is a condition likely to exist on a replication slave if you have issued a STOP SLAVE statement or if the slave is highly loaded.)\n\nNote: RESET SLAVE does not reset the globalgtid_slave_pos variable. This means that a slave server configured with CHANGE MASTER TO MASTER_USE_GTID=slave_pos will not receive events with GTIDs occurring before the state saved ingtid_slave_pos. If the intent is to reprocess these events,gtid_slave_pos must be manually reset, e.g., by executing set global gtid_slave_pos="".\n\nConnection information stored in the master.info file is immediately reset using any values specified in the corresponding startup options. This information includes values such as master host, master port, master user, and master password. If the slave SQL thread was in the middle of replicating temporary tables when it was stopped, and RESET SLAVE is issued, these replicated temporary tables are deleted on the slave.\n\nThe ALL also resets the PORT, HOST, USER, and PASSWORD parameters for the slave. If you are using a connection name, it will be permanently deleted it and it will not show up anymore in SHOW ALL SLAVES STATUS.\n\nconnection_name\n\nThe connection_name option is used for multi-source replication.\n\nIf there is only one nameless master, or the default master (as specified by the default_master_connection system variable) is intended, connection_name can be omitted. If provided, the RESET SLAVE statement will apply to the specified master. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical to using the channel_name directly after RESET SLAVE.\n\nFOR CHANNEL is not available.\n\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical as using the channel_name directly after RESET SLAVE.\n\nMariaDB starting with 11.6.0\n\nRESET SLAVE resets the Master/Slave_last_event_time and Connects_Tried values (see SHOW SLAVE STATUS).\n\nRESET SLAVE resets the Master/Slave_last_event_time values (see SHOW SLAVE STATUS).\n\nRESET SLAVE does not reset the Master/Slave_last_event_time values (see SHOW SLAVE STATUS).\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/reset-replica', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/reset-replica');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (535, 26, 'SET GLOBAL SQL\\_SLAVE\\_SKIP\\_COUNTER', 'Syntax\n------\n\nSET GLOBAL sql_slave_skip_counter = N\n\nDescription\n-----------\n\nThis statement skips the next N events from the master. This is useful for recovering from replication stops caused by a statement.\n\nIf multi-source replication is used, this statement applies to the default connection. It could be necessary to change the value of the default_master_connection system variable.\n\nNote that, if the event is a transaction, the whole transaction will be skipped. With non-transactional engines, an event is always a single statement.\n\nThis statement is valid only when the slave threads are not running. Otherwise, it produces an error.\n\nThe statement does not automatically restart the slave threads.\n\nExamples\n--------\n\nSHOW SLAVE STATUS \\G\n...\nSET GLOBAL sql_slave_skip_counter = 1;\nSTART SLAVE;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/set-global-sql_slave_skip_counter', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/set-global-sql_slave_skip_counter');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (536, 26, 'START SLAVE', 'Syntax\n------\n\nSTART { SLAVE | REPLICA } ["connection_name"] [thread_type [, thread_type] ... ]\nSTART { SLAVE | REPLICA } ["connection_name"] [SQL_THREAD] UNTIL                \n    MASTER_LOG_FILE = ''log_name'', MASTER_LOG_POS = log_pos \nSTART { SLAVE | REPLICA } ["connection_name"] [SQL_THREAD] UNTIL\n    RELAY_LOG_FILE = ''log_name'', RELAY_LOG_POS = log_pos \nSTART { SLAVE | REPLICA } ["connection_name"] [SQL_THREAD] UNTIL\n    MASTER_GTID_POS = <GTID position> \nSTART ALL { SLAVES | REPLICAS } [thread_type [, thread_type]] \n\nthread_type: IO_THREAD | SQL_THREAD\n\nDescription\n-----------\n\nSTART REPLICA is a synonym for START SLAVE.\n\nOnly START SLAVE can be used.\n\nSTART SLAVE or START REPLICA with no thread_type options starts both of the slave threads (see replication) needed to connect with a master setup with CHANGE MASTER TO. The I/O thread reads events from the master server and stores them in the relay log. The SQL thread reads events from the relay log and executes them.\n\nSTART SLAVE requires the REPLICATION SLAVE ADMIN privilege.\n\nSTART SLAVE requires the SUPER privilege.\n\nIf START SLAVE succeeds in starting the slave threads, it returns without any error. However, even in that case, it might be that the slave threads start and then later stop (for example, because they do not manage to connect to the master or read its binary log, or some other problem). START SLAVE does not warn you about this. You must check the slave''s error log for error messages generated by the slave threads or check that they are running satisfactorily with SHOW SLAVE STATUS (SHOW REPLICA STATUS).\n\nSTART SLAVE UNTIL\n\nSTART SLAVE UNTIL refers to the SQL_THREAD slave position at which the SQL_THREAD replication will halt. If SQL_THREAD isn''t specified, both threads are started.\n\nSTART SLAVE UNTIL master_gtid_pos=xxx is also supported. See Global Transaction ID/START SLAVE UNTIL master_gtid_pos=xxx for more details.\n\nMariaDB starting with 11.3.0\n\nSQL_BEFORE_GTIDS|SQL_AFTER_GTIDS\n\nThe START SLAVE UNTIL statement contains the options SQL_BEFORE_GTIDS and SQL_AFTER_GTIDS to allow control of whether the slave stops before or after a provided GTID state. Its syntax is:\n\n``sql\nSTART SLAVE UNTIL (SQL_BEFORE_GTIDS|SQL_AFTER_GTIDS)="<gtid_list>"\n`\n\nSee Global Transaction ID#SQL_BEFORE_GTIDS/SQL_AFTER_GTIDS for details.\n\nSQL_BEFORE_GTIDS and SQL_AFTER_GTIDS are not available.\n\nconnection_name\n\nIf there is only one nameless master, or the default master (as specified by the default_master_connection system variable) is intended, connection_name can be omitted. If provided, the START SLAVE statement will apply to the specified master. connection_name is case-insensitive.\n\nThe FOR CHANNEL keyword is available for MySQL compatibility. This is identical to using the channel_name directly after START SLAVE.\n\nThe FOR CHANNEL keyword is not available.\n\nSTART ALL SLAVES\n\nSTART ALL SLAVES starts all configured slaves (slaves with master_host not empty) that were not started before. It will give a note` for all started connections. You can check the notes with SHOW WARNINGS.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/start-replica', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/start-replica');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (537, 26, 'STOP SLAVE', 'Syntax\n------\n\nSTOP { SLAVE | REPLICA } ["connection_name"] [thread_type [, thread_type] ... ] \n[FOR CHANNEL "connection_name"]\n\nSTOP ALL { SLAVES | REPLICAS } [thread_type [, thread_type]]\n\nSTOP { SLAVE | REPLICA } ["connection_name"] [thread_type [, thread_type] ... ]\n\nSTOP ALL { SLAVES | REPLICAS } [thread_type [, thread_type]] \n\nthread_type: IO_THREAD | SQL_THREAD\n\nDescription\n-----------\n\nStops the slave threads. STOP SLAVE requires the SUPER privilege, or, from MariaDB 10.5.2, the REPLICATION SLAVE ADMIN privilege.\n\nLike START SLAVE, this statement may be used with the IO_THREAD andSQL_THREAD options to name the thread or threads to be stopped. In almost all cases, one never need to use the thread_type options.\n\nSTOP SLAVE waits until any current replication event group affecting one or more non-transactional tables has finished executing (if there is any such replication group), or until the user issues a KILL QUERY or KILL CONNECTION statement.\n\nNote that STOP SLAVE doesn''t delete the connection permanently. Next time you execute START SLAVE or the MariaDB server restarts, the slave connection is restored with it''s original arguments. If you want to delete a connection, you should execute RESET SLAVE.\n\nSTOP ALL SLAVES\n\nSTOP ALL SLAVES stops all your running slaves. It will give you a note for every stopped connection. You can check the notes with SHOW WARNINGS.\n\nconnection_name\n\nThe connection_name option is used for multi-source replication.\n\nIf there is only one nameless master, or the default master (as specified by the default_master_connection system variable) is intended, connection_name can be omitted. If provided, the STOP SLAVE statement will apply to the specified master. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n\nThe FOR CHANNEL keyword is available for MySQL compatibility. This is identical as using the channel_name directly after STOP SLAVE.\n\nThe FOR CHANNEL keyword is not available.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/stop-replica', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/stop-replica');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (538, 26, 'RESET', 'Syntax\n------\n\nRESET reset_option [, reset_option] ...\n\nDescription\n-----------\n\nThe RESET statement is used to clear the state of various server operations. You must have the RELOAD privilege to executeRESET.\n\nRESET acts as a stronger version of the FLUSH statement.\n\nThe different RESET options are:\n\n| Option                                           | Description                                                                                                                                                                                                                                                                                                                                                                                           |\n| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| SLAVE \\["connection_name"] \\[ALL]               | Deletes all relay logs from the slave and reset the replication position in the master binary log.                                                                                                                                                      |\n| MASTER | Deletes all old binary logs, makes the binary index file (--log-bin-index) empty and creates a new binary log file. This is useful when you want to reset the master to an initial state. If you want to just delete old, not used binary logs, you should use the PURGE BINARY LOGS command. |\n| QUERY CACHE                                      | Removes all queries from the query cache. See also FLUSH QUERY CACHE.                                                                                                                                                                                         |\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/reset', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/reset');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (539, 26, 'SET Statements', 'Description\n-----------\n\nset.md\n\nset-character-set.md\n\nset-global-sql_slave_skip_counter.md\n\nset-names.md\n\nset-password.md\n\nset-role.md\n\nset-sql_log_bin.md\n\nset-statement.md\n\nset-transaction.md\n\nset-variable.md\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/README', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (540, 26, 'SET PATH', 'Syntax\n------\n\nSET PATH ''db1 [, db2 [, ...]]''\n\nDescription\n-----------\n\nSets the list of schemas (databases) that MariaDB uses to search for stored routines to invoke. Such a search happens in the CALL statement and when stored function are used in expressions.\n\nThe value of the path is a string which contains comma-separated schema names. A schema name can be quoted with backticks (or double quotes, as appropriate). A special name CURRENT_SCHEMA means to look in the current schema. Spaces are ignored, unless they are part of a quoted schema name. A path cannot contain two equivalent schema names.\n\nThe following two commands invoke the same stored procedure:\n\n``sql\nCALL sys.optimizer_switch_on();\n`\nand\n`sql\nSET PATH ''sys'';\nCALL optimizer_switch_on();\n`\n\nA default value of the path is ''CURRENT_SCHEMA'' which provides the traditional behavior — stored routines must be in the current database.\n\nAlso the path is used to look up packages in package routine invocations. Assuming there is a package UTL_ENCODE in the sys schema, and it contains the function BASE64_DECODE(), one can write\n\n`sql\nSELECT sys.UTL_ENCODE.BASE64_DECODE(''data'');\n`\nor\n`sql\nSET PATH=''sys''; \nSELECT UTL_ENCODE.BASE64_DECODE(''data'');\n`\n\nNotes\n\n This functionality introduces the @@path system variable (session and global).\n The SET PATH statement sets the @@session.path variable. It is also possible to assign a new value to the @@path variable directory, using a statement like this: SET @@path=''sys''`.\n* Prepared statements, stored routines, and views remember the value of the path when they are created. The value of the path at the time of the execution does not apply.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set-path', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set-path');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (541, 26, 'SET SQL\\_LOG\\_BIN', 'Syntax\n------\n\nSET [SESSION] sql_log_bin = {0|1}\n\nDescription\n-----------\n\nSets the sql_log_bin system variable, which disables or enables binary logging for the current connection, if the client has the SUPER privilege. The statement is refused with an error if the client does not have that privilege.\n\nNote that setting sql_log_bin=1 has no effect if log_bin variable, which enables global binary logging, is not set.\n\nYou cannot set sql_log_bin as a global variable.\n\nYou can set sql_log_bin as a global variable. This is considered dangerous, though, as it can damage replication.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set-sql_log_bin', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set-sql_log_bin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (542, 26, 'SET STATEMENT', 'Syntax\n------\n\nSET STATEMENT var1=value1 [, var2=value2, ...] \n  FOR <statement>\n\nDescription\n-----------\n\nSET STATEMENT var1=value1 FOR stmt\n\nis roughly equivalent to\n\n``sql\nSET @save_value=@@var1;\nSET SESSION var1=value1;\nstmt;\nSET SESSION var1=@save_value;\n``\n\nThe server parses the whole statement before executing it, so any variables set in this fashion that affect the parser may not have the expected effect. Examples include the charset variables, sql_mode=ansi_quotes, etc.\n\nExamples\n--------\n\nSET STATEMENT max_statement_time=1000 FOR SELECT ... ;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set-statement', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set-statement');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (543, 26, 'SET', 'Syntax\n------\n\nSET variable_assignment [, variable_assignment] ...\n\nvariable_assignment:\n      user_var_name = expr\n    | [GLOBAL | SESSION] system_var_name = expr\n    | [@@global. | @@session. | @@]system_var_name = expr\n\nDescription\n-----------\n\nThe SET statement assigns values to different types of variables that affect the operation of the server or your client.\n\nThe SET statement assigns values to different types of variables that affect the operation of the server or your client. Older versions of MySQL employed SET OPTION, but this syntax was deprecated in favor of SET without OPTION.\n\nChanging a system variable by using the SET statement does not make the change permanently. To do so, the change must be made in a configuration file.\n\nFor setting variables on a per-query basis, see SET STATEMENT.\n\nSee SHOW VARIABLES for documentation on viewing server system variables.\n\nSee Server System Variables for a list of all the system variables.\n\nGLOBAL / SESSION\n\nWhen setting a system variable, the scope can be specified as either GLOBAL or SESSION.\n\nA global variable change affects all new sessions. It does not affect any currently open sessions, including the one that made the change.\n\nA session variable change affects the current session only.\n\nIf the variable has a session value, not specifying either GLOBAL or SESSION will be the same as specifying SESSION. If the variable only has a global value, not specifying GLOBAL or SESSION will apply to the change to the global value.\n\nDEFAULT\n\nSetting a global variable to DEFAULT will restore it to the server default, and setting a session variable to DEFAULT will restore it to the current global value.\n\nExamples\n--------\n\nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n  VARIABLE_NAME IN (''max_error_count'', ''skip_parallel_replication'', ''innodb_sync_spin_loops'');\n+---------------------------+---------------+--------------+\n| VARIABLE_NAME             | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT           | 64            | 64           |\n| SKIP_PARALLEL_REPLICATION | OFF           | NULL         |\n| INNODB_SYNC_SPIN_LOOPS    | NULL          | 30           |\n+---------------------------+---------------+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (544, 26, 'About SHOW', 'Description\n-----------\n\nSHOW provides information about various aspects of MariaDB Server. A list of the various SHOW statements is here.\n\nThe general syntax is:\n\n``sql\nSHOW LIKE ''pattern'' | WHERE expr\n`\n\nThe LIKE and WHERE clauses make sense only for particular SHOW statements, though. See Extended SHOW for what SHOW statements benefit from using those clauses.\n\nIf the syntax for a given SHOW statement includes LIKE ''pattern'' , ''pattern'' is a\\\nstring that can contain the SQL % and _` wildcard characters. The pattern is useful for\\\nrestricting statement output to matching values.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/about-show', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/about-show');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (545, 26, 'Extended SHOW', 'Description\n-----------\n\nThe following SHOW statements can be extended using a WHERE clause and a LIKE clause to refine the results:\n\n SHOW CHARACTER SET\n SHOW COLLATION\n SHOW COLUMNS\n SHOW DATABASES\n SHOW FUNCTION STATUS\n SHOW INDEX\\\\\n SHOW OPEN TABLES\n SHOW PACKAGE STATUS\n SHOW PACKAGE BODY STATUS\n SHOW INDEX\n SHOW PROCEDURE STATUS\n SHOW STATUS\n SHOW TABLE STATUS\n SHOW TABLES\n SHOW TRIGGERS\n SHOW VARIABLES\n\nAs with a regular SELECT, the WHERE clause can be used for the specific columns returned, and the LIKE clause with the regular wildcards.\n\nExamples\n--------\n\nSHOW TABLES;\n+----------------------+\n| Tables_in_test       |\n+----------------------+\n| animal_count         |\n| animals              |\n| are_the_mooses_loose |\n| aria_test2           |\n| t1                   |\n| view1                |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/extended-show', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/extended-show');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (546, 26, 'SHOW ANALYZE', 'Syntax\n------\n\nSHOW ANALYZE [FORMAT=JSON] FOR <connection_id>;\n\nDescription\n-----------\n\nSHOW ANALYZE allows one to retrieve ANALYZE-like output from a currently running statement. The statement\n\n``sql\nSHOW ANALYZE [FORMAT=JSON] FOR <connection_id>;\n`\n\nconnects to the query running in connection connection_id, gets information about the query plan it is executing, _also gets information about the runtime statistics of the execution so far_ and returns it in a format similar to ANALYZE [FORMAT=JSON] output.\n\nThis is similar to the SHOW EXPLAIN command, the difference being that SHOW ANALYZE also produces runtime statistics information.\n\nUse Case\n\nYou''re trying to troubleshoot a query that never finishes. Since it doesn''t finish, it is not possible to get ANALYZE output for it. With SHOW ANALYZE`, you can get the runtime statistics without waiting for the query to finish.\n\nExamples\n--------\n\nEXPLAIN format=json\nSELECT sum(orders.amount)\nFROM\n  customer JOIN orders ON customer.cust_id=orders.cust_id\nWHERE\n  customer.status=''GOLD'';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-analyze', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-analyze');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (547, 26, 'SHOW AUTHORS', 'Syntax\n------\n\nSHOW AUTHORS\n\nDescription\n-----------\n\nThe SHOW AUTHORS statement displays information about the people who work on MariaDB. For each author, it displays Name, Location, and Comment values. All columns are encoded as latin1.\n\nThese include:\n\n First the active people in MariaDB are listed.\n Then the active people in MySQL.\n Last the people that have contributed to MariaDB/MySQL in the past.\n\nThe order is somewhat related to importance of the contribution given to the MariaDB project, but this is not 100% accurate. There is still room for improvement and debate...\n\nExamples\n--------\n\nSHOW AUTHORS\\G\n*********************** 1. row *********************\n    Name: Michael (Monty) Widenius\nLocation: Tusby, Finland\n Comment: Lead developer and main author\n********************* 2. row *********************\n    Name: Sergei Golubchik\nLocation: Kerpen, Germany\n Comment: Architect, Full-text search, precision math, plugin framework, merges etc\n********************* 3. row *********************\n    Name: Igor Babaev\nLocation: Bellevue, USA\n Comment: Optimizer, keycache, core work\n********************* 4. row *********************\n    Name: Sergey Petrunia\nLocation: St. Petersburg, Russia\n Comment: Optimizer\n********************* 5. row *********************\n    Name: Oleksandr Byelkin\nLocation: Lugansk, Ukraine\n Comment: Query Cache (4.0), Subqueries (4.1), Views (5.0)\n********************* 6. row *********************\n    Name: Timour Katchaounov\nLocation: Sofia , Bulgaria\n Comment: Optimizer\n********************* 7. row *********************\n    Name: Kristian Nielsen\nLocation: Copenhagen, Denmark\n Comment: Replication, Async client prototocol, General buildbot stuff\n********************* 8. row *********************\n    Name: Alexander (Bar) Barkov\nLocation: Izhevsk, Russia\n Comment: Unicode and character sets\n********************* 9. row *********************\n    Name: Alexey Botchkov (Holyfoot)\nLocation: Izhevsk, Russia\n Comment: GIS extensions, embedded server, precision math\n********************* 10. row *********************\n    Name: Daniel Bartholomew\nLocation: Raleigh, USA\n Comment: MariaDB documentation, Buildbot, releases\n********************* 11. row *********************\n    Name: Colin Charles\nLocation: Selangor, Malesia\n Comment: MariaDB documentation, talks at a LOT of conferences\n********************* 12. row *********************\n    Name: Sergey Vojtovich\nLocation: Izhevsk, Russia\n Comment: initial implementation of plugin architecture, maintained native storage engines (MyISAM, MEMORY, ARCHIVE, etc), rewrite of table cache\n********************* 13. row *********************\n    Name: Vladislav Vaintroub\nLocation: Mannheim, Germany\n Comment: MariaDB Java connector, new thread pool, Windows optimizations\n********************* 14. row *********************\n    Name: Elena Stepanova\nLocation: Sankt Petersburg, Russia\n Comment: QA, test cases\n********************* 15. row *********************\n    Name: Georg Richter\nLocation: Heidelberg, Germany\n Comment: New LGPL C connector, PHP connector\n********************* 16. row *********************\n    Name: Jan Lindström\nLocation: Ylämylly, Finland\n Comment: Working on InnoDB\n********************* 17. row *********************\n    Name: Lixun Peng\nLocation: Hangzhou, China\n Comment: Multi Source replication\n********************* 18. row *********************\n    Name: Olivier Bertrand\nLocation: Paris, France\n Comment: CONNECT storage engine\n********************* 19. row *********************\n    Name: Kentoku Shiba\nLocation: Tokyo, Japan\n Comment: Spider storage engine, metadata_lock_info Information schema\n********************* 20. row *********************\n    Name: Percona\nLocation: CA, USA\n Comment: XtraDB, microslow patches, extensions to slow log\n********************* 21. row *********************\n    Name: Vicentiu Ciorbaru\nLocation: Bucharest, Romania\n Comment: Roles\n********************* 22. row *********************\n    Name: Sudheera Palihakkara\nLocation: \n Comment: PCRE Regular Expressions\n********************* 23. row *********************\n    Name: Pavel Ivanov\nLocation: USA\n Comment: Some patches and bug fixes\n********************* 24. row *********************\n    Name: Konstantin Osipov\nLocation: Moscow, Russia\n Comment: Prepared statements (4.1), Cursors (5.0), GET_LOCK (10.0)\n********************* 25. row *********************\n    Name: Ian Gilfillan\nLocation: South Africa\n Comment: MariaDB documentation\n********************* 26. row *********************\n    Name: Federico Razolli\nLocation: Italy\n Comment: MariaDB documentation Italian translation\n********************* 27. row *********************\n    Name: Guilhem Bichot\nLocation: Bordeaux, France\n Comment: Replication (since 4.0)\n********************* 28. row *********************\n    Name: Andrei Elkin\nLocation: Espoo, Finland\n Comment: Replication\n********************* 29. row *********************\n    Name: Dmitri Lenev\nLocation: Moscow, Russia\n Comment: Time zones support (4.1), Triggers (5.0)\n********************* 30. row *********************\n    Name: Marc Alff\nLocation: Denver, CO, USA\n Comment: Signal, Resignal, Performance schema\n********************* 31. row *********************\n    Name: Mikael Ronström\nLocation: Stockholm, Sweden\n Comment: NDB Cluster, Partitioning, online alter table\n********************* 32. row *********************\n    Name: Ingo Strüwing\nLocation: Berlin, Germany\n Comment: Bug fixing in MyISAM, Merge tables etc\n********************* 33. row ************************\n    Name: Marko Mäkelä\nLocation: Helsinki, Finland\n Comment: InnoDB core developer\n...\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-authors', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-authors');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (548, 26, 'SHOW BINARY LOGS', 'Syntax\n------\n\nSHOW BINARY LOGS\nSHOW MASTER LOGS\n\nDescription\n-----------\n\nLists the binary log files on the server. This statement is used as part of the procedure described in PURGE BINARY LOGS, that shows how to determine which logs can be purged.\n\nThis statement requires the BINLOG MONITOR privilege.\n\nThis statement requires the SUPER privilege and the REPLICATION_CLIENT privilege.\n\nExamples\n--------\n\nSHOW BINARY LOGS;\n+--------------------+-----------+\n| Log_name           | File_size |\n+--------------------+-----------+\n| mariadb-bin.000001 |     19039 |\n| mariadb-bin.000002 |    717389 |\n| mariadb-bin.000003 |       300 |\n| mariadb-bin.000004 |       333 |\n| mariadb-bin.000005 |       899 |\n| mariadb-bin.000006 |       125 |\n| mariadb-bin.000007 |     18907 |\n| mariadb-bin.000008 |     19530 |\n| mariadb-bin.000009 |       151 |\n| mariadb-bin.000010 |       151 |\n| mariadb-bin.000011 |       125 |\n| mariadb-bin.000012 |       151 |\n| mariadb-bin.000013 |       151 |\n| mariadb-bin.000014 |       125 |\n| mariadb-bin.000015 |       151 |\n| mariadb-bin.000016 |       314 |\n+--------------------+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-binary-logs', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-binary-logs');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (549, 26, 'SHOW BINLOG EVENTS', 'Syntax\n------\n\nSHOW BINLOG EVENTS\n   [IN ''log_name''] [FROM pos] [LIMIT [offset,] row_count]\n\nDescription\n-----------\n\nShows the events in the binary log. If you do not specify log_name, the first binary log is displayed.\n\nThis statement requires the BINLOG MONITOR privilege.\n\nThis statement requires the REPLICATION SLAVE privilege.\n\nExamples\n--------\n\nSHOW BINLOG EVENTS IN ''mysql_sandbox10019-bin.000002'';\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n| Log_name                      | Pos | Event_type        | Server_id | End_log_pos | Info                                           |\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n| mysql_sandbox10019-bin.000002 |   4 | Format_desc       |         1 |         248 | Server ver: 10.0.19-MariaDB-log, Binlog ver: 4 |\n| mysql_sandbox10019-bin.000002 | 248 | Gtid_list         |         1 |         273 | []                                             |\n| mysql_sandbox10019-bin.000002 | 273 | Binlog_checkpoint |         1 |         325 | mysql_sandbox10019-bin.000002                  |\n| mysql_sandbox10019-bin.000002 | 325 | Gtid              |         1 |         363 | GTID 0-1-1                                     |\n| mysql_sandbox10019-bin.000002 | 363 | Query             |         1 |         446 | CREATE DATABASE blog                           |\n| mysql_sandbox10019-bin.000002 | 446 | Gtid              |         1 |         484 | GTID 0-1-2                                     |\n| mysql_sandbox10019-bin.000002 | 484 | Query             |         1 |         571 | use blog; CREATE TABLE bb (id INT)           |\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-binlog-events', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-binlog-events');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (550, 26, 'SHOW MASTER STATUS', 'Syntax\n------\n\nSHOW [MASTER | BINLOG] STATUS\n\nDescription\n-----------\n\nProvides status information about the binary log files of the master.\n\nThis statement requires the BINLOG MONITOR privilege.\n\nThis statement requires the SUPER privilege and the REPLICATION_CLIENT privilege.\n\nThe following improved functionality is available from MariaDB 12.3.\n\nTo see information about the current GTIDs in the binary log, use the gtid_binlog_pos variable. It is enabled by default, and helps find the current state of the master server. (Previously, this required two statements, SHOW MASTER STATUS and SELECT @@global.gtid_binlog_pos.)\n\nExamples\n--------\n\nSHOW BINLOG STATUS;\n+--------------------+----------+--------------+------------------+\n| File               | Position | Binlog_Do_DB | Binlog_Ignore_DB |\n+--------------------+----------+--------------+------------------+\n| mariadb-bin.000016 |      475 |              |                  |\n+--------------------+----------+--------------+------------------+\nSELECT @@global.gtid_binlog_pos;\n+--------------------------+\n| @@global.gtid_binlog_pos |\n+--------------------------+\n| 0-1-2                    |\n+--------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-binlog-status', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-binlog-status');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (551, 26, 'SHOW CHARACTER SET', 'Syntax\n------\n\nSHOW CHARACTER SET\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nThe SHOW CHARACTER SET statement shows all available character sets. The LIKE clause, if present on its own, indicates which character set names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nThe same information can be queried from the Information Schema CHARACTER_SETS table.\n\nSee Setting Character Sets and Collations for details on specifying the character set at the server, database, table and column levels.\n\nExamples\n--------\n\nSHOW CHARACTER SET LIKE ''latin%'';\n+---------+-----------------------------+-------------------+--------+\n| Charset | Description                 | Default collation | Maxlen |\n+---------+-----------------------------+-------------------+--------+\n| latin1  | cp1252 West European        | latin1_swedish_ci |      1 |\n| latin2  | ISO 8859-2 Central European | latin2_general_ci |      1 |\n| latin5  | ISO 8859-9 Turkish          | latin5_turkish_ci |      1 |\n| latin7  | ISO 8859-13 Baltic          | latin7_general_ci |      1 |\n+---------+-----------------------------+-------------------+--------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-character-set', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-character-set');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (552, 26, 'SHOW CLIENT\\_STATISTICS', 'Syntax\n------\n\nSHOW CLIENT_STATISTICS\n\nDescription\n-----------\n\nThe SHOW CLIENT_STATISTICS statement has effectively been replaced by the generic SHOW TABLE STATISTICS statement. The information_schema.CLIENT_STATISTICS table holds statistics about client connections.\n\nThe SHOW CLIENT_STATISTICS statement is part of the User Statistics feature. The information_schema.CLIENT_STATISTICS table holds statistics about client connections.\n\nThe userstat system variable must be set to 1 to activate this feature. See the User Statistics and information_schema.CLIENT_STATISTICS articles for more information.\n\nExamples\n--------\n\nSHOW CLIENT_STATISTICS\\G\n************************ 1. row ************************\n                Client: localhost\n     Total_connections: 35\nConcurrent_connections: 0\n        Connected_time: 708\n             Busy_time: 2.5557979999999985\n              Cpu_time: 0.04123740000000002\n        Bytes_received: 3883\n            Bytes_sent: 21595\n  Binlog_bytes_written: 0\n             Rows_read: 18\n             Rows_sent: 115\n          Rows_deleted: 0\n         Rows_inserted: 0\n          Rows_updated: 0\n       Select_commands: 70\n       Update_commands: 0\n        Other_commands: 0\n   Commit_transactions: 1\n Rollback_transactions: 0\n    Denied_connections: 0\n      Lost_connections: 0\n         Access_denied: 0\n         Empty_queries: 35\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-client-statistics', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-client-statistics');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (553, 26, 'SHOW COLLATION', 'Syntax\n------\n\nSHOW COLLATION\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nThe output from SHOW COLLATION includes all available collations. The LIKE clause, if present on its own, indicates which collation names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nSimilar information, including some extra information, can be queried from the Information Schema COLLATIONS table.\n\nNo similar information or extra information can be queried from the Information Schema COLLATIONS table.\n\nSee Setting Character Sets and Collations for details on specifying the collation at the server, database, table and column levels.\n\nThe pad_attribute column (not shown in the examples below) has a value of NO PAD or PAD SPACE. This attribute affects whether trailing spaces are significant in string comparisons. See the INFORMATION_SCHEMA.COLLATIONS table description for more information.\n\n``sql\nSHOW COLLATION LIKE ''utf8mb4_bin''; \n+-------------+---------+------+---------+----------+---------+---------------+ \n| Collation   | Charset | Id   | Default | Compiled | Sortlen | Pad_attribute | \n+-------------+---------+------+---------+----------+---------+---------------+ \n| utf8mb4_bin | utf8mb4 | 46   |         | Yes      | 1       | PAD SPACE     | \n+-------------+---------+------+---------+----------+---------+---------------+\n`\n\nThe pad_attribute` column is not available.\n\nExamples\n--------\n\nSHOW COLLATION LIKE ''latin1%'';\n+-------------------------+---------+------+---------+----------+---------+\n| Collation               | Charset | Id   | Default | Compiled | Sortlen |\n+-------------------------+---------+------+---------+----------+---------+\n| latin1_german1_ci       | latin1  |    5 |         | Yes      |       1 |\n| latin1_swedish_ci       | latin1  |    8 | Yes     | Yes      |       1 |\n| latin1_danish_ci        | latin1  |   15 |         | Yes      |       1 |\n| latin1_german2_ci       | latin1  |   31 |         | Yes      |       2 |\n| latin1_bin              | latin1  |   47 |         | Yes      |       1 |\n| latin1_general_ci       | latin1  |   48 |         | Yes      |       1 |\n| latin1_general_cs       | latin1  |   49 |         | Yes      |       1 |\n| latin1_spanish_ci       | latin1  |   94 |         | Yes      |       1 |\n| latin1_swedish_nopad_ci | latin1  | 1032 |         | Yes      |       1 |\n| latin1_nopad_bin        | latin1  | 1071 |         | Yes      |       1 |\n+-------------------------+---------+------+---------+----------+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-collation', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-collation');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (554, 26, 'SHOW COLUMNS', 'Syntax\n------\n\nSHOW [FULL] {COLUMNS | FIELDS} FROM tbl_name [FROM db_name]\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nSHOW COLUMNS displays information about the columns in a given table. It also works for views. The LIKE clause, if present on its own, indicates which column names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nIf the data types differ from what you expect them to be based on aCREATE TABLE statement, note that MariaDB sometimes changes data types when you create or alter a table. The conditions under which this occurs are described in the Silent Column Changes article.\n\nThe FULL keyword causes the output to include the column collation and comments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to thetbl_name FROM db_name syntax. In other words, these two statements are equivalent:\n\n``sql\nSHOW COLUMNS FROM mytable FROM mydb;\nSHOW COLUMNS FROM mydb.mytable;\n`\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for non-binary string columns, or NULL for other columns. This value is displayed only if you use the FULL keyword.\n\nThe Null field contains YES if NULL values can be stored in the column, NO if not.\n\nThe Key field indicates whether the column is indexed:\n\n If Key is empty, the column either is not indexed or is indexed only as a secondary column in a multiple-column, non-unique index.\n If Key is PRI, the column is a PRIMARY KEY or is one of the columns in a multiple-column PRIMARY KEY.\n If Key is UNI, the column is the first column of a unique-valued index that cannot contain NULL values.\n If Key is MUL, multiple occurrences of a given value are allowed within the column. The column is the first column of a non-unique index or a unique-valued index that can contain NULL values.\n\nIf more than one of the Key values applies to a given column of a table, Key displays the one with the highest priority, in the order PRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values and there is noPRIMARY KEY in the table. A UNIQUE index may display as MUL if several columns form a compositeUNIQUE index; although the combination of the columns is unique, each column can still hold multiple occurrences of a given value.\n\nThe Default field indicates the default value that is assigned to the column.\n\nThe Extra field contains any additional information that is available about a given column.\n\n| Value                        | Description                                                                          |\n| ---------------------------- | ------------------------------------------------------------------------------------ |\n| AUTO_INCREMENT              | The column was created with the AUTO_INCREMENT keyword.                             |\n| PERSISTENT                   | The column was created with the PERSISTENT keyword.                                  |\n| VIRTUAL                      | The column was created with the VIRTUAL keyword.                                     |\n| on update CURRENT_TIMESTAMP | The column is a TIMESTAMP column that is automatically updated on INSERT and UPDATE. |\n\nPrivileges indicates the privileges you have for the column. This value is displayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed only if you use the FULL keyword.\n\nSHOW FIELDS is a synonym forSHOW COLUMNS. Also DESCRIBE and EXPLAIN can be used as shortcuts.\n\nYou can also list a table''s columns with:\n\n`\nmariadb-show db_name tbl_name\n`\n\nSee the mariadb-show command for more details.\n\nThe DESCRIBE statement provides information similar to SHOW COLUMNS`. The information_schema.COLUMNS table provides similar, but more complete, information.\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements also provide information about tables.\n\nExamples\n--------\n\nSHOW COLUMNS FROM city;\n+------------+----------+------+-----+---------+----------------+\n| Field      | Type     | Null | Key | Default | Extra          |\n+------------+----------+------+-----+---------+----------------+\n| Id         | int(11)  | NO   | PRI | NULL    | auto_increment |\n| Name       | char(35) | NO   |     |         |                |\n| Country    | char(3)  | NO   | UNI |         |                |\n| District   | char(20) | YES  | MUL |         |                |\n| Population | int(11)  | NO   |     | 0       |                |\n+------------+----------+------+-----+---------+----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-columns', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-columns');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (555, 26, 'SHOW CONTRIBUTORS', 'Syntax\n------\n\nSHOW CONTRIBUTORS\n\nDescription\n-----------\n\nThe SHOW CONTRIBUTORS statement displays information about the companies and people who financially contribute to MariaDB. For each contributor, it displays Name, Location, and Comment values. All columns are encoded as latin1.\n\nIt displays all members and sponsors of the MariaDB Foundation as well as other financial contributors.\n\nExamples\n--------\n\nSHOW CONTRIBUTORS;\n+---------------------+-------------------------------+-------------------------------------------------------------+\n| Name                | Location                      | Comment                                                     |\n+---------------------+-------------------------------+-------------------------------------------------------------+\n| Alibaba Cloud       | https://www.alibabacloud.com/ | Platinum Sponsor of the MariaDB Foundation                  |\n| Tencent Cloud       | https://cloud.tencent.com     | Platinum Sponsor of the MariaDB Foundation                  |\n| Microsoft           | https://microsoft.com/        | Platinum Sponsor of the MariaDB Foundation                  |\n| MariaDB Corporation | https://mariadb.com           | Founding member, Platinum Sponsor of the MariaDB Foundation |\n| ServiceNow          | https://servicenow.com        | Platinum Sponsor of the MariaDB Foundation                  |\n| Intel               | https://www.intel.com         | Platinum Sponsor of the MariaDB Foundation                  |\n| SIT                 | https://sit.org               | Platinum Sponsor of the MariaDB Foundation                  |\n| Visma               | https://visma.com             | Gold Sponsor of the MariaDB Foundation                      |\n| DBS                 | https://dbs.com               | Gold Sponsor of the MariaDB Foundation                      |\n| IBM                 | https://www.ibm.com           | Gold Sponsor of the MariaDB Foundation                      |\n| Automattic          | https://automattic.com        | Silver Sponsor of the MariaDB Foundation                    |\n| Percona             | https://www.percona.com/      | Sponsor of the MariaDB Foundation                           |\n| Galera Cluster      | https://galeracluster.com     | Sponsor of the MariaDB Foundation                           |\n| Google              | USA                           | Sponsoring encryption, parallel replication and GTID        |\n| Facebook            | USA                           | Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc        |\n| Ronald Bradford     | Brisbane, Australia           | EFF contribution for UC2006 Auction                         |\n| Sheeri Kritzer      | Boston, Mass. USA             | EFF contribution for UC2006 Auction                         |\n| Mark Shuttleworth   | London, UK.                   | EFF contribution for UC2006 Auction                         |\n+---------------------+-------------------------------+-------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-contributors', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-contributors');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (556, 26, 'SHOW CREATE DATABASE', 'Syntax\n------\n\nSHOW CREATE {DATABASE | SCHEMA} db_name\n\nDescription\n-----------\n\nShows the CREATE DATABASE statement that creates the given database. SHOW CREATE SCHEMA is a synonym for SHOW CREATE DATABASE. SHOW CREATE DATABASE quotes database names according to the value of the sql_quote_show_create server system variable.\n\nExamples\n--------\n\nSHOW CREATE DATABASE test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database                                                 |\n+----------+-----------------------------------------------------------------+\n| test     | CREATE DATABASE test /!40100 DEFAULT CHARACTER SET latin1 / |\n+----------+-----------------------------------------------------------------+\n\nSHOW CREATE SCHEMA test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database                                                 |\n+----------+-----------------------------------------------------------------+\n| test     | CREATE DATABASE test /!40100 DEFAULT CHARACTER SET latin1 / |\n+----------+-----------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-database', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-database');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (557, 26, 'SHOW CREATE EVENT', 'Syntax\n------\n\nSHOW CREATE EVENT event_name\n\nDescription\n-----------\n\nThis statement displays the CREATE EVENT statement that creates a given event, as well as the SQL_MODE that was used when the trigger was created, and the character set used by the connection. To find out which events are present, use SHOW EVENTS.\n\nSHOW CREATE EVENT quotes identifiers according to the value of the sql_quote_show_create system variable.\n\nSHOW CREATE EVENT quotes identifiers according to the value of the sql_quote_show_create system variable. Note, however, that the output of this statement is unreliably affected by the sql_quote_show_create system variable.\n\nThe information_schema.EVENTS table provides similar, but more complete, information.\n\nExamples\n--------\n\nSHOW CREATE EVENT test.e_daily\\G\n************************ 1. row ***********************\n               Event: e_daily\n            sql_mode: \n           time_zone: SYSTEM\n        Create Event: CREATE EVENT e_daily\n                        ON SCHEDULE EVERY 1 DAY\n                        STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR\n                        ON COMPLETION NOT PRESERVE\n                        ENABLE\n                        COMMENT ''Saves total number of sessions then\n                                clears the table each day''\n                        DO BEGIN\n                          INSERT INTO site_activity.totals (time, total)\n                            SELECT CURRENT_TIMESTAMP, COUNT() \n                            FROM site_activity.sessions;\n                          DELETE FROM site_activity.sessions;\n                        END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n  Database Collation: latin1_swedish_ci\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-event', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-event');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (558, 26, 'SHOW CREATE FUNCTION', 'Syntax\n------\n\nSHOW CREATE FUNCTION func_name\n\nDescription\n-----------\n\nThis statement is similar to SHOW CREATE PROCEDURE but for stored functions.\n\nSHOW CREATE FUNCTION quotes identifiers, according to the value of the sql_quote_show_create system variable.\n\nSHOW CREATE FUNCTION quotes identifiers, according to the value of the sql_quote_show_create system variable. However, the output of this statement is unreliably affected by the sql_quote_show_create system variable.\n\nExamples\n--------\n\nSHOW CREATE FUNCTION VatCents\\G\n************************ 1. row ***********************\n            Function: VatCents\n            sql_mode: \n     Create Function: CREATE DEFINER=root@localhost FUNCTION VatCents(price DECIMAL(10,2)) RETURNS int(11)\n    DETERMINISTIC\nBEGIN\n DECLARE x INT;\n SET x = price  114;\n RETURN x;\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n  Database Collation: latin1_swedish_ci\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-function', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-function');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (559, 26, 'SHOW CREATE PACKAGE BODY', 'Syntax\n------\n\nSHOW CREATE PACKAGE BODY  [ db_name . ] package_name\n\nDescription\n-----------\n\nThe SHOW CREATE PACKAGE BODY statement shows the CREATE PACKAGE BODY statement that creates the given package body (that is, the implementation of the package).\n\nThe SHOW CREATE PACKAGE BODY statement shows the CREATE PACKAGE BODY statement that creates the given package body (that is, the implementation of the package). CREATE PACKAGE BODY can be used when Oracle SQL_MODE is set.\n\nSHOW CREATE PACKAGE BODY quotes identifiers according to the value of the sql_quote_show_create system variable.\n\nExamples\n--------\n\nSHOW CREATE PACKAGE BODY employee_tools\\G\n************************ 1. row ************************\n        Package body: employee_tools\n            sql_mode: PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package Body: CREATE DEFINER="root"@"localhost" PACKAGE BODY "employee_tools" AS\n  \n  stdRaiseAmount DECIMAL(10,2):=500;\n  \n  PROCEDURE log (eid INT, ecmnt TEXT) AS\n  BEGIN\n    INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);\n  END;\n  \n  PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS\n    eid INT;\n  BEGIN\n    INSERT INTO employee (name, salary) VALUES (ename, esalary);\n    eid:= last_insert_id();\n    log(eid, ''hire '' || ename);\n  END;\n\n  FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2) AS\n    nSalary DECIMAL(10,2);\n  BEGIN\n    SELECT salary INTO nSalary FROM employee WHERE id=eid;\n    log(eid, ''getSalary id='' || eid || '' salary='' || nSalary);\n    RETURN nSalary;\n  END;\n\n  PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2)) AS\n  BEGIN\n    UPDATE employee SET salary=salary+amount WHERE id=eid;\n    log(eid, ''raiseSalary id='' || eid || '' amount='' || amount);\n  END;\n\n  PROCEDURE raiseSalaryStd(eid INT) AS\n  BEGIN\n    raiseSalary(eid, stdRaiseAmount);\n    log(eid, ''raiseSalaryStd id='' || eid);\n  END;\n\nBEGIN  \n  log(0, ''Session '' || connection_id() || '' '' || current_user || '' started'');\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n  Database Collation: latin1_swedish_ci\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-package-body', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-package-body');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (560, 26, 'SHOW CREATE PACKAGE', 'Syntax\n------\n\nSHOW CREATE PACKAGE  [ db_name . ] package_name\n\nDescription\n-----------\n\nThe SHOW CREATE PACKAGE statement can be used when Oracle SQL_MODE is set. It shows the CREATE statement that creates the given package specification.\n\nSHOW CREATE PACKAGE quotes identifiers according to the value of the sql_quote_show_create system variable.\n\nExamples\n--------\n\nSHOW CREATE PACKAGE employee_tools\\G\n************************ 1. row ************************\n             Package: employee_tools\n            sql_mode: PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n      Create Package: CREATE DEFINER="root"@"localhost" PACKAGE "employee_tools" AS\n  FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n  PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n  PROCEDURE raiseSalaryStd(eid INT);\n  PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n  Database Collation: latin1_swedish_ci\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-package', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-package');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (561, 26, 'SHOW CREATE PROCEDURE', 'Syntax\n------\n\nSHOW CREATE PROCEDURE proc_name\n\nDescription\n-----------\n\nThis statement is a MariaDB extension. It returns the exact string that can be used to re-create the named stored procedure, as well as the SQL_MODE that was used when the trigger has been created and the character set used by the connection.. A similar statement, SHOW CREATE FUNCTION, displays information about stored functions.\n\nBoth statements require that:\n\n you are the owner of the routine;\n you have the SHOW CREATE ROUTINE privilege (from MariaDB 11.3.0); or\n you have the SELECT privilege on the mysql.proc table.\n\nWhen none of the above statements are true, the statements display NULL for the Create Procedure or Create Function field.\n\nUsers with SELECT privileges on mysql.proc or USAGE privileges on . can view the text of routines, even when they do not have privileges for the function or procedure itself.\n\nSHOW CREATE PROCEDURE quotes identifiers, according to the value of the sql_quote_show_create system variable.\n\nSHOW CREATE PROCEDURE quotes identifiers, according to the value of the sql_quote_show_create system variable. The output of this statement is unreliably affected by the sql_quote_show_create system variable.\n\nExamples\n--------\n\nSHOW CREATE PROCEDURE test.simpleproc\\G\n*********************** 1. row ***********************\n           Procedure: simpleproc\n            sql_mode: \n    Create Procedure: CREATE PROCEDURE simpleproc(OUT param1 INT)\n                      BEGIN\n                      SELECT COUNT() INTO param1 FROM t;\n                      END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n  Database Collation: latin1_swedish_ci\n\nSHOW CREATE FUNCTION test.hello\\G\n************************ 1. row ************************\n            Function: hello\n            sql_mode:\n     Create Function: CREATE FUNCTION hello(s CHAR(20))\n                      RETURNS CHAR(50)\n                      RETURN CONCAT(''Hello, '',s,''!'')\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n  Database Collation: latin1_swedish_ci\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-procedure', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-procedure');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (562, 26, 'SHOW CREATE SEQUENCE', 'Syntax\n------\n\nSHOW CREATE SEQUENCE sequence_name;\n\nDescription\n-----------\n\nShows the CREATE SEQUENCE statement that creates the given sequence. The statement requires the SELECT privilege for the table.\n\nSHOW CREATE SEQUENCE quotes identifiers according to the value of the sql_quote_show_create system variable.\n\nExamples\n--------\n\nCREATE SEQUENCE s1 START WITH 50;\nSHOW CREATE SEQUENCE s1\\G;\n************************ 1. row ************************\n       Table: s1\nCreate Table: CREATE SEQUENCE s1 start with 50 minvalue 1 maxvalue 9223372036854775806 \n  increment by 1 cache 1000 nocycle ENGINE=InnoDB\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-sequence', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-sequence');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (563, 26, 'SHOW CREATE SERVER', 'Description\n-----------\n\nSyntax\n\n``sql\nSHOW CREATE SERVER server_name\n`\n\nDescription\n\nShows the CREATE SERVER statement that created the given server definition.\n\nExample\n\n`sql\nSHOW CREATE SERVER srv1\\G\n************************ 1. row ************************\n       Server: srv1\nCreate Server: CREATE SERVER srv1 FOREIGN DATA WRAPPER mysql \n  OPTIONS (HOST ''172.30.0.58'', DATABASE ''db1'', USER ''maxscale'', PASSWORD ''password'');\n`\n\nThe SHOW CREATE SERVER` statement is not available.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-server', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-server');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (564, 26, 'SHOW CREATE TABLE', 'Syntax\n------\n\nSHOW CREATE TABLE tbl_name\n\nDescription\n-----------\n\nShows the CREATE TABLE statement that creates the given table. The statement requires the SELECT privilege for the table. This statement also works with views and SEQUENCE.\n\nSHOW CREATE TABLE quotes table and column names according to the value of the sql_quote_show_create server system variable.\n\nCertain SQL_MODE values can result in parts of the original CREATE statement not being included in the output. MariaDB-specific table options, column options, and index options are not included in the output of this statement if the NO_TABLE_OPTIONS, NO_FIELD_OPTIONS and NO_KEY_OPTIONS SQL_MODE flags are used. All MariaDB-specific table attributes are also not shown when a non-MariaDB/MySQL emulation mode is used, which includes ANSI, DB2, POSTGRESQL, MSSQL, MAXDB or ORACLE.\n\nInvalid table options, column options and index options are normally commented out (note, that it is possible to create a table with invalid options, by altering a table of a different engine, where these options were valid). To have them uncommented, enable the IGNORE_BAD_TABLE_OPTIONS SQL_MODE. Remember that replaying a CREATE TABLE statement with uncommented invalid options will fail with an error, unless the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is in effect.\n\nNote that SHOW CREATE TABLE is not meant to provide metadata about a table. It provides information about how the table was declared, but the real table structure could differ a bit. For example, if an index has been declared as HASH, the CREATE TABLE statement returned by SHOW CREATE TABLE will declare that index as HASH; however, it is possible that the index is in fact a BTREE, because the storage engine does not support HASH.\n\nMariaDB permits TEXT and BLOB data types to be assigned a DEFAULT value. As a result, SHOW CREATE TABLE will append a DEFAULT NULL to nullable TEXT or BLOB fields if no specific default is provided.\n\nNumbers are quoted in the DEFAULT clause in SHOW CREATE statement.\n\nNumbers are not quoted in the DEFAULT clause in SHOW CREATE statement.\n\nIndex Order\n\nIndexes are sorted and displayed in the following order, which may differ from the order of the CREATE TABLE statement.\n\n PRIMARY KEY\n UNIQUE keys where all column are NOT NULL\n UNIQUE keys that don''t contain partial segments\n Other UNIQUE keys\n LONG UNIQUE keys\n Normal keys\n Fulltext keys\n\nSee sql/sql_table.cc for details.\n\nExamples\n--------\n\nSHOW CREATE TABLE t\\G\n*********************** 1. row ************************\n       Table: t\nCreate Table: CREATE TABLE t (\n  id int(11) NOT NULL AUTO_INCREMENT,\n  s char(60) DEFAULT NULL,\n  PRIMARY KEY (id)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-table', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-table');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (565, 26, 'SHOW CREATE TRIGGER', 'Syntax\n------\n\nSHOW CREATE TRIGGER trigger_name\n\nDescription\n-----------\n\nThis statement shows a CREATE TRIGGER statement that creates the given trigger, as well as the SQL_MODE that was used when the trigger has been created and the character set used by the connection.\n\nThe TRIGGER privilege is required on the table the trigger is defined for to execute this statement.\n\nSHOW CREATE TRIGGER quotes identifiers, according to the value of the sql_quote_show_create system variable.\n\nSHOW CREATE TRIGGER quotes identifiers, according to the value of the sql_quote_show_create system variable. However, the output of this statement is unreliably affected by the sql_quote_show_create system variable.\n\nExamples\n--------\n\nSHOW CREATE TRIGGER example\\G\n************************ 1. row ***********************\n               Trigger: example\n              sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,STRICT_ALL_TABLES\n,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_\nENGINE_SUBSTITUTION\nSQL Original Statement: CREATE DEFINER=root@localhost TRIGGER example BEFORE\n INSERT ON t FOR EACH ROW\nBEGIN\n        SET NEW.c = NEW.c  2;\nEND\n  character_set_client: cp850\n  collation_connection: cp850_general_ci\n  Database Collation: utf8_general_ci\n  Created: 2016-09-29 13:53:34.35\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-trigger', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-trigger');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (566, 26, 'SHOW CREATE USER', 'Syntax\n------\n\nSHOW CREATE USER [user-name]\n\nDescription\n-----------\n\nShows the CREATE USER statement that creates the given user. The statement requires the SELECT privilege for the mysql database, except for the current user. The CREATE USER statement for the current user is shown where no user is specified.\n\nSHOW CREATE USER quotes identifiers according to the value of the sql_quote_show_create system variable.\n\nExamples\n--------\n\nCREATE USER foo4@test require cipher ''text'' \n  issuer ''foo_issuer'' subject ''foo_subject'';\n\nSHOW CREATE USER foo4@test\\G\n************************ 1. row ************************\nCREATE USER ''foo4''@''test'' \n  REQUIRE ISSUER ''foo_issuer'' \n  SUBJECT ''foo_subject'' \n  CIPHER ''text''\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-user', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-user');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (567, 26, 'SHOW CREATE VIEW', 'Syntax\n------\n\nSHOW CREATE VIEW [view-name]\n\nDescription\n-----------\n\nThis statement shows a CREATE VIEW statement that creates the given view, as well as the character set used by the connection when the view was created. This statement also works with views.\n\nSHOW CREATE VIEW quotes table, column and stored function names according to the value of the sql_quote_show_create server system variable.\n\nExamples\n--------\n\nSHOW CREATE VIEW example\\G\n************************ 1. row ************************\n                View: example\n         Create View: CREATE ALGORITHM=UNDEFINED DEFINER=root@localhost SQL\nSECURITY DEFINER VIEW example AS (select t.id AS id,t.s AS s from\nt)\ncharacter_set_client: cp850\ncollation_connection: cp850_general_ci\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-view', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-view');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (568, 26, 'SHOW DATABASES', 'Syntax\n------\n\nSHOW {DATABASES | SCHEMAS}\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nSHOW DATABASES lists the databases on the MariaDB server host.SHOW SCHEMAS is a synonym forSHOW DATABASES. The LIKE clause, if present on its own, indicates which database names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nYou see only those databases for which you have some kind of privilege, unless you have the global SHOW DATABASES privilege. You can also get this list using the mariadb-show command.\n\nIf the server was started with the --skip-show-database option, you cannot use this statement at all unless you have the SHOW DATABASES privilege.\n\nThe list of results returned by SHOW DATABASES is based on directories in the data directory, which is how MariaDB implements databases. It''s possible that output includes directories that do not correspond to actual databases.\n\nThe Information Schema SCHEMATA table also contains database information.\n\nExamples\n--------\n\nSHOW DATABASES;\n+--------------------+\n| Database           |\n+--------------------+\n| information_schema |\n| mysql              |\n| performance_schema |\n| test               |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-databases', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-databases');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (569, 26, 'SHOW ENGINE INNODB STATUS', 'Description\n-----------\n\nSyntax\n\n``sql\nSHOW ENGINE INNODB STATUS\n`\n\nSHOW ENGINE INNODB STATUS is a specific form of the SHOW ENGINE statement that displays the InnoDB Monitor output, which is extensive InnoDB information which can be useful in diagnosing problems.\n\nThe following sections are displayed\n\n Status: Shows the timestamp, monitor name and the number of seconds, or the elapsed time between the current time and the time the InnoDB Monitor output was last displayed. The per-second averages are based upon this time.\n BACKGROUND THREAD: srv_master_thread lines show work performed by the main background thread.\n SEMAPHORES: Threads waiting for a semaphore and stats on how the number of times threads have needed a spin or a wait on a mutex or rw-lock semaphore. If this number of threads is large, there may be I/O or contention issues. Reducing the size of the innodb_thread_concurrency system variable may help if contention is related to thread scheduling. Spin rounds per wait shows the number of spinlock rounds per OS wait for a mutex.\n LATEST FOREIGN KEY ERROR: Only shown if there has been a foreign key constraint error, it displays the failed statement and information about the constraint and the related tables.\n LATEST DETECTED DEADLOCK: Only shown if there has been a deadlock, it displays the transactions involved in the deadlock and the statements being executed, held and required locked and the transaction rolled back to.\n TRANSACTIONS: The output of this section can help identify lock contention, as well as reasons for the deadlocks.\n FILE I/O: InnoDB thread information as well as pending I/O operations and I/O performance statistics.\n INSERT BUFFER AND ADAPTIVE HASH INDEX: InnoDB insert buffer (old name for the change buffer) and adaptive hash index status information, including the number of each type of operation performed, and adaptive hash index performance.\n LOG: InnoDB log information, including current log sequence number, how far the log has been flushed to disk, the position at which InnoDB last took a checkpoint, pending writes and write performance statistics.\n BUFFER POOL AND MEMORY: Information on buffer pool pages read and written, which allows you to see the number of data file I/O operations performed by your queries. See InnoDB Buffer Pool for more. Similar information is also available from the INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS table.\n* ROW OPERATIONS:Information about the main thread, including the number and performance rate for each type of row operation.\n\nIf the innodb_status_output_locks system variable is set to 1, extended lock information will be displayed.\n\nExample output:\n\n`sql\n=====================================\n2019-09-06 12:44:13 0x7f93cc236700 INNODB MONITOR OUTPUT\n=====================================\nPer second averages calculated from the last 4 seconds\n-----------------\nBACKGROUND THREAD\n-----------------\nsrv_master_thread loops: 2 srv_active, 0 srv_shutdown, 83698 srv_idle\nsrv_master_thread log flush and writes: 83682\n----------\nSEMAPHORES\n----------\nOS WAIT ARRAY INFO: reservation count 15\nOS WAIT ARRAY INFO: signal count 8\nRW-shared spins 0, rounds 20, OS waits 7\nRW-excl spins 0, rounds 0, OS waits 0\nRW-sx spins 0, rounds 0, OS waits 0\nSpin rounds per wait: 20.00 RW-shared, 0.00 RW-excl, 0.00 RW-sx\n------------\nTRANSACTIONS\n------------\nTrx id counter 236\nPurge done for trx''s n:o < 236 undo n:o < 0 state: running\nHistory list length 22\nLIST OF TRANSACTIONS FOR EACH SESSION:\n---TRANSACTION 421747401994584, not started\n0 lock struct(s), heap size 1136, 0 row lock(s)\n---TRANSACTION 421747401990328, not started\n0 lock struct(s), heap size 1136, 0 row lock(s)\n--------\nFILE I/O\n--------\nI/O thread 0 state: waiting for completed aio requests (insert buffer thread)\nI/O thread 1 state: waiting for completed aio requests (log thread)\nI/O thread 2 state: waiting for completed aio requests (read thread)\nI/O thread 3 state: waiting for completed aio requests (read thread)\nI/O thread 4 state: waiting for completed aio requests (read thread)\nI/O thread 5 state: waiting for completed aio requests (read thread)\nI/O thread 6 state: waiting for completed aio requests (write thread)\nI/O thread 7 state: waiting for completed aio requests (write thread)\nI/O thread 8 state: waiting for completed aio requests (write thread)\nI/O thread 9 state: waiting for completed aio requests (write thread)\nPending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,\n ibuf aio reads:, log i/o''s:, sync i/o''s:\nPending flushes (fsync) log: 0; buffer pool: 0\n286 OS file reads, 171 OS file writes, 22 OS fsyncs\n0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s\n-------------------------------------\nINSERT BUFFER AND ADAPTIVE HASH INDEX\n-------------------------------------\nIbuf: size 1, free list len 0, seg size 2, 0 merges\nmerged operations:\n insert 0, delete mark 0, delete 0\ndiscarded operations:\n insert 0, delete mark 0, delete 0\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\n0.00 hash searches/s, 0.00 non-hash searches/s\n---\nLOG\n---\nLog sequence number 445926\nLog flushed up to   445926\nPages flushed up to 445926\nLast checkpoint at  445917\n0 pending log flushes, 0 pending chkp writes\n18 log i/o''s done, 0.00 log i/o''s/second\n----------------------\nBUFFER POOL AND MEMORY\n----------------------\nTotal large memory allocated 167772160\nDictionary memory allocated 50768\nBuffer pool size   8012\nFree buffers       7611\nDatabase pages     401\nOld database pages 0\nModified db pages  0\nPercent of dirty pages(LRU & free pages): 0.000\nMax dirty pages percent: 75.000\nPending reads 0\nPending writes: LRU 0, flush list 0, single page 0\nPages made young 0, not young 0\n0.00 youngs/s, 0.00 non-youngs/s\nPages read 264, created 137, written 156\n0.00 reads/s, 0.00 creates/s, 0.00 writes/s\nNo buffer pool page gets since the last printout\nPages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s\nLRU len: 401, unzip_LRU len: 0\nI/O sum[0]:cur[0], unzip sum[0]:cur[0]\n--------------\nROW OPERATIONS\n--------------\n0 queries inside InnoDB, 0 queries in queue\n0 read views open inside InnoDB\nProcess ID=4267, Main thread ID=140272021272320, state: sleeping\nNumber of rows inserted 1, updated 0, deleted 0, read 1\n0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s\nNumber of system rows inserted 0, updated 0, deleted 0, read 0\n0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s\n----------------------------\nEND OF INNODB MONITOR OUTPUT\n============================\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-engine-innodb-status', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-engine-innodb-status');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (570, 26, 'SHOW ENGINE', 'Syntax\n------\n\nSHOW ENGINE [engine-name] {STATUS | MUTEX}\n\nDescription\n-----------\n\nSHOW ENGINE displays operational information about a storage engine. The following statements currently are supported:\n\n``sql\nSHOW ENGINE INNODB STATUS\nSHOW ENGINE INNODB MUTEX\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\nSHOW ENGINE ROCKSDB STATUS\n`\n\nIf the Sphinx Storage Engine is installed, the following is also supported:\n\n`sql\nSHOW ENGINE SPHINX STATUS\n`\n\nSHOW ENGINE INNODB STATUS\n\nSHOW ENGINE INNODB STATUS displays extensive information from the standard InnoDB Monitor about the state of the InnoDB storage engine. See SHOW ENGINE INNODB STATUS for more.\n\nSHOW ENGINE INNODB MUTEX\n\nSHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics.\n\nThe statement displays the following output fields:\n\n Type: Always InnoDB.\n Name: The source file where the mutex is implemented, and the line number in the file where the mutex is created. The line number is dependent on the MariaDB version.\n Status: This field displays the following values if UNIV_DEBUG was defined at compilation time (for example, in include/univ.h in the InnoDB part of the source tree). Only the os_waits value is displayed if UNIV_DEBUG was not defined. Without UNIV_DEBUG, the information on which the output is based is insufficient to distinguish regular mutexes and mutexes that protect rw-locks (which allow multiple readers or a single writer). Consequently, the output may appear to contain multiple rows for the same mutex.\n   count indicates how many times the mutex was requested.\n   spin_waits indicates how many times the spinlock had to run.\n   spin_rounds indicates the number of spinlock rounds. (spin_rounds divided by spin_waits provides the average round count.)\n   os_waits indicates the number of operating system waits. This occurs when the spinlock did not work (the mutex was not locked during the spinlock and it was necessary to yield to the operating system and wait).\n   os_yields indicates the number of times a the thread trying to lock a mutex gave up its timeslice and yielded to the operating system (on the presumption that allowing other threads to run will free the mutex so that it can be locked).\n   os_wait_times indicates the amount of time (in ms) spent in operating system waits, if the timed_mutexes system variable is 1 (ON). If timed_mutexes is 0 (OFF), timing is disabled, so os_wait_times is 0. timed_mutexes is off by default.\n\nInformation from this statement can be used to diagnose system problems. For example, large values of spin_waits and spin_rounds may indicate scalability problems.\n\nThe information_schema.INNODB_MUTEXES table provides similar information.\n\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n\nThis statement shows how much memory is used for performance_schema tables and internal buffers.\n\nThe output contains the following fields:\n\n Type: Always performance_schema.\n Name: The name of a table, the name of an internal buffer, or the performance_schema word, followed by a dot and an attribute. Internal buffers names are enclosed by parenthesis. performance_schema means that the attribute refers to the whole database (it is a total).\n Status: The value for the attribute.\n\nThe following attributes are shown, in this order, for all tables:\n\n row_size: The memory used for an individual record. This value will never change.\n row_count: The number of rows in the table or buffer. For some tables, this value depends on a server system variable.\n memory: For tables and performance_schema, this is the result of row_size \\ row_count`.\n\nFor internal buffers, the attributes are:\n\n count\n size\n\nSHOW ENGINE ROCKSDB STATUS\n\nSee also MyRocks Performance Troubleshooting\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-engine', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-engine');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (571, 26, 'SHOW ENGINES', 'Syntax\n------\n\nSHOW [STORAGE] ENGINES\n\nDescription\n-----------\n\nSHOW ENGINES displays status information about the server''s storage engines. This is particularly useful for checking whether a storage engine is supported, or to see what the default engine is.SHOW TABLE TYPES is a deprecated synonym.\n\nThe information_schema.ENGINES table provides the same information.\n\nSince storage engines are plugins, different information about them is also shown in the information_schema.PLUGINS table and by the SHOW PLUGINS statement.\n\nNote that both MySQL''s InnoDB and Percona''s XtraDB replacement are labeled as InnoDB. However, if XtraDB is in use, it will be specified in the COMMENT field. See XtraDB and InnoDB. The same applies to FederatedX.\n\nThe output consists of the following columns:\n\n Engine indicates the engine''s name.\n Support indicates whether the engine is installed, and whether it is the default engine for the current session.\n Comment is a brief description.\n Transactions, XA and Savepoints indicate whether transactions, XA transactions and transaction savepoints are supported by the engine.\n\nExamples\n--------\n\nSHOW ENGINES\\G\n************************ 1. row *********************\n      Engine: InnoDB\n     Support: DEFAULT\n     Comment: Supports transactions, row-level locking, and foreign keys\nTransactions: YES\n          XA: YES\n  Savepoints: YES\n********************* 2. row *********************\n      Engine: CSV\n     Support: YES\n     Comment: CSV storage engine\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n********************* 3. row *********************\n      Engine: MyISAM\n     Support: YES\n     Comment: MyISAM storage engine\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n********************* 4. row *********************\n      Engine: BLACKHOLE\n     Support: YES\n     Comment: /dev/null storage engine (anything you write to it disappears)\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n********************* 5. row *********************\n      Engine: FEDERATED\n     Support: YES\n     Comment: FederatedX pluggable storage engine\nTransactions: YES\n          XA: NO\n  Savepoints: YES\n********************* 6. row *********************\n      Engine: MRG_MyISAM\n     Support: YES\n     Comment: Collection of identical MyISAM tables\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n********************* 7. row *********************\n      Engine: ARCHIVE\n     Support: YES\n     Comment: Archive storage engine\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n********************* 8. row *********************\n      Engine: MEMORY\n     Support: YES\n     Comment: Hash based, stored in memory, useful for temporary tables\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n********************* 9. row *********************\n      Engine: PERFORMANCE_SCHEMA\n     Support: YES\n     Comment: Performance Schema\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n********************* 10. row ************************\n      Engine: Aria\n     Support: YES\n     Comment: Crash-safe tables with MyISAM heritage\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n10 rows in set (0.00 sec)\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-engines', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-engines');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (572, 26, 'SHOW ERRORS', 'Syntax\n------\n\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT() ERRORS\n\nDescription\n-----------\n\nThis statement is similar to SHOW WARNINGS, except that instead of displaying errors, warnings, and notes, it displays only errors.\n\nThe LIMIT clause has the same syntax as for the SELECT statement.\n\nThe SHOW COUNT() ERRORS statement displays the number of errors. You can also retrieve this number from the error_count variable.\n\n``sql\nSHOW COUNT() ERRORS;\nSELECT @@error_count;\n``\n\nThe value of error_count might be greater than the number of messages displayed by SHOW WARNINGS if the max_error_count system variable is set so low that not all messages are stored.\n\nFor a list of MariaDB error codes, see MariaDB Error Codes.\n\nExamples\n--------\n\nSELECT f();\nERROR 1305 (42000): FUNCTION f does not exist\n\nSHOW COUNT() ERRORS;\n+-----------------------+\n| @@session.error_count |\n+-----------------------+\n|                     1 |\n+-----------------------+\n\nSHOW ERRORS;\n+-------+------+---------------------------+\n| Level | Code | Message                   |\n+-------+------+---------------------------+\n| Error | 1305 | FUNCTION f does not exist |\n+-------+------+---------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-errors', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-errors');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (573, 26, 'SHOW EVENTS', 'Syntax\n------\n\nSHOW EVENTS [{FROM | IN} schema_name]\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nShows information about Event Manager events (created with CREATE EVENT). Requires the EVENT privilege. Without any arguments, SHOW EVENTS lists all of the events in the current schema:\n\n``sql\nSELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora    | myschema |\n+----------------+----------+\n\nSHOW EVENTS\\G\n************************ 1. row ************************\n                  Db: myschema\n                Name: e_daily\n             Definer: jon@ghidora\n           Time zone: SYSTEM\n                Type: RECURRING\n          Execute at: NULL\n      Interval value: 10\n      Interval field: SECOND\n              Starts: 2006-02-09 10:41:23\n                Ends: NULL\n              Status: ENABLED\n          Originator: 0\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n  Database Collation: latin1_swedish_ci\n`\n\nTo see the event action, use SHOW CREATE EVENT instead, or look at the information_schema.EVENTS table.\n\nTo see events for a specific schema, use the FROM clause. For example, to see events for the test schema, use the following statement:\n\n`sql\nSHOW EVENTS FROM test;\n`\n\nThe LIKE clause, if present, indicates which event names to match. The WHERE` clause can be given to select rows using more general conditions, as discussed in Extended Show.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-events', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-events');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (574, 26, 'SHOW EXPLAIN', 'Syntax\n------\n\nSHOW EXPLAIN [FORMAT=JSON] FOR <connection_id>;\nEXPLAIN [FORMAT=JSON] FOR CONNECTION <connection_id>;\n\nDescription\n-----------\n\nThe SHOW EXPLAIN command allows one to get an EXPLAIN (that is, a description of a query plan) of a query running in a certain connection.\n\n``sql\nSHOW EXPLAIN FOR <connection_id>;\n`\n\nwill produce an EXPLAIN output for the query that connection number connection_id is running. The connection id can be obtained with SHOW PROCESSLIST.\n\n`sql\nSHOW EXPLAIN FOR 1;\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| id   | select_type | table | type  | possible_keys | key  | key_len | ref  | rows    | Extra       |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n|    1 | SIMPLE      | tbl   | index | NULL          | a    | 5       | NULL | 1000107 | Using index |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n1 row in set, 1 warning (0.00 sec)\n`\n\nThe output is always accompanied with a warning which shows the query the target connection is running (this shows what the EXPLAIN is for):\n\n`sql\nSHOW WARNINGS;\n+-------+------+------------------------+\n| Level | Code | Message                |\n+-------+------+------------------------+\n| Note  | 1003 | select sum(a) from tbl |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\n`\n\nEXPLAIN FOR CONNECTION\n\nThe EXPLAIN FOR CONNECTION syntax was added for MySQL compatibility.\n\nFORMAT=JSON\n\nSHOW EXPLAIN [FORMAT=JSON] FOR <connection_id> extends SHOW EXPLAIN to return more detailed JSON output.\n\nEXPLAIN FOR CONNECTION and FORMAT=JSON are not available.\n\nPossible Errors\n\nThe output can be only produced if the target connection is _currently_ running a query, which has a ready query plan. If this is not the case, the output will be:\n\n`sql\nSHOW EXPLAIN FOR 2;\nERROR 1932 (HY000): Target is not running an EXPLAINable command\n`\n\nYou will get this error when:\n\n The target connection is not running a command for which one can run EXPLAIN;\n The target connection is running a command for which one can run EXPLAIN, but there is no query plan yet (for example, tables are open and locks are acquired before the query plan is produced).\n\nDifferences Between SHOW EXPLAIN and EXPLAIN Outputs\n\nBackground\n\nIn MySQL, EXPLAIN execution takes a slightly different route from the way the real query (typically the SELECT) is optimized. This is unfortunate, and has caused a number of bugs in EXPLAIN. (For example, see MDEV-326, MDEV-410, and lp:1013343.lp:992942 is not directly about EXPLAIN, but it also would not have existed if MySQL didn''t try to delete parts of a query plan in the middle of the query)\n\nSHOW EXPLAIN examines a running SELECT, and hence its output may be slightly different from what EXPLAIN SELECT would produce. We did our best to make sure that either the difference is negligible, or SHOW EXPLAIN''s output is closer to reality than EXPLAIN''s output.\n\nList of Recorded Differences\n\n SHOW EXPLAIN may have Extra=''no matching row in const table'', where EXPLAIN would produce Extra=''Impossible WHERE ...''\n For queries with subqueries, SHOW EXPLAIN may print select_type==PRIMARY where regular EXPLAIN used to print select_type==SIMPLE, or vice versa.\n\nRequired Permissions\n\nRunning SHOW EXPLAIN` requires the same permissions as running SHOW PROCESSLIST would.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-explain', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-explain');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (575, 26, 'SHOW FUNCTION CODE', 'Syntax\n------\n\nSHOW FUNCTION CODE func_name\n\nDescription\n-----------\n\nSHOW FUNCTION CODE shows a representation of the internal implementation of the stored function.\n\nIt is similar to SHOW PROCEDURE CODE but for stored functions.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-function-code', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-function-code');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (576, 26, 'SHOW FUNCTION STATUS', 'Syntax\n------\n\nSHOW FUNCTION STATUS\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nThis statement is similar to SHOW PROCEDURE STATUS but for stored functions.\n\nThe LIKE clause, if present on its own, indicates which function names to match.\n\nThe WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nThe information_schema.ROUTINES table contains more detailed information.\n\nExamples\n--------\n\nSHOW FUNCTION STATUS\\G\n************************ 1. row ************************\n                  Db: test\n                Name: VatCents\n                Type: FUNCTION\n             Definer: root@localhost\n            Modified: 2013-06-01 12:40:31\n             Created: 2013-06-01 12:40:31\n       Security_type: DEFINER\n             Comment: \ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n  Database Collation: latin1_swedish_ci\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-function-status', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-function-status');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (577, 26, 'SHOW GRANTS', 'Syntax\n------\n\nSHOW GRANTS [FOR user|role]\n\nDescription\n-----------\n\nThe SHOW GRANTS statement lists privileges granted to a particular user or role.\n\nUsers\n\nThe statement lists the GRANT statement or statements that must be issued to duplicate the privileges that are granted to a MariaDB user account. The account is named using the same format as for theGRANT statement; for example, ''jeffrey''@''localhost''. If you specify only the user name part of the account name, a host name part of ''%'' is used. For additional information about specifying account names, see GRANT.\n\n``sql\nSHOW GRANTS FOR ''root''@''localhost'';\n+---------------------------------------------------------------------+\n| Grants for root@localhost                                           |\n+---------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON . TO ''root''@''localhost'' WITH GRANT OPTION |\n+---------------------------------------------------------------------+\n`\n\nTo list the privileges granted to the account that you are using to connect to the server, you can use any of the following statements:\n\n`sql\nSHOW GRANTS;\nSHOW GRANTS FOR CURRENT_USER;\nSHOW GRANTS FOR CURRENT_USER();\n`\n\nIf SHOW GRANTS FOR CURRENT_USER (or any of the equivalent syntaxes) is used in DEFINER context (such as within a stored procedure that is defined withSQL SECURITY DEFINER), the grants displayed are those of the definer and not the invoker.\n\nRoles\n\nSHOW GRANTS can also be used to view the privileges granted to a role.\n\nExamples\n--------\n\nSHOW GRANTS FOR journalist;\n+------------------------------------------+\n| Grants for journalist                    |\n+------------------------------------------+\n| GRANT USAGE ON . TO ''journalist''       |\n| GRANT DELETE ON test`.* TO ''journalist'' |\n+------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-grants', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-grants');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (578, 26, 'SHOW INDEX\\_STATISTICS', 'Syntax\n------\n\nSHOW INDEX_STATISTICS\n\nDescription\n-----------\n\nThe information_schema.INDEX_STATISTICS table shows statistics on index usage and makes it possible to do such things as locating unused indexes and generating the commands to remove them.\n\nSHOW INDEX_STATISTICS is replaced by the generic SHOW TABLE STATISTICS statement.\n\nThe SHOW INDEX_STATISTICS statement was introduced in MariaDB 5.2 as part of the User Statistics feature. It was removed as a separate statement in MariaDB 10.1.1, but effectively replaced by the generic SHOW TABLE STATISTICS statement.\n\nThe userstat system variable must be set to 1 to activate this feature. See the User Statistics and information_schema.INDEX_STATISTICS table for more information.\n\nExamples\n--------\n\nSHOW INDEX_STATISTICS;\n+--------------+-------------------+------------+-----------+\n| Table_schema | Table_name        | Index_name | Rows_read |\n+--------------+-------------------+------------+-----------+\n| test         | employees_example | PRIMARY    |         1 |\n+--------------+-------------------+------------+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-index-statistics', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-index-statistics');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (579, 26, 'SHOW INDEX', 'Syntax\n------\n\nSHOW {INDEX | INDEXES | KEYS} \n FROM tbl_name [FROM db_name]\n [WHERE expr]\n\nDescription\n-----------\n\nSHOW INDEX returns table index information. The format resembles that of the SQLStatistics call in ODBC.\n\nYou can use db_name.tbl_name as an alternative to thetbl_name FROM db_name syntax. These two statements are equivalent:\n\n``sql\nSHOW INDEX FROM mytable FROM mydb;\nSHOW INDEX FROM mydb.mytable;\n`\n\nSHOW KEYS and SHOW INDEXES are synonyms for SHOW INDEX.\n\nYou can also list a table''s indexes with the mariadb-show command:\n\n`sql\nmariadb-show -k db_name tbl_name\n`\n\nThe information_schema.STATISTICS table stores similar information.\n\nThe following fields are returned by SHOW INDEX.\n\n| Field          | Description                                                                                                                                                                                                                                                                              |\n| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Table          | Table name                                                                                                                                                                                                                                                                               |\n| Non_unique    | 1 if the index permits duplicate values, 0 if values must be unique.                                                                                                                                                                                                                     |\n| Key_name      | Index name. The primary key is always named PRIMARY.                                                                                                                                                                                                                                     |\n| Seq_in_index | The column''s sequence in the index, beginning with 1.                                                                                                                                                                                                                                    |\n| Column_name   | Column name.                                                                                                                                                                                                                                                                             |\n| Collation      | Either A, if the column is sorted in ascending order in the index, or NULL if it''s not sorted.                                                                                                                                                                                           |\n| Cardinality    | Estimated number of unique values in the index. The cardinality statistics are calculated at various times, and can help the optimizer make improved decisions.                                                                                                                          |\n| Sub_part      | NULL if the entire column is included in the index, or the number of included characters if not.                                                                                                                                                                                         |\n| Packed         | NULL if the index is not packed, otherwise how the index is packed.                                                                                                                                                                                                                      |\n| Null           | NULL if NULL values are permitted in the column, an empty string if NULLs are not permitted.                                                                                                                                                                                             |\n| Index_type    | The index type, which can be BTREE, FULLTEXT, HASH or RTREE. See Storage Engine Index Types.                                                                            |\n| Comment        | Other information, such as whether the index is disabled.                                                                                                                                                                                                                                |\n| Index_comment | Contents of the COMMENT attribute when the index was created.                                                                                                                                                                                                                            |\n| Ignored        | Whether or not an index will be ignored by the optimizer. See Ignored Indexes. From MariaDB 10.6.0. |\n\nThe WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nExamples\n--------\n\nCREATE TABLE IF NOT EXISTS employees_example (\n  id INT(11) NOT NULL AUTO_INCREMENT,\n  first_name VARCHAR(30) NOT NULL,\n  last_name VARCHAR(40) NOT NULL,\n  position VARCHAR(25) NOT NULL,\n  home_address VARCHAR(50) NOT NULL,\n  home_phone VARCHAR(12) NOT NULL,\n  employee_code VARCHAR(25) NOT NULL,\n  PRIMARY KEY (id),\n  UNIQUE KEY employee_code (employee_code),\n  KEY first_name (first_name,last_name)\n) ENGINE=Aria;\n\nINSERT INTO employees_example (first_name, last_name, position, home_address, home_phone, employee_code`)\n  VALUES\n  (''Mustapha'', ''Mond'', ''Chief Executive Officer'', ''692 Promiscuous Plaza'', ''326-555-3492'', ''MM1''),\n  (''Henry'', ''Foster'', ''Store Manager'', ''314 Savage Circle'', ''326-555-3847'', ''HF1''),\n  (''Bernard'', ''Marx'', ''Cashier'', ''1240 Ambient Avenue'', ''326-555-8456'', ''BM1''),\n  (''Lenina'', ''Crowne'', ''Cashier'', ''281 Bumblepuppy Boulevard'', ''328-555-2349'', ''LC1''),\n  (''Fanny'', ''Crowne'', ''Restocker'', ''1023 Bokanovsky Lane'', ''326-555-6329'', ''FC1''),\n  (''Helmholtz'', ''Watson'', ''Janitor'', ''944 Soma Court'', ''329-555-2478'', ''HW1'');\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-index', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-index');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (580, 26, 'SHOW INNODB STATUS (removed)', 'Syntax\n------\n\nSHOW INNODB STATUS\n\nDescription\n-----------\n\nThis is a deprecated synonym for SHOW ENGINE INNODB STATUS. It was removed in MariaDB and MySQL 5.5.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-innodb-status-removed', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-innodb-status-removed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (581, 26, 'SHOW LOCALES', 'Syntax\n------\n\nSHOW LOCALES\n\nDescription\n-----------\n\nSHOW LOCALES was introduced as part of the Information Schema plugin extension.\n\nSHOW LOCALES is used to return locales information as part of the Locales plugin. It requires this plugin to be installed to work.\n\nWhile the information_schema.LOCALES table has 8 columns, the SHOW LOCALES statement will only display 4 of them:\n\nExamples\n--------\n\nSHOW LOCALES;\n+-----+-------+-------------------------------------+------------------------+\n| Id  | Name  | Description                         | Error_Message_Language |\n+-----+-------+-------------------------------------+------------------------+\n|   0 | en_US | English - United States             | english                |\n|   1 | en_GB | English - United Kingdom            | english                |\n|   2 | ja_JP | Japanese - Japan                    | japanese               |\n|   3 | sv_SE | Swedish - Sweden                    | swedish                |\n...\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-locales', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-locales');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (582, 26, 'SHOW OPEN TABLES', 'Syntax\n------\n\nSHOW OPEN TABLES [FROM db_name]\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nSHOW OPEN TABLES lists the non-TEMPORARY tables that are currently open in the table cache. See table-cache.html.\n\nThe FROM and LIKE clauses may be used.\n\nThe FROM clause, if present, restricts the tables shown to those present in thedb_name database.\n\nThe LIKE clause, if present on its own, indicates which table names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nThe following information is returned:\n\n| Column       | Description                                                                         |\n| ------------ | ----------------------------------------------------------------------------------- |\n| Database     | Database name.                                                                      |\n| Name         | Table name.                                                                         |\n| In_use      | Number of table instances being used.                                               |\n| Name_locked | 1 if the table is name-locked, e.g. if it is being dropped or renamed, otherwise 0. |\n\nLOCK TABLE... WRITE acquires a strong MDL lock, and concurrent connections will wait on this MDL lock, so any subsequent LOCK TABLE... WRITE will not increment In_use.\n\nBefore MariaDB 5.5, each use of, for example, LOCK TABLE ... WRITE would increment In_use for that table. With the implementation of the metadata locking improvements in MariaDB 5.5, LOCK TABLE... WRITE acquires a strong MDL lock, and concurrent connections will wait on this MDL lock, so any subsequent LOCK TABLE... WRITE will not increment In_use.\n\nExamples\n--------\n\nSHOW OPEN TABLES;\n+----------+---------------------------+--------+-------------+\n| Database | Table                     | In_use | Name_locked |\n+----------+---------------------------+--------+-------------+\n...\n| test     | xjson                     |      0 |           0 |\n| test     | jauthor                   |      0 |           0 |\n| test     | locks                     |      1 |           0 |\n...\n+----------+---------------------------+--------+-------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-open-tables', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-open-tables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (583, 26, 'SHOW PACKAGE BODY STATUS', 'Syntax\n------\n\nSHOW PACKAGE BODY STATUS\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nThe SHOW PACKAGE BODY STATUS statement returns characteristics of stored package bodies (implementations), such as the database, name, type, creator, creation and modification dates, and character set information. A similar statement, SHOW PACKAGE STATUS, displays information about stored package specifications.\n\nThe LIKE clause, if present, indicates which package names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nThe ROUTINES table in the INFORMATION_SCHEMA database contains more detailed information.\n\nExamples\n--------\n\nSHOW PACKAGE BODY STATUS LIKE ''pkg1''\\G\n************************ 1. row ************************\n                  Db: test\n                Name: pkg1\n                Type: PACKAGE BODY\n             Definer: root@localhost\n            Modified: 2018-02-27 14:44:14\n             Created: 2018-02-27 14:44:14\n       Security_type: DEFINER\n             Comment: This is my first package body\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n  Database Collation: latin1_swedish_ci\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-package-body-status', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-package-body-status');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (584, 26, 'SHOW PACKAGE STATUS', 'Syntax\n------\n\nSHOW PACKAGE STATUS\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nThe SHOW PACKAGE STATUS statement returns characteristics of stored package specifications, such as the database, name, type, creator, creation and modification dates, and character set information. A similar statement, SHOW PACKAGE BODY STATUS, displays information about stored package bodies (i.e. implementations).\n\nThe LIKE clause, if present, indicates which package names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nThe ROUTINES table in the INFORMATION_SCHEMA database contains more detailed information.\n\nExamples\n--------\n\nSHOW PACKAGE STATUS LIKE ''pkg1''\\G\n************************ 1. row ************************\n                  Db: test\n                Name: pkg1\n                Type: PACKAGE\n             Definer: root@localhost\n            Modified: 2018-02-27 14:38:15\n             Created: 2018-02-27 14:38:15\n       Security_type: DEFINER\n             Comment: This is my first package\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n  Database Collation: latin1_swedish_ci\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-package-status', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-package-status');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (585, 5, 'SHOW PLUGINS SONAME', 'Syntax\n------\n\nSHOW PLUGINS SONAME { library | LIKE ''pattern'' | WHERE expr };\n\nDescription\n-----------\n\nSHOW PLUGINS SONAME displays information about compiled-in and all server plugins in the plugin_dir directory, including plugins that haven''t been installed.\n\nExamples\n--------\n\nSHOW PLUGINS SONAME ''ha_example.so'';\n+----------+---------------+----------------+---------------+---------+\n| Name     | Status        | Type           | Library       | License |\n+----------+---------------+----------------+---------------+---------+\n| EXAMPLE  | NOT INSTALLED | STORAGE ENGINE | ha_example.so | GPL     |\n| UNUSABLE | NOT INSTALLED | DAEMON         | ha_example.so | GPL     |\n+----------+---------------+----------------+---------------+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-plugins-soname', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-plugins-soname');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (586, 5, 'SHOW PLUGINS', 'Syntax\n------\n\nSHOW PLUGINS;\n\nDescription\n-----------\n\nSHOW PLUGINS displays information about installed plugins. The Library column indicates the plugin library - if it is NULL, the plugin is built-in and cannot be uninstalled.\n\nThe PLUGINS table in the information_schema database contains more detailed information.\n\nFor specific information about storage engines (a particular type of plugin), see the information_schema.ENGINES table and the SHOW ENGINES statement.\n\nExamples\n--------\n\nSHOW PLUGINS;\n+----------------------------+----------+--------------------+-------------+---------+\n| Name                       | Status   | Type               | Library     | License |\n+----------------------------+----------+--------------------+-------------+---------+\n| binlog                     | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| mysql_native_password      | ACTIVE   | AUTHENTICATION     | NULL        | GPL     |\n| mysql_old_password         | ACTIVE   | AUTHENTICATION     | NULL        | GPL     |\n| MRG_MyISAM                 | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| MyISAM                     | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| CSV                        | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| MEMORY                     | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| FEDERATED                  | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| PERFORMANCE_SCHEMA         | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| Aria                       | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| InnoDB                     | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| INNODB_TRX                 | ACTIVE   | INFORMATION SCHEMA | NULL        | GPL     |\n...\n| INNODB_SYS_FOREIGN         | ACTIVE   | INFORMATION SCHEMA | NULL        | GPL     |\n| INNODB_SYS_FOREIGN_COLS    | ACTIVE   | INFORMATION SCHEMA | NULL        | GPL     |\n| SPHINX                     | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| ARCHIVE                    | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| BLACKHOLE                  | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| FEEDBACK                   | DISABLED | INFORMATION SCHEMA | NULL        | GPL     |\n| partition                  | ACTIVE   | STORAGE ENGINE     | NULL        | GPL     |\n| pam                        | ACTIVE   | AUTHENTICATION     | auth_pam.so | GPL     |\n+----------------------------+----------+--------------------+-------------+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-plugins', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-plugins');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (587, 26, 'SHOW PRIVILEGES', 'Syntax\n------\n\nSHOW PRIVILEGES\n\nDescription\n-----------\n\nSHOW PRIVILEGES shows the list of system privileges that the MariaDB server supports. The exact list of privileges depends on the version of your server.\n\nSHOW PRIVILEGES shows the list of system privileges that the MariaDB server supports. The exact list of privileges depends on the version of your server.\n\nNote that before MariaDB 10.3.23, MariaDB 10.4.13 and MariaDB 10.5.2 , the Delete history privilege displays as Delete versioning rows (MDEV-20382).\n\nExamples\n--------\n\nSHOW PRIVILEGES;\n+--------------------------+---------------------------------------+--------------------------------------------------------------------+\n| Privilege                | Context                               | Comment                                                            |\n+--------------------------+---------------------------------------+--------------------------------------------------------------------+\n| Alter                    | Tables                                | To alter the table                                                 |\n| Alter routine            | Functions,Procedures                  | To alter or drop stored functions/procedures                       |\n| Create                   | Databases,Tables,Indexes              | To create new databases and tables                                 |\n| Create routine           | Databases                             | To use CREATE FUNCTION/PROCEDURE                                   |\n| Create temporary tables  | Databases                             | To use CREATE TEMPORARY TABLE                                      |\n| Create view              | Tables                                | To create new views                                                |\n| Create user              | Server Admin                          | To create new users                                                |\n| Delete                   | Tables                                | To delete existing rows                                            |\n| Delete history           | Tables                                | To delete versioning table historical rows                         |\n| Drop                     | Databases,Tables                      | To drop databases, tables, and views                               |\n| Event                    | Server Admin                          | To create, alter, drop and execute events                          |\n| Execute                  | Functions,Procedures                  | To execute stored routines                                         |\n| File                     | File access on server                 | To read and write files on the server                              |\n| Grant option             | Databases,Tables,Functions,Procedures | To give to other users those privileges you possess                |\n| Index                    | Tables                                | To create or drop indexes                                          |\n| Insert                   | Tables                                | To insert data into tables                                         |\n| Lock tables              | Databases                             | To use LOCK TABLES (together with SELECT privilege)                |\n| Process                  | Server Admin                          | To view the plain text of currently executing queries              |\n| Proxy                    | Server Admin                          | To make proxy user possible                                        |\n| References               | Databases,Tables                      | To have references on tables                                       |\n| Reload                   | Server Admin                          | To reload or refresh tables, logs and privileges                   |\n| Binlog admin             | Server                                | To purge binary logs                                               |\n| Binlog monitor           | Server                                | To use SHOW BINLOG STATUS and SHOW BINARY LOG                      |\n| Binlog replay            | Server                                | To use BINLOG (generated by mariadb-binlog)                        |\n| Replication master admin | Server                                | To monitor connected slaves                                        |\n| Replication slave admin  | Server                                | To start/stop slave and apply binlog events                        |\n| Slave monitor            | Server                                | To use SHOW SLAVE STATUS and SHOW RELAYLOG EVENTS                  |\n| Replication slave        | Server Admin                          | To read binary log events from the master                          |\n| Select                   | Tables                                | To retrieve rows from table                                        |\n| Show databases           | Server Admin                          | To see all databases with SHOW DATABASES                           |\n| Show view                | Tables                                | To see views with SHOW CREATE VIEW                                 |\n| Shutdown                 | Server Admin                          | To shut down the server                                            |\n| Super                    | Server Admin                          | To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.                |\n| Trigger                  | Tables                                | To use triggers                                                    |\n| Create tablespace        | Server Admin                          | To create/alter/drop tablespaces                                   |\n| Update                   | Tables                                | To update existing rows                                            |\n| Set user                 | Server                                | To create views and stored routines with a different definer       |\n| Federated admin          | Server                                | To execute the CREATE SERVER, ALTER SERVER, DROP SERVER statements |\n| Connection admin         | Server                                | To bypass connection limits and kill other users'' connections      |\n| Read_only admin          | Server                                | To perform write operations even if @@read_only=ON                 |\n| Usage                    | Server Admin                          | No privileges - allow connect only                                 |\n+--------------------------+---------------------------------------+--------------------------------------------------------------------+\n41 rows in set (0.000 sec)\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-privileges', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-privileges');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (588, 26, 'SHOW PROCEDURE CODE', 'Syntax\n------\n\nSHOW PROCEDURE CODE proc_name\n\nDescription\n-----------\n\nThis statement is a MariaDB extension that is available only for servers that have been built with debugging support. It displays a representation of the internal implementation of the named stored procedure. A similar statement, SHOW FUNCTION CODE, displays information about stored functions.\n\nBoth statements require that you be the owner of the routine or have SELECT access to the mysql.proc table.\n\nIf the named routine is available, each statement produces a result set. Each row in the result set corresponds to one "instruction" in the routine. The first column is Pos, which is an ordinal number beginning with 0. The second column is Instruction, which contains an SQL statement (usually changed from the original source), or a directive which has meaning only to the stored-routine handler.\n\nExamples\n--------\n\nDELIMITER //\n\nCREATE PROCEDURE p1 ()\n  BEGIN\n    DECLARE fanta INT DEFAULT 55;\n    DROP TABLE t2;\n    LOOP\n      INSERT INTO t3 VALUES (fanta);\n      END LOOP;\n  END//\nQuery OK, 0 rows affected (0.00 sec)\n\nSHOW PROCEDURE CODE p1//\n+-----+----------------------------------------+\n| Pos | Instruction                            |\n+-----+----------------------------------------+\n|   0 | set fanta@0 55                         |\n|   1 | stmt 9 "DROP TABLE t2"                 |\n|   2 | stmt 5 "INSERT INTO t3 VALUES (fanta)" |\n|   3 | jump 2                                 |\n+-----+----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-procedure-code', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-procedure-code');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (589, 26, 'SHOW PROCEDURE STATUS', 'Syntax\n------\n\nSHOW PROCEDURE STATUS\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nThis statement is a MariaDB extension. It returns characteristics of a stored procedure, such as the database, name, type, creator, creation and modification dates, and character set information. A similar statement, SHOW FUNCTION STATUS, displays information about stored functions.\n\nThe LIKE clause, if present, indicates which procedure or function names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nThe ROUTINES table in the INFORMATION_SCHEMA database contains more detailed information.\n\nExamples\n--------\n\nSHOW PROCEDURE STATUS LIKE ''p1''\\G\n************************ 1. row ************************\n                  Db: test\n                Name: p1\n                Type: PROCEDURE\n             Definer: root@localhost\n            Modified: 2010-08-23 13:23:03\n             Created: 2010-08-23 13:23:03\n       Security_type: DEFINER\n             Comment: \ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n  Database Collation: latin1_swedish_ci\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-procedure-status', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-procedure-status');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (590, 26, 'SHOW PROCESSLIST', 'Syntax\n------\n\nSHOW [FULL] PROCESSLIST\n\nDescription\n-----------\n\nSHOW PROCESSLIST shows which threads are running. You can also get this information from the information_schema.PROCESSLIST table or the mariadb-admin processlist command. If you have the PROCESS privilege, you can see all threads. Otherwise, you can see only your own threads (that is, threads associated with the MariaDB account that you are using). If you do not use the FULL keyword, only the first 100 characters of each statement are shown in the Info field.\n\nThe columns shown in SHOW PROCESSLIST are:\n\n| Name     | Description                                                                                                                                                |\n| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Id       | The client''s thread ID.                                                                                                                                    |\n| User     | The username associated with the process.                                                                                                                  |\n| Host     | The host the client is connected to.                                                                                                                       |\n| db       | The default database of the process (NULL if no default).                                                                                                |\n| Command  | The command type. See Thread Command Values. |\n| Time     | The amount of time, in seconds, the process has been in its current state.                                                                                 |\n| State    | See Thread States.                                     |\n| Info     | The statement being executed.                                                                                                                              |\n| Progress | The total progress of the process (0-100%) (see Progress Reporting).                                                                |\n\nThe information_schema.PROCESSLIST table contains a number of additional columns. See TIME_MS column in information_schema.PROCESSLIST for differences in the TIME column between MariaDB and MySQL.\n\nNote that the PROGRESS field from the information schema, and the PROGRESS field from SHOW PROCESSLIST display different results. SHOW PROCESSLIST shows the total progress, while the information schema shows the progress for the current stage only.\n\nThreads can be killed using their thread_id or their query_id, with the KILL statement.\n\nSince queries on this table are locking, if the performance_schema is enabled, you may want to query the THREADS table instead.\n\nExamples\n--------\n\nSHOW PROCESSLIST;\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n| Id | User            | Host      | db   | Command | Time | State                  | Info             | Progress |\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n|  2 | event_scheduler | localhost | NULL | Daemon  | 2693 | Waiting on empty queue | NULL             |    0.000 |\n|  4 | root            | localhost | NULL | Query   |    0 | Table lock             | SHOW PROCESSLIST |    0.000 |\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-processlist', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-processlist');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (591, 26, 'SHOW PROFILE', 'Syntax\n------\n\nSHOW PROFILE [type [, type] ... ]\n    [FOR QUERY n]\n    [LIMIT row_count [OFFSET offset]]\n\ntype:\n    ALL\n  | BLOCK IO\n  | CONTEXT SWITCHES\n  | CPU\n  | IPC\n  | MEMORY\n  | PAGE FAULTS\n  | SOURCE\n  | SWAPS\n\nDescription\n-----------\n\nThe SHOW PROFILE and SHOW PROFILES statements display profiling information that indicates resource usage for statements executed during the course of the current session.\n\nProfiling is controlled by the profiling session variable, which has a default value of 0 (OFF). Profiling is enabled by setting profiling to 1 or ON:\n\n``sql\nSET profiling = 1;\n`\n\nSHOW PROFILES displays a list of the most recent statements sent to the master. The size of the list is controlled by the profiling_history_size session variable, which has a default value of 15. The maximum value is 100. Setting the value to 0 has the practical effect of disabling profiling.\n\nAll statements are profiled except SHOW PROFILES andSHOW PROFILE, so you will find neither of those statements in the profile list. Malformed statements are profiled. For example,SHOW PROFILING is an illegal statement, and a syntax error occurs if you try to execute it, but it will show up in the profiling list.\n\nSHOW PROFILE displays detailed information about a single statement. Without the FOR QUERY n clause, the output pertains to the most recently executed statement. IfFOR QUERY n is included,SHOW PROFILE displays information for statement _n_. The values of _n_ correspond to the Query_ID values displayed by SHOW PROFILES.\n\nThe LIMIT row_count clause may be given to limit the output to _row_count_ rows. If LIMIT is given,OFFSET offset may be added to begin the output offset rows into the full set of rows.\n\nBy default, SHOW PROFILE displays Status and Duration columns. The Status values are like the State values displayed by SHOW PROCESSLIST (see General Thread States), although there might be some minor differences in interpretation for the two statements for some status values.\n\nOptional type values may be specified to display specific additional types of information:\n\n ALL displays all information\n BLOCK IO displays counts for block input and output operations\n CONTEXT SWITCHES displays counts for voluntary and involuntary context switches\n CPU displays user and system CPU usage times\n IPC displays counts for messages sent and received\n MEMORY is not currently implemented\n PAGE FAULTS displays counts for major and minor page faults\n SOURCE displays the names of functions from the source code, together with the name and line number of the file in which the function occurs\n* SWAPS` displays swap counts\n\nProfiling is enabled per session. When a session ends, its profiling information is lost.\n\nThe information_schema.PROFILING table contains similar information.\n\nExamples\n--------\n\nSELECT @@profiling;\n+-------------+\n| @@profiling |\n+-------------+\n|           0 |\n+-------------+\n\nSET profiling = 1;\n\nUSE test;\n\nDROP TABLE IF EXISTS t1;\n\nCREATE TABLE T1 (id INT);\n\nSHOW PROFILES;\n+----------+------------+--------------------------+\n| Query_ID | Duration   | Query                    |\n+----------+------------+--------------------------+\n|        1 | 0.00009200 | SELECT DATABASE()        |\n|        2 | 0.00023800 | show databases           |\n|        3 | 0.00018900 | show tables              |\n|        4 | 0.00014700 | DROP TABLE IF EXISTS t1  |\n|        5 | 0.24476900 | CREATE TABLE T1 (id INT) |\n+----------+------------+--------------------------+\n\nSHOW PROFILE;\n+----------------------+----------+\n| Status               | Duration |\n+----------------------+----------+\n| starting             | 0.000042 |\n| checking permissions | 0.000044 |\n| creating table       | 0.244645 |\n| After create         | 0.000013 |\n| query end            | 0.000003 |\n| freeing items        | 0.000016 |\n| logging slow query   | 0.000003 |\n| cleaning up          | 0.000003 |\n+----------------------+----------+\n\nSHOW PROFILE FOR QUERY 4;\n+--------------------+----------+\n| Status             | Duration |\n+--------------------+----------+\n| starting           | 0.000126 |\n| query end          | 0.000004 |\n| freeing items      | 0.000012 |\n| logging slow query | 0.000003 |\n| cleaning up        | 0.000002 |\n+--------------------+----------+\n\nSHOW PROFILE CPU FOR QUERY 5;\n+----------------------+----------+----------+------------+\n| Status               | Duration | CPU_user | CPU_system |\n+----------------------+----------+----------+------------+\n| starting             | 0.000042 | 0.000000 |   0.000000 |\n| checking permissions | 0.000044 | 0.000000 |   0.000000 |\n| creating table       | 0.244645 | 0.000000 |   0.000000 |\n| After create         | 0.000013 | 0.000000 |   0.000000 |\n| query end            | 0.000003 | 0.000000 |   0.000000 |\n| freeing items        | 0.000016 | 0.000000 |   0.000000 |\n| logging slow query   | 0.000003 | 0.000000 |   0.000000 |\n| cleaning up          | 0.000003 | 0.000000 |   0.000000 |\n+----------------------+----------+----------+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-profile', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-profile');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (592, 26, 'SHOW PROFILES', 'Syntax\n------\n\nSHOW PROFILES\n\nDescription\n-----------\n\nThe SHOW PROFILES statement displays profiling information that indicates resource usage for statements executed during the course of the current session. It is used together with SHOW PROFILE.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-profiles', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-profiles');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (593, 26, 'SHOW QUERY\\_RESPONSE\\_TIME', 'Syntax\n------\n\nSHOW QUERY_RESPONSE_TIME\n\nDescription\n-----------\n\nIt is possible to use SHOW QUERY_RESPONSE_TIME as an alternative for retrieving information from the QUERY_RESPONSE_TIME plugin.\n\nThis was introduced as part of the Information Schema plugin extension.\n\nExamples\n--------\n\nSHOW 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\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-query_response_time', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-query_response_time');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (594, 26, 'SHOW RELAYLOG EVENTS', 'Syntax\n------\n\nSHOW RELAYLOG [''connection_name''] EVENTS\n    [IN ''log_name''] [FROM pos] [LIMIT [offset,] row_count]\n    [ FOR CHANNEL ''channel_name'']\n\nDescription\n-----------\n\nOn slaves, this command shows the events in the relay log. If ''log_name'' is not specified, the first relay log is shown.\n\nSyntax for the LIMIT clause is the same as for SELECT ... LIMIT.\n\nUsing the LIMIT clause is highly recommended because the SHOW RELAYLOG EVENTS command returns the complete contents of the relay log, which can be quite large.\n\nThis command does not return events related to setting user and system variables. If you need those, use mariadb-binlog.\n\nOn the master, this command does nothing.\n\nRequires the SLAVE MONITOR privilege.\n\nRequires the SLAVE MONITOR privilege (>= MariaDB 10.5.9), the REPLICATION SLAVE ADMIN privilege (>= MariaDB 10.5.2) or the REPLICATION SLAVE privilege (<= MariaDB 10.5.1).\n\nconnection_name\n\nIf there is only one nameless master, or the default master (as specified by the default_master_connection system variable) is intended, connection_name can be omitted. If provided, the SHOW RELAYLOG statement will apply to the specified master. connection_name is case-insensitive.\n\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical as using the channel_name directly after SHOW RELAYLOG.\n\nFOR CHANNEL is not available.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-relaylog-events', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-relaylog-events');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (595, 26, 'SHOW SLAVE HOSTS', 'Syntax\n------\n\nSHOW { SLAVE | REPLICA } HOSTS\n\nDescription\n-----------\n\nThis command is run on the master and displays a list of slaves that are currently registered with it. The output looks like this:\n\n``sql\nSHOW SLAVE HOSTS;\n+------------+-----------+------+-----------+\n| Server_id  | Host      | Port | Master_id |\n+------------+-----------+------+-----------+\n|  192168010 | iconnect2 | 3306 | 192168011 |\n| 1921680101 | athena    | 3306 | 192168011 |\n+------------+-----------+------+-----------+\n`\n\nServer_id: The unique server ID of the slave server, as configured in the server''s option file, or on the command line with --server-id=value.\n\nHost: The host name of the slave server, as configured in the server''s option file, or on the command line with --report-host=host_name (note that this can differ from the machine name as configured in the operating system). If a slave doesn''t configure --report-host explicitly, the value for the Host column is automatically extracted using the network connection''s host name or IP address.\n\nHost: The host name of the slave server, as configured in the server''s option file, or on the command line with --report-host=host_name (note that this can differ from the machine name as configured in the operating system). If a slave doesn''t configure --report-host explicitly, the value for the Host column is automatically extracted using the network connection''s host name or IP address. The Host value is left blank if a slave''s --report-host parameter is not configured.\n\nPort: The port the slave server is listening on.\n\nMaster_id: The unique server ID of the master server that the slave server is replicating from.\n\nRequires the REPLICATION MASTER ADMIN privilege.\n\nRequires the REPLICATION SLAVE privilege.\n\nSHOW REPLICA HOSTS\n\nSHOW REPLICA HOSTS is an alias for SHOW SLAVE HOSTS .\n\nSHOW REPLICA HOSTS is not available, use SHOW SLAVE HOSTS` instead.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-replica-hosts', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-replica-hosts');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (596, 26, 'SHOW SLAVE STATUS', 'Syntax\n------\n\nSHOW { SLAVE | REPLICA} ["connection_name"] STATUS [FOR CHANNEL "connection_name"]\n\nDescription\n-----------\n\nThis statement is to be run on a slave and provides status information on essential parameters of the slave threads.\n\nThis statement requires the SLAVE MONITOR privilege.\n\nThis statement requires the SLAVE MONITOR privilege.\n\nThis statement requires the REPLICATION SLAVE ADMIN privilege.\n\nMulti-Source\n\nThe ALL and "connection_name" options allow you to connect to many primaries at the same time.\n\nALL SLAVES gives you a list of all connections to the master nodes.\n\nALL SLAVES gives you a list of all connections to the master nodes.\n\nThe rows are sorted according to Connection_name.\n\nIf you specify a connection_name, you only get the information about that connection. If connection_name is not used, then the name set by default_master_connection is used. If the connection name doesn''t exist you will get an error:There is no master connection for ''xxx''.\n\nMariaDB starting with 10.7.0\n\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical to using the channel_name directly after SHOW SLAVE.\n\nColumn Descriptions\n\nThe order in which the columns appear depends on the MariaDB version. This means that extracting a column value is best done by comparing the field name instead of using a fixed offset into the row.\n\nThese columns can also be viewed/extracted from the INFORMATION_SCHEMA.SLAVE_STATUS table.\n\nThese columns cannot be viewed/extracted from the INFORMATION_SCHEMA.SLAVE_STATUS table.\n\nConnection_name: Name of the master connection. Returned with SHOW ALL SLAVES STATUS only.\n\nSlave_SQL_State: State of SQL thread. Returned with SHOW ALL SLAVES STATUSonly. See Slave SQL Thread States. Slave_IO_State: State of I/O thread. See Slave I/O Thread States.\n\nConnection_name: Name of the master connection. Returned with SHOW ALL SLAVES STATUS only.\n\nSlave_SQL_State: State of SQL thread. Returned with SHOW ALL SLAVES STATUS only. See Slave SQL Thread States. Slave_IO_State: State of I/O thread. See Slave I/O Thread States.\n\nMaster_host: Master host that the slave is connected to.\n\nMaster_user: Account user name being used to connect to the master.\n\nMaster_port: The port being used to connect to the master.\n\nConnect_Retry: Time in seconds between retries to connect. The default is 60. The CHANGE MASTER TO statement can set this. The master-retry-count option determines the maximum number of reconnection attempts.\n\nMaster_Log_File: Name of the master binary log file that the I/O thread is currently reading from.\n\nRead_Master_Log_Pos: Position up to which the I/O thread has read in the current master binary log file.\n\nRelay_Log_File: Name of the relay log file that the SQL thread is currently processing.\n\nRelay_Log_Pos: Position up to which the SQL thread has finished processing in the current relay log file.\n\nRelay_Master_Log_File: Name of the master binary log file that contains the most recent event executed by the SQL thread.\n\nSlave_IO_Running: Whether the slave I/O thread is running and connected (Yes), running but not connected to a master (Connecting) or not running (No).\n\nSlave_SQL_Running: Whether or not the SQL thread is running.\n\nReplicate_Do_DB: Databases specified for replicating with the replicate_do_db option.\n\nReplicate_Ignore_DB: Databases specified for ignoring with the replicate_ignore_db option.\n\nReplicate_Do_Table: Tables specified for replicating with the replicate_do_table option.\n\nReplicate_Ignore_Table: Tables specified for ignoring with the replicate_ignore_table option.\n\nReplicate_Wild_Do_Table: Tables specified for replicating with the replicate_wild_do_table option.\n\nReplicate_Wild_Ignore_Table: Tables specified for ignoring with the replicate_wild_ignore_table option.\n\nLast_Errno: Alias for Last_SQL_Errno (see below)\n\nLast_Error: Alias for Last_SQL_Error (see below)\n\nSkip_Counter: Number of events that a slave skips from the master, as recorded in the sql_slave_skip_counter system variable.\n\nExec_Master_Log_Pos: Position up to which the SQL thread has processed in the current master binary log file. Can be used to start a new slave from a current slave with the CHANGE MASTER TO ... MASTER_LOG_POS option.\n\nRelay_Log_Space: Total size of all relay log files combined.\n\nUntil_Condition: One of four possible values: None, Master, Relay, or Gtid, depending on the respective START SLAVE UNTIL condition.\n\nUntil_Log_File: The MASTER_LOG_FILE value of the START SLAVE UNTIL condition.\n\nUntil_Log_Pos: The MASTER_LOG_POS value of the START SLAVE UNTIL condition.\n\nMaster_SSL_Allowed: Whether an SSL connection is permitted (Yes), not permitted (No) or permitted but without the slave having SSL support enabled (Ignored)\n\nMaster_SSL_CA_File: The MASTER_SSL_CA option of the CHANGE MASTER TO statement.\n\nMaster_SSL_CA_Path: The MASTER_SSL_CAPATH option of the CHANGE MASTER TO statement.\n\nMaster_SSL_Cert: The MASTER_SSL_CERT option of the CHANGE MASTER TO statement.\n\nMaster_SSL_Cipher: The MASTER_SSL_CIPHER option of the CHANGE MASTER TO statement.\n\nMaster_SSL_Key: The MASTER_SSL_KEY option of the CHANGE MASTER TO statement.\n\nSeconds_Behind_Master: Difference between the timestamp logged on the master for the event that the slave is currently processing, and the current timestamp on the slave. Zero if the slave is not currently processing an event. With serial replication, seconds_behind_master is updated when the SQL thread begins executing a transaction. With parallel replication, seconds_behind_master is updated only after transactions commit. An exception is thrown on the parallel slave to additionally update seconds_behind_master when the first transaction received after idling is queued to a worker for execution, to provide a reliable initial value for the duration until a transaction commits.\n\nAdditional behavior to be aware of:\n\n1. Seconds_Behind_Master will update for ignored events, e.g. those skipped due to sql_slave_skip_counter.\n2. On the serial slave, transactions with prior timestamps can update Seconds_Behind_Master such that it can go backwards, though this is not true for the parallel slave.\n3. When configured with MASTER_DELAY, as a replicated transaction begins executing (i.e. on a serial or post-idle parallel slave), Seconds_Behind_Master will update before delaying, and while delaying occurs will grow to encompass the configured value.\n4. There is a known issue, tracked by MDEV-17516, such that Seconds_Behind_Master will initially present as 0 on slave restart until a replicated transaction begins executing, even if the last slave session was lagging behind when stopped.\n\nSeconds_Behind_Master: Difference between the timestamp logged on the master for the event that the slave is currently processing, and the current timestamp on the slave. Zero if the slave is not currently processing an event. With serial replication, seconds_behind_master is updated when the SQL thread begins executing a transaction. With parallel replication, seconds_behind_master is updated only after transactions commit.\n\nAdditional behavior to be aware of:\n\n1. Seconds_Behind_Master will update for ignored events, e.g. those skipped due to sql_slave_skip_counter.\n2. On the serial slave, transactions with prior timestamps can update Seconds_Behind_Master such that it can go backwards, though this is not true for the parallel slave.\n3. When configured with MASTER_DELAY, as a replicated transaction begins executing (i.e. on a serial or post-idle parallel slave), Seconds_Behind_Master will update before delaying, and while delaying occurs will grow to encompass the configured value.\n4. There is a known issue, tracked by MDEV-17516, such that Seconds_Behind_Master will initially present as 0 on slave restart until a replicated transaction begins executing, even if the last slave session was lagging behind when stopped.\n\nMaster_SSL_Verify_Server_Cert: The MASTER_SSL_VERIFY_SERVER_CERT option of the CHANGE MASTER TO statement.\n\nLast_IO_Errno: Error code of the most recent error that caused the I/O thread to stop (also recorded in the slave''s error log). 0 means no error. RESET SLAVE or RESET MASTER will reset this value.\n\nLast_IO_Error: Error message of the most recent error that caused the I/O thread to stop (also recorded in the slave''s error log). An empty string means no error. RESET SLAVE or RESET MASTER will reset this value.\n\nLast_SQL_Errno: Error code of the most recent error that caused the SQL thread to stop (also recorded in the slave''s error log). 0 means no error. RESET SLAVE or RESET MASTER will reset this value.\n\nLast_SQL_Error: Error message of the most recent error that caused the SQL thread to stop (also recorded in the slave''s error log). An empty string means no error. RESET SLAVE or RESET MASTER will reset this value.\n\nReplicate_Ignore_Server_Ids: List of server_ids that are currently being ignored for replication purposes, or an empty string for none, as specified in the IGNORE_SERVER_IDS option of the CHANGE MASTER TO statement.\n\nMaster_Server_Id: The master''s server_id value.\n\nMaster_SSL_Crl: The MASTER_SSL_CRL option of the CHANGE MASTER TO statement.\n\nMaster_SSL_Crlpath: The MASTER_SSL_CRLPATH option of the CHANGE MASTER TO statement.\n\nUsing_Gtid: Whether or not global transaction ID''s are being used for replication (can be No, Slave_Pos, or Current_Pos).\n\nGtid_IO_Pos: Current global transaction ID value.\n\nReplicate_Do_Domain_Ids: List of domain_ids that are currently being recognized for replication purposes, or an empty string for none, as specified in the DO_DOMAIN_IDS option of the CHANGE MASTER TO statement.\n\nReplicate_Ignore_Domain_Ids: List of domain_ids that are currently being ignored for replication purposes, or an empty string for none, as specified in the IGNORE_DOMAIN_IDS option of the CHANGE MASTER TO statement.\n\nParallel_Mode: The in-order parallel replication mode as configured by the slave_parallel_mode system variable.\n\nSQL_Delay: Value specified by MASTER_DELAY in CHANGE MASTER (or 0 if none).\n\nSQL_Remaining_Delay: When the slave is delaying the execution of an event due to MASTER_DELAY, this is the number of seconds of delay remaining before the event will be applied. Otherwise, the value is NULL.\n\nSlave_SQL_Running_State: The state of the SQL driver threads, same as in SHOW PROCESSLIST. When the slave is delaying the execution of an event due to MASTER_DELAY, this field displays: "Waiting until MASTER_DELAY seconds after master executed event".\n\nSlave_DDL_Groups: This status variable counts the occurrence of DDL statements. This is a slave-side counter for optimistic parallel replication.\n\nSlave_Non_Transactional_Groups: This status variable counts the occurrence of non-transactional event groups. This is a slave-side counter for optimistic parallel replication.\n\nSlave_Transactional_Groups: This status variable counts the occurrence of transactional event groups. This is a slave-side counter for optimistic parallel replication.\n\nReplicate_Rewrite_DB: Databases specified for replicating and rewriting with the replicate_rewrite_db system variable/option.\n\nReplica_Rewrite_DB is not available.\n\nRetried_transactions: The number of times that replicating transactions have been retried due to temporary errors (e.g. deadlocks in parallel replication). Returned with SHOW ALL SLAVES STATUS only.\n\nMax_relay_log_size: Max relay log size for this connection. Returned with SHOW ALL SLAVES STATUS only.\n\nExecuted_log_entries: Number of binary log events that have been executed, irrespective of error outcome (i.e. if the event execution results in an error, this number will still increase). Returned with SHOW ALL SLAVES STATUS only.\n\nSlave_received_heartbeats: Number of Heartbeat Log Events that the slave has received. Note this counter does not reset when the slave is restarted; only when a new CHANGE MASTER command has executed. Returned with SHOW ALL SLAVES STATUS only.\n\nSlave_heartbeat_period: Configured (by CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD) interval in seconds between replication heartbeats. Returned with SHOW ALL SLAVES STATUS only.\n\nGtid_Slave_Pos: The value of the global variable gtid_slave_pos, i.e. the GTID of the last event group replicated on a slave server, for each replication domain, as stored in the gtid_slave_pos system variable. Returned with SHOW ALL SLAVES STATUS only.\n\nMaster_last_event_time: Timestamp of the last event read from the master by the IO thread. NULL until the slave has started and the slave has read one query event from the master that changes data.\n\nSlave_last_event_time: Master timestamp of the last event committed on the slave. NULL until the slave has started and the slave has read one query event from the master that changes data.\n\nMaster_Slave_time_diff: The difference of the above two timestamps. NULL until the slave has started and the slave has read one query event from the master that changes data.\n\nMaster_last_event_time, Slave_last_event_time, and Master_Slave_time_diff are not available.\n\nConnects_Tried: The number of attempts done to connect to the master. It starts from 0 with _START_ SLAVE (but not STOP SLAVE), RESET SLAVE or CHANGE MASTER TO MASTER_RETRY_COUNT, and increments after each connection attempt until one succeeds or, after this reaches Master_Retry_Count, aborts the connection.\n\nMaster_Retry_Count: The limit to Connects_Tried as configured by CHANGE MASTER TO MASTER_RETRY_COUNT.\n\nConnects_Tried: and Master_Retry_Count: are not available. If the Performance Schema is enabled, replication_connection_configuration has CONNECTION_RETRY_COUNT available as an older alternative to Master_Retry_Count.\n\nExamples\n--------\n\nSHOW SLAVE STATUS\\G\n************************ 1. row ************************\n                Slave_IO_State: Waiting for master to send event\n                   Master_Host: db01.example.com\n                   Master_User: replicant\n                   Master_Port: 3306\n                 Connect_Retry: 60\n               Master_Log_File: mariadb-bin.000021\n           Read_Master_Log_Pos: 17315\n                Relay_Log_File: relay-bin.000042\n                 Relay_Log_Pos: 17446\n         Relay_Master_Log_File: mariadb-bin.000021\n              Slave_IO_Running: Yes\n             Slave_SQL_Running: Yes\n               Replicate_Do_DB: \n           Replicate_Ignore_DB: \n            Replicate_Do_Table: \n        Replicate_Ignore_Table: \n       Replicate_Wild_Do_Table: \n   Replicate_Wild_Ignore_Table: \n                    Last_Errno: 0\n                    Last_Error: \n                  Skip_Counter: 0\n           Exec_Master_Log_Pos: 17146\n               Relay_Log_Space: 17972\n               Until_Condition: None\n                Until_Log_File: \n                 Until_Log_Pos: 0\n            Master_SSL_Allowed: Yes\n            Master_SSL_CA_File: \n            Master_SSL_CA_Path:\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-replica-status');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (597, 26, 'SHOW STATUS', 'Syntax\n------\n\nSHOW [GLOBAL | SESSION] STATUS\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nSHOW STATUS provides server status information. This information also can be obtained using the mariadb-admin extended-status command, or by querying the Information Schema GLOBAL_STATUS and SESSION_STATUS tables. The LIKE clause, if present, indicates which variable names to match. The WHERE clause can be given to select rows using more general conditions.\n\nWith the GLOBAL modifier, SHOW STATUS displays the status values for all connections to MariaDB. WithSESSION, it displays the status values for the current connection. If no modifier is present, the default isSESSION. LOCAL is a synonym forSESSION. If you see a lot of 0 values, the reason is probably that you have used SHOW STATUS with a new connection instead of SHOW GLOBAL STATUS.\n\nSome status variables have only a global value. For these, you get the same value for both GLOBAL and SESSION.\n\nSee Server Status Variables for a full list, scope and description of the variables that can be viewed with SHOW STATUS.\n\nThe LIKE clause, if present on its own, indicates which variable name to match.\n\nThe WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nExamples\n--------\n\nSHOW GLOBAL STATUS;\n+--------------------------------------------------------------+----------------------------------------+\n| Variable_name                                                | Value                                  |\n+--------------------------------------------------------------+----------------------------------------+\n| Aborted_clients                                              | 0                                      |\n| Aborted_connects                                             | 0                                      |\n| Access_denied_errors                                         | 0                                      |\n| Acl_column_grants                                            | 0                                      |\n| Acl_database_grants                                          | 2                                      |\n| Acl_function_grants                                          | 0                                      |\n| Acl_procedure_grants                                         | 0                                      |\n| Acl_proxy_users                                              | 2                                      |\n| Acl_role_grants                                              | 0                                      |\n| Acl_roles                                                    | 0                                      |\n| Acl_table_grants                                             | 0                                      |\n| Acl_users                                                    | 6                                      |\n| Aria_pagecache_blocks_not_flushed                            | 0                                      |\n| Aria_pagecache_blocks_unused                                 | 15706                                  |\n...\n| wsrep_local_index                                            | 18446744073709551615                   |\n| wsrep_provider_name                                          |                                        |\n| wsrep_provider_vendor                                        |                                        |\n| wsrep_provider_version                                       |                                        |\n| wsrep_ready                                                  | OFF                                    |\n| wsrep_thread_count                                           | 0                                      |\n+--------------------------------------------------------------+----------------------------------------+\n516 rows in set (0.00 sec)\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-status', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-status');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (598, 26, 'SHOW TABLE\\_STATISTICS', 'Syntax\n------\n\nSHOW TABLE_STATISTICS\n\nDescription\n-----------\n\nThe SHOW TABLE_STATISTICS statement is part of the User Statistics feature. It was effectively replaced by the generic SHOW TABLE STATISTICS statement. The information_schema.TABLE_STATISTICS table shows statistics on table usage.\n\nThe SHOW TABLE_STATISTICS statement is part of the User Statistics feature. The information_schema.TABLE_STATISTICS table shows statistics on table usage.\n\nThe userstat system variable must be set to 1 to activate this feature. See the User Statistics and information_schema.TABLE_STATISTICS articles for more information.\n\nExamples\n--------\n\nSHOW TABLE_STATISTICS\\G\n************************ 1. row *********************\n           Table_schema: mysql\n             Table_name: proxies_priv\n              Rows_read: 2\n           Rows_changed: 0\nRows_changed_x_#indexes: 0\n********************* 2. row *********************\n           Table_schema: test\n             Table_name: employees_example\n              Rows_read: 7\n           Rows_changed: 0\nRows_changed_x_#indexes: 0\n********************* 3. row *********************\n           Table_schema: mysql\n             Table_name: user\n              Rows_read: 16\n           Rows_changed: 0\nRows_changed_x_#indexes: 0\n********************* 4. row ************************\n           Table_schema: mysql\n             Table_name: db\n              Rows_read: 2\n           Rows_changed: 0\nRows_changed_x_#indexes: 0\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-table-statistics', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-table-statistics');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (599, 26, 'SHOW TABLE STATUS', 'Syntax\n------\n\nSHOW TABLE STATUS [{FROM | IN} db_name]\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TABLE STATUS works like SHOW TABLES, but provides more extensive information about each table.\n\nSHOW TABLE STATUS works like SHOW TABLES, but provides more extensive information about each table. Only non-TEMPORARY tables are shown.\n\nThe LIKE clause, if present on its own, indicates which table names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nThe following information is returned:\n\n| Column             | Description                                                                                                                                                                                                                                                                                                                                                                                                                            |\n| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Name               | Table name.                                                                                                                                                                                                                                                                                                                                                                                                                            |\n| Engine             | Table storage engine.                                                                                                                                                                                                                                                                                                                                                                     |\n| Version            | Version number from the table''s .frm file.                                                                                                                                                                                                                                                                                                                                                                                             |\n| Row_format        | Row format (see InnoDB, Aria and MyISAM row formats).                                                                                                        |\n| Rows               | Number of rows in the table. Some engines, such as InnoDB may store an estimate.                                                                                                                                                                                                                                                                                                   |\n| Avg_row_length   | Average row length in the table.                                                                                                                                                                                                                                                                                                                                                                                                       |\n| Data_length       | For InnoDB, the index size, in pages, multiplied by the page size. For Aria and MyISAM, length of the data file, in bytes. For MEMORY, the approximate allocated memory.                 |\n| Max_data_length  | Maximum length of the data file, ie the total number of bytes that could be stored in the table. Not used in InnoDB.                                                                                                                                                                                                                                                               |\n| Index_length      | Length of the index file.                                                                                                                                                                                                                                                                                                                                                                                                              |\n| Data_free         | Bytes allocated but unused. For InnoDB tables in a shared tablespace, the free space of the shared tablespace with small safety margin. An estimate in the case of partitioned tables - see the PARTITIONS table.                                                                                                        |\n| Auto_increment    | Next AUTO_INCREMENT value.                                                                                                                                                                                                                                                                                                                                                                   |\n| Create_time       | Time the table was created. Some engines just return the ctime information from the file system layer here, in that case the value is not necessarily the table creation time but rather the time the file system metadata for it had last changed.                                                                                                                                                                                    |\n| Update_time       | Time the table was last updated. On Windows, the timestamp is not updated on update, so MyISAM values will be inaccurate. In InnoDB, if shared tablespaces are used, will be NULL, while buffering can also delay the update, so the value will differ from the actual time of the last UPDATE, INSERT or DELETE.                                                                  |\n| Check_time        | Time the table was last checked. Not kept by all storage engines, in which case will be NULL.                                                                                                                                                                                                                                                                                                                                          |\n| Collation          | Character set and collation.                                                                                                                                                                                                                                                                                                                                                  |\n| Checksum           | Live checksum value, if any.                                                                                                                                                                                                                                                                                                                                                                                                           |\n| Create_options    | Extra CREATE TABLE options.                                                                                                                                                                                                                                                                                                                                                            |\n| Comment            | Table comment provided when MariaDB created the table.                                                                                                                                                                                                                                                                                                                                                                                 |\n| Max_index_length | Maximum index length (supported by MyISAM and Aria tables).                                                                                                                                                                                                                                                                                                                                                                            |\n| Temporary          | Until MariaDB 11.2.0, placeholder to signal that a table is a temporary table and always "N", except "Y" for generated information_schema tables and NULL for views. From MariaDB 11.2.0, will also be set to "Y" for local temporary tables. |\n\nSimilar information can be found in the information_schema.TABLES table as well as by using mariadb-show:\n\n``bash\nmariadb-show --status db_name\n`\n\nViews\n\nFor views, all columns in SHOW TABLE STATUS are NULL` except ''Name'' and ''Comment''\n\nExamples\n--------\n\nSHOW TABLE STATUS\\G\n************************ 1. row ************************\n           Name: bus_routes\n         Engine: InnoDB\n        Version: 10\n     Row_format: Dynamic\n           Rows: 5\n Avg_row_length: 3276\n    Data_length: 16384\nMax_data_length: 0\n   Index_length: 0\n      Data_free: 0\n Auto_increment: NULL\n    Create_time: 2017-05-24 11:17:46\n    Update_time: NULL\n     Check_time: NULL\n      Collation: latin1_swedish_ci\n       Checksum: NULL\n Create_options: \n        Comment:\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-table-status', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-table-status');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (600, 26, 'SHOW TABLES', 'Syntax\n------\n\nSHOW [FULL] TABLES [FROM db_name]\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TABLES lists the tables, sequences and views in a given database.\n\nSHOW TABLES lists the tables (only non-TEMPORARY tables are shown), sequences and views in a given database.\n\nThe LIKE clause, if present on its own, indicates which table names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW. For example, when searching for tables in the test database, the column name for use in the WHERE and LIKE clauses will be Tables_in_test\n\nThe FULL modifier is supported such that SHOW FULL TABLES displays a second output column. Values for the second column, Table_type, are BASE TABLE for a table, VIEW for a view and SEQUENCE for a sequence.\n\nYou can also get this information using:\n\n``bash\nmariadb-show db_name\n`\n\nSee mariadb-show for more details.\n\nIf you have no privileges for a base table or view, it does not show up in the output from SHOW TABLES or mariadb-show db_name`.\n\nThe information_schema.TABLES table, as well as the SHOW TABLE STATUS statement, provide extended information about tables.\n\nExamples\n--------\n\nSHOW TABLES;\n+----------------------+\n| Tables_in_test       |\n+----------------------+\n| animal_count         |\n| animals              |\n| are_the_mooses_loose |\n| aria_test2           |\n| t1                   |\n| view1                |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-tables', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-tables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (601, 26, 'SHOW TRIGGERS', 'Syntax\n------\n\nSHOW TRIGGERS [FROM db_name]\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TRIGGERS lists the triggers currently defined for tables in a database (the default database unless a FROM clause is given). This statement requires the TRIGGER privilege.\n\nSHOW TRIGGERS lists the triggers currently defined for tables in a database (the default database unless a FROM clause is given). This statement requires the SUPER privilege.\n\nThe LIKE clause, if present on its own, indicates which table names to match and causes the statement to display triggers for those tables. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nSimilar information is stored in the information_schema.TRIGGERS table.\n\nIf there are multiple triggers for the same action, then the triggers are shown in action order.\n\nExamples\n--------\n\nSHOW triggers Like ''animals'' \\G\n************************ 1. row ************************\n             Trigger: the_mooses_are_loose\n               Event: INSERT\n               Table: animals\n           Statement: BEGIN\n IF NEW.name = ''Moose'' THEN\n  UPDATE animal_count SET animal_count.animals = animal_count.animals+100;\n ELSE \n  UPDATE animal_count SET animal_count.animals = animal_count.animals+1;\n END IF;\nEND\n              Timing: AFTER\n             Created: 2016-09-29 13:53:34.35\n            sql_mode: \n             Definer: root@localhost\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n  Database Collation: latin1_swedish_ci\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-triggers', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-triggers');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (602, 26, 'SHOW USER\\_STATISTICS', 'Syntax\n------\n\nSHOW USER_STATISTICS\n\nDescription\n-----------\n\nThe SHOW USER_STATISTICS statement is part of the User Statistics feature. It was effectively replaced by the generic SHOW information_schema_table statement. The information_schema.USER_STATISTICS table holds statistics about user activity. You can use this table to find out such things as which user is causing the most load and which users are being abusive. You can also use this table to measure how close to capacity the server may be.\n\nThe SHOW USER_STATISTICS statement is part of the User Statistics feature. The information_schema.USER_STATISTICS table holds statistics about user activity. You can use this table to find out such things as which user is causing the most load and which users are being abusive. You can also use this table to measure how close to capacity the server may be.\n\nThe userstat system variable must be set to 1 to activate this feature. See the User Statistics and information_schema.USER_STATISTICS table for more information.\n\nExamples\n--------\n\nSHOW USER_STATISTICS\\G\n************************ 1. row ************************\n                  User: root\n     Total_connections: 1\nConcurrent_connections: 0\n        Connected_time: 3297\n             Busy_time: 0.14113400000000006\n              Cpu_time: 0.017637000000000003\n        Bytes_received: 969\n            Bytes_sent: 22355\n  Binlog_bytes_written: 0\n             Rows_read: 10\n             Rows_sent: 67\n          Rows_deleted: 0\n         Rows_inserted: 0\n          Rows_updated: 0\n       Select_commands: 7\n       Update_commands: 0\n        Other_commands: 0\n   Commit_transactions: 1\n Rollback_transactions: 0\n    Denied_connections: 0\n      Lost_connections: 0\n         Access_denied: 0\n         Empty_queries: 7\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-user-statistics', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-user-statistics');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (603, 26, 'SHOW USER\\_VARIABLES', 'Description\n-----------\n\nSee the User Variables Plugin for details.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-user_variables', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-user_variables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (604, 26, 'SHOW VARIABLES', 'Syntax\n------\n\nSHOW [GLOBAL | SESSION] VARIABLES\n    [LIKE ''pattern'' | WHERE expr]\n\nDescription\n-----------\n\nSHOW VARIABLES shows the values of MariaDB system variables. This does not include user-defined variables - see here for details on viewing those.\n\nSystem variable information can also be obtained using the mariadb-admin variables command. The LIKE clause, if present, indicates which variable names to match. The WHERE clause can be given to select rows using more general conditions.\n\nWith the GLOBAL modifier, SHOW VARIABLES displays the values that are used for new connections to MariaDB. With SESSION, it displays the values that are in effect for the current connection. If no modifier is present, the default is SESSION. LOCAL is a synonym for SESSION. With a LIKE clause, the statement displays only rows for those variables with names that match the pattern. To obtain the row for a specific variable, use a LIKE clause as shown:\n\n``sql\nSHOW VARIABLES LIKE ''maria_group_commit'';\nSHOW SESSION VARIABLES LIKE ''maria_group_commit'';\n`\n\nTo get a list of variables whose name match a pattern, use the "%" wildcard character in a LIKE clause:\n\n`sql\nSHOW VARIABLES LIKE ''%maria%'';\nSHOW GLOBAL VARIABLES LIKE ''%maria%'';\n`\n\nWildcard characters can be used in any position within the pattern to be matched. Strictly speaking, because "_" is a wildcard that matches any single character, you should escape it as "_" to match it literally. In practice, this is rarely necessary.\n\nThe WHERE and LIKE` clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.\n\nSee SET for information on setting server system variables.\n\nSee Server System Variables for a list of all the variables that can be set.\n\nYou can also see the server variables by querying the Information Schema GLOBAL_VARIABLES and SESSION_VARIABLES tables.\n\nExamples\n--------\n\nSHOW VARIABLES LIKE ''aria%'';\n+------------------------------------------+---------------------+\n| Variable_name                            | Value               |\n+------------------------------------------+---------------------+\n| aria_block_size                          | 8192                |\n| aria_checkpoint_interval                 | 30                  |\n| aria_checkpoint_log_activity             | 1048576             |\n| aria_force_start_after_recovery_failures | 0                   |\n| aria_group_commit                        | none                |\n| aria_group_commit_interval               | 0                   |\n| aria_log_file_size                       | 1073741824          |\n| aria_log_purge_type                      | immediate           |\n| aria_max_sort_file_size                  | 9223372036853727232 |\n| aria_page_checksum                       | ON                  |\n| aria_pagecache_age_threshold             | 300                 |\n| aria_pagecache_buffer_size               | 134217728           |\n| aria_pagecache_division_limit            | 100                 |\n| aria_recover                             | NORMAL              |\n| aria_repair_threads                      | 1                   |\n| aria_sort_buffer_size                    | 134217728           |\n| aria_stats_method                        | nulls_unequal       |\n| aria_sync_log_dir                        | NEWFILE             |\n| aria_used_for_temp_tables                | ON                  |\n+------------------------------------------+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-variables', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-variables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (605, 26, 'SHOW WARNINGS', 'Syntax\n------\n\nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT() WARNINGS\n\nDescription\n-----------\n\nSHOW WARNINGS shows the error, warning, and note messages that resulted from the last statement that generated messages in the current session. It shows nothing if the last statement used a table and generated no messages. (That is, a statement that uses a table but generates no messages clears the message list.) Statements that do not use tables and do not generate messages have no effect on the message list.\n\nA note is different to a warning in that it only appears if the sql_notes variable is set to 1 (the default), and is not converted to an error if strict mode is enabled.\n\nA related statement, SHOW ERRORS, shows only the errors.\n\nThe SHOW COUNT() WARNINGS statement displays the total number of errors, warnings, and notes. You can also retrieve this number from the warning_count variable:\n\n``sql\nSHOW COUNT() WARNINGS;\nSELECT @@warning_count;\n`\n\nThe value of warning_count might be greater than the number of messages displayed by SHOW WARNINGS if the max_error_count system variable is set so low that not all messages are stored.\n\nThe LIMIT clause has the same syntax as for the SELECT statement.\n\nSHOW WARNINGS can be used after EXPLAIN EXTENDED to see how a query is internally rewritten by MariaDB.\n\nIf the sql_notes server variable is set to 1, Notes are included in the output of SHOW WARNINGS; if it is set to 0, this statement will not show (or count) Notes.\n\nThe results of SHOW WARNINGS and SHOW COUNT() WARNINGS are directly sent to the client. If you need to access those information in a stored program, you can use the GET DIAGNOSTICS statement instead.\n\nThe mariadb client also has a number of options related to warnings. The \\W command will show warnings after every statement, while \\w will disable this. Starting the client with the --show-warnings option will show warnings after every statement.\n\nMariaDB implements a stored routine error stack trace. SHOW WARNINGS` can also be used to show more information. See the example below.\n\nExamples\n--------\n\nSELECT 1/0;\n+------+\n| 1/0  |\n+------+\n| NULL |\n+------+\n\nSHOW COUNT(*) WARNINGS;\n+-------------------------+\n| @@session.warning_count |\n+-------------------------+\n|                       1 |\n+-------------------------+\n\nSHOW WARNINGS;\n+---------+------+---------------+\n| Level   | Code | Message       |\n+---------+------+---------------+\n| Warning | 1365 | Division by 0 |\n+---------+------+---------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-warnings', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-warnings');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (606, 26, 'SHOW WSREP\\_MEMBERSHIP', 'Syntax\n------\n\nSHOW WSREP_MEMBERSHIP\n\nDescription\n-----------\n\nThe SHOW WSREP_MEMBERSHIP statement returns Galera node cluster membership information. It returns the same information as found in the information_schema.WSREP_MEMBERSHIP table. Only users with the SUPER privilege can access this information.\n\nExamples\n--------\n\nSHOW WSREP_MEMBERSHIP;\n+-------+--------------------------------------+----------+-----------------+\n| Index | Uuid                                 | Name     | Address         |\n+-------+--------------------------------------+----------+-----------------+\n|     0 | 19058073-8940-11e4-8570-16af7bf8fced | my_node1 | 10.0.2.15:16001 |\n|     1 | 19f2b0e0-8942-11e4-9cb8-b39e8ee0b5dd | my_node3 | 10.0.2.15:16003 |\n|     2 | d85e62db-8941-11e4-b1ef-4bc9980e476d | my_node2 | 10.0.2.15:16002 |\n+-------+--------------------------------------+----------+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-wsrep_membership', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-wsrep_membership');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (607, 26, 'SHOW WSREP\\_STATUS', 'Syntax\n------\n\nSHOW WSREP_STATUS\n\nDescription\n-----------\n\nThe SHOW WSREP_STATUS statement returns Galera node and cluster status information. It returns the same information as found in the information_schema.WSREP_STATUS table. Only users with the SUPER privilege can access this information.\n\nExamples\n--------\n\nSHOW WSREP_STATUS;\n+------------+-------------+----------------+--------------+\n| Node_Index | Node_Status | Cluster_Status | Cluster_Size |\n+------------+-------------+----------------+--------------+\n|          0 | Synced      | Primary        |            3 |\n+------------+-------------+----------------+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-wsrep_status', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-wsrep_status');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (608, 26, 'SHUTDOWN', 'Syntax\n------\n\nSHUTDOWN [WAIT FOR ALL { SLAVES | REPLICAS } ]\n\nDescription\n-----------\n\nThe SHUTDOWN command shuts the server down.\n\nWAIT FOR ALL SLAVES / REPLICAS\n\nThe WAIT FOR ALL REPLICAS statement can be used throughout.\n\nThe WAIT FOR ALL SLAVES option was first added in MariaDB 10.4.4.\n\nWhen a master server is shutdown and it goes through the normal shutdown process, the master kills client threads in random order. By default, the master also considers its binary log dump threads to be regular client threads. As a consequence, the binary log dump threads can be killed while client threads still exist, and this means that data can be written on the master during a normal shutdown that won''t be replicated. This is true even if semi-synchronous replication is being used.\n\nThis problem can be solved by shutting down the server with the SHUTDOWN command and by providing the WAIT FOR ALL SLAVES/WAIT FOR ALL REPLICAS option to the command. For example:\n\n``sql\nSHUTDOWN WAIT FOR ALL SLAVES;\n`\n\nWhen the WAIT FOR ALL SLAVES option is provided, the server only kills its binary log dump threads after all client threads have been killed, and it only completes the shutdown after the last binary log has been sent to all connected slaves.\n\nSee Replication Threads: Binary Log Dump Threads and the Shutdown Process for more information.\n\nRequired Permissions\n\nOne must have a SHUTDOWN privilege (see GRANT) to use this command. It is the same privilege one needs to use the mariadb-admin shutdown command.\n\nShutdown for Upgrades\n\nIf you are doing a shutdown to migrate to another major version of MariaDB, please ensure that the innodb_fast_shutdown variable is not 2 (fast crash shutdown). The default of this variable is 1.\n\nExamples\n--------\n\nCREATE EVENT test.shutd`\n    ON SCHEDULE\n        EVERY 1 DAY\n        STARTS ''2014-01-01 20:00:00''\n    COMMENT ''Shutdown Maria when the office is closed''\nDO BEGIN\n    SHUTDOWN;\nEND;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/shutdown', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/shutdown');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (609, 26, 'USE \\[DATABASE]', 'Syntax\n------\n\nUSE db_name\n\nDescription\n-----------\n\nThe ''USE db_name'' statement tells MariaDB to use the db_name database as the default (current) database for subsequent statements. The database remains the default until the end of the session, or until another USE statement is issued:\n\n``sql\nUSE db1;\nSELECT COUNT() FROM mytable;   # selects FROM db1.mytable\nUSE db2;\nSELECT COUNT() FROM mytable;   # selects FROM db2.mytable\n`\n\nThe DATABASE() function (SCHEMA() is a synonym) returns the default database.\n\nAnother way to set the default database is by specifying its name when starting the mariadb command line client:\n\n`\nmariadb db1    # starts the mariadb command-line client with db1 as the current database\n`\n\nOne cannot use USE` to a database one has no privileges to. The reason is that a user with no privileges to a database should not be able to know if a database exists or not.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/use-database', '', 'https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/use-database');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (610, 35, 'Comment Syntax', 'Description\n-----------\n\nThere are three supported comment styles in MariaDB:\n\n1. From a hash sign (#) to the end of a line:\n\n``sql\nSELECT  FROM users; \n\nThis is a comment\n\n`\n\n1. From a double dash (--) to the end of a line. The space after the two dashes is required (as in MySQL).\n\n`sql\nSELECT  FROM users; -- This is a comment\n`\n\n1. C style comments from an opening ''/'' to a closing ''/''. Comments of this form can span multiple lines:\n\n`sql\nSELECT  FROM users; / This is a\nmulti-line\ncomment /\n`\n\nNested comments are possible in some situations, but they are not supported or recommended.\n\nExecutable Comments\n\nAs an aid to portability between different databases, MariaDB supports executable comments. These special comments allow you to embed SQL code which will not execute when run on other databases, but will execute when run on MariaDB.\n\nMariaDB supports both MySQL''s executable comment format, and a slightly modified version specific to MariaDB. This way, if you have SQL code that works on MySQL and MariaDB, but not other databases, you can wrap it in a MySQL executable comment, and if you have code that specifically takes advantage of features only available in MariaDB you can use the MariaDB specific format to\\\nhide the code from MySQL.\n\nExecutable Comment Syntax\n\nMySQL and MariaDB executable comment syntax:\n\n`sql\n/! MySQL or MariaDB-specific code /\n`\n\nCode that should be executed only starting from a specific MySQL or MariaDB version:\n\n`sql\n/!##### MySQL or MariaDB-specific code /\n`\n\nThe numbers, represented by ''######'' in the syntax examples above specify the specific the minimum versions of MySQL and MariaDB that should execute the comment. The first number is the major version, the second 2 numbers are the minor version and the last 2 is the patch level.\n\nFor example, if you want to embed some code that should only execute on MySQL or MariaDB starting from 5.1.0, you would do the following:\n\n`sql\n/!50100 MySQL and MariaDB 5.1.0 (and above) code goes here. /\n`\n\nMariaDB-only executable comment syntax (starting from MariaDB 5.3.1):\n\n`sql\n/M! MariaDB-specific code /\n/M!###### MariaDB-specific code /\n`\n\nMariaDB ignores MySQL-style executable comments that have a version number in the range 50700..99999. This is needed to skip features introduced in MySQL-5.7 that are not ported to MariaDB 10.x yet.\n\n`sql\n/!50701 MariaDB-10.x ignores MySQL-5.7 specific code /\n`\n\nNote: comments which have a version number in the range 50700..99999 that use MariaDB-style executable comment syntax are still executed.\n\n`sql\n/M!50701 MariaDB-10.x does not ignore this /\n``\n\nStatement delimiters cannot be used within executable comments.\n\nExamples\n--------\n\nSELECT 2 / +1 /;\nSELECT 1 /! +1 /;\nSELECT 1 /!50101 +1 /;\nSELECT 2 /M! +1 /;\nSELECT 2 /M!50301 +1 */;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/comment-syntax', '', 'https://mariadb.com/docs/server/reference/sql-statements/comment-syntax');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (611, 39, 'ALTER DATABASE', 'Syntax\n------\n\nALTER {DATABASE | SCHEMA} [db_name]\n    alter_specification ...\nALTER {DATABASE | SCHEMA} db_name\n    UPGRADE DATA DIRECTORY NAME\n\nalter_specification:\n    [DEFAULT] CHARACTER SET [=] charset_name\n  | [DEFAULT] COLLATE [=] collation_name\n  | COMMENT [=] ''comment''\n\nDescription\n-----------\n\nALTER DATABASE enables you to change the overall characteristics of a database. These characteristics are stored in the db.opt file in the database directory. To use ALTER DATABASE, you need the ALTER privilege on the database. ALTER SCHEMA is a synonym for ALTER DATABASE.\n\nThe CHARACTER SET clause changes the default database character set. The COLLATE clause changes the default database collation. See Character Sets and Collations for more.\n\nYou can see what character sets and collations are available using, respectively, the SHOW CHARACTER SET and SHOW COLLATION statements.\n\nChanging the default character set/collation of a database does not change the character set/collation of any stored procedures or stored functions that were previously created, and relied on the defaults. These need to be dropped and recreated in order to apply the character set/collation changes.\n\nThe database name can be omitted from the first syntax, in which case the statement applies to the default database.\n\nThe syntax that includes the UPGRADE DATA DIRECTORY NAME clause. It updates the name of the directory associated with the database to use the encoding implemented in MySQL for mapping database names to database directory names (see Identifier to File Name Mapping). This clause is for use under these conditions:\n\n It is intended when upgrading MySQL from older versions.\n It is intended to update a database directory name to the current encoding format if the name contains special characters that need encoding.\n* The statement is used by mariadb-check (as invoked by mariadb-upgrade).\n\nFor example, if a database in MySQL 5.0 has a name of a-b-c, the name contains instance of the \\-'' character. In 5.0, the database directory is also named a-b-c, which is not necessarily safe for all file systems. In MySQL, the same database name is encoded as a@002db@002dc to produce a file-system-neutral directory name.\n\nWhen a MySQL installation is upgraded from an older version, the server displays a name such as a-b-c (which is in the old format) as #mysql50#a-b-c, and you must refer to the name using the #mysql50# prefix. Use UPGRADE DATA DIRECTORY NAME in this case to explicitly tell the server to re-encode the database directory name to the current encoding format:\n\n`sql\nALTER DATABASE #mysql50#a-b-c UPGRADE DATA DIRECTORY NAME;\n`\n\nAfter executing this statement, you can refer to the database as a-b-c without the special #mysql50` prefix.\n\nMariaDB starting with 10.5.0\n\nFrom MariaDB 10.5.0, it is possible to add a comment of a maximum of 1024 bytes. If the comment length exceeds this length, a error/warning code 4144 is thrown. The database comment is also added to the db.opt file, as well as to the information_schema.schemata table.\n\nExamples\n--------\n\nALTER DATABASE p COMMENT=''Presentations'';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-database', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-database');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (612, 39, 'ALTER FUNCTION', 'Syntax\n------\n\nALTER FUNCTION func_name [characteristic ...]\n\ncharacteristic:\n    { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n  | SQL SECURITY { DEFINER | INVOKER }\n  | COMMENT ''string''\n\nDescription\n-----------\n\nThis statement can be used to change the characteristics of a stored function. More than one change may be specified in an ALTER FUNCTION statement. However, you cannot change the parameters or body of a stored function using this statement; to make such changes, you must drop and re-create the function using DROP FUNCTION and CREATE FUNCTION.\n\nYou must have the ALTER ROUTINE privilege for the function. (That privilege is granted automatically to the function creator.) If binary logging is enabled, the ALTER FUNCTION statement might also require\\\nthe SUPER privilege, as described in Binary Logging of Stored Routines.\n\nExamples\n--------\n\nALTER FUNCTION hello SQL SECURITY INVOKER;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-function', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-function');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (613, 39, 'ALTER LOGFILE GROUP', 'Description\n-----------\n\nThe ALTER LOGFILE GROUP statement is not supported by MariaDB. It was originally inherited from MySQL NDB Cluster. See MDEV-19295 for more information.\n\nSyntax\n\n``sql\nALTER LOGFILE GROUP logfile_group\n    ADD UNDOFILE ''file_name''\n    [INITIAL_SIZE [=] size]\n    [WAIT]\n    ENGINE [=] engine_name\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-logfile-group', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-logfile-group');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (614, 39, 'ALTER SERVER', 'Syntax\n------\n\nALTER SERVER server_name\n    OPTIONS (option [, option] ...)\n\nDescription\n-----------\n\nAlters the server information for _server_name_, adjusting the specified options as per the CREATE SERVER command. The corresponding fields in the mysql.servers table are updated accordingly. This statement requires the SUPER privilege or, from MariaDB 10.5.2, the FEDERATED ADMIN privilege.\n\nALTER SERVER is not written to the binary log, irrespective of the binary log format being used. From MariaDB 10.1.13, Galera replicates the CREATE SERVER, ALTER SERVER and DROP SERVER statements.\n\nExamples\n--------\n\nALTER SERVER s OPTIONS (USER ''sally'');\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-server', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-server');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (615, 39, 'ALTER TABLE', 'Syntax\n------\n\nALTER [ONLINE] [IGNORE] TABLE [IF EXISTS] tbl_name\n    [WAIT n | NOWAIT]\n    alter_specification [, alter_specification] ...\n\nalter_specification:\n    table_option ...\n  | ADD [COLUMN] [IF NOT EXISTS] col_name column_definition\n        [FIRST | AFTER col_name ]\n  | ADD [COLUMN] [IF NOT EXISTS] (col_name column_definition, ...)\n  | ADD {INDEX|KEY} [IF NOT EXISTS] [index_name]\n        [index_type] (index_col_name,...) [index_option] ...\n  | ADD [CONSTRAINT [symbol]] PRIMARY KEY [IF NOT EXISTS]\n        [index_type] (index_col_name,...) [index_option] ...\n  | ADD [CONSTRAINT [symbol]]\n        UNIQUE [INDEX|KEY] [IF NOT EXISTS] [index_name]\n        [index_type] (index_col_name,...) [index_option] ...\n  | ADD FULLTEXT [INDEX|KEY] [IF NOT EXISTS [index_name]\n        (index_col_name,...) [index_option] ...\n  | ADD SPATIAL [INDEX|KEY] [IF NOT EXISTS [index_name]\n        (index_col_name,...) [index_option] ...\n  | ADD VECTOR [INDEX|KEY] [IF NOT EXISTS [index_name]\n        (index_col_name,...) [index_option] ...\n  | ADD [CONSTRAINT [symbol]]\n        FOREIGN KEY [IF NOT EXISTS] [index_name] (index_col_name,...)\n        reference_definition\n  | ADD PERIOD FOR [time_period_name|SYSTEM_TIME] (start_column_name, end_column_name)\n  | ALTER [COLUMN] col_name SET DEFAULT literal | (expression)\n  | ALTER [COLUMN] col_name DROP DEFAULT\n  | ALTER {INDEX|KEY} [IF EXISTS] index_name [NOT] IGNORED\n  | CHANGE [COLUMN] [IF EXISTS] old_col_name new_col_name column_definition\n        [FIRST|AFTER col_name]\n  | MODIFY [COLUMN] [IF EXISTS] col_name column_definition\n        [FIRST | AFTER col_name]\n  | DROP [COLUMN] [IF EXISTS] col_name [RESTRICT|CASCADE]\n  | DROP [CONSTRAINT] PRIMARY KEY\n  | DROP {INDEX|KEY} [IF EXISTS] index_name\n  | DROP FOREIGN KEY [IF EXISTS] fk_symbol\n  | DROP CONSTRAINT [IF EXISTS] constraint_name\n  | DISABLE KEYS\n  | ENABLE KEYS\n  | RENAME [TO] new_tbl_name\n  | ORDER BY col_name [, col_name] ...\n  | RENAME COLUMN [IF EXISTS] old_col_name TO new_col_name\n  | RENAME {INDEX|KEY} old_index_name TO new_index_name\n  | CONVERT TO CHARACTER SET charset_name [COLLATE collation_name]\n  | [DEFAULT] CHARACTER SET [=] charset_name\n  | [DEFAULT] COLLATE [=] collation_name\n  | DISCARD TABLESPACE\n  | IMPORT TABLESPACE\n  | ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n  | LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n  | FORCE\n  | partition_options\n  | CONVERT TABLE normal_table TO partition_definition [{WITH | WITHOUT} VALIDATION]\n  | CONVERT PARTITION partition_name TO TABLE tbl_name\n  | ADD PARTITION [IF NOT EXISTS] (partition_definition)\n  | DROP PARTITION [IF EXISTS] partition_names\n  | TRUNCATE PARTITION partition_names\n  | COALESCE PARTITION number\n  | REORGANIZE PARTITION [partition_names INTO (partition_definitions)]\n  | ANALYZE PARTITION partition_names\n  | CHECK PARTITION partition_names\n  | OPTIMIZE PARTITION partition_names\n  | REBUILD PARTITION partition_names\n  | REPAIR PARTITION partition_names\n  | EXCHANGE PARTITION partition_name WITH TABLE tbl_name [{WITH | WITHOUT} VALIDATION]\n  | REMOVE PARTITIONING\n  | ADD SYSTEM VERSIONING\n  | DROP SYSTEM VERSIONING\n\nindex_col_name:\n    col_name [(length)] [ASC | DESC]\n\nindex_type:\n    USING {BTREE | HASH | RTREE}\n\nindex_option:\n    KEY_BLOCK_SIZE [=] value\n  | index_type\n  | WITH PARSER parser_name\n  | VISIBLE\n  | COMMENT ''string''\n  | CLUSTERING={YES | NO}\n  | { IGNORED | NOT IGNORED }\n  | DISTANCE={EUCLIDEAN | COSINE}\n  | M=number\n\n  table_option [[,] table_option] ...\n\nDescription\n-----------\n\nALTER TABLE enables you to change the structure of an existing table. For example, you can add or delete columns, create or destroy indexes, change the type of existing columns, or rename columns or the table itself. You can also change the comment for the table and the storage engine of the table.\n\nIf another connection is using the table, a metadata lock is active, and this statement will wait until the lock is released. This is also true for non-transactional tables.\n\nWhen adding a UNIQUE index on a column (or a set of columns) which have duplicated values, an error will be produced and the statement will be stopped. To suppress the error and force the creation of UNIQUE indexes, discarding duplicates, the IGNORE option can be specified. This can be useful if a column (or a set of columns) should be UNIQUE but it contains duplicate values; however, this technique provides no control on which rows are preserved and which are deleted. Also, note that IGNORE is accepted but ignored in ALTER TABLE ... EXCHANGE PARTITION statements.\n\nThis statement can also be used to rename a table. For details see RENAME TABLE.\n\nWhen an index is created, the storage engine may use a configurable buffer in the process. Incrementing the buffer speeds up the index creation. Aria and MyISAM allocate a buffer whose size is defined by aria_sort_buffer_size or myisam_sort_buffer_size, also used for REPAIR TABLE. InnoDB allocates three buffers whose size is defined by innodb_sort_buffer_size.\n\nPrivileges\n\nExecuting the ALTER TABLE statement generally requires at least the ALTER privilege for the table or the database. If you are renaming a table, this also requires the DROP, CREATE and INSERT privileges for the table or the database.\n\nOnline DDL\n\nOnline DDL is supported with the ALGORITHM and LOCK clauses.\n\nSee InnoDB Online DDL Overview for more information on online DDL with InnoDB.\n\nALTER ONLINE TABLE\n\nALTER ONLINE TABLE also works for partitioned tables.\n\nALTER ONLINE TABLE ... is equivalent to the ALTER TABLE ... LOCK = NONE.\n\nSee the LOCK alter specification for more information.\n\nWAIT/NOWAIT\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nIF EXISTS\n\nThe IF EXISTS and IF NOT EXISTS clauses are available for the following clauses:\n\n``sql\nADD COLUMN       [IF NOT EXISTS]\nADD INDEX        [IF NOT EXISTS]\nADD FOREIGN KEY  [IF NOT EXISTS]\nADD PARTITION    [IF NOT EXISTS]\nCREATE INDEX     [IF NOT EXISTS]\nDROP COLUMN      [IF EXISTS]\nDROP INDEX       [IF EXISTS]\nDROP FOREIGN KEY [IF EXISTS]\nDROP PARTITION   [IF EXISTS]\nCHANGE COLUMN    [IF EXISTS]\nMODIFY COLUMN    [IF EXISTS]\nDROP INDEX       [IF EXISTS]\n`\n\nWhen IF EXISTS and IF NOT EXISTS are used in clauses, queries will not report errors when the condition is triggered for that clause. A warning with the same message text will be issued and the ALTER will move on to the next clause in the statement (or end if finished).\n\nIf this is directive is used after ALTER ... TABLE, you don''t get an error if the table doesn''t exist. Example:\n\n`sql\nCREATE TABLE t (i INT);\nALTER TABLE IF EXISTS t RENAME COLUMN IF EXISTS i TO k;\n`\n\nColumn Definitions\n\nSee CREATE TABLE: Column Definitions for information about column definitions.\n\nIndex Definitions\n\nSee CREATE TABLE: Index Definitions for information about index definitions.\n\nThe CREATE INDEX and DROP INDEX statements can also be used to add or remove an index.\n\nCharacter Sets and Collations\n\n`sql\nCONVERT TO CHARACTER SET charset_name [COLLATE collation_name]\n[DEFAULT] CHARACTER SET [=] charset_name\n[DEFAULT] COLLATE [=] collation_name\n`\n\nSee Setting Character Sets and Collations for details on setting the character sets and collations.\n\nAlter Specifications\n\nTable Options\n\nSee CREATE TABLE: Table Options for information about table options.\n\nADD COLUMN\n\n`sql\n... ADD COLUMN [IF NOT EXISTS]  (col_name column_definition,...)\n`\n\nAdds a column to the table. The syntax is the same as in CREATE TABLE. If you are using IF NOT_EXISTS the column will not be added if it was not there already. This is very useful when doing scripts to modify tables.\n\nThe FIRST and AFTER clauses affect the physical order of columns in the datafile. Use FIRST to add a column in the first (leftmost) position, or AFTER followed by a column name to add the new column in any other position. Note that, nowadays, the physical position of a column is usually irrelevant.\n\nSee also Instant ADD COLUMN for InnoDB.\n\nDROP COLUMN\n\n`sql\n... DROP COLUMN [IF EXISTS] col_name [CASCADE|RESTRICT]\n`\n\nDrops the column from the table. If you are using IF EXISTS you will not get an error if the column didn''t exist. If the column is part of any index, the column will be dropped from them, except if you add a new column with identical name at the same time. The index will be dropped if all columns from the index were dropped. If the column was used in a view or trigger, you will get an error next time the view or trigger is accessed. Dropping a column that is part of a multi-column UNIQUE constraint is not permitted. For example:\n\n`sql\nCREATE TABLE a (\n  a int,\n  b int,\n  primary key (a,b)\n);\n\nALTER TABLE x DROP COLUMN a;\n[42000][1072] Key column ''A'' doesn''t exist in table\n`\n\nThe reason is that dropping column a would result in the new constraint that all values in column b be unique. In order to drop the column, an explicit DROP PRIMARY KEY and ADD PRIMARY KEY would be required.\n\nMariaDB supports instant DROP COLUMN. DROP COLUMN of an indexed column would imply DROP INDEX (and in the case of a non-UNIQUE multi-column index, possibly ADD INDEX). These will not be allowed with ALGORITHM=INSTANT, but unlike prior versions, they can be allowed with ALGORITHM=NOCOPY\n\nRESTRICT and CASCADE are allowed to make porting from other database systems easier. In MariaDB, they do nothing.\n\nMODIFY COLUMN\n\nAllows you to modify the type of a column. The column will be at the same place as the original column and all indexes on the column will be kept. Note that when modifying column, you should specify all attributes for the new column.\n\n`sql\nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY((a));\nALTER TABLE t1 MODIFY a BIGINT UNSIGNED AUTO_INCREMENT;\n`\n\nCHANGE COLUMN\n\nWorks like MODIFY COLUMN except that you can also change the name of the column. The column will be at the same place as the original column and all index on the column will be kept.\n\n`sql\nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a));\nALTER TABLE t1 CHANGE a b BIGINT UNSIGNED AUTO_INCREMENT;\n`\n\nALTER COLUMN\n\nThis lets you change column options.\n\n`sql\nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, b varchar(50), PRIMARY KEY(a));\nALTER TABLE t1 ALTER b SET DEFAULT ''hello'';\n`\n\nRENAME INDEX/KEY\n\nYou can rename an index using the RENAME INDEX (or RENAME KEY) syntax:\n\n`sql\nALTER TABLE t1 RENAME INDEX i_old TO i_new;\n`\n\nRENAME INDEX/KEY is not available.\n\nRENAME COLUMN\n\nYou can rename a column using the RENAME COLUMN syntax:\n\n`sql\nALTER TABLE t1 RENAME COLUMN c_old TO c_new;\n`\n\nRENAME COLUMN is not available.\n\nADD PRIMARY KEY\n\nAdds a primary key. For PRIMARY KEY indexes, you can specify a name for the index, but it is silently ignored, and the name of the index is always PRIMARY. See Getting Started with Indexes: Primary Key for more information.\n\nDROP PRIMARY KEY\n\nDrops a primary key. For PRIMARY KEY indexes, you can specify a name for the index, but it is silently ignored, and the name of the index is always PRIMARY. See Getting Started with Indexes: Primary Key for more information.\n\nADD FOREIGN KEY\n\nAdds a foreign key. For FOREIGN KEY indexes, a reference definition must be provided. For FOREIGN KEY indexes, you can specify a name for the constraint, using the CONSTRAINT keyword. That name will be used in error messages.\n\nFirst, you have to specify the name of the target (parent) table and a column or a column list which must be indexed and whose values must match to the foreign key''s values. The MATCH clause is accepted to improve the compatibility with other DBMS''s, but has no meaning in MariaDB. The ON DELETE and ON UPDATE clauses specify what must be done when a DELETE (or a REPLACE) statements attempts to delete a referenced row from the parent table, and when an UPDATE statement attempts to modify the referenced foreign key columns in a parent table row, respectively. The following options are allowed:\n\n RESTRICT: The delete/update operation is not performed. The statement terminates with a 1451 error (SQLSTATE ''2300'').\n NO ACTION: Synonym for RESTRICT.\n CASCADE: The delete/update operation is performed in both tables.\n SET NULL: The update or delete goes ahead in the parent table, and the corresponding foreign key fields in the child table are set to NULL. (They must not be defined as NOT NULL for this to succeed).\n SET DEFAULT: This option is implemented only for the legacy PBXT storage engine, which is disabled by default and no longer maintained. It sets the child table''s foreign key fields to their DEFAULT values when the referenced parent table key entries are updated or deleted.\n\nIf either clause is omitted, the default behavior for the omitted clause is RESTRICT.\n\nSee Foreign Keys for more information.\n\nDROP FOREIGN KEY\n\nDrops a foreign key. See Foreign Keys for more information.\n\nADD INDEX\n\nAdds a plain index. Plain indexes are regular indexes that are not unique, and are not acting as a primary key or a foreign key. They are also not the "specialized" FULLTEXT or SPATIAL indexes. For limits on InnoDB indexes, see InnoDB Limitations. See Getting Started with Indexes: Plain Indexes for more information.\n\nDROP INDEX\n\nDrops a plain index. Plain indexes are regular indexes that are not unique, and are not acting as a primary key or a foreign key. They are also not the "specialized" FULLTEXT or SPATIAL indexes. See Getting Started with Indexes: Plain Indexes for more information.\n\nADD UNIQUE INDEX\n\nAdds a unique index. The UNIQUE keyword means that the index will not accept duplicated values, except for NULLs. An error will raise if you try to insert duplicate values in a UNIQUE index. For UNIQUE indexes, you can specify a name for the constraint, using the CONSTRAINT keyword. That name will be used in error messages. See Getting Started with Indexes: Unique Index for more information.\n\nDROP UNIQUE INDEX\n\nDrops a unique index. The UNIQUE keyword means that the index will not accept duplicated values, except for NULLs. An error will raise if you try to insert duplicate values in a UNIQUE index. For UNIQUE indexes, you can specify a name for the constraint, using the CONSTRAINT keyword. That name will be used in error messages. See Getting Started with Indexes: Unique Index for more information.\n\nADD FULLTEXT INDEX\n\nAdds a FULLTEXT index. See Full-Text Indexes for more information.\n\nDROP FULLTEXT INDEX\n\nDrops a FULLTEXT index. See Full-Text Indexes for more information.\n\nADD SPATIAL INDEX\n\nAdds a SPATIAL index. See SPATIAL INDEX for more information.\n\nDROP SPATIAL INDEX\n\nDrops a SPATIAL index. See SPATIAL INDEX for more information.\n\nENABLE/ DISABLE KEYS\n\nDISABLE KEYS disables all non unique keys for the table for storage engines that support this (at least MyISAM and Aria). This can be used to speed up inserts into empty tables. ENABLE KEYS enables all disabled keys.\n\nRENAME TO\n\nRenames a table. See also RENAME TABLE.\n\nADD CONSTRAINT\n\nModifies the table adding a constraint on a particular column or columns.\n\n`sql\nALTER TABLE table_name \nADD CONSTRAINT [constraint_name] CHECK(\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-table/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (616, 39, 'Online Schema Change', 'Description\n-----------\n\nThis functionality is available from MariaDB 11.4.\n\nThe term _Online Schema Change_ refers to the ability to update the table schema without blocking concurrent DML[^1] statements for the duration of the schema change.\n\nExamples\n--------\n\nALTER TABLE items ADD ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-table/online-schema-change', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-table/online-schema-change');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (617, 39, 'ALTER TABLESPACE', 'Description\n-----------\n\nThe ALTER TABLESPACE statement is not supported by MariaDB. It was originally inherited from MySQL NDB Cluster. In MySQL 5.7 and later, the statement is also supported for InnoDB. However, MariaDB has chosen not to include that specific feature. See MDEV-19294 for more information.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-tablespace', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/alter/alter-tablespace');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (618, 39, 'Atomic DDL', 'Description\n-----------\n\nWe improved readability for DDL (Data Definition Language) operations to make most of them atomic, and the rest crash-safe, even if the server crashes in the middle of an operation.\n\nThese improvements were made in MariaDB 10.6.1.\n\nThe design of Atomic/Crash-safe DDL (MDEV-17567) allows it to work with all storage engines.\n\nDefinitions\n\n Atomic means that either the operation succeeds (and is logged to the binary log or is completely reversed.\n Crash-safe means that in case of a crash, after the server has restarted, all tables are consistent, there are no temporary files or tables on disk and the binary log matches the status of the server.\n DDL Data definition language.\n DML Data manipulation language.\n ''DDL recovery log'' or ''DDL log'' for short, is the new log file, ddl_recovery.log by default, that stores all DDL operations in progress. This is used to recover the state of the server in case of sudden crash.\n\nBackground\n\nBefore 10.6, in case of a crash, there was a small possibility that one of the following things could happen:\n\n There could be temporary tables starting with #sql-alter or #sql-shadow or temporary files ending with '''' left.\n The table in the storage engine and the table''s .frm file could be out of sync.\n During a multi-table rename, only some of the tables were renamed.\n\nWhich DDL Operations are Now Atomic\n\n CREATE TABLE, except when used with CREATE OR REPLACE, which is only crash safe.\n RENAME TABLE and RENAME TABLES.\n CREATE VIEW\n CREATE SEQUENCE\n CREATE TRIGGER\n DROP TRIGGER\n DROP TABLE and DROP VIEW. Dropping multiple tables is only crash safe.\n ALTER TABLE\n ALTER SEQUENCE is not listed above as it is internally implemented as a DML.\n\nWhich DDL Operations are Now Crash Safe\n\nDROP TABLE of Multiple Tables.\n\nDROP TABLE over multiple tables is treated as if every DROP is a separate, atomic operation. This means that after a crash, all fully, or partly, dropped tables will be dropped and logged to the binary log. The undropped tables will be left untouched.\n\nCREATE OR REPLACE TABLE\n\nCREATE OR REPLACE TABLE foo is implemented as:\n\n``sql\nDROP TABLE IF EXISTS foo;\nCREATE TABLE foo ...\n`\n\nThis means that if there is a crash during CREATE TABLE then the original table ''foo'' will be dropped even if the new table was not created.\\\nIf the table was not re-created, the binary log will contain theDROP TABLE.\n\nDROP DATABASE\n\nDROP DATABASE is implemented as:\n\n`sql\n  DROP TABLE table\nLOOP OVER ALL tables\n`\n\nEach DROP TABLE is atomic, but in case of a crash, things will work the same way as DROP TABLE with multiple tables.\n\nAtomic with Different Storage Engines\n\nAtomic/Crash-safe DDL works with all storage engines that either have atomic DDLs internally or are able to re-execute DROP or RENAME in case of failure.\n\nThis should be true for most storage engines. The ones that still need some work are:\n\n The S3 storage engine.\n The partitioning engine. Partitioning should be atomic for most cases, but there are still some known issues that need to be tested and fixed.\n\nThe DDL Log Recovery File\n\nThe new startup option --log-ddl-recovery=path (ddl_recovery.log by default) can be used to specify the place for the DDL log file. This is mainly useful in the case when one has a filesystem on persistent memory, as there is a lot of sync on this file during DDL operations.\n\nThis file contains all DDL operations that are in progress.\n\nAt MariaDB server startup, the DDL log file is copied to a file with the same base name but with a backup.log suffix. This is mainly done to be able to find out what went wrong if recovery fails.\n\nIf the server crashes during recovery (unlikely but possible), the recovery will continue where it was before. The recovery will retry each entry up to 3 times before giving up and proceeding with the next entry.\n\nConclusions\n\n We believe that a clean separation of layers leads to an easier-to-maintain solution. The Atomic DDL implementation in MariaDB 10.6 introduced minimal changes to the storage engine API, mainly for native ALTER TABLE.\n In our InnoDB implementation, no file format changes were needed on top of the RENAME undo log that was introduced in MariaDB 10.2.19 for a backup-safe TRUNCATE re-implementation. Correct use of sound design principles (write-ahead logging and transactions; also file creation now follows the ARIES protocol) is sufficient. We removed the hacks (at most one CREATE or DROP per transaction) and correctly implemented rollback and purge` triggers for the InnoDB SYS_INDEXES table.\n Numerous DDL recovery bugs in InnoDB were found and fixed quickly thanks to rr-project.org. We are still working on one: data files must not be deleted before the DDL transaction is committed.\n\nThanks to Atomic/Crash-safe DDL, the MariaDB server is now much more stable and reliable in unstable environments. There is still ongoing work to fix the few remaining issues mentioned above to make all DDL operations Atomic.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/atomic-ddl', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/atomic-ddl');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (619, 39, 'CONSTRAINT', 'Syntax\n------\n\n[CONSTRAINT [symbol]] constraint_expression\n\nconstraint_expression:\n  | PRIMARY KEY [index_type] (index_col_name, ...) [index_option] ...\n  | FOREIGN KEY [index_name] (index_col_name, ...) \n       REFERENCES tbl_name (index_col_name, ...)\n       [ON DELETE reference_option]\n       [ON UPDATE reference_option]\n  | UNIQUE [INDEX|KEY] [index_name]\n       [index_type] (index_col_name, ...) [index_option] ...\n  | CHECK (check_constraints)\n\nindex_type:\n  USING {BTREE | HASH | RTREE}\n\nindex_col_name:\n  col_name [(length)] [ASC | DESC]\n\nindex_option:\n  | KEY_BLOCK_SIZE [=] value\n  | index_type\n  | WITH PARSER parser_name\n  | COMMENT ''string''\n  | CLUSTERING={YES|NO}\n\nreference_option:\n  RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT\n\nDescription\n-----------\n\nConstraints provide restrictions on the data you can add to a table. This allows to enforce data integrity in MariaDB, rather than through application logic. When a statement violates a constraint, MariaDB throws an error.\n\nThere are four types of table constraints:\n\n PRIMARY KEY – Sets the column for referencing rows. Values must be UNIQUE and NOT NULL.&#x20;\n   This constraint is documented here.\n FOREIGN KEY – Sets the column to reference the primary key on another table.&#x20;\n   This constraint is documented here and, in more detail, here and here.\n UNIQUE – Requires values in column or columns only occur once in the table.&#x20;\n   This constraint is documented here.\n CHECK – Checks whether the data meets the given condition.&#x20;\n   This constraint is documented here and, in more detail, here.\n\nThe Information Schema TABLE_CONSTRAINTS Table contains information about tables that have constraints:\n\n``sql\nSELECT CONSTRAINT_SCHEMA, CONSTRAINT_NAME, TABLE_NAME, CONSTRAINT_TYPE  FROM information_schema.TABLE_CONSTRAINTS LIMIT 5;\n+-------------------+----------------------+---------------+-----------------+\n| CONSTRAINT_SCHEMA | CONSTRAINT_NAME      | TABLE_NAME    | CONSTRAINT_TYPE |\n+-------------------+----------------------+---------------+-----------------+\n| nation            | PRIMARY              | countries     | PRIMARY KEY     |\n| nation            | country_code2        | countries     | UNIQUE          |\n| nation            | country_code3        | countries     | UNIQUE          |\n| nation            | countries_ibfk_1     | countries     | FOREIGN KEY     |\n| nation            | PRIMARY              | regions       | PRIMARY KEY     |\n+-------------------+----------------------+---------------+-----------------+\n`\n\nFOREIGN KEY Constraints\n\nInnoDB supports foreign key constraints. The syntax for a foreign key constraint definition in InnoDB looks like this:\n\n`sql\n[CONSTRAINT [symbol]] FOREIGN KEY\n    [index_name] (index_col_name, ...)\n    REFERENCES tbl_name (index_col_name,...)\n    [ON DELETE reference_option]\n    [ON UPDATE reference_option]\n\nreference_option:\n    RESTRICT | CASCADE | SET NULL | NO ACTION\n`\n\nThe symbol clause is optional. If you omit it, MariaDB automatically sets one.&#x20;\n\nThe Information Schema REFERENTIAL_CONSTRAINTS table has more information about foreign keys:\n\n`sql\nSELECT  FROM information_schema.REFERENTIAL_CONSTRAINTS LIMIT 2 \\G\n*********************** 1. row *********************\n       CONSTRAINT_CATALOG: def\n        CONSTRAINT_SCHEMA: nation\n          CONSTRAINT_NAME: countries_ibfk_1\nUNIQUE_CONSTRAINT_CATALOG: def\n UNIQUE_CONSTRAINT_SCHEMA: nation\n   UNIQUE_CONSTRAINT_NAME: PRIMARY\n             MATCH_OPTION: NONE\n              UPDATE_RULE: RESTRICT\n              DELETE_RULE: RESTRICT\n               TABLE_NAME: countries\n    REFERENCED_TABLE_NAME: regions\n********************* 2. row ***********************\n       CONSTRAINT_CATALOG: def\n        CONSTRAINT_SCHEMA: nation\n          CONSTRAINT_NAME: regions_ibfk_1\nUNIQUE_CONSTRAINT_CATALOG: def\n UNIQUE_CONSTRAINT_SCHEMA: nation\n   UNIQUE_CONSTRAINT_NAME: PRIMARY\n             MATCH_OPTION: NONE\n              UPDATE_RULE: RESTRICT\n              DELETE_RULE: RESTRICT\n               TABLE_NAME: regions\n    REFERENCED_TABLE_NAME: continents\n`\n\nFrom MariaDB 12.1, multiple tables in the same database are allowed to use the same constraint name.\n\nConsider this example, which creates two tables, then adds constraints to them:\n\n`sql\nCREATE TABLE t1(a int, b int, key(a),key(b))engine=innodb;\nCREATE TABLE t2(a int, b int, key(a),key(b))engine=innodb;\nALTER TABLE t2 ADD CONSTRAINT c FOREIGN KEY (b) REFERENCES t1(a);\nALTER TABLE t1 ADD CONSTRAINT c FOREIGN KEY (b) REFERENCES t2(a);\n`\n\nPreviously, the last statement failed because of duplicate constraint names:\n\n`\nmysqltest: At line 5: query ''alter table t1 add constraint c foreign key (b) references t2(a)'' failed: ER_CANT_CREATE_TABLE (1005): Can''t create table test.t1 (errno: 121 "Duplicate key on write or update")\n`\n\nNow, the statement works, because internally, names are assigned that aren''t duplicates. (User-visible names can be duplicates, but internally they''re prefixed with the schema and table names.)\n\nCHECK Constraints\n\nConstraints are enforced. You can define constraints in 2 different ways:\n\n CHECK(expression) given as part of a column definition.\n* CONSTRAINT [constraint_name] CHECK (expression)\n\nBefore a row is inserted or updated, all constraints are evaluated in the order they are defined. If any constraint expression returns false, then the row is not inserted or updated. You can use most deterministic functions in a constraint, including UDFs.\n\n`sql\nCREATE TABLE t1 (a INT CHECK (a>2), b INT CHECK (b>2), CONSTRAINT a_greater CHECK (a>b));\n`\n\nIf you use the CONSTRAINT [constraint_name] CHECK (expression) format and don''t give a name to the constraint, the constraint gets an automatically generated name. This is done so that you can later delete it with ALTER TABLE DROP _constraint_.\n\nYou can disable all constraint expression checks by setting the check_constraint_checks variable to OFF`. This is useful for example when loading a table that violates some constraints that you want to later find and fix in SQL.\n\nReplication\n\nIn row-based replication, only the master checks constraints, and failed statements are not replicated. In statement-based replication, the slaves also check constraints. Constraints should therefore be identical, as well as deterministic, in a replication environment.\n\nAuto_increment\n\nauto_increment columns are not permitted in check constraints.\n\nExamples\n--------\n\nCREATE TABLE product (category INT NOT NULL, id INT NOT NULL,\n                      price DECIMAL,\n                      PRIMARY KEY(category, id)) ENGINE=INNODB;\nCREATE TABLE customer (id INT NOT NULL,\n                       PRIMARY KEY (id)) ENGINE=INNODB;\nCREATE TABLE product_order (NO INT NOT NULL AUTO_INCREMENT,\n                            product_category INT NOT NULL,\n                            product_id INT NOT NULL,\n                            customer_id INT NOT NULL,\n                            PRIMARY KEY(NO),\n                            INDEX (product_category, product_id),\n                            FOREIGN KEY (product_category, product_id)\n                              REFERENCES product(category, id)\n                              ON UPDATE CASCADE ON DELETE RESTRICT,\n                            INDEX (customer_id),\n                            FOREIGN KEY (customer_id)\n                              REFERENCES customer(id)) ENGINE=INNODB;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/constraint', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/constraint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (620, 39, 'CREATE', 'Description\n-----------\n\ncreate-catalog.md\n\ncreate-database.md\n\ncreate-event.md\n\ncreate-function.md\n\ncreate-function-udf.md\n\ncreate-index.md\n\ncreate-logfile-group.md\n\ncreate-package.md\n\ncreate-package-body.md\n\ncreate-procedure.md\n\ncreate-role.md\n\ncreate-sequence.md\n\ncreate-server.md\n\ncreate-table.md\n\ncreate-table-with-vectors.md\n\ncreate-tablespace.md\n\ncreate-trigger.md\n\ncreate-user.md\n\ncreate-view.md\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/README', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (621, 39, 'CREATE DATABASE', 'Syntax\n------\n\nCREATE [OR REPLACE] {DATABASE | SCHEMA} [IF NOT EXISTS] db_name\n    [create_specification] ...\n\ncreate_specification:\n    [DEFAULT] CHARACTER SET [=] charset_name\n  | [DEFAULT] COLLATE [=] collation_name\n  | COMMENT [=] ''comment''\n\nDescription\n-----------\n\nCREATE DATABASE creates a database with the given name. To use this statement, you need the CREATE privilege for the database. CREATE SCHEMA is a synonym for CREATE DATABASE.\n\nFor valid identifiers to use as database names, see Identifier Names.\n\nOR REPLACE\n\nIf the optional OR REPLACE clause is used, it acts as a shortcut for:\n\n``sql\nDROP DATABASE IF EXISTS db_name;\nCREATE DATABASE db_name ...;\n`\n\nIF NOT EXISTS\n\nWhen the IF NOT EXISTS clause is used, MariaDB will return a warning instead of an error if the specified database already exists.\n\nCOMMENT\n\nThe maximum length of a comment is 1024 bytes. If the comment length exceeds this length, an error/warning code 4144 is thrown. The database comment is also added to the db.opt` file, as well as to the information_schema.schemata table.\n\nComments added for databases do not exist.\n\nExamples\n--------\n\nCREATE DATABASE db1;\nQuery OK, 1 row affected (0.18 sec)\n\nCREATE DATABASE db1;\nERROR 1007 (HY000): Can''t create database ''db1''; database exists\n\nCREATE OR REPLACE DATABASE db1;\nQuery OK, 2 rows affected (0.00 sec)\n\nCREATE DATABASE IF NOT EXISTS db1;\nQuery OK, 1 row affected, 1 warning (0.01 sec)\n\nSHOW WARNINGS;\n+-------+------+----------------------------------------------+\n| Level | Code | Message                                      |\n+-------+------+----------------------------------------------+\n| Note  | 1007 | Can''t create database ''db1''; database exists |\n+-------+------+----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-database', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-database');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (622, 39, 'CREATE EVENT', 'Syntax\n------\n\nCREATE [OR REPLACE]\n    [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n    EVENT \n    [IF NOT EXISTS]\n    event_name    \n    ON SCHEDULE schedule\n    [ON COMPLETION [NOT] PRESERVE]\n    [ENABLE | DISABLE | DISABLE ON SLAVE]\n    [COMMENT ''comment'']\n    DO sql_statement;\n\nschedule:\n    AT timestamp [+ INTERVAL interval] ...\n  | EVERY interval \n    [STARTS timestamp [+ INTERVAL interval] ...] \n    [ENDS timestamp [+ INTERVAL interval] ...]\n\ninterval:\n    quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n              WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n              DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n\nDescription\n-----------\n\nThis statement creates and schedules a new event. It requires the EVENT privilege for the schema in which the event is to be created.\n\nThe minimum requirements for a valid CREATE EVENT statement are as follows:\n\n The keywords CREATE EVENT plus an event name, which uniquely identifies the event in the current schema.\n An ON SCHEDULE clause, which determines when and how often the event executes.\n* A DO clause, which contains the SQL statement to be executed by an event.\n\nHere is an example of a minimal CREATE EVENT statement:\n\n``sql\nCREATE EVENT myevent\n    ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n    DO\n      UPDATE myschema.mytable SET mycol = mycol + 1;\n`\n\nThe previous statement creates an event named myevent. This event executes once\\\n— one hour following its creation\\\n— by running an SQL statement that increments the value of the myschema.mytable table''s mycol column by 1.\n\nThe event_name must be a valid MariaDB identifier with a maximum length of 64 characters. It may be delimited using back ticks, and may be qualified with the name of a database schema. An event is associated with both a MariaDB user (the definer) and a schema, and its name must be unique among names of events within that schema. In general, the rules governing event names are the same as those for names of stored routines. See Identifier Names.\n\nIf no schema is indicated as part of event_name, the default (current) schema is assumed.\n\nFor valid identifiers to use as event names, see Identifier Names.\n\nOR REPLACE\n\nThe OR REPLACE clause works like this: If the event already exists, instead of an error being returned, the existing event will be dropped and replaced by the newly defined event.\n\nThe OR REPLACE clause is not available.\n\nIF NOT EXISTS\n\nIf the IF NOT EXISTS clause is used, MariaDB will return a warning instead of an error if the event already exists. Cannot be used together with OR REPLACE.\n\nON SCHEDULE\n\nThe ON SCHEDULE clause can be used to specify when the event must be triggered.\n\nAT\n\nIf you want to execute the event only once (one time event), you can use the AT keyword, followed by a timestamp. If you use CURRENT_TIMESTAMP, the event acts as soon as it is created. As a convenience, you can add one or more intervals to that timestamp. You can also specify a timestamp in the past, so that the event is stored but not triggered, until you modify it via ALTER EVENT.\n\nThe following example shows how to create an event that will be triggered tomorrow at a certain time:\n\n`sql\nCREATE EVENT example\nON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY + INTERVAL 3 HOUR\nDO something;\n`\n\nYou can also specify that an event must be triggered at a regular interval (recurring event). In such cases, use the EVERY clause followed by the interval.\n\nIf an event is recurring, you can specify when the first execution must happen via the STARTS clause and a maximum time for the last execution via the ENDS clause. STARTS and ENDS clauses are followed by a timestamp and, optionally, one or more intervals. The ENDS clause can specify a timestamp in the past, so that the event is stored but not executed until you modify it via ALTER EVENT.\n\nIn the following example, next month a recurring event will be triggered hourly for a week:\n\n`sql\nCREATE EVENT example\nON SCHEDULE EVERY 1 HOUR\nSTARTS CURRENT_TIMESTAMP + INTERVAL 1 MONTH\nENDS CURRENT_TIMESTAMP + INTERVAL 1 MONTH + INTERVAL 1 WEEK\nDO some_task;\n`\n\nIntervals consist of a quantity and a time unit. The time units are the same used for other statements and time functions, except that you can''t use microseconds for events. For simple time units, like HOUR or MINUTE, the quantity is an integer number, for example ''10 MINUTE''. For composite time units, like HOUR_MINUTE or HOUR_SECOND, the quantity must be a string with all involved simple values and their separators, for example ''2:30'' or ''2:30:30''.\n\nON COMPLETION \\[NOT] PRESERVE\n\nThe ON COMPLETION clause can be used to specify if the event must be deleted after its last execution (that is, after its AT or ENDS timestamp is past). By default, events are dropped when they are expired. To explicitly state that this is the desired behaviour, you can use ON COMPLETION NOT PRESERVE. Instead, if you want the event to be preserved, you can use ON COMPLETION PRESERVE.\n\nIn you specify ON COMPLETION NOT PRESERVE, and you specify a timestamp in the past for AT or ENDS clause, the event will be immediately dropped. In such cases, you will get a Note 1558: "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation".\n\nENABLE/DISABLE/DISABLE ON SLAVE\n\nEvents are ENABLEd by default. If you want to stop MariaDB from executing an event, you may specify DISABLE. When it is ready to be activated, you may enable it using ALTER EVENT. Another option is DISABLE ON SLAVE, which indicates that an event was created on a master and has been replicated to the slave, which is prevented from executing the event. If DISABLE ON SLAVE is specifically set, the event will be disabled everywhere. It will not be executed on the master or the slaves.\n\nCOMMENT\n\nThe COMMENT clause may be used to set a comment for the event. Maximum length for comments is 64 characters. The comment is a string, so it must be quoted. To see events comments, you can query the INFORMATION_SCHEMA.EVENTS table (the column is named EVENT_COMMENT`).\n\nExamples\n--------\n\nCREATE EVENT myevent\n    ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n    DO\n      UPDATE myschema.mytable SET mycol = mycol + 1;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-event', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-event');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (623, 39, 'CREATE FUNCTION', 'Syntax\n------\n\nCREATE [OR REPLACE]\n    [DEFINER = {user | CURRENT_USER | role | CURRENT_ROLE }]\n    [AGGREGATE] FUNCTION [IF NOT EXISTS] func_name ([func_parameter[,...]])\n    RETURNS type\n    [characteristic ...]\n    func_body\n\nfunc_parameter:\n    [ OUT | INOUT | IN OUT ] param_name type |\n    [ IN ] param_name type [DEFAULT value or expression]\n\ntype:\n    Any valid MariaDB data type\n\ncharacteristic:\n    LANGUAGE SQL\n  | [NOT] DETERMINISTIC\n  | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n  | SQL SECURITY { DEFINER | INVOKER }\n  | COMMENT ''string''\n\nfunc_body:\n    Valid SQL procedure statement\n\nDescription\n-----------\n\nUse the CREATE FUNCTION statement to create a new stored function. You must have the CREATE ROUTINE database privilege to use CREATE FUNCTION. A function takes any number of arguments and returns a value from the function body. The function body can be any valid SQL expression as you would use, for example, in any select expression. If you have the appropriate privileges, you can call the function exactly as you would any built-in function. See Security below for details on privileges.\n\nYou can also use a variant of the CREATE FUNCTION statement to install a user-defined function (UDF) defined by a plugin. See CREATE FUNCTION (UDF) for details.\n\nYou can use a SELECT statement for the function body by enclosing it in parentheses, exactly as you would to use a subselect for any other expression. The SELECT statement must return a single value. If more than one column is returned when the function is called, error 1241 results. If more than one row is returned when the function is called, error 1242 results. Use a LIMIT clause to ensure only one row is returned.\n\nYou can also replace the RETURN clause with a BEGIN...END compound statement. The compound statement must contain a RETURN statement. When the function is called, the RETURN statement immediately returns its result, and any statements after RETURN are effectively ignored.\n\nBy default, a function is associated with the current database. To associate the function explicitly with a given database, specify the fully-qualified name as db_name.func_name when you create it. If the function name is the same as the name of a built-in function, you must use the fully qualified name when you call it.\n\nThe parameter list enclosed within parentheses must always be present. If there are no parameters, an empty parameter list of () should be used. Parameter names are not case-sensitive.\n\nEach parameter can be declared to use any valid data type, except that the COLLATE attribute cannot be used.\n\nFor valid identifiers to use as function names, see Identifier Names.\n\nRETURN\n\nThe RETURN clause can return a function body. In newer versions of MariaDB, it can also return a cursor (using SYS_REFCURSOR).\n\nRETURN func_body\n\nThe RETURN clause can return a function body (a valid SQL PROCEDURE statement).\n\nRETURN SYS_REFCURSOR\n\nIt can also return a cursor, if the function was declared with a SYS_REFCURSOR variable, like this:\n\n``sql\nCREATE FUNCTION f1 RETURN SYS_REFCURSOR AS\n  c SYS_REFCURSOR;\nBEGIN\n  OPEN c FOR SELECT a FROM t1 ORDER BY a;\n  RETURN c;\nEND;\n/\n`\n\nAlternatively, a cursor can be returned in an OUT parameter, see this section.\n\nRETURN func_body\n\nThe RETURN clause can return a function body (a valid SQL PROCEDURE statement).\n\nAGGREGATE\n\nIt is possible to create stored aggregate functions as well. See Stored Aggregate Functions for details.\n\nIN | OUT | INOUT | IN OUT\n\nOUT, INOUT and its equivalent IN OUT, are only valid if called from SET and not SELECT. These quantifiers are especially useful for creating functions with more than one return value. This allows functions to be more complex and nested.\n\n`sql\nDELIMITER $$\nCREATE FUNCTION add_func3(IN a INT, IN b INT, OUT c INT) RETURNS INT\nBEGIN\n  SET c = 100;\n  RETURN a + b;\nEND;\n$$\nDELIMITER ;\n \nSET @a = 2;\nSET @b = 3;\nSET @c = 0;\nSET @res= add_func3(@a, @b, @c);\n\nSELECT add_func3(@a, @b, @c);\nERROR 4186 (HY000): OUT or INOUT argument 3 for function add_func3 is not allowed here\n\nDELIMITER $$\nCREATE FUNCTION add_func4(IN a INT, IN b INT, d INT) RETURNS INT\nBEGIN\n  DECLARE c, res INT;\n  SET res = add_func3(a, b, c) + d;\n  if (c > 99) then\n    return  3;\n  else\n    return res;\n  end if;\nEND;\n$$\n\nDELIMITER ;\n\nSELECT add_func4(1,2,3);\n+------------------+\n| add_func4(1,2,3) |\n+------------------+\n|                3 |\n+------------------+\n`\n\nQuantifiers are not available.\n\nA cursor can be returned, like this:\n\n`sql\nCREATE TABLE t1 (a INT);\nINSERT INTO t1 VALUES (10),(20);\n \nCREATE FUNCTION f1 RETURN SYS_REFCURSOR AS\n  c SYS_REFCURSOR;\nBEGIN\n  OPEN c FOR SELECT a FROM t1 ORDER BY a;\n  RETURN c;\nEND;\n/\n \nCREATE PROCEDURE p1 AS\n  a INT;\n  c SYS_REFCURSOR DEFAULT f1();\nBEGIN\n  LOOP\n    FETCH c INTO a;\n    EXIT WHEN c%NOTFOUND;\n    dbms_output.put_line(a);\n  END LOOP;\n  CLOSE c;\n  END;\n/\n \nCALL p1();\n`\n\nThis feature is not available.\n\nRETURNS\n\nThe RETURNS clause specifies the return type of the function. NULL values are permitted with all return types.\n\nWhat happens if the RETURN clause returns a value of a different type? It depends on the SQL_MODE in effect at the moment of the function creation.\n\nIf the SQL_MODE is strict (STRICT_ALL_TABLES or STRICT_TRANS_TABLES flags are specified), a 1366 error will be produced.\n\nOtherwise, the value is coerced to the proper type. For example, if a function specifies an ENUM or SET value in the RETURNS clause, but the RETURN clause returns an integer, the value returned from the function is the string for the corresponding ENUM member of set of SET members.\n\nMariaDB stores the SQL_MODE system variable setting that is in effect at the time a routine is created, and always executes the routine with this setting in force, regardless of the server SQL mode in effect when the routine is invoked.\n\nLANGUAGE SQL\n\nLANGUAGE SQL is a standard SQL clause which can be used in MariaDB for portability. However that clause has no meaning, because SQL is the only supported language for stored functions.\n\nA function is deterministic if it can produce only one result for a given list of parameters. If the result may be affected by stored data, server variables, random numbers or any value that is not explicitly passed, then the function is not deterministic. Also, a function is non-deterministic if it uses nondeterministic functions like NOW() or CURRENT_TIMESTAMP(). The optimizer may choose a faster execution plan if it known that the function is deterministic. In such cases, you should declare the routine using the DETERMINISTIC keyword. If you want to explicitly state that the function is not deterministic (which is the default) you can use the NOT DETERMINISTIC keywords.\n\nIf you declare a non-deterministic function as DETERMINISTIC, you may get incorrect results. If you declare a deterministic function as NOT DETERMINISTIC, in some cases the queries will be slower.\n\nOR REPLACE\n\nIf the optional OR REPLACE clause is used, it acts as a shortcut for:\n\n`sql\nDROP FUNCTION IF EXISTS function_name;\nCREATE FUNCTION function_name ...;\n`\n\nwith the exception that any existing privileges for the function are not dropped.\n\nIF NOT EXISTS\n\nIf the IF NOT EXISTS clause is used, MariaDB will return a warning instead of an error if the function already exists. Cannot be used together with OR REPLACE.\n\n\\[NOT] DETERMINISTIC\n\nThe [NOT] DETERMINISTIC clause also affects binary logging, because the STATEMENT format can not be used to store or replicate non-deterministic statements.\n\nCONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA are informative clauses that tell the server what the function does. MariaDB does not check in any way whether the specified clause is correct. If none of these clauses are specified, CONTAINS SQL is used by default.\n\nMODIFIES SQL DATA\n\nMODIFIES SQL DATA means that the function contains statements that may modify data stored in databases. This happens if the function contains statements like DELETE, UPDATE, INSERT, REPLACE or DDL.\n\nREADS SQL DATA\n\nREADS SQL DATA means that the function reads data stored in databases, but does not modify any data. This happens if SELECT statements are used, but there no write operations are executed.\n\nCONTAINS SQL\n\nCONTAINS SQL means that the function contains at least one SQL statement, but it does not read or write any data stored in a database. Examples include SET or DO.\n\nNO SQL\n\nNO SQL means nothing, because MariaDB does not currently support any language other than SQL.\n\nOracle Mode\n\nA subset of Oracle''s PL/SQL language is supported in addition to the traditional SQL/PSM-based MariaDB syntax. See Oracle mode for details on changes when running Oracle mode.\n\nSecurity\n\nYou must have the EXECUTE privilege on a function to call it. MariaDB automatically grants the EXECUTE and ALTER ROUTINE privileges to the account that called CREATE FUNCTION, even if the DEFINER clause was used.\n\nEach function has an account associated as the definer. By default, the definer is the account\\\nthat created the function. Use the DEFINER clause to specify a different account as the\\\ndefiner. You must have the SET USER privilege to use the DEFINER clause. See Account Names for details on specifying accounts.\n\nThe SQL SECURITY clause specifies what privileges are used when a function is called. If SQL SECURITY is INVOKER, the function body will be evaluated using the privileges of the user calling the function. If SQL SECURITY is DEFINER, the function body is always evaluated using the privileges of the definer account. DEFINER is the default.\n\nThis allows you to create functions that grant limited access to certain data. For example, say you have a table that stores some employee information, and that you''ve granted SELECT privileges only on certain columns to the user account roger.\n\n`sql\nCREATE TABLE employees (name TINYTEXT, dept TINYTEXT, salary INT);\nGRANT SELECT (name, dept) ON employees TO roger;\n`\n\nTo allow the user the get the maximum salary for a department, define a function and grant the EXECUTE privilege:\n\n`sql\nCREATE FUNCTION max_salary (dept TINYTEXT) RETURNS INT RETURN\n  (SELECT MAX(salary) FROM employees WHERE employees.dept = dept);\nGRANT EXECUTE ON FUNCTION max_salary TO roger;\n`\n\nSince SQL SECURITY defaults to DEFINER, whenever the user roger calls this function, the subselect will execute with your privileges. As long as you have privileges to select the salary of each employee, the caller of the function will be able to get the maximum salary for each department without being able to see individual salaries.\n\nCharacter Sets and Collations\n\nFunction return types can be declared to use any valid character set and collation. If used, the COLLATE attribute needs to be preceded by a CHARACTER SET` attribute.\n\nIf the character set and collation are not specifically set in the statement, the database defaults at the time of creation will be used. If the database defaults change at a later stage, the stored function character set/collation will not be changed at the same time; the stored function needs to be dropped and recreated to ensure the same character set/collation as the database is used.\n\nExamples\n--------\n\nCREATE FUNCTION hello (s CHAR(20))\n    RETURNS CHAR(50) DETERMINISTIC\n    RETURN CONCAT(''Hello, '',s,''!'');\n\nSELECT hello(''world'');\n+----------------+\n| hello(''world'') |\n+----------------+\n| Hello, world!  |\n+----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-function', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-function');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (624, 39, 'CREATE INDEX', 'Syntax\n------\n\nCREATE [OR REPLACE] [UNIQUE|FULLTEXT|SPATIAL|VECTOR] INDEX \n  [IF NOT EXISTS] index_name\n    [index_type]\n    ON tbl_name (index_col_name,...)\n    [WAIT n | NOWAIT]\n    [index_option]\n    [algorithm_option | lock_option] ...\n\nindex_col_name:\n    col_name [(length)] [ASC | DESC]\n\nindex_type:\n    USING {BTREE | HASH | RTREE}\n\nindex_option:\n    [ KEY_BLOCK_SIZE [=] value\n  | index_type\n  | WITH PARSER parser_name\n  | COMMENT ''string''\n  | CLUSTERING={YES| NO} ]\n  [ IGNORED | NOT IGNORED ]\n  | DISTANCE={EUCLIDEAN| COSINE} ]\n  | M=number ]\n\nalgorithm_option:\n    ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n\nlock_option:\n    LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n\nDescription\n-----------\n\nThe CREATE INDEX statement is used to add indexes to a table. Indexes can be created at the same as the table, with the CREATE TABLE statement. In some cases, such as for InnoDB primary keys, doing so during creation is preferable, as adding a primary key will involve rebuilding the table.\n\nThe statement is mapped to an ALTER TABLE statement to create indexes. See ALTER TABLE. CREATE INDEX cannot be used to create a PRIMARY KEY; use ALTER TABLE instead.\n\nIf another connection is using the table, a metadata lock is active, and this statement will wait until the lock is released. This is also true for non-transactional tables.\n\nAnother shortcut, DROP INDEX, allows the removal of an index.\n\nFor valid identifiers to use as index names, see Identifier Names.\n\nFor limits on InnoDB indexes, see InnoDB Limitations.\n\nNote that KEY_BLOCK_SIZE is currently ignored in CREATE INDEX, although it is included in the output of SHOW CREATE TABLE.\n\nPrivileges\n\nExecuting the CREATE INDEX statement requires the INDEX privilege for the table or the database.\n\nOnline DDL\n\nOnline DDL is supported with the ALGORITHM and LOCK clauses.\n\nSee InnoDB Online DDL Overview for more information on online DDL with InnoDB.\n\nCREATE OR REPLACE INDEX\n\nIf the OR REPLACE clause is used and if the index already exists, then instead of returning an error, the server will drop the existing index and replace it with the newly defined index.\n\nCREATE INDEX IF NOT EXISTS\n\nIf the IF NOT EXISTS clause is used, then the index will only be created if an index with the same name does not already exist. If the index already exists, then a warning will be triggered by default.\n\nIndex Definitions\n\nSee CREATE TABLE: Index Definitions for information about index definitions.\n\nWAIT/NOWAIT\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nALGORITHM\n\nSee ALTER TABLE: ALGORITHM for more information.\n\nLOCK\n\nSee ALTER TABLE: LOCK for more information.\n\nProgress Reporting\n\nMariaDB provides progress reporting for CREATE INDEX statement for clients that support the new progress reporting protocol. For example, if you were using the mariadb client, then the progress report might look like this::\n\n``sql\nCREATE INDEX i ON tab (num);\nStage: 1 of 2 ''copy to tmp table''    46% of stage\n`\n\nThe progress report is also shown in the output of the SHOW PROCESSLIST statement and in the contents of the information_schema.PROCESSLIST table.\n\nSee Progress Reporting for more information.\n\nWITHOUT OVERLAPS\n\nThe WITHOUT OVERLAPS clause allows you to constrain a primary or unique index such that application-time periods cannot overlap. It can be used like this:\n\n`sql\nCREATE UNIQUE INDEX u ON rooms (room_number, p WITHOUT OVERLAPS);\n`\n\nWITHOUT OVERLAPS` is not available.\n\nExamples\n--------\n\nCREATE UNIQUE INDEX HomePhone ON Employees(Home_Phone);\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-index', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-index');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (625, 39, 'CREATE LOGFILE GROUP', 'Description\n-----------\n\nThe CREATE LOGFILE GROUP statement is not supported by MariaDB. It was originally inherited from MySQL NDB Cluster. See MDEV-19295 for more information.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-logfile-group', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-logfile-group');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (626, 39, 'CREATE PACKAGE BODY', 'Syntax\n------\n\nCREATE [ OR REPLACE ]\n    [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n    PACKAGE BODY\n    [ IF NOT EXISTS ]\n    [ db_name . ] package_name\n    [ package_characteristic... ]\n{ AS | IS }\n    package_implementation_declare_section\n    package_implementation_executable_section\nEND [ package_name]\n\npackage_implementation_declare_section:\n    package_implementation_item_declaration\n      [ package_implementation_item_declaration... ]\n      [ package_implementation_routine_definition... ]\n  | package_implementation_routine_definition\n      [ package_implementation_routine_definition...]\n\npackage_implementation_item_declaration:\n    variable_declaration ;\n\nvariable_declaration:\n    variable_name[,...] type [:= expr ]\n\npackage_implementation_routine_definition:\n    FUNCTION package_specification_function\n       [ package_implementation_function_body ] ;\n  | PROCEDURE package_specification_procedure\n       [ package_implementation_procedure_body ] ;\n\npackage_implementation_function_body:\n    { AS | IS } package_routine_body [func_name]\n\npackage_implementation_procedure_body:\n    { AS | IS } package_routine_body [proc_name]\n\npackage_routine_body:\n    [ package_routine_declarations ]\n    BEGIN\n      statements [ EXCEPTION exception_handlers ]\n    END\n\npackage_routine_declarations:\n    package_routine_declaration '';'' [package_routine_declaration '';'']...\n\npackage_routine_declaration:\n          variable_declaration\n        | condition_name CONDITION FOR condition_value\n        | user_exception_name EXCEPTION\n        | CURSOR_SYM cursor_name\n          [ ( cursor_formal_parameters ) ]\n          IS select_statement\n        ;\n\npackage_implementation_executable_section:\n          END\n        | BEGIN\n            statement ; [statement ; ]...\n          [EXCEPTION exception_handlers]\n          END\n\nexception_handlers:\n           exception_handler [exception_handler...]\n\nexception_handler:\n          WHEN_SYM condition_value [, condition_value]...\n            THEN_SYM statement ; [statement ;]...\n\ncondition_value:\n          condition_name\n        | user_exception_name\n        | SQLWARNING\n        | SQLEXCEPTION\n        | NOT FOUND\n        | OTHERS_SYM\n        | SQLSTATE [VALUE] sqlstate_value\n        | mariadb_error_code\n\nDescription\n-----------\n\nThe CREATE PACKAGE BODY statement creates the package body for a stored package. The package specification must be previously created using the CREATE PACKAGE statement.\n\nA package body provides implementations of the package public routines and can optionally have:\n\n package-wide private variables\n package private routines\n forward declarations for private routines\n an executable initialization section\n\n> Starting with MariaDB 13.0.1, package bodies can define RECORD and REF CURSOR types that can be used as:\n>\n>  Parameters (IN, OUT, INOUT) for procedures and functions defined in the package\n>  RETURN clause data types for package functions\n>\n> For detailed syntax and examples, see DECLARE TYPE.<br>\n\nExamples\n--------\n\nSET sql_mode=ORACLE;\nDELIMITER $$\nCREATE OR REPLACE PACKAGE employee_tools AS\n  FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n  PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n  PROCEDURE raiseSalaryStd(eid INT);\n  PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND;\n$$\nCREATE PACKAGE BODY employee_tools AS\n  -- package body variables\n  stdRaiseAmount DECIMAL(10,2):=500;\n\n  -- private routines\n  PROCEDURE log (eid INT, ecmnt TEXT) AS\n  BEGIN\n    INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);\n  END;\n\n  -- public routines\n  PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS\n    eid INT;\n  BEGIN\n    INSERT INTO employee (name, salary) VALUES (ename, esalary);\n    eid:= last_insert_id();\n    log(eid, ''hire '' || ename);\n  END;\n\n  FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2) AS\n    nSalary DECIMAL(10,2);\n  BEGIN\n    SELECT salary INTO nSalary FROM employee WHERE id=eid;\n    log(eid, ''getSalary id='' || eid || '' salary='' || nSalary);\n    RETURN nSalary;\n  END;\n\n  PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2)) AS\n  BEGIN\n    UPDATE employee SET salary=salary+amount WHERE id=eid;\n    log(eid, ''raiseSalary id='' || eid || '' amount='' || amount);\n  END;\n\n  PROCEDURE raiseSalaryStd(eid INT) AS\n  BEGIN\n    raiseSalary(eid, stdRaiseAmount);\n    log(eid, ''raiseSalaryStd id='' || eid);\n  END;\n\nBEGIN\n  -- This code is executed when the current session\n  -- accesses any of the package routines for the first time\n  log(0, ''Session '' || connection_id() || '' '' || current_user || '' started'');\nEND;\n$$\n\nDELIMITER ;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-package-body', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-package-body');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (627, 39, 'CREATE PACKAGE', 'Syntax\n------\n\nCREATE\n    [ OR REPLACE]\n    [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n    PACKAGE [ IF NOT EXISTS ]\n    [ db_name . ] package_name\n    [ package_characteristic ... ]\n    [ package_specification_element ... ]\nEND\n\npackage_characteristic:\n    COMMENT ''string''\n  | SQL SECURITY { DEFINER | INVOKER }\n\npackage_specification_element:\n    FUNCTION_SYM package_specification_function ;\n  | PROCEDURE_SYM package_specification_procedure ;\n\npackage_specification_function:\n    func_name [ ( func_param [, func_param]... ) ]\n    RETURNS type\n    [ package_routine_characteristic... ]\n\npackage_specification_procedure:\n    proc_name [ ( proc_param [, proc_param]... ) ]\n    [ package_routine_characteristic... ]\n\nfunc_param:\n    param_name [ IN | OUT | INOUT | IN OUT ] type\n\nproc_param:\n    param_name [ IN | OUT | INOUT | IN OUT ] type\n\ntype:\n    Any valid MariaDB explicit or anchored data type\n\npackage_routine_characteristic:\n      COMMENT  ''string''\n    | LANGUAGE SQL\n    | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n    | SQL SECURITY { DEFINER | INVOKER }\n\nDescription\n-----------\n\nCREATE PACKAGE creates the specification for a stored package (a collection of logically related stored objects). A stored package specification declares public routines (procedures and functions) of the package, but does not implement these routines.\n\nA package whose specification was created by the CREATE PACKAGE statement, should later be implemented using the CREATE PACKAGE BODY statement.\n\nFunction parameter quantifiers IN | OUT | INOUT | IN OUT\n\nMariaDB starting with 10.8.0\n\nThe function parameter quantifiers for IN, OUT, INOUT, and IN OUT are supported anywhere.\n\nThe function parameter quantifiers for IN, OUT, INOUT, and IN OUT are supported only in procedures.\n\nOUT, INOUT and its equivalent IN OUT, are only valid if called from SET and not SELECT. These quantifiers are especially useful for creating functions and procedures with more than one return value. This allows functions and procedures to be more complex and nested.\n\nExamples\n--------\n\nSET sql_mode=ORACLE; # unnecessary from MariaDB 11.4\nDELIMITER $$\nCREATE OR REPLACE PACKAGE employee_tools AS\n  FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n  PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n  PROCEDURE raiseSalaryStd(eid INT);\n  PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND;\n$$\nDELIMITER ;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-package', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-package');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (628, 39, 'CREATE SERVER', 'Syntax\n------\n\nCREATE [OR REPLACE] SERVER [IF NOT EXISTS] server_name\n    FOREIGN DATA WRAPPER wrapper_name\n    OPTIONS (option [, option] ...)\n\noption: <= MariaDB 11.6\n  { HOST character-literal\n  | DATABASE character-literal\n  | USER character-literal\n  | PASSWORD character-literal\n  | SOCKET character-literal\n  | OWNER character-literal\n  | PORT numeric-literal }\n\noption: >= MariaDB Enterprise Server 11.4 / Community Server 11.7\n  { HOST character-literal\n  | DATABASE character-literal\n  | USER character-literal\n  | PASSWORD character-literal\n  | SOCKET character-literal\n  | OWNER character-literal\n  | PORT numeric-literal\n  | PORT quoted-numerical-literal\n  | identifier character-literal}\n\nDescription\n-----------\n\nThis statement creates the definition of a server for use with the Spider, Connect, FEDERATED, or FederatedX storage engine. The CREATE SERVER statement creates a new row in the servers table within the mysql database. This statement requires the FEDERATED ADMIN privilege.\n\nThis statement creates the definition of a server for use with the Spider, Connect, FEDERATED, or FederatedX storage engine. The CREATE SERVER statement creates a new row in the servers table within the mysql database. This statement requires the SUPER privilege.\n\nThe server_name should be a unique reference to the server. Server definitions are global within the scope of the server, it is not possible to qualify the server definition to a specific database. server_name has a maximum length of 64 characters (names longer than 64 characters are silently truncated), and is case-insensitive. You may specify the name as a quoted string.\n\nThe wrapper_name may be quoted with single quotes. Supported values are:\n\n mysql\n mariadb&#x20;\n\nFor each option you must specify either a character literal or numeric literal. Character literals are UTF-8, support a maximum length of 64 characters and default to a blank (empty) string. String literals are silently truncated to 64 characters. Numeric literals must be a number between 0 and 9999, default value is 0.\n\nNote: The OWNER option is currently not applied, and has no effect on the ownership or operation of the server connection that is created.\n\nThe CREATE SERVER statement creates an entry in the mysql.servers table that can later be used with the CREATE TABLE statement when creating a Spider, Connect, FederatedX or FEDERATED table. The options that you specify will be used to populate the columns in the mysql.servers table. The table columns are Server_name, Host, Db, Username, Password, Port, and Socket.\n\nNote: When used with the Spider storage engine, connection information provided via CREATE SERVER may be overridden by table-level or engine-defined parameters. For information on connection configuration and precedence rules, see the Spider Storage Engine Core Concepts page.\n\nDROP SERVER removes a previously created server definition.\n\nCREATE SERVER is not written to the binary log, irrespective of the binary log format being used and therefore will not replicate.\n\nGalera replicates the CREATE SERVER, ALTER SERVER and DROP SERVER statements.\n\nGalera does not replicate the CREATE SERVER, ALTER SERVER and DROP SERVER statements.\n\nFor valid identifiers to use as server names, see Identifier Names.\n\nThe SHOW CREATE SERVER statement can be used to show the CREATE SERVER statement that created a given server definition.\n\nThe SHOW CREATE SERVER statement cannot be used to show the CREATE SERVER statement that created a given server definition.\n\nOR REPLACE\n\nIf the optional OR REPLACE clause is used, it acts as a shortcut for:\n\n``sql\nDROP SERVER IF EXISTS name;\nCREATE SERVER server_name ...;\n`\n\nIF NOT EXISTS\n\nIf the IF NOT EXISTS clause is used, MariaDB will return a warning instead of an error if the server already exists. Cannot be used together with OR REPLACE`.\n\nExamples\n--------\n\nCREATE SERVER s\nFOREIGN DATA WRAPPER mariadb\nOPTIONS (USER ''Remote'', HOST ''192.168.1.106'', DATABASE ''test'');\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-server', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-server');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (629, 39, 'CREATE TABLE', 'Description\n-----------\n\nUse the CREATE TABLE statement to create a table with the given name.\n\nIn its most basic form, the CREATE TABLE statement provides a table name followed by a list of columns, indexes, and constraints. By default, the table is created in the default database. Specify a database with db_name.tbl_name. If you quote the table name, you must quote the database name and table name separately as ` db_name.tbl_name . This is particularly useful for CREATE TABLE ... SELECT, because it allows creating a table in a database that contains data from other databases. See Identifier Qualifiers.\n\nIf a table with the same name exists, error 1050 results. Use IF NOT EXISTS to suppress this error and issue a note instead. Use SHOW WARNINGS to see notes.\n\nThe CREATE TABLE statement automatically commits the current transaction, except when using the TEMPORARY keyword.\n\nFor valid identifiers to use as table names, see Identifier Names.\n\nIf the default_storage_engine is set to ColumnStore, it needs to be set on all UMs. Otherwise, when the tables using the default engine are replicated across UMs, they will use the wrong engine. You should therefore not use this option as a session variable with ColumnStore.\n\nMicrosecond precision can be between 0-6. If no precision is specified, it is assumed to be 0, for backward compatibility reasons.\n\nPrivileges\n\nExecuting the CREATE TABLE statement requires the CREATE privilege for the table or the database.\n\nCREATE OR REPLACE\n\nIf the OR REPLACE clause is used and the table already exists, then instead of returning an error, the server will drop the existing table and replace it with the newly defined table.\n\nThis syntax was originally added to make replication more robust if it has to rollback and repeat statements such as CREATE ... SELECT on slaves.\n\n`sql\nCREATE OR REPLACE TABLE table_name (a INT);\n`\n\nis basically the same as:\n\n`sql\nDROP TABLE IF EXISTS TABLE_NAME;\nCREATE TABLE TABLE_NAME (a INT);\n`\n\nwith the following exceptions:\n\n If table_name was locked with LOCK TABLES, it will continue to be locked after the statement.\n Temporary tables are only dropped if the TEMPORARY keyword was used. (With DROP TABLE, temporary tables are preferred to be dropped before normal tables).\n\nThings to be Aware of With CREATE OR REPLACE\n\n The table is dropped first (if it existed), and after that, the CREATE is done. Because of this, if the CREATE fails, then the table will not exist anymore after the statement. If the table was used with LOCK TABLES, it will be unlocked.\n One can''t use OR REPLACE together with IF EXISTS.\n Slaves will, by default, use CREATE OR REPLACE when replicating CREATE statements that don''t use IF EXISTS. This can be changed by setting the variable slave-ddl-exec-mode to STRICT.\n\nCREATE TABLE IF NOT EXISTS\n\nIf the IF NOT EXISTS clause is used, then the table will only be created if a table with the same name does not already exist. If the table already exists, then a warning will be triggered by default.\n\nCREATE TEMPORARY TABLE\n\nUse the TEMPORARY keyword to create a temporary table that is only available to the current session. Temporary tables are dropped when the session ends. Temporary table names are specific to the session. They will not conflict with other temporary tables from other sessions, even if they share the same name. They will shadow names of non-temporary tables or views, if they are identical. A temporary table can have the same name as a non-temporary table, which is located in the same database. In that case, their name will reference the temporary table when used in SQL statements. You must have the CREATE TEMPORARY TABLES privilege on the database to create temporary tables. If no storage engine is specified, the default_tmp_storage_engine setting will determine the engine.\n\nROCKSDB temporary tables cannot be created by setting the default_tmp_storage_engine system variable or using CREATE TEMPORARY TABLE LIKE. If you try, an error is returned. Explicitly creating a temporary table with ENGINE=ROCKSDB has never been permitted.\n\nROCKSDB temporary tables cannot be created by setting the default_tmp_storage_engine system variable, or using CREATE TEMPORARY TABLE LIKE. They can be specified, but fail silently, and a MyISAM table is created instead. Explicitly creating a temporary table with ENGINE=ROCKSDB has never been permitted.\n\nReplicating temporary tables\n\nBy default, temporary tables are only created on the slave if the master is using the STATEMENT binary log format.\n\nThe new deterministic rules for logging of temporary tables are:\n\n The STATEMENT binlog format is used. The user can change this behavior by setting create_tmp_table_binlog_formats to MIXED, STATEMENT in which case the create is logged in statement format also in MIXED mode (as before).\n Changes to temporary tables are only binlogged if and only if the CREATE was logged. The logging happens under STATEMENT or MIXED. If binlog_format=ROW, temporary table changes are not binlogged. A temporary table that is changed under ROW is marked as ''not up to date in binlog'' and no future row changes are logged. Any usage of this temporary table will force row logging of other tables in any future statements using the temporary table to be row logged.\n DROP TEMPORARY is binlogged only if the CREATE was binlogged.\n\nIn some contexts, temporary tables on the master and slave can become inconsistent.\\\nOne example is if a temporary table is updated with the value of a non deterministic function like UUID(), in which the change is never sent to the slave.\n\nIn some other contexts, while using MIXED mode, all changes will be logged in ROW mode while the user has any active temporary tables, even if the temporary tables are not used in the query. This depends on in which format some previous independent commands were logged.\n\nThere are many other pitfalls with logging temporary table to the slave.\n\nCREATE TABLE ... LIKE\n\nUse the LIKE clause instead of a full table definition to create an empty table with the same definition as another table, including columns, indexes, and table options. Foreign key definitions, as well as any DATA DIRECTORY or INDEX DIRECTORY table options specified on the original table, will not be created.\n\nLIKE does not preserve the TEMPORARY status of the original table. To make the new table TEMPORARY as well, use CREATE TEMPORARY TABLE ... LIKE.\n\nLIKE does not work with views, only base tables. Attempting to use it on a view will result in an error:\n\n`sql\nCREATE VIEW v (mycol) AS SELECT ''abc'';\n\nCREATE TABLE v2 LIKE v;\nERROR 1347 (HY000): ''test.v'' is not of type ''BASE TABLE''\n`\n\nThe same version of the table storage format as found in the original table is used for the new table.\n\nCREATE TABLE ... LIKE performs the same checks as CREATE TABLE. So a statement may fail if a change in the SQL_MODE renders it invalid. For example:\n\n`sql\nCREATE OR REPLACE TABLE x (d DATE DEFAULT ''0000-00-00'');\n\nSET SQL_MODE=''NO_ZERO_DATE'';\n\nCREATE OR REPLACE TABLE y LIKE x;\nERROR 1067 (42000): Invalid default value for ''d''\n`\n\nCREATE TABLE ... SELECT\n\nYou can create a table containing data from other tables using the CREATE ... SELECT statement. Columns will be created in the table for each field returned by the SELECT query.\n\nYou can also define some columns normally and add other columns from a SELECT. You can also create columns in the normal way and assign them some values using the query, this is done to force a certain type or other field characteristics. The columns that are not named in the query will be placed before the others. For example:\n\n`sql\nCREATE TABLE test (a INT NOT NULL, b CHAR(10)) ENGINE=MyISAM\n    SELECT 5 AS b, c, d FROM another_table;\n`\n\nRemember that the query just returns data. If you want to use the same indexes or the same column attributes ([NOT] NULL, DEFAULT, AUTO_INCREMENT, CHECK constraints) in the new table, you need to specify them manually. Types and sizes are not automatically preserved if no data is returned by the SELECT that requires the full size, and VARCHAR could be converted into CHAR. The CAST() function can be used to force the new table to use certain types.\n\nAliases (AS) are taken into account, and they should always be used when you SELECT an expression (function, arithmetical operation, etc.).\n\nIf an error occurs during the query, the table will not be created at all.\n\nIf the new table has a primary key or UNIQUE indexes, you can use the IGNORE or REPLACE keywords to handle duplicate key errors during the query. IGNORE means that the newer values must not be inserted if an identical value exists in the index. REPLACE means that older values must be overwritten.\n\nIf the columns in the new table are more than the rows returned by the query, the columns populated by the query will be placed after the other columns. Note that if the strict SQL_MODE is on, and the columns that are not named in the query do not have a DEFAULT value, an error will be raised and no rows will be copied.\n\nConcurrent inserts are not used during the execution of a CREATE ... SELECT.\n\nIf the table already exists, an error similar to the following will be returned:\n\n`\nERROR 1050 (42S01): Table ''t'' already exists\n`\n\nIf the IF NOT EXISTS clause is used, and the table exists, a note will be produced instead of an error.\n\nTo insert rows from a query into an existing table, INSERT ... SELECT can be used.\n\nColumn Definitions\n\n<pre class="language-bnf"><code class="lang-bnf">create_definition:\n  { col_name column_definition | <a data-footnote-ref href="#user-content-fn-5">index_definition</a> | <a data-footnote-ref href="#user-content-fn-4">period_definition</a> | CHECK (expr) }\n\ncolumn_definition:\n  <a data-footnote-ref href="#user-content-fn-6">data_type</a>\n    [NOT NULL | NULL] [DEFAULT default_value | (expression)]\n    [ON UPDATE [NOW | CURRENT_TIMESTAMP] [(precision)]]\n    [AUTO_INCREMENT] [ZEROFILL] [UNIQUE [KEY] | [PRIMARY] KEY]\n    [INVISIBLE] [{WITH|WITHOUT} SYSTEM VERSIONING]\n    [COMMENT ''string''] [REF_SYSTEM_ID = value]\n    [<a data-footnote-ref href="#user-content-fn-5">reference_definition</a>]\n  | <a data-footnote-ref href="#user-content-fn-6">data_type</a> [GENERATED ALWAYS] \n  AS [ ROW {START|END} [NOT NULL ENABLE] [[PRIMARY] KEY]\n        | (expression) [VIRTUAL | PERSISTENT | STORED] ]\n      [INVISIBLE] [UNIQUE [KEY]] [COMMENT ''string'']\n\nconstraint_definition:\n   CONSTRAINT [constraint_name] CHECK (expression)\n</code></pre>\n\nNote:\n\nMariaDB accepts the shortcut format with a REFERENCES clause only in ALTER TABLE and CREATE TABLE statements, but that syntax does nothing. For example:\n\n`sql\nCREATE TABLE b(for_key INT REFERENCES a(not_key));\n`\n\nMariaDB will attempt to apply the constraint. See Foreign Keys examples.\n\nMariaDB accepts the shortcut format with a REFERENCES clause only in ALTER TABLE and CREATE TABLE statements, but that syntax does nothing. For example:\n\n`sql\nCREATE TABLE b(for_key INT REFERENCES a(not_key));\n`\n\nEach definition either creates a column in the table or specifies an index or constraint on one or more columns. See Indexes below for details on creating indexes.\n\nCreate a column by specifying a column name and a data type, optionally followed by column options. See Data Types for a full list of data types allowed in MariaDB.\n\nNULL and NOT NULL\n\nUse the NULL or NOT NULL options to specify that values in the column may or may not be NULL, respectively. By default, values may be NULL. See also NULL Values in MariaDB.\n\nDEFAULT Column Option\n\nSpecify a default value using the DEFAULT clause. If you don''t specify DEFAULT then the following rules apply:\n\n If the column is not defined with NOT NULL, AUTO_INCREMENT or TIMESTAMP, an explicit DEFAULT NULL will be added.\\\n  Note that in MySQL, you may get an explicit DEFAULT for primary key parts, if not specified with NOT NULL.\n\nThe default value will be used if you INSERT a row without specifying a value for that column, or if you specify DEFAULT for that column.\n\nCURRENT_TIMESTAMP may also be used as the default value for a DATETIME\n\nYou can use most functions in DEFAULT. Expressions should have parentheses around them. If you use a non deterministic function in DEFAULT then all inserts to the table will be replicated in row mode. You can even refer to earlier columns in the DEFAULT expression (excluding AUTO_INCREMENT columns):\n\n`sql\nCREATE TABLE t1 (a INT DEFAULT (1+1), b INT DEFAULT (a+1));\nCREATE TABLE t2 (a BIGINT PRIMARY KEY DEFAULT UUID_SHORT());\n`\n\nThe DEFAULT clause cannot contain any stored functions or subqueries, and a column used in the clause must already have been defined earlier in the statement.\n\nIt is possible to assign BLOB or TEXT columns a DEFAULT value.\n\nYou can also use DEFAULT (NEXT VALUE FOR sequence).\n\nAUTO_INCREMENT Column Option\n\nUse AUTO_INCREMENT to create a column whose value can be set automatically from a simple counter. You can only use AUTO_INCREMENT on a column with an integer type. The column must be a key, and there can only be one AUTO_INCREMENT column in a table. If you insert a row without specifying a value for that column (or if you specify 0, NULL, or DEFAULT as the value), the actual value will be taken from the counter, with each insertion incrementing the counter by one. You can still insert a value explicitly. If you insert a value that is greater than the current counter value, the counter is\\\nset based on the new value. An AUTO_INCREMENT column is implicitly NOT NULL. Use LAST_INSERT_ID to get the AUTO_INCREMENT value most recently used by an INSERT statement.\n\nZEROFILL Column Option\n\nIf the ZEROFILL column option is specified for a column using a numeric data type, then the column will be set to UNSIGNED and the spaces used by default to pad the field are replaced with zeros. ZEROFILL is ignored in expressions or as part of a UNION, INTERSECT, or EXCEPT. ZEROFILL is a non-standard MariaDB and MySQL extension.\n\nPRIMARY KEY Column Option\n\nUse PRIMARY KEY to make a column a primary key. A primary key is a special type of a unique key. There can be at most one primary key per table, and it is implicitly NOT NULL.\n\nSpecifying a column as a unique key creates a unique index on that column. See the Index Definitions section below for more information.\n\nUNIQUE KEY Column Option\n\nUse UNIQUE KEY (or just UNIQUE) to specify that all values in the column must be distinct from each other. Unless the column is NOT NULL, there may be multiple rows with NULL in the column.\n\n`\n`\n\nWhen any inserts or updates occur in the table, reading the binlog shows the hidden column (@3). it causes confusion for the user; we can document these behaviours.\n\n`\nINSERT INTO securedb.t_long_keys\nSET\n@1=1 / INT meta=0 nullable=0 is_null=0 /\n@2=''a'' / VARSTRING(4073) meta=4073 nullable=1 is_null=0 /\n@3=580 / LONGINT meta=0 nullable=1 is_null=0 /\n`\n\n`sql\nCREATE TABLE t_long_keys (   a INT PRIMARY KEY,   b  VARCHAR(4073),   UNIQUE KEY uk_b (b) ) ENGINE=InnoDB;\nQuery OK, 0 r\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-table');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (630, 39, 'CREATE TABLESPACE', 'Description\n-----------\n\nThe CREATE TABLESPACE statement is not supported by MariaDB. It was originally inherited from MySQL NDB Cluster. In MySQL 5.7 and later, the statement is also supported for InnoDB. However, MariaDB has chosen not to include that specific feature. See MDEV-19294 for more information.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-tablespace', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-tablespace');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (631, 39, 'Generated Columns', 'Syntax\n------\n\n<type>  [GENERATED ALWAYS]  AS   ( <expression> )\n[VIRTUAL | PERSISTENT | STORED]  [UNIQUE] [UNIQUE KEY] [COMMENT <text>]\n\nDescription\n-----------\n\nA generated column is a column in a table that cannot explicitly be set to a specific value in a DML query. Instead, its value is automatically generated based on an expression. This expression might generate the value based on the values of other columns in the table, or it might generate the value by calling built-in functions or user-defined functions (UDFs).\n\nThere are two types of generated columns:\n\n PERSISTENT (a.k.a. STORED): This type''s value is actually stored in the table.\n VIRTUAL: This type''s value is not stored at all. Instead, the value is generated dynamically when the table is queried. This type is the default.\n\nGenerated columns are also sometimes called computed columns or virtual columns.\n\nSupported Features\n\nStorage Engine Support\n\n Generated columns can only be used with storage engines which support them. If you try to use a storage engine that does not support them, then you will see an error similar to the following:\n\n``sql\nERROR 1910 (HY000): TokuDB storage engine does not support computed columns\n`\n\n InnoDB, Aria, MyISAM and CONNECT support generated columns.\n A column in a MERGE table can be built on a PERSISTENT generated column.\n   However, a column in a MERGE table can not be defined as a VIRTUAL and PERSISTENT generated column.\n\nData Type Support\n\nAll data types are supported when defining generated columns.\n\nUsing the ZEROFILL column option is supported when defining generated columns.\n\nUsing the AUTO_INCREMENT column option is not supported when defining generated columns.\n\nUsing the AUTO_INCREMENT column option is supported when defining generated columns.\n\nIt does not work correctly, though. See MDEV-11117.\n\nIndex Support\n\nUsing a generated column as a table''s primary key is not supported. See MDEV-5590 for more information. If you try to use one as a primary key, then you will see an error similar to the following:\n\n`sql\nERROR 1903 (HY000): Primary key cannot be defined upon a computed column\n`\n\nUsing PERSISTENT generated columns as part of a foreign key is supported.\n\nReferencing PERSISTENT generated columns as part of a foreign key is also supported.\n\nHowever, using the ON UPDATE CASCADE, ON UPDATE SET NULL, or ON DELETE SET NULL clauses is not supported. If you try to use an unsupported clause, then you will see an error similar to the following:\n\n`sql\nERROR 1905 (HY000): Cannot define foreign key with ON UPDATE SET NULL clause on a computed column\n`\n\nDefining indexes on both VIRTUAL and PERSISTENT generated columns is supported.\n\nIf an index is defined on a generated column, then the optimizer considers using it in the same way as indexes based on "real" columns.\n\nThe optimizer can recognize use of indexed virtual column expressions in the WHERE clause and use them to construct range and ref(const) accesses. See Virtual Column Support in the Optimizer.\n\nThe optimizer cannot recognize use of indexed virtual column expressions in the WHERE clause and use them to construct range and ref(const) accesses. See Virtual Column Support in the Optimizer.\n\nStatement Support\n\nGenerated columns are used in DML queries just as if they were "real" columns.\n\n However, VIRTUAL and PERSISTENT generated columns differ in how their data is stored.\n   Values for PERSISTENT generated columns are generated whenever a DML queries inserts or updates the row with the special DEFAULT value. This generates the columns value, and it is stored in the table like the other "real" columns. This value can be read by other DML queries just like the other "real" columns.\n   Values for VIRTUAL generated columns are not stored in the table. Instead, the value is generated dynamically whenever the column is queried. If other columns in a row are queried, but the VIRTUAL generated column is not one of the queried columns, then the column''s value is not generated.\n\nThe SELECT statement supports generated columns.\n\nGenerated columns can be referenced in the INSERT, UPDATE, and DELETE statements.\n\n However, VIRTUAL or PERSISTENT generated columns cannot be explicitly set to any other values than NULL or DEFAULT. If a generated column is explicitly set to any other value, then the outcome depends on whether strict mode is enabled in sql_mode. If it is not enabled, then a warning will be raised and the default generated value will be used instead. If it is enabled, then an error will be raised instead.\n\nThe CREATE TABLE statement has limited support for generated columns.\n\n It supports defining generated columns in a new table.\n It supports using generated columns to partition tables.\n It does not support using the versioning clauses with generated columns.\n\nThe ALTER TABLE statement has limited support for generated columns.\n\n It supports the MODIFY and CHANGE clauses for PERSISTENT generated columns.\n It does not support the MODIFY clause for VIRTUAL generated columns if ALGORITHM is not set to COPY. See MDEV-15476 for more information.\n It does not support the CHANGE clause for VIRTUAL generated columns if ALGORITHM is not set to COPY. See MDEV-17035 for more information.\n It does not support altering a table if ALGORITHM is not set to COPY if the table has a VIRTUAL generated column that is indexed. See MDEV-14046 for more information.\n It does not support adding a VIRTUAL generated column with the ADD clause if the same statement is also adding other columns if ALGORITHM is not set to COPY. See MDEV-17468 for more information.\n It also does not support altering an existing column into a VIRTUAL generated column.\n It supports using generated columns to partition tables.\n It does not support using the versioning clauses with generated columns.\n\nThe SHOW CREATE TABLE statement supports generated columns.\n\nThe DESCRIBE statement can be used to check whether a table has generated columns.\n\n You can tell which columns are generated by looking for the ones where the Extra column is set to either VIRTUAL or PERSISTENT. For example:\n\n`sql\nDESCRIBE table1;\n+-------+-------------+------+-----+---------+------------+\n| Field | Type        | Null | Key | Default | Extra      |\n+-------+-------------+------+-----+---------+------------+\n| a     | int(11)     | NO   |     | NULL    |            |\n| b     | varchar(32) | YES  |     | NULL    |            |\n| c     | int(11)     | YES  |     | NULL    | VIRTUAL    |\n| d     | varchar(5)  | YES  |     | NULL    | PERSISTENT |\n+-------+-------------+------+-----+---------+------------+\n`\n\nGenerated columns can be properly referenced in the NEW and OLD rows in triggers.\n\nStored procedures support generated columns.\n\nThe HANDLER statement supports generated columns.\n\nExpression Support\n\nMost legal, deterministic expressions which can be calculated are supported in expressions for generated columns.\n\nMost built-in functions are supported in expressions for generated columns.\n\n However, some built-in functions can''t be supported for technical reasons. For example, If you try to use an unsupported function in an expression, an error is generated similar to the following:\n\n`sql\nERROR 1901 (HY000): Function or expression ''dayname()'' cannot be used in the GENERATED ALWAYS AS clause of v\n`\n\nSubqueries are not supported in expressions for generated columns because the underlying data can change.\n\nUsing anything that depends on data outside the row is not supported in expressions for generated columns.\n\nStored functions are not supported in expressions for generated columns. See MDEV-17587 for more information.\n\nNon-deterministic built-in functions are supported in expressions for not indexed VIRTUAL generated columns.\n\nNon-deterministic built-in functions are not supported in expressions for PERSISTENT or indexed VIRTUAL generated columns.\n\nUser-defined functions (UDFs) are supported in expressions for generated columns.\n\n However, MariaDB can''t check whether a UDF is deterministic, so it is up to the user to be sure that they do not use non-deterministic UDFs with VIRTUAL generated columns.\n\nDefining a generated column based on other generated columns defined before it in the table definition is supported. For example:\n\n`sql\nCREATE TABLE t1 (a INT AS (1), b INT AS (a));\n`\n\nHowever, defining a generated column based on other generated columns defined after in the table definition is not supported in expressions for generation columns because generated columns are calculated in the order they are defined.\n\nUsing an expression that exceeds 255 characters in length is supported in expressions for generated columns. The new limit for the entire table definition, including all expressions for generated columns, is 65,535 bytes.\n\nUsing constant expressions is supported in expressions for generated columns. For example:\n\n`sql\nCREATE TABLE t1 (a int as (1));\n`\n\nMaking Stored Values Consistent\n\nWhen a generated column is PERSISTENT or indexed, the value of the expression needs to be consistent regardless of the SQL Mode flags in the current session. If it is not, then the table will be seen as corrupted when the value that should actually be returned by the computed expression and the value that was previously stored and/or indexed using a different sql_mode setting disagree.\n\nThere are currently two affected classes of inconsistencies: character padding and unsigned subtraction:\n\n For a VARCHAR or TEXT generated column the length of the value returned can vary depending on the PAD_CHAR_TO_FULL_LENGTH sql_mode flag. To make the value consistent, create the generated column using an RTRIM() or RPAD() function. Alternately, create the generated column as a CHAR column so that its data is always fully padded.\n If a SIGNED generated column is based on the subtraction of an UNSIGNED value, the resulting value can vary depending on how large the value is and the NO_UNSIGNED_SUBTRACTION sql_mode flag. To make the value consistent, use CAST() to ensure that each UNSIGNED operand is SIGNED before the subtraction.\n\nA fatal error is generated when trying to create a generated column whose value can change depending on the SQL Mode when its data is PERSISTENT or indexed. For an existing generated column that has a potentially inconsistent value, a warning about a bad expression is generated the first time it is used (if warnings are enabled).\n\nFor an existing generated column that has a potentially inconsistent value, a warning about a bad expression is generated the first time it is used (if warnings are enabled).\n\nA potentially inconsistent generated column outputs a warning when created or first used (without restricting the creation).\n\nA potentially inconsistent generated column does not output a warning when created or first used.\n\nHere is an example of two tables that are warned about:\n\n`sql\nCREATE TABLE bad_pad (\n  txt CHAR(5),\n  -- CHAR -> VARCHAR or CHAR -> TEXT can''t be persistent or indexed:\n  vtxt VARCHAR(5) AS (txt) PERSISTENT\n);\n\nCREATE TABLE bad_sub (\n  num1 BIGINT UNSIGNED,\n  num2 BIGINT UNSIGNED,\n  -- The resulting value can vary for some large values\n  vnum BIGINT AS (num1 - num2) VIRTUAL,\n  KEY(vnum)\n);\n`\n\nThe warnings look like this:\n\n`sql\nWarning (Code 1901): Function or expression ''txt'' cannot be used in the GENERATED ALWAYS AS clause of vtxt\nWarning (Code 1105): Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH\n\nWarning (Code 1901): Function or expression ''num1 - num2'' cannot be used in the GENERATED ALWAYS AS clause of vnum\nWarning (Code 1105): Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION\n`\n\nTo work around the issue, force the padding or type to make the generated column''s expression return a consistent value. For example:\n\n`sql\nCREATE TABLE good_pad (\n  txt CHAR(5),\n  -- Using RTRIM() or RPAD() makes the value consistent:\n  vtxt VARCHAR(5) AS (RTRIM(txt)) PERSISTENT,\n  -- When not persistent or indexed, it is OK for the value to vary by mode:\n  vtxt2 VARCHAR(5) AS (txt) VIRTUAL,\n  -- CHAR -> CHAR is always OK:\n  txt2 CHAR(5) AS (txt) PERSISTENT\n);\n\nCREATE TABLE good_sub (\n  num1 BIGINT UNSIGNED,\n  num2 BIGINT UNSIGNED,\n  -- The indexed value will always be consistent in this expression:\n  vnum BIGINT AS (CAST(num1 AS SIGNED) - CAST(num2 AS SIGNED)) VIRTUAL,\n  KEY(vnum)\n);\n`\n\nHere is an example of two tables whose creation is rejected:\n\n`sql\nCREATE TABLE bad_pad (\n  txt CHAR(5),\n  -- CHAR -> VARCHAR or CHAR -> TEXT can''t be persistent or indexed:\n  vtxt VARCHAR(5) AS (txt) PERSISTENT\n);\n\nCREATE TABLE bad_sub (\n  num1 BIGINT UNSIGNED,\n  num2 BIGINT UNSIGNED,\n  -- The resulting value can vary for some large values\n  vnum BIGINT AS (num1 - num2) VIRTUAL,\n  KEY(vnum)\n);\n`\n\nMySQL Compatibility Support\n\n The STORED keyword is supported as an alias for the PERSISTENT keyword.\n Tables created with MySQL 5.7 or later that contain MySQL''s generated columns can be imported into MariaDB without a dump and restore.\n\nImplementation Differences\n\nGenerated columns are subject to various constraints in other DBMSs that are not present in MariaDB''s implementation. Generated columns may also be called computed columns or virtual columns in different implementations. The various details for a specific implementation can be found in the documentation for each specific DBMS.\n\nImplementation Differences Compared to Microsoft SQL Server\n\nMariaDB''s generated columns implementation does not enforce the following\\\nrestrictions that are present in Microsoft SQL Server''s computed columns implementation:\n\n MariaDB allows server variables in generated column expressions, including those that change dynamically, such as warning_count.\n MariaDB allows the CONVERT_TZ() function to be called with a named time zone as an argument, even though time zone names and time offsets are configurable.\n MariaDB allows the CAST() function to be used with non-unicode character sets, even though character sets are configurable and differ between binaries/versions.\n MariaDB allows FLOAT expressions to be used in generated columns. Microsoft SQL Server considers these expressions to be "imprecise" due to potential cross-platform differences in floating-point implementations and precision.\n Microsoft SQL Server requires the ARITHABORT mode to be set, so that division by zero returns an error, and not a NULL.\n Microsoft SQL Server requires QUOTED_IDENTIFIER to be set in sql_mode. In MariaDB, if data is inserted without ANSI_QUOTES` set in sql_mode, then it will be processed and stored differently in a generated column that contains quoted identifiers.\n\nMicrosoft SQL Server enforces the above restrictions by doing one of the following things:\n\n Refusing to create computed columns.\n Refusing to allow updates to a table containing them.\n* Refusing to use an index over such a column if it can not be guaranteed that the expression is fully deterministic.\n\nIn MariaDB, as long as the sql_mode, language, and other settings that were in effect duri\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/generated-columns');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (632, 39, 'Invisible Columns', 'Description\n-----------\n\nInvisible columns (sometimes also called hidden columns) are hidden in certain contexts.\n\nColumns can be given an INVISIBLE attribute in a CREATE TABLE or ALTER TABLE statement. These columns will then not be listed in the results of a SELECT \\ statement, nor do they need to be assigned a value in an INSERT statement, unless INSERT explicitly mentions them by name.\n\nSince SELECT  does not return the invisible columns, new tables or views created in this manner will have no trace of the invisible columns. If specifically referenced in the SELECT statement, the columns will be brought into the view/new table, but the INVISIBLE attribute will not.\n\nInvisible columns can be declared as NOT NULL, but then require a DEFAULT value.\n\nIt is not possible for all columns in a table to be invisible.\n\nExamples\n--------\n\nCREATE TABLE t (x INT INVISIBLE);\nERROR 1113 (42000): A table must have at least 1 column\n\nCREATE TABLE t (x INT, y INT INVISIBLE, z INT INVISIBLE NOT NULL);\nERROR 4106 (HY000): Invisible column z must have a default value\n\nCREATE TABLE t (x INT, y INT INVISIBLE, z INT INVISIBLE NOT NULL DEFAULT 4);\n\nINSERT INTO t VALUES (1),(2);\n\nINSERT INTO t (x,y) VALUES (3,33);\n\nSELECT * FROM t;\n+------+\n| x    |\n+------+\n|    1 |\n|    2 |\n|    3 |\n+------+\n\nSELECT x,y,z FROM t;\n+------+------+---+\n| x    | y    | z |\n+------+------+---+\n|    1 | NULL | 4 |\n|    2 | NULL | 4 |\n|    3 |   33 | 4 |\n+------+------+---+\n\nDESC t;\n+-------+---------+------+-----+---------+-----------+\n| Field | Type    | Null | Key | Default | Extra     |\n+-------+---------+------+-----+---------+-----------+\n| x     | int(11) | YES  |     | NULL    |           |\n| y     | int(11) | YES  |     | NULL    | INVISIBLE |\n| z     | int(11) | NO   |     | 4       | INVISIBLE |\n+-------+---------+------+-----+---------+-----------+\n\nALTER TABLE t MODIFY x INT INVISIBLE, MODIFY y INT, MODIFY z INT NOT NULL DEFAULT 4;\n\nDESC t;\n+-------+---------+------+-----+---------+-----------+\n| Field | Type    | Null | Key | Default | Extra     |\n+-------+---------+------+-----+---------+-----------+\n| x     | int(11) | YES  |     | NULL    | INVISIBLE |\n| y     | int(11) | YES  |     | NULL    |           |\n| z     | int(11) | NO   |     | 4       |           |\n+-------+---------+------+-----+---------+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/invisible-columns', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/invisible-columns');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (633, 39, 'Silent Column Changes', 'Description\n-----------\n\nWhen a CREATE TABLE or ALTER TABLE command is issued, MariaDB silently changes a column specification in the following cases:\n\n PRIMARY KEY columns are always NOT NULL.\n Any trailing spaces from SET and ENUM values are discarded.\n TIMESTAMP columns are always NOT NULL, and display sizes are discarded.\n A row-size limit of 65535 bytes applies.\n If strict SQL mode is not enabled (by default, it is), a VARCHAR column longer than 65535 become TEXT, and a VARBINARY columns longer than 65535 becomes a BLOB. If strict mode is enabled the silent changes will not be made, and an error will occur.\n If a USING clause specifies an index that''s not permitted by the storage engine, the engine will instead use another available index type that can be applied without affecting results.\n* If the CHARACTER SET binary attribute is specified, the column is created as the matching binary data type. A TEXT becomes a BLOB, CHAR a BINARY and VARCHAR a VARBINARY. ENUMs and SETs are created as defined.\n\nTo ease imports from other RDBMSs, MariaDB also silently maps the following data types:\n\n| Other Vendor Type    | MariaDB Type                                                      |\n| -------------------- | ----------------------------------------------------------------- |\n| BOOL                 | TINYINT      |\n| BOOLEAN              | TINYINT      |\n| CHARACTER VARYING(M) | VARCHAR(M)    |\n| FIXED                | DECIMAL      |\n| FLOAT4               | FLOAT          |\n| FLOAT8               | DOUBLE        |\n| INT1                 | TINYINT      |\n| INT2                 | SMALLINT    |\n| INT3                 | MEDIUMINT  |\n| INT4                 | INT              |\n| INT8                 | BIGINT        |\n| LONG VARBINARY       | MEDIUMBLOB |\n| LONG VARCHAR         | MEDIUMTEXT |\n| LONG                 | MEDIUMTEXT |\n| MIDDLEINT            | MEDIUMINT  |\n| NUMERIC              | DECIMAL      |\n\nCurrently, all MySQL types are supported in MariaDB.\n\nFor type mapping between Cassandra and MariaDB, see Cassandra storage engine.\n\nExamples\n--------\n\nCREATE TABLE SilenceIsGolden\n   (\n    f1 TEXT CHARACTER SET BINARY,\n    f2 VARCHAR(15) CHARACTER SET BINARY,\n    f3 CHAR CHARACTER SET BINARY,\n    f4 ENUM(''x'',''y'',''z'') CHARACTER SET BINARY,\n    f5 VARCHAR (65536),\n    f6 VARBINARY (65536),\n    f7 INT1\n   );\nQuery OK, 0 rows affected, 2 warnings (0.31 sec)\n\nSHOW WARNINGS;\n+-------+------+-----------------------------------------------+\n| Level | Code | Message                                       |\n+-------+------+-----------------------------------------------+\n| Note  | 1246 | Converting column ''f5'' from VARCHAR to TEXT   |\n| Note  | 1246 | Converting column ''f6'' from VARBINARY to BLOB |\n+-------+------+-----------------------------------------------+\n\nDESCRIBE SilenceIsGolden;\n+-------+-------------------+------+-----+---------+-------+\n| Field | Type              | Null | Key | Default | Extra |\n+-------+-------------------+------+-----+---------+-------+\n| f1    | blob              | YES  |     | NULL    |       |\n| f2    | varbinary(15)     | YES  |     | NULL    |       |\n| f3    | binary(1)         | YES  |     | NULL    |       |\n| f4    | enum(''x'',''y'',''z'') | YES  |     | NULL    |       |\n| f5    | mediumtext        | YES  |     | NULL    |       |\n| f6    | mediumblob        | YES  |     | NULL    |       |\n| f7    | tinyint(4)        | YES  |     | NULL    |       |\n+-------+-------------------+------+-----+---------+-------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/silent-column-changes', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/silent-column-changes');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (634, 39, 'DROP DATABASE', 'Syntax\n------\n\nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n\nDescription\n-----------\n\nDROP DATABASE drops all tables in the database and deletes the database. Be very careful with this statement! To use DROP DATABASE, you need the DROP privilege on the database. DROP SCHEMA is a synonym for DROP DATABASE.\n\nImportant: When a database is dropped, user privileges on the database are not automatically dropped. See GRANT.\n\nIF EXISTS\n\nUse IF EXISTS to prevent an error from occurring for databases that do not exist. A NOTE is generated for each non-existent database when using IF EXISTS. See SHOW WARNINGS.\n\nAtomic DDL\n\nMariaDB 10.6.1 supports Atomic DDL.DROP DATABASE is implemented as\n\n``sql\nLOOP OVER ALL tables\n  DROP TABLE tbl\n`\n\nEach individual DROP TABLE is atomic while DROP DATABASE as a whole is crash-safe.\n\nAtomic DROP` is not available.\n\nExamples\n--------\n\nDROP DATABASE bufg;\nQuery OK, 0 rows affected (0.39 sec)\n\nDROP DATABASE bufg;\nERROR 1008 (HY000): Can''t drop database ''bufg''; database doesn''t exist\n\n \\W\nSHOW warnings enabled.\n\nDROP DATABASE IF EXISTS bufg;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\nNote (Code 1008): Can''t DROP DATABASE ''bufg''; DATABASE doesn''t exist\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-database', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-database');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (635, 39, 'DROP EVENT', 'Syntax\n------\n\nDROP EVENT [IF EXISTS] event_name\n\nDescription\n-----------\n\nThis statement drops the event named event_name. The event immediately ceases being active, and is deleted completely from the server.\n\nIf the event does not exist, the errorERROR 1517 (HY000): Unknown event ''event_name'' results. You can override this and cause the statement to generate a NOTE for non-existent events instead by usingIF EXISTS. See SHOW WARNINGS.\n\nThis statement requires the EVENT privilege.\n\nExamples\n--------\n\nDROP EVENT myevent3;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-event', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-event');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (636, 39, 'DROP INDEX', 'Syntax\n------\n\nDROP INDEX [IF EXISTS] index_name ON tbl_name \n    [WAIT n |NOWAIT]\n\nDescription\n-----------\n\nDROP INDEX drops the index named index_name from the table tbl_name. This statement is mapped to an ALTER TABLE statement to drop the index.\n\nIf another connection is using the table, a metadata lock is active, and this statement will wait until the lock is released. This is also true for non-transactional tables.\n\nSee ALTER TABLE.\n\nAnother shortcut, CREATE INDEX, allows the creation of an index.\n\nTo remove the primary key, PRIMARY must be specified as index_name. Note that the quotes are necessary, because PRIMARY is a keyword.\n\nPrivileges\n\nExecuting the DROP INDEX statement requires the INDEX privilege for the table or the database.\n\nOnline DDL\n\nOnline DDL is used by default with InnoDB, when the drop index operation supports it.\n\nSee InnoDB Online DDL Overview for more information on online DDL with InnoDB.\n\nDROP INDEX IF EXISTS ...\n\nIf the IF EXISTS clause is used, then MariaDB will return a warning instead of an error if the index does not exist.\n\nWAIT/NOWAIT\n\nSets the lock wait timeout. See WAIT and NOWAIT.\n\nProgress Reporting\n\nMariaDB provides progress reporting for DROP INDEX statement for clients\\\nthat support the new progress reporting protocol. For example, if you were using the mariadb client, then the progress report might look like this::\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-index', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-index');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (637, 39, 'DROP LOGFILE GROUP', 'Description\n-----------\n\nThe DROP LOGFILE GROUP statement is not supported by MariaDB. It was originally inherited from MySQL NDB Cluster. See MDEV-19295 for more information.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-logfile-group', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-logfile-group');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (638, 39, 'DROP PACKAGE BODY', 'Syntax\n------\n\nDROP PACKAGE BODY [IF EXISTS]  [ db_name . ] package_name\n\nDescription\n-----------\n\nThe DROP PACKAGE BODY statement can be used when Oracle SQL_MODE is set.\n\nThe DROP PACKAGE BODY statement drops the package body (that is, the implementation) which was created using the CREATE PACKAGE BODY statement.\n\nNote, DROP PACKAGE BODY drops only the package implementation, but does not drop the package specification. Use DROP PACKAGE to drop the package entirely (i.e. both implementation and specification).\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-package-body', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-package-body');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (639, 39, 'DROP PACKAGE', 'Syntax\n------\n\nDROP PACKAGE [IF EXISTS]  [ db_name . ] package_name\n\nDescription\n-----------\n\nThe DROP PACKAGE statement can be used when Oracle SQL_MODE is set.\n\nThe DROP PACKAGE statement drops a stored package entirely:\n\n Drops the package specification (earlier created using the CREATE PACKAGE statement).\n Drops the package implementation, if the implementation was already created using the CREATE PACKAGE BODY statement.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-package', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-package');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (640, 39, 'DROP SERVER', 'Syntax\n------\n\nDROP SERVER [ IF EXISTS ] server_name\n\nDescription\n-----------\n\nDrops the server definition for the server named _server_name_. The corresponding row within the mysql.servers table will be deleted. This statement requires the SUPER privilege or, from MariaDB 10.5.2, the FEDERATED ADMIN privilege.\n\nDropping a server for a table does not affect any FederatedX, FEDERATED, Connect or Spider tables that used this connection information when they were created.\n\nDROP SERVER is not written to the binary log, irrespective of the binary log format being used. From MariaDB 10.1.13, Galera replicates the CREATE SERVER, ALTER SERVER and DROP SERVER statements.\n\nIF EXISTS\n\nIf the IF EXISTS clause is used, MariaDB will not return an error if the server does not exist. Unlike all other statements, DROP SERVER IF EXISTS does not issue a note if the server does not exist. See MDEV-9400.\n\nExamples\n--------\n\nDROP SERVER s;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-server', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-server');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (641, 39, 'DROP TABLE', 'Syntax\n------\n\nDROP [TEMPORARY] TABLE [IF EXISTS] [/COMMENT TO SAVE/]\n    tbl_name [, tbl_name] ...\n    [WAIT n|NOWAIT]\n    [RESTRICT | CASCADE]\n\nDescription\n-----------\n\nDROP TABLE removes one or more tables. You must have the DROP privilege for each table. All table data and the table definition are removed, as well as triggers associated to the table, so be careful with this statement! If any of the tables named in the argument list do not exist, MariaDB returns an error indicating by name which non-existing tables it was unable to drop, but it also drops all of the tables in the list that do exist.\n\nImportant: When a table is dropped, user privileges on the table are not automatically dropped. See GRANT.\n\nIf another thread is using the table in an explicit transaction or an autocommit transaction, then the thread acquires a metadata lock (MDL) on the table. The DROP TABLE statement will wait in the "Waiting for table metadata lock" thread state until the MDL is released. MDLs are released in the following cases:\n\n If an MDL is acquired in an explicit transaction, then the MDL will be released when the transaction ends.\n If an MDL is acquired in an autocommit transaction, then the MDL will be released when the statement ends.\n Transactional and non-transactional tables are handled the same.\n\nNote that for a partitioned table, DROP TABLE permanently removes the table definition, all of its partitions, and all of the data which was stored in those partitions. It also removes the partitioning definition (.par) file associated with the dropped table.\n\nFor each referenced table, DROP TABLE drops a temporary table with that name, if it exists. If it does not exist, and the TEMPORARY keyword is not used, it drops a non-temporary table with the same name, if it exists. The TEMPORARY keyword ensures that a non-temporary table will not accidentally be dropped.\n\nUse IF EXISTS to prevent an error from occurring for tables that do not\\\nexist. A NOTE is generated for each non-existent table when usingIF EXISTS. See SHOW WARNINGS.\n\nIf a foreign key references this table, the table cannot be dropped. In this case, it is necessary to drop the foreign key first.\n\nRESTRICT and CASCADE are allowed to make porting from other database systems easier. In MariaDB, they do nothing.\n\nThe comment before the table names (/COMMENT TO SAVE/) is stored in the binary log. That feature can be used by replication tools to send their internal messages.\n\nIt is possible to specify table names as db_name.tab_name. This is useful to delete tables from multiple databases with one statement. See Identifier Qualifiers for details.\n\nThe DROP privilege is required to use DROP TABLE on non-temporary tables. For temporary tables, no privilege is required, because such tables are only visible for the current session.\n\nNote: DROP TABLE automatically commits the current active transaction, unless you use the TEMPORARY keyword.\n\nDROP TABLE reliably deletes table remnants inside a storage engine even if the .frm file is missing.\n\nDROP TABLE does not reliably delete table remnants inside a storage engine even if the .frm file is missing. A missing .frm file will result in the statement failing.\n\nWAIT/NOWAIT\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nDROP TABLE in replication\n\nDROP TABLE has the following characteristics in replication:\n\n DROP TABLE IF EXISTS are always logged.\n DROP TABLE without IF EXISTS for tables that don''t exist are not written to the binary log.\n Dropping of TEMPORARY tables are prefixed in the log with TEMPORARY. These drops are only logged when running statement or mixed mode replication.\n One DROP TABLE statement can be logged with up to 3 different DROP statements:\n   DROP TEMPORARY TABLE list_of_non_transactional_temporary_tables\n   DROP TEMPORARY TABLE list_of_transactional_temporary_tables\n   DROP TABLE list_of_normal_tables\n\nDROP TABLE on the master is treated on the slave as DROP TABLE IF EXISTS. You can change that by setting slave-ddl-exec-mode to STRICT.\n\nDropping an Internal #sql-... Table\n\nDROP TABLE is atomic.\n\nif the mariadbd process is killed during an ALTER TABLE, you may find a table named #sql-... in your data directory. These temporary tables will always be deleted automatically.\n\nIf you want to delete one of these tables explicitly you can do so by using the following syntax:\n\n``\nDROP TABLE #mysql50##sql-...;\n`\n\nWhen running an ALTER TABLE…ALGORITHM=INPLACE that rebuilds the table, InnoDB will create an internal #sql-ib table.\n\nThe same name as the .frm file is used for the intermediate copy of the table. The #sql-ib names are used by TRUNCATE and delayed DROP.\n\nThe #sql-ib tables will be deleted automatically.\n\nDropping All Tables in a Database\n\nThe best way to drop all tables in a database is by executing DROP DATABASE, which will drop the database itself, and all tables in it.\n\nHowever, if you want to drop all tables in the database, but you also want to keep the database itself and any other non-table objects in it, then you would need to execute DROP TABLE to drop each individual table. You can construct these DROP TABLE commands by querying the TABLES table in the information_schema database. For example:\n\n`\nSELECT CONCAT(''DROP TABLE IF EXISTS '', TABLE_SCHEMA, ''.'', TABLE_NAME, '';'')\nFROM information_schema.TABLES\nWHERE TABLE_SCHEMA = ''mydb'';\n`\n\nAtomic DROP TABLE\n\nMariaDB starting with 10.6.1\n\nDROP TABLE for a single table is atomic (MDEV-25180) for most engines, including InnoDB, MyRocks, MyISAM and Aria. This means that if there is a crash (server down or power outage) during DROP TABLE, all tables that have been processed so far will be completely dropped, including related trigger files and status entries, and the binary log will include a DROP TABLE statement for the dropped tables. Tables for which the drop had not started will be left intact.DROP TABLE was extended to be able to delete a table that was only partly dropped (MDEV-11412), as explained above. Atomic DROP TABLE is the final piece to make DROP TABLE fully reliable. Dropping multiple tables is crash-safe. See Atomic DDL for more information.\n\nThere is a small chance that, during a server crash happening in the middle of DROP TABLE, some storage engines that were using multiple storage files, like MyISAM, could have only a part of its internal files dropped. In MariaDB 10.5, DROP TABLE was extended to be able to delete a table that was only partly dropped (MDEV-11412) as explained above. Atomic DROP TABLE is the final piece to make DROP TABLE` fully reliable. Dropping multiple tables is crash-safe. See Atomic DDL for more information.\n\nExamples\n--------\n\nDROP TABLE Employees, Customers;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-table', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-table');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (642, 39, 'DROP TABLESPACE', 'Description\n-----------\n\nThe DROP TABLESPACE statement is not supported by MariaDB. It was originally inherited from MySQL NDB Cluster. In MySQL 5.7 and later, the statement is also supported for InnoDB. However, MariaDB has chosen not to include that specific feature. See MDEV-19294 for more information.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-tablespace', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-tablespace');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (643, 39, 'DROP TRIGGER', 'Syntax\n------\n\nDROP TRIGGER [IF EXISTS] [schema_name.]trigger_name\n\nDescription\n-----------\n\nThis statement drops a trigger. The schema (database) name is optional. If the schema is omitted, the trigger is dropped from the default schema. Its use requires the TRIGGER privilege for the table associated with the trigger.\n\nUse IF EXISTS to prevent an error from occurring for a trigger that does not exist. A NOTE is generated for a non-existent trigger when using IF EXISTS. See SHOW WARNINGS.\n\nNote: Triggers for a table are also dropped if you drop the table.\n\nAtomic DDL\n\nDROP TRIGGER is atomic.\n\nDROP TRIGGER is not atomic.\n\nExamples\n--------\n\nDROP TRIGGER test.example_trigger;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-trigger', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-trigger');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (644, 39, 'RENAME TABLE', 'Syntax\n------\n\nRENAME TABLE[S] [IF EXISTS] tbl_name \n  [WAIT n | NOWAIT]\n  TO new_tbl_name\n    [, tbl_name2 TO new_tbl_name2] ...\n\nDescription\n-----------\n\nThis statement renames one or more tables or views, but not the privileges associated with them. For InnoDB tables, it also triggers a reload of InnoDB statistics.\n\nIF EXISTS\n\nIf this clause is used, you don''t get an error if the table to be renamed doesn''t exist.\n\nThe rename operation is done atomically, which means that no other session can access any of the tables while the rename is running. For example, if you have an existing table old_table, you can create another table new_table that has the same structure but is empty, and then replace the existing table with the empty one as follows (assuming that backup_table does not already exist):\n\n``sql\nCREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO old_table;\n`\n\nMoving Tables to Another Database\n\ntbl_name can optionally be specified as db_name.tbl_name. See Identifier Qualifiers. This allows to use RENAME to move a table from a database to another (as long as they are on the same filesystem):\n\n`sql\nRENAME TABLE db1.t TO db2.t;\n`\n\nLimitations of Moving Tables to Another Database\n\nNote that moving a table to another database is not possible if it has triggers.\n\nTrying to do so produces the following error:\n\n`sql\nERROR 1435 (HY000): Trigger in wrong schema\n`\n\nViews cannot be moved to another database.\n\nTrying to do so produces the following error:\n\n`sql\nERROR 1450 (HY000): Changing schema from ''old_db'' to ''new_db'' is not allowed.\n`\n\nRenaming Multiple Tables at Once\n\nMultiple tables can be renamed in a single statement. The presence or absence of the optional S (RENAME TABLE or RENAME TABLES) has no impact, whether a single or multiple tables are being renamed.\n\nIf a RENAME TABLE renames more than one table and one renaming fails, all renames executed by the same statement are rolled back.\n\nRenames are always executed in the specified order. Knowing this, it is also possible to swap two tables'' names:\n\n`sql\nRENAME TABLE t1 TO tmp_table,\n    t2 TO t1,\n    tmp_table TO t2;\n`\n\nWAIT/NOWAIT\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nPrivileges\n\nExecuting the RENAME TABLE statement requires the DROP, CREATE and INSERT privileges for the table or the database.\n\nAtomic RENAME TABLE\n\nRENAME TABLE is atomic for most storage engines, including InnoDB, MyRocks, MyISAM and Aria (MDEV-23842).\n\nThis means that if there is a crash (server down or power outage) during RENAME TABLE, all tables revert to their original names and any changes to trigger files are reverted.\\\n\\\nSee Atomic DDL for more information.\n\nRENAME TABLE is not atomic.\n\nThere is a small chance that, during a server crash happening in the middle of RENAME TABLE`, some tables could have been renamed (in the worst case partly) while others would not be renamed.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/rename-table', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/rename-table');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (645, 39, 'Renaming Databases', 'Description\n-----------\n\nThere is no RENAME DATABASE statement. To rename a database, use one of the following procedures.\n\nUsing RENAME TABLE\n\nUse this procedure only if your tables have neither triggers nor views or events.\n\nTo move your tables from a database named db1 to one named db2, run these statements:\n\n``sql\nCREATE DATABASE db2;\nDo this for every table in database db1\nRENAME TABLE db1.t TO db2.t;\nWhen no table is left in database db1, optionally drop it\nDROP DATABASE db1;\n`\n\nPrivileges are neither dropped for db1, nor are they "copied" to db2. Use SHOW PRIVILEGES to see which privileges are related to db1, then apply those privileges to db2.\n\nRenaming Databases Manually\n\nTo overcome the limitations of the previous procedure, you can do the following.\n\nIn the following steps, the source database is named PROD , and the destination database TEST.\n\n* Full Backup and Restore: If restoring to a different server, use mariadb-backup to create a full backup, then restore it to the intended server. (This step is optional. It is not necessary if your renamed database is to reside on the same computer.)\n\nDump Logical Objects.\n\nRENAME TABLE does not work for triggers, events, and routines. You need to dump these logical objects separately.\n\n`bash\nmariadb-dump PROD --no-data --routines --triggers --events \\\n> PROD_routines_triggers_events.sql\n`\n\nGenerate RENAME TABLE Commands.\n\nRun the following query to generate a script with the necessary RENAME TABLE statements. This is much faster than a full logical dump.\n\n`sql\nmysql -ss -e"SELECT CONCAT(''RENAME TABLE PROD.'', TABLE_NAME, '' TO TEST.'', \\\nTABLE_NAME, '';'') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ''PROD''" \\\n> PROD_rename_table.sql\n`\n\nList all Existing Objects.\n\n`sql\nSELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES \n       WHERE TABLE_SCHEMA = ''PROD'';\nSELECT EVENT_SCHEMA, EVENT_NAME FROM INFORMATION_SCHEMA.EVENTS \n       WHERE EVENT_SCHEMA = ''PROD'';\nSELECT ROUTINE_SCHEMA, ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES \n       WHERE ROUTINE_SCHEMA = ''PROD'';\nSELECT TRIGGER_SCHEMA, TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS \n WHERE TRIGGER_SCHEMA = ''PROD'';\n`\n\nCreate the new Database.\n\n`sql\nCREATE DATABASE TEST;\n`\n\nRun the rename_table Script.\n\n`bash\nmysql TEST < PROD_rename_table.sql\n`\n\nRestore Logical Objects.\n\nAfter the rename script completes, restore the triggers, routines, and events into the new database.\n\n`bash\nmysql TEST < PROD_routines_triggers_events.sql\n`\n\nVerify all Objects are Restored.\n\nVerify that all objects have been correctly moved to the new TEST database.\n\n`sql\nSELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES \n       WHERE TABLE_SCHEMA = ''TEST'';\nSELECT EVENT_SCHEMA, EVENT_NAME FROM INFORMATION_SCHEMA.EVENTS \n       WHERE EVENT_SCHEMA = ''TEST'';\nSELECT ROUTINE_SCHEMA, ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES \n       WHERE ROUTINE_SCHEMA = ''TEST'';\nSELECT TRIGGER_SCHEMA, TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS \n       WHERE TRIGGER_SCHEMA = ''TEST'';\n`\n\nCleanup.\n\nOnce you have confirmed everything looks good, you can drop the old PROD database.\n\nPrivileges are neither dropped for PROD, nor are they "copied" to TEST. Use SHOW PRIVILEGES to see which privileges are related to PROD, then apply those privileges to TEST`.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-definition/renaming-databases', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-definition/renaming-databases');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (646, 27, 'DELETE', 'Syntax\n------\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE] \n  FROM tbl_name [PARTITION (partition_list)]\n  [FOR PORTION OF PERIOD FROM expr1 TO expr2]\n  [AS alias]                    -- from MariaDB 11.6\n  [WHERE where_condition]\n  [ORDER BY ...]\n  [LIMIT row_count]\n  [RETURNING select_expr \n    [, select_expr ...]]\n\nDescription\n-----------\n\n| Option        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| LOW_PRIORITY | Wait until all SELECT statement are done before starting the statement. Used with storage engines that uses table locking (MyISAM, Aria etc). See HIGH_PRIORITY and LOW_PRIORITY clauses for details.                                                                                                                                                                                                                                                          |\n| QUICK         | Signal the storage engine that it should expect that a lot of rows are deleted. The storage engine can do things to speed up the DELETE like ignoring merging of data blocks until all rows are deleted from the block (instead of when a block is half full). This speeds up things at the expanse of lost space in data blocks. At least MyISAM and Aria support this feature. |\n| IGNORE        | Don''t stop the query even if a not-critical error occurs (like data overflow). See How IGNORE works for a full description.                                                                                                                                                                                                                                                                                                                                      |\n\nFor the single-table syntax, the DELETE statement deletes rows from tbl_name and returns a count of the number of deleted rows. This count can be obtained by calling the ROW_COUNT() function. TheWHERE clause, if given, specifies the conditions that identify which rows to delete. With no WHERE clause, all rows are deleted. If the ORDER BY clause is specified, the rows are deleted in the order that is specified. The LIMIT clause places a limit on the number of rows that can be deleted.\n\nFor the multiple-table syntax, DELETE deletes from each tbl_name the rows that satisfy the conditions. In this case, ORDER BY and LIMIT cannot be used. A DELETE can also reference tables which are located in different databases; see Identifier Qualifiers for the syntax.\n\nwhere_condition is an expression that evaluates to true for each row to be deleted. It is specified as described in SELECT.\n\nYou cannot delete from a table and select from the same table in a subquery.\n\nYou need the DELETE privilege on a table to delete rows from it. You need only the SELECT privilege for any columns that are only read, such as those named in the WHERE clause. See GRANT.\n\nAs stated, a DELETE statement with no WHERE clause deletes all rows. A faster way to do this, when you do not need to know the number of deleted rows, is to use TRUNCATE TABLE. However, within a transaction or if you have a lock on the table,TRUNCATE TABLE cannot be used whereas DELETE can. See TRUNCATE TABLE, and LOCK.\n\nAS\n\nSingle-table DELETE statements support aliases. For example:\n\n``sql\nCREATE TABLE t1 (c1 INT);\nINSERT INTO t1 VALUES (1), (2);\n\nDELETE FROM t1 AS a1 WHERE a1.c1 = 2;\n`\n\nSingle-table DELETE statements do not support aliases.\n\nPARTITION\n\nSee Partition Pruning and Selection for details.\n\nFOR PORTION OF\n\nSee Application Time Periods - Deletion by Portion.\n\nRETURNING\n\nIt is possible to return a result set of the deleted rows for a single table to the client by using the syntax DELETE ... RETURNING select_expr [, select_expr2 ...]]\n\nAny of SQL expression that can be calculated from a single row fields is allowed. Subqueries are allowed. The AS keyword is allowed, so it is possible to use aliases.\n\nThe use of aggregate functions is not allowed. RETURNING cannot be used in multi-table DELETE statements.\n\nSame Source and Target Table\n\nIt is possible to delete from a table with the same source and target. For example:\n\n`sql\nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE b.c2=0);\n`\n\nDELETE HISTORY\n\nYou can use DELETE HISTORY` to delete historical information from System-versioned tables.\n\nExamples\n--------\n\nDELETE FROM page_hit ORDER BY TIMESTAMP LIMIT 1000000;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/delete', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/delete');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (647, 27, 'HIGH\\_PRIORITY and LOW\\_PRIORITY', 'Description\n-----------\n\nThe InnoDB storage engine uses row-level locking to ensure data integrity. However some storage engines (such as MEMORY, MyISAM, Aria and MERGE) lock the whole table to prevent conflicts. These storage engines use two separate queues to remember pending statements; one is for SELECTs and the other one is for write statements (INSERT, DELETE, UPDATE). By default, the latter has a higher priority.\n\nTo give write operations a lower priority, the low_priority_updates server system variable can be set to ON. The option is available on both the global and session levels, and it can be set at startup or via the SET statement.\n\nWhen too many table locks have been set by write statements, some pending SELECTs are executed. The maximum number of write locks that can be acquired before this happens is determined by the max_write_lock_count server system variable, which is dynamic.\n\nIf write statements have a higher priority (default), the priority of individual write statements (INSERT, REPLACE, UPDATE, DELETE) can be changed via the LOW_PRIORITY attribute, and the priority of a SELECT statement can be raised via the HIGH_PRIORITY attribute. Also, LOCK TABLES supports a LOW_PRIORITY attribute for WRITE locks.\n\nIf read statements have a higher priority, the priority of an INSERT can be changed via the HIGH_PRIORITY attribute. However, the priority of other write statements cannot be raised individually.\n\nThe use of LOW_PRIORITY or HIGH_PRIORITY for an INSERT prevents Concurrent Inserts from being used.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/high_priority-and-low_priority', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/high_priority-and-low_priority');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (648, 27, 'REPLACE', 'Syntax\n------\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n[RETURNING select_expr \n      [, select_expr ...]]\n\nDescription\n-----------\n\nREPLACE works exactly like INSERT, except that if an old row in the table has the same value as a new row for a PRIMARY KEY or aUNIQUE index, the old row is deleted before the new row is inserted. If the table has more than one UNIQUE keys, it is possible that the new row conflicts with more than one row. In this case, all conflicting rows will be deleted.\n\nThe table name can be specified in the form db_name.tbl_name or, if a default database is selected, in the form tbl_name (see Identifier Qualifiers). This allows to use REPLACE ... SELECT to copy rows between different databases.\n\nBasically it works like this:\n\n``sql\nBEGIN;\nSELECT 1 FROM t1 WHERE KEY=# FOR UPDATE;\nIF FOUND-ROW\n  DELETE FROM t1 WHERE KEY=# ;\nENDIF\nINSERT INTO t1 VALUES (...);\nEND;\n`\n\nThe above can be replaced with:\n\n`sql\nREPLACE INTO t1 VALUES (...)\n`\n\nREPLACE is a MariaDB/MySQL extension to the SQL standard. It either inserts, or deletes and inserts. For other MariaDB/MySQL extensions to standard SQL --- that also handle duplicate values --- see IGNORE and INSERT ON DUPLICATE KEY UPDATE.\n\nNote that unless the table has a PRIMARY KEY orUNIQUE index, using a REPLACE statement makes no sense. It becomes equivalent to INSERT, because there is no index to be used to determine whether a new row duplicates another.\n\nValues for all columns are taken from the values. See Partition Pruning and Selection for details. Specified in theREPLACE statement. Any missing columns are set to their default values, just as happens for INSERT. You cannot refer to values from the current row and use them in the new row. If you use an assignment such as ''SET col = col + 1'', the reference to the column name on the right hand side is treated asDEFAULT(col), so the assignment is equivalent to''SET col = DEFAULT(col) + 1''.\n\nTo use REPLACE, you must have both theINSERT and DELETE privileges for the table.\n\nThere are some issues you should be aware of, before using REPLACE:\n\n If there is an AUTO_INCREMENT field, a new value will be generated.\n If there are foreign keys, ON DELETE action will be activated by REPLACE.\n* Triggers on DELETE and INSERT will be activated by REPLACE.\n\nTo avoid some of these behaviors, you can use INSERT ... ON DUPLICATE KEY UPDATE.\n\nThis statement activates INSERT and DELETE triggers. See Trigger Overview for details.\n\nPARTITION\n\nSee Partition Pruning and Selection for details.\n\nREPLACE RETURNING\n\nREPLACE ... RETURNING returns a resultset of the replaced rows. This returns the listed columns for all the rows that are replaced, or alternatively, the specified SELECT expression. Any SQL expressions which can be calculated can be used in the select expression for the RETURNING` clause, including virtual columns and aliases, expressions which use various operators such as bitwise, logical and arithmetic operators, string functions, date-time functions, numeric functions, control flow functions, secondary functions and stored functions. Along with this, statements which have subqueries and prepared statements can also be used.\n\nExamples\n--------\n\nREPLACE INTO t2 VALUES (1,''Leopard''),(2,''Dog'') RETURNING id2, id2+id2 \nas Total ,id2|id2, id2&&id2;\n+-----+-------+---------+----------+\n| id2 | Total | id2|id2 | id2&&id2 |\n+-----+-------+---------+----------+\n|   1 |     2 |       1 |        1 |\n|   2 |     4 |       2 |        1 |\n+-----+-------+---------+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/replace', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/replace');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (649, 27, 'REPLACE...RETURNING', 'Syntax\n------\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n[RETURNING select_expr \n      [, select_expr ...]]\n\nDescription\n-----------\n\nREPLACE ... RETURNING returns a result set of the replaced rows. The statement returns the listed columns for all the rows that are replaced, or alternatively, the specified SELECT expression. Any SQL expressions which can be calculated can be used in the select expression for the RETURNING clause, including virtual columns and aliases, expressions which use various operators such as bitwise, logical and arithmetic operators, string functions, date-time functions, numeric functions, control flow functions, secondary functions and stored functions. Along with this, statements which have subqueries and prepared statements can also be used.\n\nExamples\n--------\n\nREPLACE INTO t2 VALUES (1,''Leopard''),(2,''Dog'') RETURNING id2, id2+id2 \nAS Total ,id2|id2, id2&&id2;\n+-----+-------+---------+----------+\n| id2 | Total | id2|id2 | id2&&id2 |\n+-----+-------+---------+----------+\n|   1 |     2 |       1 |        1 |\n|   2 |     4 |       2 |        1 |\n+-----+-------+---------+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/replacereturning', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/replacereturning');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (650, 27, 'UPDATE', 'Syntax\n------\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_reference \n  [PARTITION (partition_list)]\n  [FOR PORTION OF period FROM expr1 TO expr2]\n  SET col1={expr1|DEFAULT} [,col2={expr2|DEFAULT}] ...\n  [WHERE where_condition]\n  [ORDER BY ...]\n  [LIMIT row_count]\n  RETURNING OLD_VALUE(val) AS old [, val as new]\n\nDescription\n-----------\n\nFor the single-table syntax, the UPDATE statement updates columns of existing rows in the named table with new values. TheSET clause indicates which columns to modify and the values they should be given. Each value can be given as an expression, or the keywordDEFAULT to set a column explicitly to its default value. TheWHERE clause, if given, specifies the conditions that identify which rows to update. With no WHERE clause, all rows are updated. If the ORDER BY clause is specified, the rows are\\\nupdated in the order that is specified. The LIMIT clause places a limit on the number of rows that can be updated.\n\nBoth clauses can be used with multiple-table updates.\n\nBoth clauses can be used with multiple-table updates. For the multiple-table syntax, UPDATE updates rows in each table named in table_references that satisfy the conditions. In this case, ORDER BY and LIMIT could not be used.\n\nAn UPDATE can also reference tables which are located in different databases; see Identifier Qualifiers for the syntax.\n\nwhere_condition is an expression that evaluates to true for each row to be updated.\n\ntable_references and where_condition are as specified as described in SELECT.\n\nFor single-table updates, assignments are evaluated in left-to-right order, while for multi-table updates, there is no guarantee of a particular order. If the SIMULTANEOUS_ASSIGNMENT sql_mode is set, UPDATE statements evaluate all assignments simultaneously.\n\nYou need the UPDATE privilege only for columns referenced in an UPDATE that are actually updated. You need only the SELECT privilege for any columns that are read but not modified. See GRANT.\n\nThe UPDATE statement supports the following modifiers:\n\n If you use the LOW_PRIORITY keyword, execution of the UPDATE is delayed until no other clients are reading from the table. This affects only storage engines that use only table-level locking (MyISAM, MEMORY, MERGE). See HIGH_PRIORITY and LOW_PRIORITY clauses for details.\n If you use the IGNORE keyword, the update statement does not abort even if errors occur during the update. Rows for which duplicate-key conflicts occur are not updated. Rows for which columns are updated to values that would cause data conversion errors are updated to the closest valid values instead.\n\nPARTITION\n\nSee Partition Pruning and Selection for details.\n\nFOR PORTION OF\n\nSee Application Time Periods - Updating by Portion.\n\nUPDATE Statements With the Same Source and Target\n\nUPDATE statements may have the same source and target. For example, given the following table:\n\n``sql\nDROP TABLE t1;\nCREATE TABLE t1 (c1 INT, c2 INT);\nINSERT INTO t1 VALUES (10,10), (20,20);\n\nUPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);\n\nSELECT * FROM t1;\n+------+------+\n| c1   | c2   |\n+------+------+\n|   10 |   10 |\n|   21 |   20 |\n+------+------+\n``\n\nExamples\n--------\n\nUPDATE table_name SET column1 = value1, column2 = value2 WHERE id=100;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/update', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/update');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (651, 27, 'Concurrent Inserts', 'Description\n-----------\n\nThe MyISAM storage engine supports concurrent inserts. This feature allows SELECT statements to be executed during INSERT operations, reducing contention.\n\nWhether concurrent inserts can be used or not depends on the value of the concurrent_insert server system variable:\n\n NEVER (0) disables concurrent inserts.\n AUTO (1) allows concurrent inserts only when the target table has no free blocks (no data in the middle of the table has been deleted after the last OPTIMIZE TABLE). This is the default.\n* ALWAYS (2) always enables concurrent inserts, in which case new rows are added at the end of a table if the table is being used by another thread.\n\nIf the binary log is used, CREATE TABLE ... SELECT and INSERT ... SELECT statements cannot use concurrent inserts. These statements acquire a read lock on the table, so concurrent inserts will need to wait. This way, the log can be safely used to restore data.\n\nConcurrent inserts are not used by slaves with the row-based replication (see binary log formats).\n\nIf an INSERT statement contains the HIGH_PRIORITY clause, concurrent inserts cannot be used. INSERT ... DELAYED is usually unneeded if concurrent inserts are enabled.\n\nLOAD DATA INFILE uses concurrent inserts if the CONCURRENT keyword is specified and concurrent_insert is not NEVER. This makes the statement slower (even if no other sessions access the table) but reduces contention.\n\nLOCK TABLES allows non-conflicting concurrent inserts if a READ LOCAL lock is used. Concurrent inserts are not allowed if the LOCAL keyword is omitted.\n\nNotes\n\nThe decision to enable concurrent insert for a table is done when the table is opened. If you change the value of concurrent_insert, it will only affect newly opened tables. If you want it to work for also for tables in use or cached, you should do FLUSH TABLES after setting the variable.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/concurrent-inserts', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/concurrent-inserts');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (652, 27, 'IGNORE', 'Description\n-----------\n\nThe IGNORE option tells the server to ignore some common errors.\n\nIGNORE can be used with the following statements:\n\n DELETE\n INSERT (see also INSERT IGNORE)\n LOAD DATA INFILE\n UPDATE\n ALTER TABLE\n CREATE TABLE ... SELECT\n INSERT ... SELECT\n\nThe logic used:\n\n Variables out of ranges are replaced with the maximum/minimum value.\n SQL_MODEs STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE are ignored.\n Inserting NULL in a NOT NULL field will insert 0 ( in a numerical field), 0000-00-00 ( in a date field) or an empty string ( in a character field).\n* Rows that cause a duplicate key error or break a foreign key constraint are not inserted, updated, or deleted.\n\nThe following errors are ignored:\n\n| Error number | Symbolic error name                              | Description                                                           |\n| ------------ | ------------------------------------------------ | --------------------------------------------------------------------- |\n| 1022         | ER_DUP_KEY                                     | Can''t write; duplicate key in table ''%s''                              |\n| 1048         | ER_BAD_NULL_ERROR                             | Column ''%s'' cannot be null                                            |\n| 1062         | ER_DUP_ENTRY                                   | Duplicate entry ''%s'' for key %d                                       |\n| 1242         | ER_SUBQUERY_NO_1_ROW                         | Subquery returns more than 1 row                                      |\n| 1264         | ER_WARN_DATA_OUT_OF_RANGE                   | Out of range value for column ''%s'' at row %ld                         |\n| 1265         | WARN_DATA_TRUNCATED                            | Data truncated for column ''%s'' at row %ld                             |\n| 1292         | ER_TRUNCATED_WRONG_VALUE                      | Truncated incorrect %s value: ''%s''                                    |\n| 1366         | ER_TRUNCATED_WRONG_VALUE_FOR_FIELD          | Incorrect integer value                                               |\n| 1369         | ER_VIEW_CHECK_FAILED                          | CHECK OPTION failed ''%s.%s''                                           |\n| 1451         | ER_ROW_IS_REFERENCED_2                       | Cannot delete or update a parent row                                  |\n| 1452         | ER_NO_REFERENCED_ROW_2                       | Cannot add or update a child row: a foreign key constraint fails (%s) |\n| 1526         | ER_NO_PARTITION_FOR_GIVEN_VALUE             | Table has no partition for value %s                                   |\n| 1586         | ER_DUP_ENTRY_WITH_KEY_NAME                  | Duplicate entry ''%s'' for key ''%s''                                     |\n| 1591         | ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT     | Table has no partition for some existing values                       |\n| 1748         | ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET | Found a row not matching the given partition set                      |\n\nIgnored errors normally generate a warning.\n\nA property of the IGNORE clause consists in causing transactional engines and non-transactional engines (like InnoDB and Aria) to behave the same way. For example, normally a multi-row insert which tries to violate a UNIQUE contraint is completely rolled back on InnoDB, but might be partially executed on Aria. With the IGNORE clause, the statement will be partially executed in both engines.\n\nDuplicate key errors also generate warnings. The OLD_MODE server variable can be used to prevent this.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/ignore', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/ignore');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (653, 27, 'INSERT - Default & Duplicate Values', 'Description\n-----------\n\nDefault Values\n\nIf the SQL_MODE contains STRICT_TRANS_TABLES and you are inserting into a transactional table (like InnoDB), or if the SQL_MODE contains STRICT_ALL_TABLES, all NOT NULL columns which do not have a DEFAULT value (and are not AUTO_INCREMENT) must be explicitly referenced in INSERT statements. If not, an error like this is produced:\n\n``\nERROR 1364 (HY000): Field ''col'' doesn''t have a default value\n`\n\nIn all other cases, if a NOT NULL column without a DEFAULT value is not referenced, an empty value will be inserted (for example, 0 for INTEGER columns and '''' for CHAR columns). See NULL Values in MariaDB:Inserting for examples.\n\nIf a NOT NULL column having a DEFAULT value is not referenced, NULL will be inserted.\n\nIf a NULL column having a DEFAULT value is not referenced, its default value will be inserted. It is also possible to explicitly assign the default value using the DEFAULT keyword or the DEFAULT() function.\n\nIf the DEFAULT keyword is used but the column does not have a DEFAULT value, an error like this is produced:\n\n`\nERROR 1364 (HY000): Field ''col'' doesn''t have a default value\n`\n\nDuplicate Values\n\nBy default, if you try to insert a duplicate row and there is a UNIQUE index, INSERT stops and an error like this is produced:\n\n`\nERROR 1062 (23000): Duplicate entry ''dup_value'' for key ''col''\n``\n\nTo handle duplicates you can use the IGNORE clause, INSERT ON DUPLICATE KEY UPDATE or the REPLACE statement. Note that the IGNORE and DELAYED options are ignored when you use ON DUPLICATE KEY UPDATE.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert-default-duplicate-values', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert-default-duplicate-values');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (654, 27, 'INSERT DELAYED', 'Description\n-----------\n\nThe DELAYED option for the INSERT statement is a MariaDB/MySQL extension to standard SQL that is very useful if you have clients that cannot or need not wait for the INSERT to complete. This is a common situation when you use MariaDB for logging and you also periodically run SELECT and UPDATE statements that take a long time to complete.\n\nWhen a client uses INSERT DELAYED, it gets an okay from the server at once, and the row is queued to be inserted when the table is not in use by any other thread.\n\nAnother major benefit of using INSERT DELAYED is that inserts from many clients are bundled together and written in one block. This is much faster than performing many separate inserts.\n\nNote that INSERT DELAYED is slower than a normalINSERT if the table is not otherwise in use. There is also the additional overhead for the server to handle a separate thread for each table for which there are delayed rows. This means that you should useINSERT DELAYED only when you are really sure that you need it.\n\nThe queued rows are held only in memory until they are inserted into the table. This means that if you terminate mariadbd forcibly (for example, with kill -9) or if mariadbd dies unexpectedly, any queued rows that have not been written to disk are lost.\n\nThe number of concurrent INSERT DELAYED threads is limited by the max_delayed_threads server system variables. If it is set to 0, INSERT DELAYED is disabled. The session value can be equal to the global value, or 0 to disable this statement for the current session. If this limit has been reached, the DELAYED clause will be silently ignore for subsequent statements (no error will be produced).\n\nLimitations\n\nThere are some limitations on the use of DELAYED:\n\n INSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE,\\\n  and BLACKHOLE tables. If you execute INSERT DELAYED with another storage engine, you will get an error like this: ERROR 1616 (HY000): DELAYED option not supported for table ''tab_name''\n For MyISAM tables, if there are no free blocks in the middle of the data file, concurrent SELECT and INSERT statements are supported. Under these circumstances, you very seldom need to use INSERT DELAYED with MyISAM.\n INSERT DELAYED should be used only forINSERT statements that specify value lists. The server\\\n  ignores DELAYED for INSERT ... SELECT or INSERT ... ON DUPLICATE KEY UPDATE statements.\n Because the INSERT DELAYED statement returns immediately, before the rows are inserted, you cannot useLAST_INSERT_ID() to get theAUTO_INCREMENT value that the statement might generate.\n DELAYED rows are not visible to SELECT statements until they actually have been inserted.\n After INSERT DELAYED, ROW_COUNT() returns the number of the rows you tried to insert, not the number of the successful writes.\n DELAYED is ignored on slave replication servers, so thatINSERT DELAYED is treated as a normal INSERT on slaves. This is becauseDELAYED could cause the slave to have different data than\\\n  the master. INSERT DELAYED statements are not safe for replication.\n Pending INSERT DELAYED statements are lost if a table is write locked and ALTER TABLE is used to modify the table structure.\n INSERT DELAYED is not supported for views. If you try, you will get an error like this: ERROR 1347 (HY000): ''view_name'' is not BASE TABLE\n INSERT DELAYED is not supported for partitioned tables.\n INSERT DELAYED is not supported within stored programs.\n INSERT DELAYED does not work with triggers.\n INSERT DELAYED does not work if there is a check constraint in place.\n INSERT DELAYED does not work if skip-new mode is active.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert-delayed', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert-delayed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (655, 27, 'INSERT IGNORE', 'Description\n-----------\n\nIgnoring Errors\n\nNormally INSERT stops and rolls back when it encounters an error.\n\nBy using the IGNORE keyword all errors are converted to warnings, which will not stop inserts of additional rows.\n\nInvalid values are changed to the closest valid value and inserted, with a warning produced.\n\nThe IGNORE and DELAYED options are ignored when you use ON DUPLICATE KEY UPDATE.\n\nWarnings are issued for duplicate key errors when using IGNORE. You can get the old behavior if you set OLD_MODE to NO_DUP_KEY_WARNINGS_WITH_IGNORE.\n\nNo warnings are issued for duplicate key errors when using IGNORE.\n\nSee IGNORE for a full description of effects.\n\nExamples\n--------\n\nCREATE TABLE t1 (x INT UNIQUE);\n\nINSERT INTO t1 VALUES(1),(2);\n\nINSERT INTO t1 VALUES(2),(3);\nERROR 1062 (23000): Duplicate entry ''2'' for key ''x''\nSELECT  FROM t1;\n+------+\n| x    |\n+------+\n|    1 |\n|    2 |\n+------+\n\nINSERT IGNORE INTO t1 VALUES(2),(3);\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSHOW WARNINGS;\n+---------+------+---------------------------------+\n| Level   | Code | Message                         |\n+---------+------+---------------------------------+\n| Warning | 1062 | Duplicate entry ''2'' for key ''x'' |\n+---------+------+---------------------------------+\n\nSELECT  FROM t1;\n+------+\n| x    |\n+------+\n|    1 |\n|    2 |\n|    3 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert-ignore', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert-ignore');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (656, 27, 'INSERT ON DUPLICATE KEY UPDATE', 'Syntax\n------\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n  [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n  {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n  [ ON DUPLICATE KEY UPDATE\n    col=expr\n      [, col=expr] ... ]\n\nDescription\n-----------\n\nINSERT ... ON DUPLICATE KEY UPDATE (often called "upsert") is a MariaDB/MySQL extension to the INSERT statement that, if it finds a duplicate unique or primary key, will instead perform an UPDATE.\n\nThe row/s affected value is reported as 1 if a row is inserted, and 2 if a row is updated, unless the API''s CLIENT_FOUND_ROWS flag is set.\n\nIf more than one unique index is matched, only the first is updated. It is not recommended to use this statement on tables with more than one unique index.\n\nIf the table has an AUTO_INCREMENT primary key and the statement inserts or updates a row, the LAST_INSERT_ID() function returns its AUTO_INCREMENT value.\n\nThe VALUES() function can only be used in a ON DUPLICATE KEY UPDATE clause and has no meaning in any other context. It returns the column values from the INSERT portion of the statement. This function is particularly useful for multi-rows inserts.\n\nThe IGNORE and DELAYED options are ignored when you use ON DUPLICATE KEY UPDATE.\n\nSee Partition Pruning and Selection for details on the PARTITION clause.\n\nThis statement activates INSERT and UPDATE triggers. See Trigger Overview for details.\n\nSee also a similar statement, REPLACE.\n\nExamples\n--------\n\nCREATE TABLE ins_duplicate (id INT PRIMARY KEY, animal VARCHAR(30));\nINSERT INTO ins_duplicate VALUES (1,''Aardvark''), (2,''Cheetah''), (3,''Zebra'');\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert-on-duplicate-key-update', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert-on-duplicate-key-update');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (657, 27, 'INSERT SELECT', 'Syntax\n------\n\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n    [INTO] tbl_name [(col_name,...)]\n    SELECT ...\n    [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]\n\nDescription\n-----------\n\nWith INSERT ... SELECT, you can quickly insert many rows into a table from one or more other tables. For example:\n\n``sql\nINSERT INTO tbl_temp2 (fld_id)\n  SELECT tbl_temp1.fld_order_id\n  FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;\n`\n\ntbl_name can also be specified in the form db_name.tbl_name (see Identifier Qualifiers). This allows to copy rows between different databases.\n\nIf the new table has a primary key or UNIQUE indexes, you can use IGNORE to handle duplicate key errors during the query. The newer values will not be inserted if an identical value already exists.\n\nREPLACE can be used instead of INSERT to prevent duplicates on UNIQUE indexes by deleting old values. In that case, ON DUPLICATE KEY UPDATE cannot be used.\n\nINSERT ... SELECT` works for tables which already exist. To create a table for a given resultset, you can use CREATE TABLE ... SELECT.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert-select', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert-select');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (658, 27, 'INSERT', 'Description\n-----------\n\nSyntax\n\n``sql\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n   col=expr\n     [, col=expr] ... ] [RETURNING select_expr \n      [, select_expr ...]]\n`\n\nOr:\n\n`sql\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n    [INTO] tbl_name [PARTITION (partition_list)]\n    SET col={expr | DEFAULT}, ...\n    [ ON DUPLICATE KEY UPDATE\n      col=expr\n        [, col=expr] ... ] [RETURNING select_expr \n      [, select_expr ...]]\n`\n\nOr:\n\n`sql\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n    [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n    SELECT ...\n    [ ON DUPLICATE KEY UPDATE\n      col=expr\n        [, col=expr] ... ] [RETURNING select_expr \n      [, select_expr ...]]\n`\n\nThe INSERT statement is used to insert new rows into an existing table. The INSERT ... VALUES\\\nand INSERT ... SET forms of the statement insert rows based on explicitly specified values. The INSERT ... SELECT form inserts rows selected from another table or tables. INSERT ... SELECT is discussed further in the INSERT ... SELECT article.\n\nThe table name can be specified in the form db_name.tbl_name or, if a default database is selected, in the form tbl_name (see Identifier Qualifiers). This allows to use INSERT ... SELECT to copy rows between different databases.\n\nThe PARTITION clause can be used in both the INSERT and the SELECT part. See Partition Pruning and Selection for details.\n\nThe RETURNING clause can be used.\n\nThe RETURNING clause is not available.\n\nThe columns list is optional. It specifies which values are explicitly inserted, and in which order. If this clause is not specified, all values must be explicitly specified, in the same order they are listed in the table definition.\n\nThe list of value follow the VALUES or VALUE keyword (which are interchangeable, regardless how much values you want to insert), and is wrapped by parenthesis. The values must be listed in the same order as the columns list. It is possible to specify more than one list to insert more than one rows with a single statement. If many rows are inserted, this is a speed optimization.\n\nFor one-row statements, the SET clause may be more simple, because you don''t need to remember the columns order. All values are specified in the form col = expr.\n\nValues can also be specified in the form of a SQL expression or subquery. However, the subquery cannot access the same table that is named in the INTO clause.\n\nIf you use the LOW_PRIORITY keyword, execution of the INSERT is delayed until no other clients are reading from the table. If you use the HIGH_PRIORITY keyword, the statement has the same priority as SELECTs. This affects only storage engines that use only table-level locking (MyISAM, MEMORY, MERGE). However, if one of these keywords is specified, concurrent inserts cannot be used. See HIGH_PRIORITY and LOW_PRIORITY clauses for details.\n\nINSERT DELAYED\n\nFor more details on the DELAYED` option, see INSERT DELAYED.\n\nHIGH PRIORITY and LOW PRIORITY\n\nSee HIGH_PRIORITY and LOW_PRIORITY.\n\nDefaults and Duplicate Values\n\nSee INSERT - Default & Duplicate Values for details..\n\nINSERT IGNORE\n\nSee INSERT IGNORE.\n\nINSERT ON DUPLICATE KEY UPDATE\n\nSee INSERT ON DUPLICATE KEY UPDATE.\n\nExamples\n--------\n\nINSERT INTO person (first_name, last_name) VALUES (''John'', ''Doe'');\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insert');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (659, 27, 'INSERT...RETURNING', 'Syntax\n------\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n   col=expr\n     [, col=expr] ... ] [RETURNING select_expr \n      [, select_expr ...]]\n\nDescription\n-----------\n\nINSERT ... RETURNING returns a resultset of the inserted rows.\n\nIt returns the listed columns for all the rows that are inserted, or alternatively, the specified SELECT expression. Any SQL expressions which can be calculated can be used in the select expression for the RETURNING clause, including virtual columns and aliases, expressions which use various operators such as bitwise, logical and arithmetic operators, string functions, date-time functions, numeric functions, control flow functions, secondary functions and stored functions. Along with this, statements which have subqueries and prepared statements can also be used.\n\nExamples\n--------\n\nCREATE OR REPLACE TABLE t2 (id INT, animal VARCHAR(20), t TIMESTAMP);\n\nINSERT INTO t2 (id) VALUES (2),(3) RETURNING id,t;\n+------+---------------------+\n| id   | t                   |\n+------+---------------------+\n|    2 | 2021-04-28 00:59:32 |\n|    3 | 2021-04-28 00:59:32 |\n+------+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insertreturning', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/insertreturning');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (660, 27, 'LOAD DATA INFILE', 'Syntax\n------\n\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE ''file_name''\n    [REPLACE | IGNORE]\n    INTO TABLE tbl_name\n    [CHARACTER SET charset_name]\n    [{FIELDS | COLUMNS}\n        [TERMINATED BY ''string'']\n        [[OPTIONALLY] ENCLOSED BY ''CHAR'']\n        [ESCAPED BY ''CHAR'']\n    ]\n    [LINES\n        [STARTING BY ''string'']\n        [TERMINATED BY ''string'']\n    ]\n    [IGNORE number {LINES|ROWS}]\n    [(col_name_or_user_var,...)]\n    [SET col_name = expr,...]\n\nDescription\n-----------\n\nLOAD DATA INFILE is unsafe for statement-based replication.\n\nReads rows from a text file into the designated table on the database at a very high speed. The file name must be given as a literal string.\n\nFiles are written to disk using the SELECT INTO OUTFILE statement. You can then read the files back into a table using the LOAD DATA INFILE statement. The FIELDS and LINES clauses are the same in both statements and by default fields are expected to be terminated with tabs () and lines with newlines (). These clauses are optional, but if both are specified then the FIELDS clause must precede LINES.\n\nExecuting this statement activates INSERT triggers.\n\nOne must have the FILE privilege to be able to execute LOAD DATA INFILE. This is to ensure normal users cannot read system files. LOAD DATA LOCAL INFILE does not have this requirement.\n\nIf the secure_file_priv system variable is set (by default it is not), the loaded file must be present in the specified directory.\n\nNote that MariaDB''s systemd unit file restricts access to /home, /root, and /run/user by default. See Configuring access to home directories.\n\nLOAD DATA LOCAL INFILE\n\nWhen you execute the LOAD DATA INFILE statement, MariaDB Server attempts to read the input file from its own file system. By contrast, when you execute the LOAD DATA LOCAL INFILE statement, the client attempts to read the input file from its file system, and it sends the contents of the input file to the MariaDB Server. This allows you to load files from the client''s local file system into the database.\n\nIf you don''t want to permit this operation (perhaps for security reasons), you can disable the LOAD DATA LOCAL INFILE statement on either the server or the client.\n\n The LOAD DATA LOCAL INFILE statement can be disabled on the server by setting the local_infile system variable to 0.\n The LOAD DATA LOCAL INFILE statement can be disabled on the client. If you are using MariaDB Connector/C, this can be done by unsetting the CLIENT_LOCAL_FILES capability flag with the mysql_real_connect function or by unsetting the MYSQL_OPT_LOCAL_INFILE option with mysql_optionsv function. If you are using a different client or client library, then see the documentation for your specific client or client library to determine how it handles the LOAD DATA LOCAL INFILE statement.\n The LOAD DATA LOCAL INFILE strict modes like STRICT_TRANS_TABLES are disabled with keyword "local". (MDEV-11235)\n\nIf the LOAD DATA LOCAL INFILE statement is disabled by either the server or the client and if the user attempts to execute it, then the server will cause the statement to fail with the following error message:\n\n``\nThe used command is not allowed with this MariaDB version\n`\n\nNote that it is not entirely accurate to say that the MariaDB version does not support the command. It would be more accurate to say that the MariaDB configuration does not support the command. See MDEV-20500 for more information.\n\nFrom MariaDB 10.5.2, the error message is more accurate:\n\n`\nThe used command is not allowed because the MariaDB server or client \n  has disabled the local infile capability\n`\n\nREPLACE and IGNORE\n\nIf you load data from a file into a table that already contains data and has a primary key, you may encounter issues where the statement attempts to insert a row with a primary key that already exists. When this happens, the statement fails with Error 1064, protecting the data already on the table. If you want MariaDB to overwrite duplicates, use the REPLACE keyword.\n\nThe REPLACE keyword works like the REPLACE statement. Here, the statement attempts to load the data from the file. If the row does not exist, it adds it to the table. If the row contains an existing primary key, it replaces the table data. That is, in the event of a conflict, it assumes the file contains the desired row.\n\nThis operation can cause a degradation in load speed by a factor of 20 or more if the part that has already been loaded is larger than the capacity of the InnoDB Buffer Pool. This happens because it causes a lot of turnaround in the buffer pool.\n\nUse the IGNORE keyword when you want to skip any rows that contain a conflicting primary key. Here, the statement attempts to load the data from the file. If the row does not exist, it adds it to the table. If the row contains an existing primary key, it ignores the addition request and moves on to the next. That is, in the event of a conflict, it assumes the table contains the desired row.\n\nIGNORE number {LINES|ROWS}\n\nThe IGNORE number LINES syntax can be used to ignore a number of rows from the beginning of the file. Most often this is needed when the file starts with one row that includes the column headings.\n\nCharacter Sets\n\nWhen the statement opens the file, it attempts to read the contents using the default character-set, as defined by the character_set_database system variable.\n\nIn the cases where the file was written using a character-set other than the default, you can specify the character-set to use with the CHARACTER SET clause in the statement. It ignores character-sets specified by the SET NAMES statement and by the character_set_client system variable. Setting the CHARACTER SET clause to a value of binary indicates "no conversion."\n\nThe statement interprets all fields in the file as having the same character-set, regardless of the column data type. To properly interpret file contents, you must ensure that it was written with the correct character-set. If you write a data file with mariadb-dump -T or with the SELECT INTO OUTFILE statement with the mariadb client, be sure to use the --default-character-set option, so that the output is written with the desired character-set.\n\nWhen using mixed character sets, use the CHARACTER SET clause in both SELECT INTO OUTFILE and LOAD DATA INFILE to ensure that MariaDB correctly interprets the escape sequences.\n\nThe character_set_filesystem system variable controls the interpretation of the filename.\\\nIt is currently not possible to load data files that use the ucs2 character set.\n\nPreprocessing Inputs\n\n_col_name_or_user_var_ can be a column name, or a user variable. In the case of a variable, the SET statement can be used to preprocess the value before loading into the table.\n\nPriority and Concurrency\n\nIn storage engines that perform table-level locking (MyISAM, MEMORY and MERGE), using the LOW_PRIORITY keyword, MariaDB delays insertions until no other clients are reading from the table. Alternatively, when using the MyISAM storage engine, you can use the CONCURRENT keyword to perform concurrent insertion.\n\nThe LOW_PRIORITY and CONCURRENT keywords are mutually exclusive. They cannot be used in the same statement.\n\nProgress Reporting\n\nThe LOAD DATA INFILE statement supports progress reporting. You may find this useful when dealing with long-running operations. Using another client you can issue a SHOW PROCESSLIST query to check the progress of the data load.\n\nUsing mariadb-import\n\nMariaDB ships with a separate utility for loading data from files: mariadb-import. It operates by sending LOAD DATA INFILE statements to the server.\n\nMariaDB ships with a separate utility for loading data from files: mysqlimport . It operates by sending LOAD DATA INFILE statements to the server.\n\nUsing mariadb-import you can compress the file using the --compress option, to get better performance over slow networks, providing both the client and server support the compressed protocol. Use the --local option to load from the local file system.\n\nIndexing\n\nIn cases where the storage engine supports ALTER TABLE... DISABLE KEYS statements (MyISAM and Aria), the LOAD DATA INFILE` statement automatically disables indexes during the execution.\n\nExamples\n--------\n\nCREATE TABLE t1 (a INT, b INT, c INT, d INT, PRIMARY KEY (a));\nLOAD DATA LOCAL INFILE \n ''/tmp/loaddata7.dat'' INTO TABLE t1 FIELDS TERMINATED BY '','' (a,b) SET c=a+b;\nSELECT  FROM t1;\n+------+------+------+\n| a    | b    | c    |\n+------+------+------+\n|    2 |    2 |    4 |\n|    3 |    3 |    6 |\n|    4 |    4 |    8 |\n|    5 |    5 |   10 |\n|    6 |    8 |   14 |\n+------+------+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/load-data-into-tables-or-index/load-data-infile', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/load-data-into-tables-or-index/load-data-infile');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (661, 27, 'LOAD INDEX', 'Syntax\n------\n\nLOAD INDEX INTO CACHE\n  tbl_index_list [, tbl_index_list] ...\n\ntbl_index_list:\n  tbl_name\n    [[INDEX|KEY] (index_name[, index_name] ...)]\n    [IGNORE LEAVES]\n\nDescription\n-----------\n\nThe LOAD INDEX INTO CACHE statement preloads a table index into the key cache to which it has been assigned by an explicit CACHE INDEX statement, or into the default key cache otherwise.LOAD INDEX INTO CACHE is used only for MyISAM or Aria tables.\n\nThe IGNORE LEAVES modifier causes only blocks for the nonleaf nodes of the index to be preloaded.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/load-data-into-tables-or-index/load-index', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/load-data-into-tables-or-index/load-index');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (662, 27, 'LOAD XML', 'Syntax\n------\n\nLOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE ''file_name''\n    [REPLACE | IGNORE]\n    INTO TABLE [db_name.]tbl_name\n    [CHARACTER SET charset_name]\n    [ROWS IDENTIFIED BY ''<tagname>'']\n    [IGNORE number {LINES | ROWS}]\n    [(column_or_user_var,...)]\n    [SET col_name = expr,...]\n\nDescription\n-----------\n\nThe LOAD XML statement reads data from an XML file into a table. Thefile_name must be given as a literal string. The tagname in the optional ROWS IDENTIFIED BY clause must also be given as a literal\\\nstring, and must be surrounded by angle brackets (< and >).\n\nLOAD XML acts as the complement of running the mariadb client in XML output mode (that is, starting the client with the --xml option). To write data from a table to an XML file, use a command such as the\\\nfollowing one from the system shell:\n\n``bash\nshell> mariadb --xml -e ''SELECT  FROM mytable'' > file.xml\n`\n\nTo read the file back into a table, use LOAD XML INFILE. By default, the element is considered to be the equivalent of a database table row; this can be changed using the ROWS IDENTIFIED BY clause.\n\nThis statement supports three different XML formats:\n\n Column names as attributes and column values as attribute values:\n\n`xml\n<row column1="value1" column2="value2" .../>\n`\n\n Column names as tags and column values as the content of these tags:\n\n`xml\n<row>\n  <column1>value1</column1>\n  <column2>value2</column2>\n</row>\n`\n\n Column names are the name attributes of tags, and values are\\\n  the contents of these tags:\n\n`xml\n<row>\n  <field name=''column1''>value1</field>\n  <field name=''column2''>value2</field>\n</row>\n`\n\nThis is the format used by other tools, such as mariadb-dump.\n\nAll 3 formats can be used in the same XML file; the import routine automatically detects the format for each row and interprets it correctly. Tags are matched based on the tag or attribute name and the\\\ncolumn name.\n\nThe following clauses work essentially the same way for LOAD XML as they do for LOAD DATA:\n\n LOW_PRIORITY or CONCURRENT\n LOCAL\n REPLACE or IGNORE\n CHARACTER SET\n (column_or_user_var,...)\n SET\n\nSee LOAD DATA for more information about these clauses.\n\nThe IGNORE number LINES or IGNORE number ROWS clause causes the first number rows in the XML file to be skipped. It is analogous to the LOAD DATA statement''s IGNORE ... LINES clause.\n\nIf the LOW_PRIORITY keyword is used, insertions are delayed until no other clients are reading from the table. The CONCURRENT keyword allows the use of concurrent inserts. These clauses cannot be specified together.\n\nThis statement activates INSERT` triggers.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/load-data-into-tables-or-index/load-xml', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/load-data-into-tables-or-index/load-xml');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (663, 27, 'Non-Recursive Common Table Expressions Overview', 'Description\n-----------\n\nCommon Table Expressions (CTEs) are a standard SQL feature, and are essentially temporary named result sets. There are two kinds of CTEs: Non-Recursive, which this article covers; and Recursive.\n\nNon-Recursive CTEs\n\nThe WITH keyword signifies a CTE. It is given a name, followed by a body (the main query).\n\nCTEs are similar to derived tables:\n\n``sql\nWITH engineers AS \n   ( SELECT  FROM employees\n     WHERE dept = ''Engineering'' )\n\nSELECT  FROM engineers\nWHERE ...\n`\n\n`sql\nSELECT  FROM\n   ( SELECT  FROM employees\n     WHERE dept = ''Engineering'' ) AS engineers\nWHERE\n...\n`\n\nA non-recursive CTE is basically a query-local VIEW. There are several advantages and caveats to them. The syntax is more readable than a nested FROM (SELECT ...).\\\nA CTE can refer to another and it can be referenced from multiple places.\n\nA CTE referencing Another CTE\n\nUsing this format makes for a more readable SQL than a nested FROM(SELECT ...) clause:\n\n`sql\nWITH engineers AS (\nSELECT  FROM employees\nWHERE dept IN(''Development'',''Support'') ),\neu_engineers AS ( SELECT  FROM engineers WHERE country IN(''NL'',...) )\nSELECT\n...\nFROM eu_engineers;\n`\n\nMultiple Uses of a CTE\n\nThis can be an ''anti-self join'', for example:\n\n`sql\nWITH engineers AS (\nSELECT  FROM employees\nWHERE dept IN(''Development'',''Support'') )\n\nSELECT  FROM engineers E1\nWHERE NOT EXISTS\n   (SELECT 1 FROM engineers E2\n    WHERE E2.country=E1.country\n    AND E2.name <> E1.name );\n`\n\nOr, for year-over-year comparisons, for example:\n\n`sql\nWITH sales_product_year AS (\nSELECT product, YEAR(ship_date) AS year,\nSUM(price) AS total_amt\nFROM item_sales\nGROUP BY product, year )\n\nSELECT \nFROM sales_product_year CUR,\nsales_product_year PREV,\nWHERE CUR.product=PREV.product \nAND  CUR.year=PREV.year + 1 \nAND CUR.total_amt > PREV.total_amt\n`\n\nAnother use is to compare individuals against their group. Below is an example of how this might be executed:\n\n`sql\nWITH sales_product_year AS (\nSELECT product,\nYEAR(ship_date) AS year,\nSUM(price) AS total_amt\nFROM item_sales\nGROUP BY product, year\n)\n\nSELECT  \nFROM sales_product_year S1\nWHERE\ntotal_amt > \n    (SELECT 0.1 * SUM(total_amt)\n     FROM sales_product_year S2\n     WHERE S2.year = S1.year)\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/common-table-expressions/non-recursive-common-table-expressions-overview', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/common-table-expressions/non-recursive-common-table-expressions-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (664, 27, 'Recursive Common Table Expressions Overview', 'Description\n-----------\n\nCommon Table Expressions (CTEs) are a standard SQL feature, and are essentially temporary named result sets. They are defined using the WITH clause and can be referenced like tables within the main query. CTEs first appeared in the SQL standard in 1999, and the first implementations began appearing in 2007.\n\nMariaDB supports two types of CTEs:\n\n Non-recursive;\n Recursive, which this article covers.\n\nRecursive CTE\n\nA recursive CTE will repeatedly execute subsets of the data until it obtains the complete result set. This makes it particularly useful for handling hierarchical or tree-structured data, such as organizational charts, category trees, or parent-child relationships. max_recursive_iterations avoids infinite loops. CTEs permit a query to reference itself. SQL is generally poor at recursive structures.\n\n!trees_and_graphs\n\nRecursive CTE Syntax\n\nWITH RECURSIVE signifies a recursive CTE. It is given a name, followed by a body (the main query). The body consists of two parts:\n\n An anchor member (the initial query)\n A recursive member (which references the CTE itself).\n\n!rcte_syntax\n\nComputation\n\nGiven the following structure:\n\n!rcte_computation\n\n1. First execute the anchor part of the query:\n\n!rcte1\n\n2. Next, execute the recursive part of the query:\n\n!rcte_computation_2\n\n![](../../../../../.gitbook/assets/rcte_computation_2b.png)\n\n![](../../../../../.gitbook/assets/rcte_computation_3.png)\n\n![](../../../../../.gitbook/assets/rcte_computation_3b.png)\n\n![](../../../../../.gitbook/assets/rcte_computation_4.png)\n\nSummary\n\n``sql\nWITH RECURSIVE R AS (\n  SELECT anchor_data\n  UNION [all]\n  SELECT recursive_part\n  FROM R, ...\n)\nSELECT ...\n`\n\n1. Compute anchor_data.\n2. Compute recursive_part to get the new data.\n3. If (new data is non-empty) go to 2.\n\nRecursive CTE Examples\n\nTransitive closure - determining bus destinations\n\nSample data:\n\n!tc_1\n\n`sql\nCREATE TABLE bus_routes (origin VARCHAR(50), dst VARCHAR(50));\nINSERT INTO bus_routes VALUES \n  (''New York'', ''Boston''), \n  (''Boston'', ''New York''), \n  (''New York'', ''Washington''), \n  (''Washington'', ''Boston''), \n  (''Washington'', ''Raleigh'');\n`\n\nNow, we want to return the bus destinations with New York as the origin:\n\n`sql\nWITH RECURSIVE bus_dst as ( \n    SELECT origin as dst FROM bus_routes WHERE origin=''New York'' \n  UNION\n    SELECT bus_routes.dst FROM bus_routes JOIN bus_dst ON bus_dst.dst= bus_routes.origin \n) \nSELECT  FROM bus_dst;\n+------------+\n| dst        |\n+------------+\n| New York   |\n| Boston     |\n| Washington |\n| Raleigh    |\n+------------+\n`\n\nThe above example is computed as follows:\n\nFirst, the anchor data is calculated:\n\n Starting from New York.\n Boston and Washington are added.\n\nNext, the recursive part:\n\n Starting from Boston and then Washington.\n Raleigh is added.\n UNION excludes nodes that are already present.\n\nComputing paths - determining bus routes\n\nThis time, we are trying to get bus routes such as “New York -> Washington -> Raleigh”.\n\nUsing the same sample data as the previous example:\n\n`sql\nWITH RECURSIVE paths (cur_path, cur_dest) AS (\n    SELECT origin, origin FROM bus_routes WHERE origin=''New York'' \n  UNION\n    SELECT CONCAT(paths.cur_path, '','', bus_routes.dst), bus_routes.dst \n     FROM paths\n     JOIN bus_routes \n       ON paths.cur_dest = bus_routes.origin AND \n         NOT FIND_IN_SET(bus_routes.dst, paths.cur_path)\n) \nSELECT * FROM paths;\n+-----------------------------+------------+\n| cur_path                    | cur_dest   |\n+-----------------------------+------------+\n| New York                    | New York   |\n| New York,Boston             | Boston     |\n| New York,Washington         | Washington |\n| New York,Washington,Boston  | Boston     |\n| New York,Washington,Raleigh | Raleigh    |\n+-----------------------------+------------+\n``\n\nType Resolution and Data Truncation\n\nIn previous versions of MariaDB, the data type of a Recursive CTE column was entirely determined by the Anchor (non-recursive) part. If the Recursive part carried out calculations that generated a greater value, the data was silently truncated, leading to incorrect results.\n\nStarting with the versions listed below, MariaDB prevents silent data loss. The server now validates that the data generated by the recursive part matches the column types given by the anchor part. If a mismatch that leads to truncation is detected, the query will now fail with an error. See MDEV-12325 for more information.\n\n<table><thead><tr><th width="296">MariaDB Series </th><th>Fixed Version</th></tr></thead><tbody><tr><td>10.3</td><td>10.3.36 </td></tr><tr><td>10.4</td><td>10.4.26</td></tr><tr><td>10.5 </td><td>10.5.17</td></tr><tr><td>10.6</td><td>10.6.9</td></tr><tr><td>10.7</td><td>10.7.5</td></tr></tbody></table>\n\nExamples\n--------\n\nCREATE TABLE t1\n(\n  id INT,     -- employee ID\n  mid INT,    -- manager ID, or NULL if top level employee\n  name TEXT   -- employee name\n);\nINSERT INTO t1 VALUES (0,NULL, ''Name'');\nINSERT INTO t1 VALUES (1,0,    ''Name1'');\nINSERT INTO t1 VALUES (2,0,    ''Name2'');\nINSERT INTO t1 VALUES (11,1,   ''Name11'');\nINSERT INTO t1 VALUES (12,1,   ''Name12'');\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/common-table-expressions/recursive-common-table-expressions-overview', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/common-table-expressions/recursive-common-table-expressions-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (665, 27, 'WITH', 'Syntax\n------\n\nWITH [RECURSIVE] table_reference [(columns_list)] AS  (\n  SELECT ...\n)\n[CYCLE cycle_column_list RESTRICT]\nSELECT ...\n\nDescription\n-----------\n\nThe WITH keyword signifies a Common Table Expression (CTE). It allows you to refer to a subquery expression many times in a query, as if having a temporary table that only exists for the duration of a query.\n\nThere are two kinds of CTEs:\n\n Non-Recursive.\n Recursive (signified by the RECURSIVE keyword).\n\nYou can use table_reference as any normal table in the external SELECT part. You can also use WITH in subqueries, as well as with EXPLAIN and SELECT.\n\nPoorly-formed recursive CTEs can in theory cause infinite loops. The max_recursive_iterations system variable limits the number of recursions.\n\nCYCLE ... RESTRICT\n\nThe CYCLE clause enables CTE cycle detection, avoiding excessive or infinite loops,\\\nMariaDB supports a relaxed, non-standard grammar.\\\nThe SQL Standard permits a CYCLE clause, as follows:\n\n``sql\nWITH RECURSIVE ... (\n  ...\n)\nCYCLE <cycle column list>\nSET <cycle mark column> TO <cycle mark value> DEFAULT <non-cycle mark value>\nUSING <path column>\n`\n\nwhere all clauses are mandatory.\\\nMariaDB does not support this, but permits a non-standard relaxed grammar, as follows:\n\n`sql\nWITH RECURSIVE ... (\n  ...\n)\nCYCLE <cycle column list> RESTRICT\n`\n\nWith the use of CYCLE ... RESTRICT it makes no difference whether the CTE uses UNION ALL or UNION DISTINCT anymore. UNION ALL means "all rows, but without cycles", which is exactly what the CYCLE clause enables. And UNION DISTINCT means all rows should be different, which, again, is what will happen — as uniqueness is enforced over a subset of columns, complete rows will automatically all be different.\n\nCYCLE ... RESTRICT` is not available.\n\nExamples\n--------\n\nWITH t AS (SELECT a FROM t1 WHERE b >= ''c'') \n  SELECT * FROM t2, t WHERE t2.c = t.a;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/common-table-expressions/with', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/common-table-expressions/with');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (666, 27, 'DUAL', 'Description\n-----------\n\nYou can use DUAL instead of a table name in situations where no tables are referenced, such as the following SELECT statement:\n\n``sql\nSELECT 1 + 1 FROM DUAL;\n+-------+\n| 1 + 1 |\n+-------+\n|     2 |\n+-------+\n`\n\nDUAL is purely for the convenience of people who require that all SELECT statements should haveFROM and possibly other clauses. MariaDB ignores the clauses. MariaDB does not require FROM DUAL if no tables are referenced.\n\nFROM DUAL could be used when you only SELECT computed values, but require a WHERE clause, perhaps to test that a script correctly handles empty resultsets:\n\n`sql\nSELECT 1 FROM DUAL WHERE FALSE;\nEmpty set (0.00 sec)\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/dual', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/dual');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (667, 27, 'FOR UPDATE', 'Description\n-----------\n\nInnoDB supports row-level locking. Selected rows can be locked using LOCK IN SHARE MODE or FOR UPDATE. In both cases, a lock is acquired on the rows read by the query, and it will be released when the current transaction is committed.\n\nThe FOR UPDATE clause of SELECT applies only when autocommit is set to 0 or the SELECT is enclosed in a transaction. A lock is acquired on the rows, and other transactions are prevented from writing the rows, acquire locks, and from reading them (unless their isolation level is READ UNCOMMITTED).\n\nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR UPDATE clauses have no effect in InnoDB. For non-transactional storage engines like MyISAM and ARIA, a table level lock will be taken even if autocommit is set to 1.\n\nIf the isolation level is set to SERIALIZABLE, all plain SELECT statements are converted to SELECT ... LOCK IN SHARE MODE.\n\nExamples\n--------\n\nSELECT * FROM trans WHERE period=2001 FOR UPDATE;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/for-update', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/for-update');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (668, 27, 'GROUP BY', 'Description\n-----------\n\nUse the GROUP BY clause in a SELECT statement to group rows together that have the same value in one or more column, or the same computed value using expressions with any functions and operators except grouping functions. When you use a GROUP BY clause, you will get a single result row for each group of rows that have the same value for the expression given in GROUP BY.\n\nWhen grouping rows, grouping values are compared as if by the = operator. For string values, the = operator ignores trailing whitespace and may normalize characters and ignore case, depending on the collation in use.\n\nYou can use any of the grouping functions in your select expression. Their values will be calculated based on all the rows that have been grouped together for each result row. If you select a non-grouped column or a value computed from a non-grouped column, it is undefined which row the returned value is taken from. This is not permitted if the ONLY_FULL_GROUP_BY SQL_MODE is used.\n\nYou can use multiple expressions in the GROUP BY clause, separated by commas.\\\nRows are grouped together if they match on each of the expressions.\n\nYou can also use a single integer as the grouping expression. If you use an integer _n_,\\\nthe results will be grouped by the _n_th column in the select expression.\n\nThe WHERE clause is applied before the GROUP BY clause. It filters non-aggregated\\\nrows before the rows are grouped together. To filter grouped rows based on aggregate values, use the HAVING clause. The HAVING clause takes any expression and evaluates it as a boolean, just like the WHERE clause. You can use grouping functions in the HAVING clause. As with the select expression, if you reference non-grouped columns in the HAVING clause, the behavior is undefined.\n\nBy default, if a GROUP BY clause is present, the rows in the output will be sorted by the expressions used in the GROUP BY. You can also specify ASC or DESC (ascending, descending) after those expressions, like in ORDER BY. The default is ASC.\n\nIf you want the rows to be sorted by another field, you can add an explicit ORDER BY. If you don''t want the result to be ordered, you can add ORDER BY NULL.\n\nWITH ROLLUP\n\nThe WITH ROLLUP modifier adds extra rows to the result set that represent super-aggregate summaries. For a full description with examples, see SELECT WITH ROLLUP.\n\nGROUP BY Examples\n\nConsider the following table that records how many times each user has played and won a game:\n\n``sql\nCREATE TABLE plays (name VARCHAR(16), plays INT, wins INT);\nINSERT INTO plays VALUES \n  ("John", 20, 5), \n  ("Robert", 22, 8), \n  ("Wanda", 32, 8), \n  ("Susan", 17, 3);\n`\n\nGet a list of win counts along with a count:\n\n`sql\nSELECT wins, COUNT() FROM plays GROUP BY wins;\n+------+----------+\n| wins | COUNT() |\n+------+----------+\n|    3 |        1 |\n|    5 |        1 |\n|    8 |        2 |\n+------+----------+\n3 rows in set (0.00 sec)\n`\n\nThe GROUP BY expression can be a computed value, and can refer back to an identifier specified with AS. Get a list of win averages along with a count:\n\n`sql\nSELECT (wins / plays) AS winavg, COUNT() FROM plays GROUP BY winavg;\n+--------+----------+\n| winavg | COUNT() |\n+--------+----------+\n| 0.1765 |        1 |\n| 0.2500 |        2 |\n| 0.3636 |        1 |\n+--------+----------+\n3 rows in set (0.00 sec)\n`\n\nYou can use any grouping function in the select expression. For each win average as above, get a list of the average play count taken to get that average:\n\n`sql\nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n  GROUP BY winavg;\n+--------+------------+\n| winavg | AVG(plays) |\n+--------+------------+\n| 0.1765 |    17.0000 |\n| 0.2500 |    26.0000 |\n| 0.3636 |    22.0000 |\n+--------+------------+\n3 rows in set (0.00 sec)\n`\n\nYou can filter on aggregate information using the HAVING clause. The HAVING clause is applied after GROUP BY and allows you to filter on aggregate data that is not available to the WHERE clause. Restrict the above example to results that involve an average number of plays over 20:\n\n`sql\nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n  GROUP BY winavg HAVING AVG(plays) > 20;\n+--------+------------+\n| winavg | AVG(plays) |\n+--------+------------+\n| 0.2500 |    26.0000 |\n| 0.3636 |    22.0000 |\n+--------+------------+\n2 rows in set (0.00 sec)\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/group-by', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/group-by');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (669, 27, 'Advanced Joins', 'Description\n-----------\n\nThis article is a continuation of the Joining Tables with JOIN Clauses Guide. If you''re getting started with JOIN statements, review that page first.\n\nThe Employee Database\n\nLet us begin by using an example employee database of a fairly small family business, which does not anticipate expanding in the future.\n\nFirst, we create the table that will hold all of the employees and their contact information:\n\n``sql\nCREATE TABLE Employees (\n  ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,\n  First_Name VARCHAR(25) NOT NULL,\n  Last_Name VARCHAR(25) NOT NULL,\n  Position VARCHAR(25) NOT NULL,\n  Home_Address VARCHAR(50) NOT NULL,\n  Home_Phone VARCHAR(12) NOT NULL,\n  PRIMARY KEY (ID)\n) ENGINE=MyISAM;\n`\n\nNext, we add a few employees to the table:\n\n`sql\nINSERT INTO Employees (First_Name, Last_Name, Position, Home_Address, Home_Phone)\n  VALUES\n  (''Mustapha'', ''Mond'', ''Chief Executive Officer'', ''692 Promiscuous Plaza'', ''326-555-3492''),\n  (''Henry'', ''Foster'', ''Store Manager'', ''314 Savage Circle'', ''326-555-3847''),\n  (''Bernard'', ''Marx'', ''Cashier'', ''1240 Ambient Avenue'', ''326-555-8456''),\n  (''Lenina'', ''Crowne'', ''Cashier'', ''281 Bumblepuppy Boulevard'', ''328-555-2349''),\n  (''Fanny'', ''Crowne'', ''Restocker'', ''1023 Bokanovsky Lane'', ''326-555-6329''),\n  (''Helmholtz'', ''Watson'', ''Janitor'', ''944 Soma Court'', ''329-555-2478'');\n`\n\nNow, we create a second table, containing the hours which each employee clocked in and out during the week:\n\n`sql\nCREATE TABLE Hours (\n  ID TINYINT(3) UNSIGNED NOT NULL,\n  Clock_In DATETIME NOT NULL,\n  Clock_Out DATETIME NOT NULL\n) ENGINE=MyISAM;\n`\n\nFinally, although it is a lot of information, we add a full week of hours for each of the employees into the second table that we created:\n\n`sql\nINSERT INTO Hours\n  VALUES\n  (''1'', ''2005-08-08 07:00:42'', ''2005-08-08 17:01:36''),\n  (''1'', ''2005-08-09 07:01:34'', ''2005-08-09 17:10:11''),\n  (''1'', ''2005-08-10 06:59:56'', ''2005-08-10 17:09:29''),\n  (''1'', ''2005-08-11 07:00:17'', ''2005-08-11 17:00:47''),\n  (''1'', ''2005-08-12 07:02:29'', ''2005-08-12 16:59:12''),\n  (''2'', ''2005-08-08 07:00:25'', ''2005-08-08 17:03:13''),\n  (''2'', ''2005-08-09 07:00:57'', ''2005-08-09 17:05:09''),\n  (''2'', ''2005-08-10 06:58:43'', ''2005-08-10 16:58:24''),\n  (''2'', ''2005-08-11 07:01:58'', ''2005-08-11 17:00:45''),\n  (''2'', ''2005-08-12 07:02:12'', ''2005-08-12 16:58:57''),\n  (''3'', ''2005-08-08 07:00:12'', ''2005-08-08 17:01:32''),\n  (''3'', ''2005-08-09 07:01:10'', ''2005-08-09 17:00:26''),\n  (''3'', ''2005-08-10 06:59:53'', ''2005-08-10 17:02:53''),\n  (''3'', ''2005-08-11 07:01:15'', ''2005-08-11 17:04:23''),\n  (''3'', ''2005-08-12 07:00:51'', ''2005-08-12 16:57:52''),\n  (''4'', ''2005-08-08 06:54:37'', ''2005-08-08 17:01:23''),\n  (''4'', ''2005-08-09 06:58:23'', ''2005-08-09 17:00:54''),\n  (''4'', ''2005-08-10 06:59:14'', ''2005-08-10 17:00:12''),\n  (''4'', ''2005-08-11 07:00:49'', ''2005-08-11 17:00:34''),\n  (''4'', ''2005-08-12 07:01:09'', ''2005-08-12 16:58:29''),\n  (''5'', ''2005-08-08 07:00:04'', ''2005-08-08 17:01:43''),\n  (''5'', ''2005-08-09 07:02:12'', ''2005-08-09 17:02:13''),\n  (''5'', ''2005-08-10 06:59:39'', ''2005-08-10 17:03:37''),\n  (''5'', ''2005-08-11 07:01:26'', ''2005-08-11 17:00:03''),\n  (''5'', ''2005-08-12 07:02:15'', ''2005-08-12 16:59:02''),\n  (''6'', ''2005-08-08 07:00:12'', ''2005-08-08 17:01:02''),\n  (''6'', ''2005-08-09 07:03:44'', ''2005-08-09 17:00:00''),\n  (''6'', ''2005-08-10 06:54:19'', ''2005-08-10 17:03:31''),\n  (''6'', ''2005-08-11 07:00:05'', ''2005-08-11 17:02:57''),\n  (''6'', ''2005-08-12 07:02:07'', ''2005-08-12 16:58:23'');\n`\n\nWorking with the Employee Database\n\nNow that we have a cleanly structured database to work with, let us begin this tutorial by stepping up one notch from the last tutorial and filtering our information a little.\n\nFiltering by Name\n\nEarlier in the week, an anonymous employee reported that Helmholtz came into work almost four minutes late; to verify this, we will begin our investigation by filtering out employees whose first names are "Helmholtz":\n\n`sql\nSELECT\n  Employees.First_Name,\n  Employees.Last_Name,\n  Hours.Clock_In,\n  Hours.Clock_Out\nFROM Employees\nINNER JOIN Hours ON Employees.ID = Hours.ID\nWHERE Employees.First_Name = ''Helmholtz'';\n`\n\nThe result looks like this:\n\n`\n+------------+-----------+---------------------+---------------------+\n| First_Name | Last_Name | Clock_In            | Clock_Out           |\n+------------+-----------+---------------------+---------------------+\n| Helmholtz  | Watson    | 2005-08-08 07:00:12 | 2005-08-08 17:01:02 |\n| Helmholtz  | Watson    | 2005-08-09 07:03:44 | 2005-08-09 17:00:00 |\n| Helmholtz  | Watson    | 2005-08-10 06:54:19 | 2005-08-10 17:03:31 |\n| Helmholtz  | Watson    | 2005-08-11 07:00:05 | 2005-08-11 17:02:57 |\n| Helmholtz  | Watson    | 2005-08-12 07:02:07 | 2005-08-12 16:58:23 |\n+------------+-----------+---------------------+---------------------+\n5 rows in set (0.00 sec)\n`\n\nThis is obviously more information than we care to trudge through, considering we only care about when he arrived past 7:00:59 on any given day within this week; thus, we need to add a couple more conditions to our WHERE clause.\n\nFiltering by Name, Date and Time\n\nIn the following example, we will filter out all of the times which Helmholtz clocked in that were before 7:01:00 and during the work week that lasted from the 8th to the 12th of August:\n\n`sql\nSELECT\n  Employees.First_Name,\n  Employees.Last_Name,\n  Hours.Clock_In,\n  Hours.Clock_Out\nFROM Employees\nINNER JOIN Hours ON Employees.ID = Hours.ID\nWHERE Employees.First_Name = ''Helmholtz''\nAND DATE_FORMAT(Hours.Clock_In, ''%Y-%m-%d'') >= ''2005-08-08''\nAND DATE_FORMAT(Hours.Clock_In, ''%Y-%m-%d'') <= ''2005-08-12''\nAND DATE_FORMAT(Hours.Clock_In, ''%H:%i:%S'') > ''07:00:59'';\n`\n\nThe result looks like this:\n\n`\n+------------+-----------+---------------------+---------------------+\n| First_Name | Last_Name | Clock_In            | Clock_Out           |\n+------------+-----------+---------------------+---------------------+\n| Helmholtz  | Watson    | 2005-08-09 07:03:44 | 2005-08-09 17:00:00 |\n| Helmholtz  | Watson    | 2005-08-12 07:02:07 | 2005-08-12 16:58:23 |\n+------------+-----------+---------------------+---------------------+\n2 rows in set (0.00 sec)\n`\n\nBy merely adding a few more conditions, we eliminated all of the irrelevant information; Helmholtz was late to work on the 9th and the 12th of August.\n\nDisplaying Total Work Hours per Day\n\nSuppose you would like to—based on the information stored in both of our tables in the employee database—develop a quick list of the total hours each employee has worked for each day recorded; a simple way to estimate the time each employee worked per day is exemplified below:\n\n`sql\nSELECT\n  Employees.ID,\n  Employees.First_Name,\n  Employees.Last_Name,\n  Hours.Clock_In,\n  Hours.Clock_Out,\nDATE_FORMAT(Hours.Clock_Out, ''%T'')-DATE_FORMAT(Hours.Clock_In, ''%T'') \nAS ''Total_Hours''\nFROM Employees \nINNER JOIN Hours ON Employees.ID = Hours.ID;\n`\n\nThe result (limited to 10 rows) looks like this:\n\n`\n+----+------------+-----------+---------------------+---------------------+-------------+\n| ID | First_Name | Last_Name | Clock_In            | Clock_Out           | Total_Hours |\n+----+------------+-----------+---------------------+---------------------+-------------+\n|  1 | Mustapha   | Mond      | 2005-08-08 07:00:42 | 2005-08-08 17:01:36 |          10 |\n|  1 | Mustapha   | Mond      | 2005-08-09 07:01:34 | 2005-08-09 17:10:11 |          10 |\n|  1 | Mustapha   | Mond      | 2005-08-10 06:59:56 | 2005-08-10 17:09:29 |          11 |\n|  1 | Mustapha   | Mond      | 2005-08-11 07:00:17 | 2005-08-11 17:00:47 |          10 |\n|  1 | Mustapha   | Mond      | 2005-08-12 07:02:29 | 2005-08-12 16:59:12 |           9 |\n|  2 | Henry      | Foster    | 2005-08-08 07:00:25 | 2005-08-08 17:03:13 |          10 |\n|  2 | Henry      | Foster    | 2005-08-09 07:00:57 | 2005-08-09 17:05:09 |          10 |\n|  2 | Henry      | Foster    | 2005-08-10 06:58:43 | 2005-08-10 16:58:24 |          10 |\n|  2 | Henry      | Foster    | 2005-08-11 07:01:58 | 2005-08-11 17:00:45 |          10 |\n|  2 | Henry      | Foster    | 2005-08-12 07:02:12 | 2005-08-12 16:58:57 |           9 |\n+----+------------+-----------+---------------------+---------------------+-------------+\n10 rows in set (0.00 sec)\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/joins/more-advanced-joins', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/joins/more-advanced-joins');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (670, 27, 'Subqueries', 'Description\n-----------\n\nsubqueries-and-all.md\n\nCompare a value against all results from a subquery. The ALL operator returns TRUE if the comparison holds for every row returned by the subquery.\n\nsubqueries-and-any.md\n\nCompare a value against any result from a subquery. The ANY (or SOME) operator returns TRUE if the comparison holds for at least one row. IN can be used for =ANY.\n\nsubqueries-and-exists.md\n\nTest for the existence of rows. The EXISTS operator returns TRUE if the subquery returns at least one row, often used for correlated subqueries.\n\nsubqueries-and-joins.md\n\nUnderstand when to use subqueries versus joins. This guide explains performance implications and how to rewrite subqueries as joins for efficiency.\n\nsubqueries-in-a-from-clause-derived-tables.md\n\nUse a subquery as a temporary table. Derived tables allow you to select from the result set of another query within the FROM clause.\n\nsubqueries-row-subqueries.md\n\nRetrieve a single row of multiple values. A row subquery returns a tuple that can be compared against a row constructor in the outer query.\n\nsubqueries-scalar-subqueries.md\n\nReturn a single value. A scalar subquery produces a one-row, one-column result that can be used anywhere a constant or expression is valid.\n\nsubquery-limitations.md\n\nReview restrictions on subquery usage. This page details unsupported operations, such as modifying a table while selecting from it in a subquery.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/README', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (671, 27, 'Subqueries and ALL', 'Description\n-----------\n\nSubqueries using the ALL keyword will return true if the comparison returns true for each row returned by the subquery, or the subquery returns no rows.\n\nSyntax\n\n``sql\nscalar_expression comparison_operator ALL <Table subquery>\n`\n\n scalar_expression may be any expression that evaluates to a single value.\n comparison_operator may be any one of: =, >, <, >=, <=, <> or !=\n\nALL returns:\n\n NULL if the comparison operator returns NULL for at least one row returned by the Table subquery or scalar_expression returns NULL.\n FALSE if the comparison operator returns FALSE for at least one row returned by the Table subquery.\n TRUE if the comparison operator returns TRUE for all rows returned by the Table subquery, or if Table subquery returns no rows.\n\nNOT IN is an alias for <> ALL`.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num2 TINYINT);\n\nINSERT INTO sq1 VALUES(100);\n\nINSERT INTO sq2 VALUES(40),(50),(60);\n\nSELECT  FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\n+------+\n| num  |\n+------+\n|  100 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-and-all', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-and-all');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (672, 27, 'Subqueries With ANY and SOME', 'Description\n-----------\n\nSyntax\n\nSOME is a synonym for ANY.&#x20;\n\n``sql\nscalar_expression comparison_operator ANY <Table subquery>\nscalar_expression comparison_operator SOME <Table subquery>\n`\n\n scalar_expression may be any expression that evaluates to a single value.\n comparison_operator may be any one of =, >, <, >=, <=, <> or !=.\n\nAbout IN\n\nAlthough IN functions similarly to = ANY, it is documented separately due to unique optimization characteristics. Refer to Subqueries with IN and NOT IN for more details.\n\nANY or SOME returns:\n\n TRUE if the comparison operator returns TRUE for at least one row returned by the table subquery.\n FALSE if the comparison operator returns FALSE for all rows returned by the table subquery, or if the table subquery has no rows.\n* NULL if the comparison operator returns NULL for at least one row returned by the table subquery and doesn''t returns TRUE for any of them, or if scalar_expression returns NULL`.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num1 TINYINT);\nCREATE TABLE sq2 (num2 TINYINT);\nINSERT INTO sq1 VALUES(100);\nINSERT INTO sq2 VALUES(40),(50),(120);\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-and-any', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-and-any');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (673, 27, 'Subqueries and EXISTS', 'Syntax\n------\n\nSELECT ... WHERE EXISTS <Table subquery>\n\nDescription\n-----------\n\nSubqueries using the EXISTS keyword will return true if the subquery returns any rows. Conversely, subqueries using NOT EXISTS will return true only if the subquery returns no rows from the table.\n\nEXISTS subqueries ignore the columns specified by the SELECT of the subquery, since they''re not relevant. For example,\n\n``sql\nSELECT col1 FROM t1 WHERE EXISTS (SELECT  FROM t2);\n`\n\nand\n\n`sql\nSELECT col1 FROM t1 WHERE EXISTS (SELECT col2 FROM t2);\n``\n\nproduce identical results.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num2 TINYINT);\n\nINSERT INTO sq1 VALUES(100);\n\nINSERT INTO sq2 VALUES(40),(50),(60);\n\nSELECT  FROM sq1 WHERE EXISTS (SELECT  FROM sq2 WHERE num2>50);\n+------+\n| num  |\n+------+\n|  100 |\n+------+\n\nSELECT  FROM sq1 WHERE NOT EXISTS (SELECT * FROM sq2 GROUP BY num2 HAVING MIN(num2)=40);\nEmpty set (0.00 sec)\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-and-exists', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-and-exists');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (674, 27, 'Subqueries and JOINs', 'Description\n-----------\n\nA subquery can quite often, but not in all cases, be rewritten as a JOIN.\n\nRewriting Subqueries as JOINS\n\nA subquery using IN can be rewritten with the DISTINCT keyword. Consider this query:\n\n``sql\nSELECT  FROM table1 WHERE col1 IN (SELECT col1 FROM table2);\n`\n\nIt can be rewritten like this:\n\n`sql\nSELECT DISTINCT table1. FROM table1, table2 WHERE table1.col1=table2.col1;\n`\n\nNOT IN or NOT EXISTS queries can also be rewritten. For example, these two queries return the same result:\n\n`sql\nSELECT  FROM table1 WHERE col1 NOT IN (SELECT col1 FROM table2);\nSELECT  FROM table1 WHERE NOT EXISTS (SELECT col1 FROM table2 \n         WHERE table1.col1=table2.col1);\n`\n\nThey can both be rewritten like this:\n\n`sql\nSELECT table1. FROM table1 LEFT JOIN table2 ON table1.id=table2.id \n       WHERE table2.id IS NULL;\n`\n\nSubqueries that can be rewritten as a LEFT JOIN are sometimes more efficient.\n\nUsing Subqueries instead of JOINS\n\nThere are some scenarios, though, which call for subqueries rather than joins:\n\n When you want duplicates, but not false duplicates. Suppose Table_1 has three rows — {1,1,2}\\\n  — and Table_2 has two rows\\\n  — {1,2,2}. If you need to list the rows\\\n  in Table_1 which are also in Table_2, only this subquery-based SELECT statement will give the right answer (1,1,2):\n\n`sql\nSELECT Table_1.column_1 \nFROM   Table_1 \nWHERE  Table_1.column_1 IN \n  (SELECT Table_2.column_1 \n    FROM   Table_2);\n`\n\n This SQL statement won''t work:\n\n`sql\nSELECT Table_1.column_1 \nFROM   Table_1,Table_2 \nWHERE  Table_1.column_1 = Table_2.column_1;\n`\n\n because the result will be {1,1,2,2}\\\n  — and the duplication of 2 is an error. This SQL statement won''t work either:\n\n`sql\nSELECT DISTINCT Table_1.column_1 \nFROM   Table_1,Table_2 \nWHERE  Table_1.column_1 = Table_2.column_1;\n`\n\n because the result will be {1,2} — and the removal of the duplicated 1 is an error too.\n When the outermost statement is not a query. The SQL statement:\n\n`sql\nUPDATE Table_1 SET column_1 = (SELECT column_1 FROM Table_2);\n`\n\n can''t be expressed using a join unless some rare SQL3 features are used.\n When the join is over an expression. The SQL statement:\n\n`sql\nSELECT  FROM Table_1 \nWHERE column_1 + 5 =\n  (SELECT MAX(column_1) FROM Table_2);\n`\n\n is hard to express with a join. In fact, the only way we can think of is this SQL statement:\n\n`sql\nSELECT Table_1.\nFROM   Table_1, \n      (SELECT MAX(column_1) AS max_column_1 FROM Table_2) AS Table_2\nWHERE  Table_1.column_1 + 5 = Table_2.max_column_1;\n`\n\n which still involves a parenthesized query, so nothing is gained from the transformation.\n When you want to see the exception. For example, suppose the question is: Which books are longer than Das Kapital? These two queries are effectively almost the same:\n\n`sql\nSELECT DISTINCT Bookcolumn_1.                     \nFROM   Books AS Bookcolumn_1 JOIN Books AS Bookcolumn_2 USING(page_count) \nWHERE  title = ''Das Kapital'';\n\nSELECT DISTINCT Bookcolumn_1. \nFROM   Books AS Bookcolumn_1 \nWHERE  Bookcolumn_1.page_count > \n  (SELECT DISTINCT page_count \n  FROM   Books AS Bookcolumn_2 \n  WHERE  title = ''Das Kapital'');\n`\n\n The difference is between these two SQL statements is, if there are two editions of Das Kapital (with different page counts), then the self-join example will return the books which are longer than the shortest edition of Das Kapital. That might be the wrong answer, since the original question didn''t ask for "... longer than ANY` book named Das Kapital" (it seems to contain a false assumption that there''s only one edition).\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-and-joins', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-and-joins');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (675, 27, 'Subqueries in a FROM Clause (Derived Tables)', 'Description\n-----------\n\nAlthough subqueries are more commonly placed in a WHERE clause, they can also form part of the FROM clause. Such subqueries are commonly called derived tables.\n\nIf a subquery is used in this way, you must also use an AS clause to name the result of the subquery.\n\nORACLE mode\n\nMariaDB starting with 10.6.0\n\nAnonymous subqueries in a FROM clause (no AS clause) are permitted in ORACLE mode.\n\nAnonymous subqueries in a FROM clause (no AS clause) are not permitted in ORACLE mode.\n\nCorrelation Column List\n\nMariaDB starting with 11.7.0\n\nIt is possible to assign column names in the derived table name syntax element.\n\nIt is not possible to assign column names in the derived table name syntax element.\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\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-in-a-from-clause-derived-tables', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-in-a-from-clause-derived-tables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (676, 27, 'Row Subqueries', 'Description\n-----------\n\nA row subquery is a subquery returning a single row, as opposed to a scalar subquery, which returns a single column from a row, or a literal.\n\nExamples\n--------\n\nCREATE TABLE staff (name VARCHAR(10), age TINYINT);\n\nCREATE TABLE customer (name VARCHAR(10), age TINYINT);\n\nINSERT INTO staff VALUES (''Bilhah'',37), (''Valerius'',61), (''Maia'',25);\n\nINSERT INTO customer VALUES (''Thanasis'',48), (''Valerius'',61), (''Brion'',51);\n\nSELECT * FROM staff WHERE (name,age) = (SELECT name,age FROM customer WHERE name=''Valerius'');\n+----------+------+\n| name     | age  |\n+----------+------+\n| Valerius |   61 |\n+----------+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-row-subqueries', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-row-subqueries');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (677, 27, 'Scalar Subqueries', 'Description\n-----------\n\nA scalar subquery is a subquery that returns a single value. This is the simplest form of a subquery, and can be used in most places a literal or single column value is valid.\n\nThe data type, length and character set and collation are all taken from the result returned by the subquery. The result of a subquery can always be NULL, that is, no result returned. Even if the original value is defined as NOT NULL, this is disregarded.\n\nA subquery cannot be used where only a literal is expected, for example LOAD DATA INFILE expects a literal string containing the file name, and LIMIT requires a literal integer.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num TINYINT);\n\nINSERT INTO sq1 VALUES (1);\n\nINSERT INTO sq2 VALUES (10 (SELECT num FROM sq1));\n\nSELECT  FROM sq2;\n+------+\n| num  |\n+------+\n|   10 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-scalar-subqueries', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subqueries-scalar-subqueries');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (678, 27, 'Subquery Limitations', 'Description\n-----------\n\nThere are a number of limitations regarding subqueries, which are discussed below.\n\nThe following tables and data will be used in the examples that follow:\n\n``sql\nCREATE TABLE staff(name VARCHAR(10),age TINYINT);\n\nCREATE TABLE customer(name VARCHAR(10),age TINYINT);\n`\n\n`sql\nINSERT INTO staff VALUES \n(''Bilhah'',37), (''Valerius'',61), (''Maia'',25);\n\nINSERT INTO customer VALUES \n(''Thanasis'',48), (''Valerius'',61), (''Brion'',51);\n`\n\nORDER BY and LIMIT\n\nTo use ORDER BY or limit LIMIT in subqueries both must be used.. For example:\n\n`sql\nSELECT  FROM staff WHERE name IN (SELECT name FROM customer ORDER BY name);\n+----------+------+\n| name     | age  |\n+----------+------+\n| Valerius |   61 |\n+----------+------+\n`\n\nis valid, but\n\n`sql\nSELECT  FROM staff WHERE name IN (SELECT NAME FROM customer ORDER BY name LIMIT 1);\nERROR 1235 (42000): This version of MariaDB doesn''t \n  yet support ''LIMIT & IN/ALL/ANY/SOME subquery''\n`\n\nis not.\n\nModifying and Selecting from the Same Table\n\nIt''s not possible to both modify and select from the same table in a subquery. For example:\n\n`sql\nDELETE FROM staff WHERE name = (SELECT name FROM staff WHERE age=61);\nERROR 1093 (HY000): Table ''staff'' is specified twice, both \n  as a target for ''DELETE'' and as a separate source for data\n`\n\nRow Comparison Operations\n\nThere is only partial support for row comparison operations. The expression in\n\n`sql\nexpr op {ALL|ANY|SOME} subquery,\n`\n\nmust be scalar and the subquery can only return a single column.\n\nHowever, because of the way IN is implemented (it is rewritten as a sequence of = comparisons and AND), the expression in\n\n`sql\nexpression [NOT] IN subquery\n`\n\nis permitted to be an n-tuple and the subquery can return rows of n-tuples.\n\nFor example:\n\n`sql\nSELECT  FROM staff WHERE (name,age) NOT IN (\n  SELECT name,age FROM customer WHERE age >=51]\n);\n+--------+------+\n| name   | age  |\n+--------+------+\n| Bilhah |   37 |\n| Maia   |   25 |\n+--------+------+\n`\n\nis permitted, but\n\n`sql\nSELECT  FROM staff WHERE (name,age) = ALL (\n  SELECT name,age FROM customer WHERE age >=51\n);\nERROR 1241 (21000): Operand should contain 1 column(s)\n`\n\nis not.\n\nCorrelated Subqueries\n\nSubqueries in the FROM clause cannot be correlated subqueries. They cannot be evaluated for each row of the outer query since they are evaluated to produce a result set during when the query is executed.\n\nStored Functions\n\nA subquery can refer to a stored function which modifies data. This is an extension to the SQL standard, but can result in indeterminate outcomes. For example, take:\n\n`sql\nSELECT ... WHERE x IN (SELECT f() ...);\n``\n\nwhere _f()_ inserts rows. The function _f()_ could be executed a different number of times depending on how the optimizer chooses to handle the query.\n\nThis sort of construct is therefore not safe to use in replication that is not row-based, as there could be different results on the master and the slave.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subquery-limitations', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins-subqueries/subqueries/subquery-limitations');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (679, 27, 'Joins', 'Description\n-----------\n\njoin-syntax.md\n\nMain JOIN page, documenting all join types available in MariaDB.\n\nmariadb-join-guide.md\n\nIntroduction to joining tables in MariaDB.\n\nmore-advanced-joins.md\n\nIntroduction to advanced joins in MariaDB.\n\ncomma-vs-join.md\n\nHow to use a comma instead of a JOIN clause, and why you should always prefer the latter.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins/README', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (680, 27, 'Comma vs JOIN', 'Description\n-----------\n\nA query to retrieve the list of phone numbers for clients who ordered in the last two weeks might be written in a couple of ways. Here are two:\n\n``sql\nSELECT \nFROM\n  clients,\n  orders,\n  phoneNumbers\nWHERE\n  clients.id = orders.clientId\n  AND clients.id = phoneNumbers.clientId\n  AND orderPlaced >= NOW() - INTERVAL 2 WEEK;\n`\n\n`sql\nSELECT \nFROM\n  clients\n  INNER JOIN orders ON clients.id = orders.clientId\n  INNER JOIN phoneNumbers ON clients.id = phoneNumbers.clientId\nWHERE\n  orderPlaced >= NOW() - INTERVAL 2 WEEK;\n`\n\nDoes it make a difference? Not much as written. But you should use the second form, for these reasons:\n\n Readability. Once the WHERE clause contains more than two conditions, it becomes tedious to pick out the difference between business logic (only dates in the last two weeks) and relational logic (which fields relate clients to orders). Using the JOIN syntax with an ON clause makes the WHERE list shorter, and makes it very easy to see how tables relate to each other.\n Flexibility. Let''s say we need to see all clients even if they don''t have a phone number in the system. With the second version, it''s easy; just change INNER JOIN phoneNumbers to LEFT JOIN phoneNumbers. Try that with the first version, and recent MySQL versions will issue a syntax error because of the change in precedence between the comma operator and the JOIN keyword. The solution is to rearrange the FROM` clause or add parentheses to override the precedence, and that quickly becomes frustrating.\n* Portability. If your queries use standard SQL syntax, you will have an easier time switching to a different database should the need ever arise.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins/comma-vs-join', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins/comma-vs-join');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (681, 27, 'JOIN Syntax', 'Description\n-----------\n\nMariaDB supports the following JOIN syntaxes for the table_references part of SELECT statements and multiple-table DELETE and UPDATE statements:\n\n``sql\ntable_references:\n    table_reference [, table_reference] ...\n\ntable_reference:\n    table_factor\n  | join_table\n\ntable_factor (<= MariaDB 11.6):\n    tbl_name [PARTITION (partition_list)]\n        [query_system_time_period_specification] [[AS] alias] [index_hint_list]\n  | table_subquery [query_system_time_period_specification] [AS] alias\n  | ( table_references )\n  | { ON table_reference LEFT OUTER JOIN table_reference\n        ON conditional_expr }\n\ntable_factor (>= MariaDB 11.7):\n    tbl_name [PARTITION (partition_list)]\n        [query_system_time_period_specification] [[AS] alias] [index_hint_list]\n  | table_subquery [query_system_time_period_specification] [AS] alias [(column_name_list)] \n  | ( table_references )\n  | { ON table_reference LEFT OUTER JOIN table_reference\n        ON conditional_expr }\n\njoin_table:\n    table_reference [INNER | CROSS] JOIN table_factor [join_condition]\n  | table_reference STRAIGHT_JOIN table_factor\n  | table_reference STRAIGHT_JOIN table_factor ON conditional_expr\n  | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition\n  | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor\n\njoin_condition:\n    ON conditional_expr\n  | USING (column_list)\n\nquery_system_time_period_specification:\n    FOR SYSTEM_TIME AS OF point_in_time\n  | FOR SYSTEM_TIME BETWEEN point_in_time AND point_in_time\n  | FOR SYSTEM_TIME FROM point_in_time TO point_in_time\n  | FOR SYSTEM_TIME ALL\n\npoint_in_time:\n    [TIMESTAMP] expression\n  | TRANSACTION expression\n\nindex_hint_list:\n    index_hint [, index_hint] ...\n\nindex_hint:\n    USE {INDEX|KEY}\n      [{FOR {JOIN|ORDER BY|GROUP BY}] ([index_list])\n  | IGNORE {INDEX|KEY}\n      [{FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n  | FORCE {INDEX|KEY}\n      [{FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n\nindex_list:\n    index_name [, index_name] ...\n`\n\nA _table reference_ is also known as a _join expression_.\n\nEach table can also be specified as db_name.tabl_name. This allows to write queries which involve multiple databases. See Identifier Qualifiers for syntax details.\n\nThe syntax of table_factor is an extension to the SQL Standard. The latter accepts only table_reference, not a list of them inside a pair of parentheses.\n\nThis is a conservative extension if we consider each comma in a list of table_reference items as equivalent to an inner join. Consider this query:\n\n`sql\nSELECT  FROM t1 LEFT JOIN (t2, t3, t4)\n                 ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n`\n\nIt is equivalent to this query:\n\n`sql\nSELECT  FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)\n                 ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n`\n\nIn MariaDB, CROSS JOIN is a syntactic equivalent toINNER JOIN (they can replace each other). In standard SQL, they are not equivalent. INNER JOIN is used with anON clause, CROSS JOIN is used otherwise.\n\nIn general, parentheses can be ignored in join expressions containing only inner join operations. MariaDB also supports nested joins (see Nested Join Optimization).\n\nSubqueries\n\nA table subquery is specified as a parenthesized query and must contain a following derived table name (specified as _alias_ in the above syntax specification).\n\nYou can optionally specify a list of column names in parenthesis.\n\n`sql\nSELECT ic1, ic2, ic3 FROM\n      (\n        SELECT c1, c2, c3 FROM t1 GROUP BY c1\n      ) dt2 (ic1, ic2, ic3)\n    JOIN t2 ON t2.c1 = dt2.ic1\n    WHERE c2 > 0\n    GROUP BY ic1\n`\n\nHere, the table subquery for t1 will be materialized and named dt2, with column names ic1, ic2, ic3. These column names are used outside the subquery.\n\nYou cannot optionally specify a list of column names in parenthesis.\n\nSee also Correlation Column List.\n\nSystem-Versioned Tabled\n\nSee System-versioned tables for more information about the FOR SYSTEM_TIME syntax.\n\nIndex Hints\n\nIndex hints can be specified to affect how the MariaDB optimizer makes use of indexes. For more information, see How to force query plans.\n\nOracle Mode\n\nThis feature is available from MariaDB 12.1.\n\nOverview\n\nWhen Oracle mode is active, the Oracle-style (+)  syntax can be used. For example, the following two queries are identical:\n\n`sql\nSELECT  FROM t1 LEFT JOIN t2 ON t1.a = t2.b;\n`\n\n`sql\nSELECT  FROM t1, t2 WHERE t1.a = t2.b(+);\n`\n\nSimilarly, the following two queries are identical:\n\n`sql\nSELECT  FROM t1 RIGHT JOIN t2 ON t1.a = t2.b;\n`\n\n`sql\nSELECT  FROM t1, t2 WHERE t1.a(+) = t2.b;\n`\n\nWith more than two tables, these two queries are identical:\n\n`sql\nSELECT  FROM t1 LEFT JOIN t2 ON t1.a = t2.a LEFT JOIN t3 ON t2.a = t3.a\n`\n\n`sql\nSELECT  FROM t1, t2, t3 WHERE t1.a = t2.a(+) AND t2.a = t3.a(+)\n`\n\nTo "rewrite" a join query using the (+) syntax, use EXPLAIN EXTENDED (the last line is an approximation at using the "regular" LEFT JOIN syntax):\n\n`sql\nEXPLAIN EXTENDED\n    SELECT  FROM t1, t2, t3 WHERE t1.a = t2.a(+) AND t2.a = t3.a(+);\nid	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra\n1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	\n1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where; Using join buffer (flat, BNL join)\n1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where; Using join buffer (incremental, BNL join)\nWarnings:\nNote	1003	select "test"."t1"."a" AS "a","test"."t2"."a" AS "a","test"."t3"."a" AS "a" from "test"."t1" left join "test"."t2" on("test"."t2"."a" = "test"."t1"."a") left join "test"."t3" on("test"."t3"."a" = "test"."t2"."a") where 1\n`\n\nLimitations\n\nThe table whose columns are marked with the (+) operator in a subexpression (a part of the WHERE clause divided by AND) are the inner part of the expression. A table whose columns are not marked with the operator belong to the outer part.\n\nExample of a single subexpression within a WHERE clause:\n\n`sql\n... WHERE t1.a = t2.a(+)\n`\n\nExample of two subexpressions within a WHERE clause – here, both t1.a = t2.a(+)  and t2.a = t3.a(+) are inner parts, because both contain a (+) operator:\n\n`sql\n... WHERE t1.a = t2.a(+) AND t2.a = t3.a(+)\n`\n\nExample of two subexpressions within a WHERE clause – here, t1.a = t2.a(+) is the inner part (because of the (+) operator), and t2.a = 42 is the outer part (it doesn''t have a (+) operator:\n\n`sql\n... WHERE t1.a = t2.a(+) AND t2.a = 42\n`\n\n"Rewritten" as a "regular" join, that clause looks like this:\n\n`sql\n... FROM t1 LEFT JOIN t2 ON (t1.a = t2.a) WHERE t2.a = 42\n`\n\nThe following limitations apply:\n\n The (+) operator can only be used in a WHERE clause.\n The (+) operator can only be applied to a table column, and the column should be from the local SELECT, not from an outer SELECT.\n The (+) operator cannot be used with other JOIN methods – it must be a comma-separated list in the FROM clause.\n When the WHERE clause is split into subexpressions by AND, (+) cannot be used.\n The (+) operator cannot be used on the right side of an IN function.\n The (+) operator cannot be used in row operations.\n The (+) operator cannot be used when two or more tables are on one side of and marked with the (+) operator and some are not.\n The (+) operator cannot create loops (or cycles) of dependence, where the same table appears on both sides of the operator in one expression, or through a chain of expressions.\n\nError Codes\n\nThe following errors may occur when not adhering to the (+) operator limitations or for other reasons:\n\n ER_INVALID_USE_OF_ORA_JOIN\n ER_INVALID_USE_OF_ORA_JOIN_OUTER_REF\n ER_INVALID_USE_OF_ORA_JOIN_WRONG_FUNC\n ER_INVALID_USE_OF_ORA_JOIN_ONE_TABLE\n ER_INVALID_USE_OF_ORA_JOIN_CYCLE\n\nYou can find examples of the errors by error code in these files (which are available on GitHub):\n\n mysql-test/suite/compat/oracle/t/ora_outer_join.test\n mysql-test/suite/compat/oracle/t/ora_outer_join_err.test`\n\nExamples\n--------\n\nSELECT left_tbl.*\n  FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id\n  WHERE right_tbl.id IS NULL;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins/join-syntax', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/joins/join-syntax');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (682, 27, 'LIMIT', 'Description\n-----------\n\nUse the LIMIT clause to restrict the number of returned rows. When you use a single integer _n_ with LIMIT, the first _n_ rows will be returned. Use the ORDER BY clause to control which rows come first. You can also select a number of rows after an offset using either of the following:\n\n``sql\nLIMIT offset, row_count\nLIMIT row_count OFFSET offset\n`\n\nWhen you provide an offset _m_ with a limit _n_, the first _m_ rows will be ignored, and the following _n_ rows will be returned.\n\nExecuting an UPDATE with the LIMIT clause is not safe for replication. LIMIT 0 is an exception to this rule (see MDEV-6170).\n\nThere is a LIMIT ROWS EXAMINED optimization which provides the means to terminate the execution of SELECT statements which examine too many rows, and thus use too many resources. See LIMIT ROWS EXAMINED.\n\nMulti-Table Updates\n\nIt is possible to use LIMIT (or ORDER BY) in a multi-table UPDATE statement.\n\nIt is not possible to use LIMIT (or ORDER BY) in a multi-table UPDATE statement.\n\nGROUP_CONCAT\n\nIt is possible to use LIMIT with GROUP_CONCAT().\n\nIt is not possible to use LIMIT` with GROUP_CONCAT().\n\nExamples\n--------\n\nCREATE TABLE members (name VARCHAR(20));\nINSERT INTO members VALUES(''Jagdish''),(''Kenny''),(''Rokurou''),(''Immaculada'');\n\nSELECT * FROM members;\n+------------+\n| name       |\n+------------+\n| Jagdish    |\n| Kenny      |\n| Rokurou    |\n| Immaculada |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/limit', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/limit');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (683, 27, 'LOCK IN SHARE MODE', 'Description\n-----------\n\nInnoDB supports row-level locking. Selected rows can be locked using LOCK IN SHARE MODE or FOR UPDATE. In both cases, a lock is acquired on the rows read by the query, and it will be released when the current transaction is committed.\n\nWhen LOCK IN SHARE MODE is specified in a SELECT statement, MariaDB will wait until all transactions that have modified the rows are committed. Then, a read lock is acquired. All transactions can read the rows, but if they want to modify them, they have to wait until your transaction is committed.\n\nInnoDB locks index records rather than logical rows. If a SELECT is satisfied by a secondary index (a covering index read), it just locks that index. Instead, the primary key records will be locked if a concurrent UPDATE modifies columns outside of that index. These locks do not overlap under READ COMMITTED isolation level, so the update can proceed. To ensure a block is used, the SELECT query must reference columns from the primary index.\n\nFor further information and an example, see InnoDB Lock Modes.\n\nIf autocommit is set to 1 (the default), the LOCK IN SHARE MODE and FOR UPDATE clauses have no effect in InnoDB. For non-transactional storage engines like MyISAM and ARIA, a table level lock will be taken even if autocommit is set to 1.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/lock-in-share-mode', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/lock-in-share-mode');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (684, 27, 'ORDER BY', 'Description\n-----------\n\nUse the ORDER BY clause to order a resultset, such as that are returned from a SELECT statement. You can specify just a column or use any expression with functions. If you are using the GROUP BY clause, you can use grouping functions in ORDER BY. Ordering is done after grouping.\n\nYou can use multiple ordering expressions, separated by commas. Rows are sorted by the first expression, then by the second expression if they have the same value for the first, and so on.\n\nYou can use the keywords ASC and DESC after each ordering expression to force that ordering to be ascending or descending, respectively. Ordering is ascending by default.\n\nYou can also use a single integer as the ordering expression. If you use an integer _n_, the results is ordered by the n<sup>th</sup> column in the select expression.\n\nWhen string values are compared, they are compared as if by the STRCMP function. STRCMP ignores trailing whitespace and may normalize characters and ignore case, depending on the collation in use.\n\nDuplicated entries in the ORDER BY clause are removed.\n\nORDER BY can also be used to order the activities of a DELETE or UPDATE statement (usually with the LIMIT clause).\n\nIt is possible to use ORDER BY (or LIMIT) in a multi-table UPDATE statement.\n\nIt is not possible to use ORDER BY (or LIMIT) in a multi-table UPDATE statement.\n\nMariaDB allows packed sort keys and values of non-sorted fields in the sort buffer. This can make filesort temporary files much smaller when VARCHAR, CHAR or BLOB columns are used, notably speeding up some ORDER BY sorts.\n\nMariaDB does not allow packed sort keys and values of non-sorted fields in the sort buffer.\n\nExamples\n--------\n\nCREATE TABLE seq (i INT, x VARCHAR(1));\nINSERT INTO seq VALUES (1,''a''), (2,''b''), (3,''b''), (4,''f''), (5,''e'');\n\nSELECT  FROM seq ORDER BY i;\n+------+------+\n| i    | x    |\n+------+------+\n|    1 | a    |\n|    2 | b    |\n|    3 | b    |\n|    4 | f    |\n|    5 | e    |\n+------+------+\n\nSELECT  FROM seq ORDER BY i DESC;\n+------+------+\n| i    | x    |\n+------+------+\n|    5 | e    |\n|    4 | f    |\n|    3 | b    |\n|    2 | b    |\n|    1 | a    |\n+------+------+\n\nSELECT * FROM seq ORDER BY x,i;\n+------+------+\n| i    | x    |\n+------+------+\n|    1 | a    |\n|    2 | b    |\n|    3 | b    |\n|    5 | e    |\n|    4 | f    |\n+------+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/order-by', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/order-by');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (685, 27, 'PROCEDURE', 'Description\n-----------\n\nThe PROCEDURE clause of SELECT passes the whole result set to a Procedure which will process it. These Procedures are not Stored Procedures, and can only be written in the C language, so it is necessary to recompile the server.\n\nCurrently, the only available procedure is ANALYSE, which examines the resultset and suggests the optimal datatypes for each column. It is defined in the sql/sql_analyse.cc file, and can be used as an example to create more Procedures.\n\nThis clause cannot be used in a view definition.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/procedure', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/procedure');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (686, 27, 'SELECT INTO DUMPFILE', 'Syntax\n------\n\nSELECT ... INTO DUMPFILE ''file_path''\n\nDescription\n-----------\n\nSELECT ... INTO DUMPFILE is a SELECT clause which writes the resultset into a single unformatted row, without any separators, in a file. The results will not be returned to the client.\n\n_file_path_ can be an absolute path, or a relative path starting from the data directory. It can only be specified as a string literal, not as a variable. However, the statement can be dynamically composed and executed as a prepared statement to work around this limitation.\n\nThis statement is binary-safe and so is particularly useful for writing BLOB values to file. It can be used, for example, to copy an image or an audio document from the database to a file.\n\nThe file must not exist. It cannot be overwritten. A user needs the FILE privilege to run this statement. Also, MariaDB needs permission to write files in the specified location. If the secure_file_priv system variable is set to a non-empty directory name, the file can only be written to that directory.\n\nThe character_set_filesystem system variable has controlled interpretation of file names that are given as literal strings.\n\nThe character_set_filesystem system variable does not have controlled interpretation of file names that are given as literal strings.\n\nExamples\n--------\n\nSELECT _utf8''Hello world!'' INTO DUMPFILE ''/tmp/world'';\n\nSELECT LOAD_FILE(''/tmp/world'') AS world;\n+--------------+\n| world        |\n+--------------+\n| Hello world! |\n+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select-into-dumpfile', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select-into-dumpfile');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (687, 27, 'SELECT INTO OUTFILE', 'Syntax\n------\n\nSELECT ... INTO OUTFILE ''file_name''\n        [CHARACTER SET charset_name]\n        [export_options]\n\nexport_options:\n    [{FIELDS | COLUMNS}\n        [TERMINATED BY ''string'']\n        [[OPTIONALLY] ENCLOSED BY ''char'']\n        [ESCAPED BY ''char'']\n    ]\n    [LINES\n        [STARTING BY ''string'']\n        [TERMINATED BY ''string'']\n    ]\n\nDescription\n-----------\n\nSELECT INTO OUTFILE writes the resulting rows to a file, and allows the use of column and row terminators to specify a particular output format. The default is to terminate fields with tabs () and lines with newlines ().\n\nThe file must not exist. It cannot be overwritten. A user needs the FILE privilege to run this statement. Also, MariaDB needs permission to write files in the specified location. If the secure_file_priv system variable is set to a non-empty directory name, the file can only be written to that directory.\n\nThe LOAD DATA INFILE statement complements SELECT INTO OUTFILE.\n\nCharacter Sets\n\nThe CHARACTER SET clause specifies the character set in which the results are to be written. Without the clause, no conversion takes place (the binary character set). In this case, if there are multiple character sets, the output will contain these too, and may not easily be able to be reloaded.\n\nIn cases where you have two servers using different character-sets, using SELECT INTO OUTFILE to transfer data from one to the other can have unexpected results. To ensure that MariaDB correctly interprets the escape sequences, use the CHARACTER SET clause on both the SELECT INTO OUTFILE statement and the subsequent LOAD DATA INFILE statement.\n\nExamples\n--------\n\nSELECT customer_id, firstname, surname FROM customer\n  INTO OUTFILE ''/exportdata/customers.txt''\n  FIELDS TERMINATED BY '','' OPTIONALLY ENCLOSED BY ''"''\n  LINES TERMINATED BY ''\\n'';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select-into-outfile', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select-into-outfile');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (688, 27, 'SELECT ... OFFSET ... FETCH', 'Syntax\n------\n\nOFFSET start { ROW | ROWS }\nFETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES }\n\nDescription\n-----------\n\nThe OFFSET clause allows one to return only those elements of a resultset that come after a specified offset. The FETCH clause specifies the number of rows to return, while ONLY or WITH TIES specifies whether or not to also return any further results that tie for last place according to the ordered resultset.\n\nEither the singular ROW or the plural ROWS can be used after the OFFSET and FETCH clauses; the choice has no impact on the results.\n\nFIRST and NEXT give the same result.\n\nIn the case of WITH TIES, an ORDER BY clause is required, otherwise an error will be returned.\n\n``sql\nSELECT i FROM t1 FETCH FIRST 2 ROWS WITH TIES;\nERROR 4180 (HY000): FETCH ... WITH TIES requires ORDER BY clause to be present\n``\n\nExamples\n--------\n\nCREATE OR REPLACE TABLE t1 (i INT);\nINSERT INTO t1 VALUES (1),(2),(3),(4), (4), (5);\nSELECT i FROM t1 ORDER BY i ASC;\n+------+\n| i    |\n+------+\n|    1 |\n|    2 |\n|    3 |\n|    4 |\n|    4 |\n|    5 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select-offset-fetch', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select-offset-fetch');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (689, 27, 'SELECT WITH ROLLUP', 'Description\n-----------\n\nThe WITH ROLLUP modifier adds extra rows to the result set that represent super-aggregate summaries. The super-aggregated column is represented by a NULL value. Multiple aggregates over different columns will be added if there are multiple GROUP BY columns.\n\nThe LIMIT clause can be used at the same time, and is applied after the WITH ROLLUP rows have been added.\n\nWITH ROLLUP cannot be used with ORDER BY. Some sorting is still possible by using ASC or DESC clauses with the GROUP BY column, although the super-aggregate rows will always be added last.\n\nExamples\n--------\n\nCREATE TABLE booksales ( \n  country VARCHAR(35), genre ENUM(''fiction'',''non-fiction''), year YEAR, sales INT);\n\nINSERT INTO booksales VALUES\n  (''Senegal'',''fiction'',2014,12234), (''Senegal'',''fiction'',2015,15647),\n  (''Senegal'',''non-fiction'',2014,64980), (''Senegal'',''non-fiction'',2015,78901),\n  (''Paraguay'',''fiction'',2014,87970), (''Paraguay'',''fiction'',2015,76940),\n  (''Paraguay'',''non-fiction'',2014,8760), (''Paraguay'',''non-fiction'',2015,9030);\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select-with-rollup', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select-with-rollup');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (690, 27, 'SELECT', 'Syntax\n------\n\nSELECT\n    [/+ hints /]\n    [/+ JOIN_PREFIX(argument_list) /]\n    [/+ JOIN_ORDER(argument_list) /]\n    [/+ JOIN_FIXED_ORDER(argument_list) /]\n    [/+ JOIN_SUFFIX(argument_list) /]\n    [/+ MAX_EXECUTION_TIME(milliseconds) /]\n    [ALL | DISTINCT | DISTINCTROW]\n    [HIGH_PRIORITY]\n    [STRAIGHT_JOIN]\n    [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n    [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n    select_expr [, select_expr ...]\n    [ FROM table_references\n      [WHERE where_condition]\n      [GROUP BY {col_name | expr | position} [ASC | DESC], ... [WITH ROLLUP]]\n      [HAVING where_condition]\n      [ORDER BY {col_name | expr | position} [ASC | DESC], ...]\n      [LIMIT {[offset,] row_count | row_count OFFSET offset  \n      [ROWS EXAMINED rows_limit] } |\n        [OFFSET start { ROW | ROWS }]\n        [FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES }] ]\n      procedure|[PROCEDURE procedure_name(argument_list)]\n      [INTO OUTFILE ''file_name'' [CHARACTER SET charset_name] [export_options] |\n        INTO DUMPFILE ''file_name'' | INTO var_name [, var_name] ]\n      [FOR UPDATE lock_option | LOCK IN SHARE MODE lock_option]\nexport_options:\n    [{FIELDS | COLUMNS}\n        [TERMINATED BY ''string'']\n        [[OPTIONALLY] ENCLOSED BY ''char'']\n        [ESCAPED BY ''char'']\n    ]\n    [LINES\n        [STARTING BY ''string'']\n        [TERMINATED BY ''string'']\n    ]\nlock_option:\n    [WAIT n | NOWAIT | SKIP LOCKED]\n\nDescription\n-----------\n\nSELECT is used to retrieve rows selected from one or more tables, and can include UNION statements and subqueries.\n\n Each select_expr expression indicates a column or data that you want to retrieve. You must have at least one select expression. See Select Expressions below.\n The FROM clause indicates the table or tables from which to retrieve rows. Use either a single table name or a JOIN expression. See JOIN for details. If no table is involved, FROM DUAL can be specified.\n Each table can also be specified as db_name.tabl_name. Each column can also be specified as tbl_name.col_name or even db_name.tbl_name.col_name. This allows one to write queries which involve multiple databases. See Identifier Qualifiers for syntax details.\n The WHERE clause, if given, indicates the condition or conditions that rows must satisfy to be selected. The where_condition is an expression that evaluates to true for each row to be selected. The statement selects all rows if there is no WHERE clause.\n   In the WHERE clause, you can use any of the functions and operators that MariaDB supports, except for aggregate (summary) functions. See Functions and Operators and Functions and Modifiers for use with GROUP BY (aggregate).\n Use the ORDER BY clause to order the results.\n Use the LIMIT clause to restrict the results to only a certain number of rows, optionally with an offset.\n Use the GROUP BY and HAVING clauses to group rows together when they have columns or computed values in common.\n\nSELECT can also be used to retrieve rows computed without reference to any table.\n\nSelect Expressions\n\nA SELECT statement must contain one or more select expressions, separated by commas. Each select expression can be one of the following:\n\n The name of a column.\n Any expression using functions and operators.\n  to select all columns from all tables in the FROM clause.\n tbl_name. to select all columns from just the table tbl_name.\n\nWhen specifying a column, you can either use just the column name or qualify the column name with the name of the table using tbl_name.col_name. The qualified form is useful if you are joining multiple tables in the FROM clause. If you do not qualify the column names when selecting from multiple tables, MariaDB will try to find the column in each table. It is an error if that column name exists in multiple tables.\n\nYou can quote column names using backticks. If you are qualifying column names with table names, quote each part separately as `tbl_name.col_name.\n\nIf you use any grouping functions in any of the select expressions, all rows in your results will be implicitly grouped, as if you had used GROUP BY NULL. GROUP BY NULL being an expression behaves specially such that the entire result set is treated as a group.\n\nDISTINCT\n\nA query may produce some identical rows. By default, all rows are retrieved, even when their values are the same. To explicitly specify that you want to retrieve identical rows, use the ALL option. If you want duplicates to be removed from the result set, use the DISTINCT option. DISTINCTROW is a synonym for DISTINCT. See also COUNT DISTINCT and SELECT UNIQUE in Oracle mode.\n\nINTO\n\nThe INTO clause is used to specify that the query results should be written to a file or variable.\n\n SELECT INTO OUTFILE - formatting and writing the result to an external file.\n SELECT INTO DUMPFILE - binary-safe writing of the unformatted results to an external file.\n* SELECT INTO Variable - selecting and setting variables.\n\nThe reverse of SELECT INTO OUTFILE is LOAD DATA.\n\nLIMIT\n\nRestricts the number of returned rows. See LIMIT and LIMIT ROWS EXAMINED for details.\n\nLOCK IN SHARE MODE/FOR UPDATE\n\nSee LOCK IN SHARE MODE and FOR UPDATE for details on the respective locking clauses.\n\nOFFSET ... FETCH\n\nSee SELECT ... OFFSET ... FETCH.\n\nThe clause doesn''t exist.\n\nORDER BY\n\nOrder a result set. See ORDER BY for details.\n\nPARTITION\n\nSpecifies to the optimizer which partitions are relevant for the query. Other partitions will not be read. See Partition Pruning and Selection for details.\n\nPROCEDURE\n\nPasses the whole result set to a C Procedure. See PROCEDURE and PROCEDURE ANALYSE (the only built-in procedure not requiring the server to be recompiled).\n\nSKIP LOCKED\n\nThis causes rows that couldn''t be locked (LOCK IN SHARE MODE or FOR UPDATE) to be excluded from the result set. An explicit NOWAIT is implied here. This is only implemented on InnoDB tables and ignored otherwise.\n\nThe clause doesn''t exist.\n\nOptimizer Hints\n\nThese include HIGH_PRIORITY, STRAIGHT_JOIN, SQL_SMALL_RESULT | SQL_BIG_RESULT, SQL_BUFFER_RESULT, SQL_CACHE | SQL_NO_CACHE, and SQL_CALC_FOUND_ROWS.\n\nSee Optimizer Hints for details.\n\nmax_statement_time clause\n\nBy using max_statement_time in conjunction with SET STATEMENT, it is possible to limit the execution time of individual queries. For example:\n\n`sql\nSET STATEMENT max_statement_time=100 FOR \n  SELECT field1 FROM table_name ORDER BY field1;\n``\n\nWAIT/NOWAIT\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nExamples\n--------\n\nSELECT f1,f2 FROM t1 WHERE (f3<=10) AND (f4=''y'');\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (691, 27, 'EXCEPT', 'Syntax\n------\n\nSELECT ...\n(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL | DISTINCT]) \n  SELECT ...\n[(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL | DISTINCT]) \n  SELECT ...]\n[ORDER BY [{col_name | expr | position} [ASC | DESC] \n  [, {col_name | expr | position} [ASC | DESC] ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}\n| OFFSET start { ROW | ROWS }\n| FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES } ]\n\nDescription\n-----------\n\nMariaDB supports EXCEPT and INTERSECT in addition to UNION.\n\nThe queries before and after EXCEPT must be SELECT or VALUES statements.\n\nAll behavior for naming columns, ORDER BY and LIMIT is the same as for UNION. Note that the alternative SELECT ... OFFSET ... FETCH syntax is only supported. This allows us to use the WITH TIES clause.\n\nEXCEPT implicitly supposes a DISTINCT operation.\n\nThe result of EXCEPT is all records of the left SELECT result except records which are in right SELECT result set, i.e. it is subtraction of two result sets.\n\nEXCEPT and UNION have the same operation precedence and INTERSECT has a higher precedence, unless running in Oracle mode, in which case all three have the same precedence.\n\nParentheses\n\nParentheses can be used to specify precedence. Before this, a syntax error would be returned.\n\nMariaDB starting with 10.5.0\n\nALL/DISTINCT\n\nEXCEPT ALL and EXCEPT DISTINCT . The ALL operator leaves duplicates intact, while the DISTINCT operator removes duplicates. DISTINCT is the default behavior if neither operator is supplied.\n\nOnly EXCEPT DISTINCT is available.\n\nExamples\n--------\n\n(SELECT e_name AS name, email FROM customers)\nEXCEPT\n(SELECT c_name AS name, email FROM employees);\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/except', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/except');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (692, 27, 'INTERSECT', 'Syntax\n------\n\nSELECT ...\n(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL | DISTINCT]) SELECT ...\n[(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL | DISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nDescription\n-----------\n\nMariaDB has supported INTERSECT (as well as EXCEPT) in addition to UNION since MariaDB 10.3.\n\nAll behavior for naming columns, ORDER BY and LIMIT is the same as for UNION.\n\nINTERSECT implicitly supposes a DISTINCT operation.\n\nThe result of an intersect is the intersection of right and left SELECT results, i.e. only records that are present in both result sets will be included in the result of the operation.\n\nINTERSECT has higher precedence than UNION and EXCEPT (unless running running in Oracle mode, in which case all three have the same precedence). If possible it will be executed linearly, but if not, it will be translated to a subquery in the FROM clause:\n\n``sql\n(SELECT a,b FROM t1)\nUNION\n(SELECT c,d FROM t2)\nINTERSECT\n(SELECT e,f FROM t3)\nUNION\n(SELECT 4,4);\n`\n\nwill be translated to:\n\n`sql\n(SELECT a,b FROM t1)\nUNION\nSELECT c,d FROM\n  ((SELECT c,d FROM t2)\n   INTERSECT\n   (SELECT e,f FROM t3)) dummy_subselect\nUNION\n(SELECT 4,4)\n`\n\nParentheses\n\nParentheses can be used to specify precedence.\n\nParentheses cannot be used to specify precedence.\n\nMariaDB starting with 10.5.0\n\nALL/DISTINCT\n\nINTERSECT ALL and INTERSECT DISTINCT . The ALL operator leaves duplicates intact, while the DISTINCT operator removes duplicates. DISTINCT is the default behavior if neither operator is supplied.\n\nDISTINCT` is the only behavior available.\n\nExamples\n--------\n\n(SELECT e_name AS name, email FROM employees)\nINTERSECT\n(SELECT c_name AS name, email FROM customers);\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/intersect', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/intersect');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (693, 27, 'MINUS', 'Description\n-----------\n\nMINUS is available starting from MariaDB 10.6.1.\n\nMINUS is a synonym for EXCEPT when SQL_MODE=ORACLE is set.\n\n``sql\nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(2),(3),(3),(4),(5),(6);\n\nSET SQL_MODE=''ORACLE'';\n\nSELECT i FROM seqs WHERE i <= 3 MINUS SELECT i FROM seqs WHERE i>=3;\n+------+\n| i    |\n+------+\n|    1 |\n|    2 |\n+------+\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/minus', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/minus');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (694, 27, 'Precedence Control in Table Operations', 'Syntax\n------\n\n(  expression )\n[ORDER BY [column[, column...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nDescription\n-----------\n\nUsing parentheses in SQL allows to control the order of execution for SELECT statements and Table Value Constructor, including UNION, EXCEPT, and INTERSECT operations. MariaDB executes the parenthetical expression before the rest of the statement. You can then use ORDER BY and LIMIT clauses the further organize the result set.\n\nThe Optimizer may rearrange the exact order in which MariaDB executes different parts of the statement. When it calculates the result set, however, it returns values as though the parenthetical expression were executed first.\n\nExamples\n--------\n\nCREATE TABLE test.t1 (num INT);\n\nINSERT INTO test.t1 VALUES (1),(2),(3);\n\n(SELECT  FROM test.t1 \n UNION \n VALUES (10)) \nINTERSECT \nVALUES (1),(3),(10),(11);\n+------+\n| num  |\n+------+\n|    1 |\n|    3 |\n|   10 |\n+------+\n\n((SELECT  FROM test.t1 \n  UNION \n  VALUES (10)) \n INTERSECT \n VALUES (1),(3),(10),(11)) \nORDER BY 1 DESC;\n+------+\n| num  |\n+------+\n|   10 |\n|    3 |\n|    1 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/precedence-control-in-table-operations', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/precedence-control-in-table-operations');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (695, 27, 'UNION', 'Description\n-----------\n\nUNION is used to combine the results from multiple SELECT statements into a single result set.\n\nThe column names from the first SELECT statement are used as the column names for the results returned. Selected columns listed in corresponding positions of each SELECT statement should have the same data type. (For example, the first column selected by the first statement should have the same type as the first column selected by the other statements.)\n\nIf they don''t, the type and length of the columns in the result take into account the values returned by all of the SELECTs, so there is no need for explicit casting. Note that currently this is not the case for recursive CTEs - see MDEV-12325.\n\nTable names can be specified as db_name.tbl_name. This permits writing UNIONs which involve multiple databases. See Identifier Qualifiers for syntax details.\n\nUNION queries cannot be used with aggregate functions.\n\nEXCEPT and UNION have the same operation precedence and INTERSECT has a higher precedence, unless running in Oracle mode, in which case all three have the same precedence.\n\nALL/DISTINCT\n\nThe ALL keyword causes duplicate rows to be preserved. The DISTINCT keyword (the default if the keyword is omitted) causes duplicate rows to be removed by the results.\n\nUNION ALL and UNION DISTINCT can both be present in a query. In this case, UNION DISTINCT will override any UNION ALL to its left.\n\nThe server can in most cases execute UNION ALL without creating a temporary table (see MDEV-334).\n\nORDER BY and LIMIT\n\nIndividual SELECT statements can contain their own ORDER BY and LIMIT clauses. In this case, the individual queries need to be wrapped between parentheses. However, this does not affect the order of the UNION, so they only are useful to limit the record read by one SELECT.\n\nThe UNION can have global ORDER BY and LIMIT clauses, which affect the whole result set. If the columns retrieved by individual SELECT statements have an alias (AS), the ORDER BY must use that alias, not the real column names.\n\nHIGH_PRIORITY\n\nSpecifying a query as HIGH_PRIORITY does not work inside a UNION. If applied to the first SELECT, it is ignored. Applying to a later SELECT results in a syntax error:\n\n``sql\nERROR 1234 (42000): Incorrect usage/placement of ''HIGH_PRIORITY''\n`\n\nSELECT ... INTO ...\n\nIndividual SELECT statements cannot be written INTO DUMPFILE or INTO OUTFILE. If the last SELECT statement specifies INTO DUMPFILE or INTO OUTFILE, the entire result of the UNION will be written. Placing the clause after any other SELECT` will result in a syntax error.\n\nIf the result is a single row, SELECT ... INTO @var_name can also be used.\n\nParentheses\n\nParentheses can be used to specify precedence.\n\nParentheses cannot be used to specify precedence.\n\nExamples\n--------\n\n(SELECT e_name AS name, email FROM employees)\nUNION\n(SELECT c_name AS name, email FROM customers);\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/union', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/union');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (696, 27, 'Subqueries with IN and NOT IN', 'Description\n-----------\n\nThe IN operator tests whether a value is a member of a set of values returned by a subquery. It is the most commonly used construct for equality-based subquery comparisons in MariaDB.\n\nWhile IN is logically related to the ANY and SOME operators, it has distinct semantics and receives specialized treatment from the query optimizer.\n\nSyntax\n\n``sql\nscalar_expression [NOT] IN (subquery)\n`\n\n scalar_expression: An expression that evaluates to a single value.\n subquery: A subquery that returns a single column.\n\nRelationship to ANY and SOME\n\nIn MariaDB, IN is a synonym for = ANY.\n\n IN evaluates to TRUE if the comparison returns TRUE for at least one row produced by the subquery.\n IN evaluates to FALSE if the subquery returns no rows.\n\nDespite this logical equivalence, the optimizer applies additional transformations to IN subqueries (such as semi-joins) that do not always apply to other quantitative ANY comparisons like > ANY or <= SOME.\n\nHandling NULL Values\n\nThe behavior of IN and NOT IN follows SQL three-valued logic.\n\n Source Expression is NULL: If the scalar_expression is NULL, the result is NULL.\n Subquery Contains NULL (IN): If no match is found and the subquery contains at least one NULL, the result is NULL.\n Subquery Contains NULL (NOT IN): If the subquery returns any NULL value, NOT IN will always evaluate to NULL or FALSE, never TRUE, even if no matching non-null value exists.\n\nAvoid using NOT IN if the subquery columns can contain NULL values. In such cases, NOT EXISTS is generally safer and more predictable.\n\nNOT IN vs. <> ANY\n\nNOT IN and <> ANY are not synonyms and represent different logical tests:\n\n| OperatorText | Logical MeaningText                                         | ResultText                                                                               |\n| ------------ | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------- |\n| NOT IN     | "Is this value absent from the entire set?"                 | Returns TRUE only if the value matches no rows in the subquery.                        |\n| <> ANY     | "Is there at least one value in the set that is different?" | Returns TRUE if there is at least one row in the subquery that differs from the value. |\n\nOptimization and Performance\n\nMariaDB treats IN` subqueries as high-priority candidates for specific optimizations, including:\n\n Semi-join transformations: Converting the subquery into a join to improve execution speed.\n Subquery materialization: Storing the subquery result in a temporary internal table to avoid repeated execution.\n IN-to-EXISTS rewrites: Converting the predicate based on cost estimates.\n\nExamples\n--------\n\nSELECT * FROM sq1 WHERE num1 IN (SELECT num2 FROM sq2);\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/subqueries/subqueries-with-in-and-not-in', '', 'https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/subqueries/subqueries-with-in-and-not-in');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (697, 34, 'BUFFER', 'Description\n-----------\n\nA synonym for ST_BUFFER.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/buffer', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/buffer');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (698, 34, 'CONVEXHULL', 'Description\n-----------\n\nA synonym for ST_CONVEXHULL.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/convexhull', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/convexhull');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (699, 34, 'ST\\_AsGeoJSON', 'Syntax\n------\n\nST_AsGeoJSON(g[, max_decimals[, options]])\n\nDescription\n-----------\n\nReturns the given geometry _g_ as a GeoJSON element. The optional _max_decimals_ limits the maximum number of decimals displayed.\n\nThe optional _options_ flag can be set to 1 to add a bounding box to the output.\n\nExamples\n--------\n\nSELECT ST_AsGeoJSON(ST_GeomFromText(''POINT(5.3 7.2)''));\n+-------------------------------------------------+\n| ST_AsGeoJSON(ST_GeomFromText(''POINT(5.3 7.2)'')) |\n+-------------------------------------------------+\n| {"type": "Point", "coordinates": [5.3, 7.2]}    |\n+-------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/geojson-st_asgeojson', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/geojson-st_asgeojson');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (700, 34, 'GEOMETRYCOLLECTION', 'Syntax\n------\n\nGeometryCollection(g1,g2,...)\n\nDescription\n-----------\n\nConstructs a WKB GeometryCollection. If any argument is not a well-formed WKB representation of a geometry, the return value is NULL.\n\nExamples\n--------\n\nCREATE TABLE gis_geometrycollection  (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\nINSERT INTO gis_geometrycollection VALUES\n    (GeomCollFromText(''GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))'')),\n    (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),\n    (GeomFromText(''GeometryCollection()'')),\n    (GeomFromText(''GeometryCollection EMPTY''));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/geometrycollection', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/geometrycollection');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (701, 34, 'LINESTRING', 'Syntax\n------\n\nLineString(pt1,pt2,...)\n\nDescription\n-----------\n\nWKB LineString from WKB Point coordinate data.\\\nConstructs a WKB LineString value from a number of WKB Point arguments. If any argument is not a WKB Point, the return value isNULL. If the number of Point arguments is less than two, the return value is NULL.\n\nExamples\n--------\n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n\nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3)                          |\n+-------------------------------------+\n\nCREATE TABLE gis_line  (g LINESTRING);\nINSERT INTO gis_line VALUES\n    (LineFromText(''LINESTRING(0 0,0 10,10 0)'')),\n    (LineStringFromText(''LINESTRING(10 10,20 10,20 20,10 20,10 10)'')),\n    (LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/linestring', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/linestring');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (702, 34, 'MULTILINESTRING', 'Syntax\n------\n\nMultiLineString(ls1,ls2,...)\n\nDescription\n-----------\n\nConstructs a WKB MultiLineString value using WKB LineString arguments. If any argument is not a WKB LineString, the return value isNULL.\n\nExamples\n--------\n\nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(''MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'')),\n (MLineFromText(''MULTILINESTRING((10 48,10 21,10 0))'')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), \n    Point(3, 5)), LineString(Point(2, 5),Point(5, 8),Point(21, 7))))));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/multilinestring', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/multilinestring');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (703, 34, 'MULTIPOINT', 'Syntax\n------\n\nMultiPoint(pt1,pt2,...)\n\nDescription\n-----------\n\nConstructs a WKB MultiPoint value using WKB Point arguments. If any argument is not a WKB Point, the return value is NULL.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT(''MultiPoint( 1 1, 2 2, 5 3, 7 2, 9 3, 8 4, 6 6, 6 9, 4 9, 1 5 )'');\n\nCREATE TABLE gis_multi_point (g MULTIPOINT);\nINSERT INTO gis_multi_point VALUES\n    (MultiPointFromText(''MULTIPOINT(0 0,10 10,10 20,20 20)'')),\n    (MPointFromText(''MULTIPOINT(1 1,11 11,11 21,21 21)'')),\n    (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/multipoint', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/multipoint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (704, 34, 'MULTIPOLYGON', 'Syntax\n------\n\nMultiPolygon(poly1,poly2,...)\n\nDescription\n-----------\n\nConstructs a WKB MultiPolygon value from a set of WKB Polygon arguments. If any argument is not a WKB Polygon, the return value is NULL.\n\nExamples\n--------\n\nCREATE TABLE gis_multi_polygon  (g MULTIPOLYGON);\nINSERT INTO gis_multi_polygon VALUES\n    (MultiPolygonFromText(''MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),\n     ((59 18,67 18,67 13,59 13,59 18)))'')),\n    (MPolyFromText(''MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),\n        ((59 18,67 18,67 13,59 13,59 18)))'')),\n    (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(\n       Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/multipolygon', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/multipolygon');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (705, 34, 'POINT', 'Syntax\n------\n\nPoint(x,y)\n\nDescription\n-----------\n\nConstructs a WKB Point using the given coordinates.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT(''Point(1 1)'');\n\nCREATE TABLE gis_point  (g POINT);\nINSERT INTO gis_point VALUES\n    (PointFromText(''POINT(10 10)'')),\n    (PointFromText(''POINT(20 10)'')),\n    (PointFromText(''POINT(20 20)'')),\n    (PointFromWKB(AsWKB(PointFromText(''POINT(10 20)''))));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/point', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/point');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (706, 34, 'PointOnSurface', 'Description\n-----------\n\nA synonym for ST_PointOnSurface.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/pointonsurface', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/pointonsurface');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (707, 34, 'POLYGON', 'Syntax\n------\n\nPolygon(ls1,ls2,...)\n\nDescription\n-----------\n\nConstructs a WKB Polygon value from a number of WKB LineString\\\narguments. If any argument does not represent the WKB of a LinearRing (that is,\\\nnot a closed and simple LineString) the return value is NULL.\n\nNote that according to the OpenGIS standard, a POLYGON should have exactly one ExteriorRing and all other rings should lie within that ExteriorRing and thus be the InteriorRings. Practically, however, some systems, including MariaDB''s, permit polygons to have several ''ExteriorRings''. In the case of there being multiple, non-overlapping exterior rings ST_NUMINTERIORRINGS() will return 1.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT(''POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1))'');\n\nCREATE TABLE gis_polygon   (g POLYGON);\nINSERT INTO gis_polygon VALUES\n    (PolygonFromText(''POLYGON((10 10,20 10,20 20,10 20,10 10))'')),\n    (PolyFromText(''POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'')),\n    (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/polygon', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/polygon');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (708, 34, 'ST\\_BUFFER', 'Syntax\n------\n\nST_BUFFER(g1,r)\nBUFFER(g1,r)\n\nDescription\n-----------\n\nReturns a geometry that represents all points whose distance from geometry _g1_ is less than or equal to distance, or radius, _r_.\n\nUses for this function could include creating for example a new geometry representing a buffer zone around an island.\n\nBUFFER() is a synonym.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(''POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'');\n\nSET @g2 = ST_GEOMFROMTEXT(''POINT(8 8)'');\n\nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,5));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,5)) |\n+---------------------------------+\n|                               1 |\n+---------------------------------+\n\nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,1));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,1)) |\n+---------------------------------+\n|                               0 |\n+---------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_buffer', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_buffer');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (709, 34, 'ST\\_CONVEXHULL', 'Syntax\n------\n\nST_ConvexHull(g)\nConvexHull(g)\n\nDescription\n-----------\n\nGiven a geometry, returns a geometry that is the minimum convex geometry enclosing all geometries within the set. Returns NULL if the geometry value is NULL or an empty value.\n\nST_ConvexHull() and ConvexHull() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT(''Point(0 0)'');\n\nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+------------------------------+\n| POINT(0 0)                   |\n+------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_convexhull', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_convexhull');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (710, 34, 'ST\\_GeomFromGeoJSON', 'Syntax\n------\n\nST_GeomFromGeoJSON(g[, option])\n\nDescription\n-----------\n\nGiven a GeoJSON input _g_, returns a geometry object. The _option_ specifies what to do if _g_ contains geometries with coordinate dimensions higher than 2.\n\n| Option | Description                                                                                      |\n| ------ | ------------------------------------------------------------------------------------------------ |\n| 1      | Return an error (the default)                                                                    |\n| 2 - 4  | The document is accepted, but the coordinates for higher coordinate dimensions are stripped off. |\n\nExamples\n--------\n\nSET @j = ''{ "type": "Point", "coordinates": [5.3, 15.0]}'';\n\nSELECT ST_AsText(ST_GeomFromGeoJSON(@j));\n+-----------------------------------+\n| ST_AsText(ST_GeomFromGeoJSON(@j)) |\n+-----------------------------------+\n| POINT(5.3 15)                     |\n+-----------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_geomfromgeojson', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_geomfromgeojson');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (711, 34, 'ST\\_INTERSECTION', 'Syntax\n------\n\nST_INTERSECTION(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry that is the intersection, or shared portion, of geometry _g1_ and geometry _g2_.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(2 1)'');\n\nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(2 1, 0 2)'');\n\nSELECT ASTEXT(ST_INTERSECTION(@g1,@g2));\n+----------------------------------+\n| ASTEXT(ST_INTERSECTION(@g1,@g2)) |\n+----------------------------------+\n| POINT(2 1)                       |\n+----------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_intersection', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_intersection');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (712, 34, 'ST\\_POINTONSURFACE', 'Syntax\n------\n\nST_PointOnSurface(g)\nPointOnSurface(g)\n\nDescription\n-----------\n\nGiven a geometry, returns a POINT guaranteed to intersect a surface. However, see MDEV-7514.\n\nST_PointOnSurface() and PointOnSurface() are synonyms.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_pointonsurface', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_pointonsurface');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (713, 34, 'ST\\_SYMDIFFERENCE', 'Syntax\n------\n\nST_SYMDIFFERENCE(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry that represents the portions of geometry _g1_ and geometry _g2_ that don''t intersect.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(''LINESTRING(10 20, 10 40)'');\n\nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(10 15, 10 25)'');\n\nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+----------------------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2))            |\n+----------------------------------------------+\n| MULTILINESTRING((10 15,10 20),(10 25,10 40)) |\n+----------------------------------------------+\n\nSET @g2 = ST_GeomFromText(''LINESTRING(10 20, 10 41)'');\n\nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+-----------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2)) |\n+-----------------------------------+\n| LINESTRING(10 40,10 41)           |\n+-----------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_symdifference', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_symdifference');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (714, 34, 'ST\\_UNION', 'Syntax\n------\n\nST_UNION(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry that is the union of the geometry _g1_ and geometry _g2_.\n\nExamples\n--------\n\nSET @g1 = GEOMFROMTEXT(''POINT (0 2)'');\n\nSET @g2 = GEOMFROMTEXT(''POINT (2 0)'');\n\nSELECT ASTEXT(ST_UNION(@g1,@g2));\n+---------------------------+\n| ASTEXT(ST_UNION(@g1,@g2)) |\n+---------------------------+\n| MULTIPOINT(2 0,0 2)       |\n+---------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_union', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_union');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (715, 34, 'DIMENSION', 'Description\n-----------\n\nA synonym for ST_DIMENSION.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/dimension', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/dimension');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (716, 34, 'BOUNDARY', 'Description\n-----------\n\nA synonym for ST_BOUNDARY.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-boundary', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-boundary');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (717, 34, 'ENVELOPE', 'Description\n-----------\n\nA synonym for ST_ENVELOPE.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-envelope', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-envelope');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (718, 34, 'GeometryN', 'Description\n-----------\n\nA synonym for ST_GeometryN.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-geometryn', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-geometryn');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (719, 34, 'GeometryType', 'Description\n-----------\n\nA synonym for ST_GeometryType.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-geometrytype', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-geometrytype');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (720, 34, 'IsEmpty', 'Description\n-----------\n\nA synonym for ST_IsEmpty.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-isempty', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-isempty');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (721, 34, 'IsSimple', 'Description\n-----------\n\nA synonym for ST_IsSImple.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-issimple', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-issimple');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (722, 34, 'NumGeometries', 'Description\n-----------\n\nA synonym for ST_NumGeometries.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-numgeometries', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-numgeometries');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (723, 34, 'SRID', 'Description\n-----------\n\nA synonym for ST_SRID.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-srid', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/geometry-properties-srid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (724, 34, 'IsClosed', 'Description\n-----------\n\nA synonym for ST_IsClosed.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/isclosed', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/isclosed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (725, 34, 'IsRing', 'Description\n-----------\n\nA synonym for ST_IsRing.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/isring', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/isring');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (726, 34, 'ST\\_BOUNDARY', 'Syntax\n------\n\nST_BOUNDARY(g)\nBOUNDARY(g)\n\nDescription\n-----------\n\nReturns a geometry that is the closure of the combinatorial boundary of the geometry value _g_.\n\nBOUNDARY() is a synonym.\n\nExamples\n--------\n\nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(''LINESTRING(3 3,0 0, -3 3)'')));\n+----------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(''LINESTRING(3 3,0 0, -3 3)''))) |\n+----------------------------------------------------------------------+\n| MULTIPOINT(3 3,-3 3)                                                 |\n+----------------------------------------------------------------------+\n\nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(''POLYGON((3 3,0 0, -3 3, 3 3))'')));\n+--------------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(''POLYGON((3 3,0 0, -3 3, 3 3))''))) |\n+--------------------------------------------------------------------------+\n| LINESTRING(3 3,0 0,-3 3,3 3)                                             |\n+--------------------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_boundary', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_boundary');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (727, 34, 'ST\\_DIMENSION', 'Syntax\n------\n\nST_Dimension(g)\nDimension(g)\n\nDescription\n-----------\n\nReturns the inherent dimension of the geometry value _g_. The result can\\\nbe\n\n| Dimension | Definition                               |\n| --------- | ---------------------------------------- |\n| -1        | empty geometry                           |\n| 0         | geometry with no length or area          |\n| 1         | geometry with no area but nonzero length |\n| 2         | geometry with nonzero area               |\n\nST_Dimension() and Dimension() are synonyms.\n\nExamples\n--------\n\nSELECT Dimension(GeomFromText(''LineString(1 1,2 2)''));\n+------------------------------------------------+\n| Dimension(GeomFromText(''LineString(1 1,2 2)'')) |\n+------------------------------------------------+\n|                                              1 |\n+------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_dimension', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_dimension');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (728, 34, 'ST\\_ENVELOPE', 'Syntax\n------\n\nST_ENVELOPE(g)\nENVELOPE(g)\n\nDescription\n-----------\n\nReturns the Minimum Bounding Rectangle (MBR) for the geometry value g. The result is returned as a Polygon value.\n\nThe polygon is defined by the corner points of the bounding box:\n\n``\nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n`\n\nST_ENVELOPE() and ENVELOPE()` are synonyms.\n\nExamples\n--------\n\nSELECT AsText(ST_ENVELOPE(GeomFromText(''LineString(1 1,4 4)'')));\n+----------------------------------------------------------+\n| AsText(ST_ENVELOPE(GeomFromText(''LineString(1 1,4 4)''))) |\n+----------------------------------------------------------+\n| POLYGON((1 1,4 1,4 4,1 4,1 1))                           |\n+----------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_envelope', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_envelope');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (729, 34, 'ST\\_GEOMETRYN', 'Syntax\n------\n\nST_GeometryN(gc,N)\nGeometryN(gc,N)\n\nDescription\n-----------\n\nReturns the N-th geometry in the GeometryCollection _gc._ Geometries are numbered beginning with 1.\n\nST_GeometryN() and GeometryN() are synonyms.\n\nExamples\n--------\n\nSET @gc = ''GeometryCollection(Point(1 1),LineString(12 14, 9 11))'';\n\nSELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1)                             |\n+----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_geometryn', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_geometryn');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (730, 34, 'ST\\_GEOMETRYTYPE', 'Syntax\n------\n\nST_GeometryType(g)\nGeometryType(g)\n\nDescription\n-----------\n\nReturns as a string the name of the geometry type of which the geometry instance g is a member. The name corresponds to one of the instantiable Geometry subclasses.\n\nST_GeometryType() and GeometryType() are synonyms.\n\nExamples\n--------\n\nSELECT GeometryType(GeomFromText(''POINT(1 1)''));\n+------------------------------------------+\n| GeometryType(GeomFromText(''POINT(1 1)'')) |\n+------------------------------------------+\n| POINT                                    |\n+------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_geometrytype', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_geometrytype');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (731, 34, 'ST\\_ISCLOSED', 'Syntax\n------\n\nST_IsClosed(g)\nIsClosed(g)\n\nDescription\n-----------\n\nReturns 1 if a given LINESTRING''s start and end points are the same, or 0 if they are not the same.\n\nST_IsClosed() and IsClosed() are synonyms.\n\nExamples\n--------\n\nSET @ls = ''LineString(0 0, 0 4, 4 4, 0 0)'';\nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n|                              1 |\n+--------------------------------+\n\nSET @ls = ''LineString(0 0, 0 4, 4 4, 0 1)'';\nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n|                              0 |\n+--------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_isclosed', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_isclosed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (732, 34, 'ST\\_ISEMPTY', 'Syntax\n------\n\nST_IsEmpty(g)\nIsEmpty(g)\n\nDescription\n-----------\n\nIsEmpty is a function defined by the OpenGIS specification, but is not fully implemented by MariaDB or MySQL.\n\nSince MariaDB and MySQL do not support GIS EMPTY values such as POINT EMPTY, as implemented it simply returns 1 if the geometry value _g_ is invalid, 0 if it is valid, and NULL if the argument is NULL.\n\nST_IsEmpty() and IsEmpty() are synonyms.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_isempty', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_isempty');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (733, 34, 'ST\\_IsRing', 'Syntax\n------\n\nST_IsRing(g)\nIsRing(g)\n\nDescription\n-----------\n\nReturns true if a given LINESTRING is a ring, that is, both ST_IsClosed and ST_IsSimple. A simple curve does not pass through the same point more than once. However, see MDEV-7510.\n\nSt_IsRing() and IsRing() are synonyms.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_isring', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_isring');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (734, 34, 'ST\\_IsSimple', 'Syntax\n------\n\nST_IsSimple(g)\nIsSimple(g)\n\nDescription\n-----------\n\nReturns true if the given Geometry has no anomalous geometric points, false if it does, or NULL if given a NULL value.\n\nST_IsSimple() and IsSimple() are synonyms.\n\nExamples\n--------\n\nSET @g = ''Point(1 2)'';\n\nSELECT ST_ISSIMPLE(GEOMFROMTEXT(@g));\n+-------------------------------+\n| ST_ISSIMPLE(GEOMFROMTEXT(@g)) |\n+-------------------------------+\n|                             1 |\n+-------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_issimple', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_issimple');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (735, 34, 'ST\\_NUMGEOMETRIES', 'Syntax\n------\n\nST_NumGeometries(gc)\nNumGeometries(gc)\n\nDescription\n-----------\n\nReturns the number of geometries in the GeometryCollection gc.\n\nST_NumGeometries() and NumGeometries() are synonyms.\n\nExamples\n--------\n\nSET @gc = ''GeometryCollection(Point(1 1),LineString(2 2, 3 3))'';\n\nSELECT NUMGEOMETRIES(GeomFromText(@gc));\n+----------------------------------+\n| NUMGEOMETRIES(GeomFromText(@gc)) |\n+----------------------------------+\n|                                2 |\n+----------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_numgeometries', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_numgeometries');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (736, 34, 'ST\\_RELATE', 'Syntax\n------\n\nST_Relate(g1, g2, i)\n\nDescription\n-----------\n\nReturns true if Geometry g1 is spatially related to Geometryg2 by testing for intersections between the interior, boundary and exterior of the two geometries as specified by the values in intersection matrix pattern i.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_relate', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_relate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (737, 34, 'ST\\_SRID', 'Syntax\n------\n\nST_SRID(g)\nSRID(g)\n\nDescription\n-----------\n\nReturns an integer indicating the Spatial Reference System ID for the geometry value g.\n\nIn MariaDB, the SRID value is just an integer associated with the geometry value. All calculations are done assuming Euclidean (planar) geometry.\n\nST_SRID() and SRID() are synonyms.\n\nExamples\n--------\n\nSELECT SRID(GeomFromText(''LineString(1 1,2 2)'',101));\n+-----------------------------------------------+\n| SRID(GeomFromText(''LineString(1 1,2 2)'',101)) |\n+-----------------------------------------------+\n|                                           101 |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_srid', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-properties/st_srid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (738, 34, 'CONTAINS', 'Syntax\n------\n\nContains(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether a geometry g1 completely contains geometry g2. CONTAINS() is based on the original MySQL implementation and uses object bounding rectangles, while ST_CONTAINS() uses object shapes.\n\nThis tests the opposite relationship to Within().\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/contains', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/contains');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (739, 34, 'CROSSES', 'Syntax\n------\n\nCrosses(g1,g2)\n\nDescription\n-----------\n\nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon or a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise, returns 0.\n\nThe term spatially crosses denotes a spatial relation between two given geometries that has the following properties:\n\n The two geometries intersect.\n Their intersection results in a geometry that has a dimension that is one less than the maximum dimension of the two given geometries.\n* Their intersection is not equal to either of the two given geometries.\n\nCROSSES() is based on the original MySQL implementation, and uses object bounding rectangles, while ST_CROSSES() uses object shapes.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/crosses', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/crosses');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (740, 34, 'DISJOINT', 'Syntax\n------\n\nDisjoint(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 is spatially disjoint from (does not intersect) g2.\n\nDISJOINT() tests the opposite relationship to INTERSECTS().\n\nDISJOINT() is based on the original MySQL implementation and uses object bounding rectangles, while ST_DISJOINT() uses object shapes.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/disjoint', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/disjoint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (741, 34, 'EQUALS', 'Syntax\n------\n\nMBREQUALS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether _g1_ is spatially equal to _g2_.\n\nEQUALS() is based on the original MySQL implementation and uses object bounding rectangles, while ST_EQUALS() uses object shapes.\n\nMBREQUALS is a synonym for Equals.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/equals', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/equals');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (742, 34, 'INTERSECTS', 'Syntax\n------\n\nINTERSECTS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry _g1_ spatially intersects geometry _g2_.\n\nINTERSECTS() is based on the original MySQL implementation and uses object bounding rectangles, while ST_INTERSECTS() uses object shapes.\n\nINTERSECTS() tests the opposite relationship to DISJOINT().\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/intersects', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/intersects');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (743, 34, 'OVERLAPS', 'Syntax\n------\n\nOVERLAPS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 spatially overlaps g2.\\\nThe term spatially overlaps is used if two geometries of equal dimensions intersect and their intersection results in a geometry of the same dimension but not equal to either of the given geometries.\n\nOVERLAPS() is based on the original MySQL implementation and uses object bounding rectangles, while ST_OVERLAPS() uses object shapes.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/overlaps', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/overlaps');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (744, 34, 'ST\\_CONTAINS', 'Syntax\n------\n\nST_CONTAINS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether a geometry g1 completely contains geometry g2.\n\nST_CONTAINS() uses object shapes, while CONTAINS(), based on the original MySQL implementation, uses object bounding rectangles.\n\nST_CONTAINS tests the opposite relationship to ST_WITHIN().\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(''POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))'');\n\nSET @g2 = ST_GEOMFROMTEXT(''POINT(174 149)'');\n\nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n|                    1 |\n+----------------------+\n\nSET @g2 = ST_GEOMFROMTEXT(''POINT(175 151)'');\n\nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n|                    0 |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-contains', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-contains');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (745, 34, 'ST\\_CROSSES', 'Syntax\n------\n\nST_CROSSES(g1,g2)\n\nDescription\n-----------\n\nReturns 1 if geometry _g1_ spatially crosses geometry _g2_. Returns NULL if g1 is a Polygon or a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise, returns 0.\n\nThe term spatially crosses denotes a spatial relation between two given geometries that has the following properties:\n\n The two geometries intersect.\n Their intersection results in a geometry that has a dimension that is one less than the maximum dimension of the two given geometries.\n* Their intersection is not equal to either of the two given geometries.\n\nST_CROSSES() uses object shapes, while CROSSES(), based on the original MySQL implementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(''LINESTRING(174 149, 176 151)'');\n\nSET @g2 = ST_GEOMFROMTEXT(''POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))'');\n\nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n|                   1 |\n+---------------------+\n\nSET @g1 = ST_GEOMFROMTEXT(''LINESTRING(176 149, 176 151)'');\n\nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n|                   0 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-crosses', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-crosses');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (746, 34, 'ST\\_EQUALS', 'Syntax\n------\n\nST_EQUALS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry _g1_ is spatially equal to geometry _g2_.\n\nST_EQUALS() uses object shapes, while EQUALS(), based on the original MySQL implementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(''LINESTRING(174 149, 176 151)'');\n\nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(176 151, 174 149)'');\n\nSELECT ST_EQUALS(@g1,@g2);\n+--------------------+\n| ST_EQUALS(@g1,@g2) |\n+--------------------+\n|                  1 |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-equals', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-equals');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (747, 34, 'ST\\_INTERSECTS', 'Syntax\n------\n\nST_INTERSECTS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry _g1_ spatially intersects geometry _g2_.\n\nST_INTERSECTS() uses object shapes, while INTERSECTS(), based on the original MySQL implementation, uses object bounding rectangles.\n\nST_INTERSECTS() tests the opposite relationship to ST_DISJOINT().\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(0 0)'');\n\nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(0 0, 0 2)'');\n\nSELECT ST_INTERSECTS(@g1,@g2);\n+------------------------+\n| ST_INTERSECTS(@g1,@g2) |\n+------------------------+\n|                      1 |\n+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-intersects', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-intersects');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (748, 34, 'ST\\_OVERLAPS', 'Syntax\n------\n\nST_OVERLAPS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry _g1_ spatially overlaps geometry _g2_.\n\nThe term spatially overlaps is used if two geometries of equal dimensions intersect and their\\\nintersection results in a geometry of the same dimension but not equal to either of the given geometries.\n\nST_OVERLAPS() uses object shapes, while OVERLAPS(), based on the original MySQL implementation, uses object bounding rectangles.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-overlaps', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-overlaps');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (749, 34, 'ST\\_TOUCHES', 'Syntax\n------\n\nST_TOUCHES(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry _g1_ spatially touches geometry _g2_. Two geometries spatially touch if the interiors of the geometries do not intersect, but the boundary of one of the geometries intersects either the boundary or the interior of the other.\n\nST_TOUCHES() uses object shapes, while TOUCHES(), based on the original MySQL implementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(2 0)'');\n\nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(2 0, 0 2)'');\n\nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n|                   1 |\n+---------------------+\n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(2 1)'');\n\nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n|                   0 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-touches', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-touches');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (750, 34, 'ST\\_WITHIN', 'Syntax\n------\n\nST_WITHIN(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry _g1_ is spatially within geometry _g2_.\n\nThis tests the opposite relationship as ST_CONTAINS().\n\nST_WITHIN() uses object shapes, while WITHIN(), based on the original MySQL implementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(174 149)'');\n\nSET @g2 = ST_GEOMFROMTEXT(''POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))'');\n\nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n|                  1 |\n+--------------------+\n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(176 151)'');\n\nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n|                  0 |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-within', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-within');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (751, 34, 'ST\\_DIFFERENCE', 'Syntax\n------\n\nST_DIFFERENCE(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry representing the point set difference of the given geometry values.\n\nExamples\n--------\n\nSET @g1 = POINT(10,10), @g2 = POINT(20,20);\n\nSELECT ST_AsText(ST_Difference(@g1, @g2));\n+------------------------------------+\n| ST_AsText(ST_Difference(@g1, @g2)) |\n+------------------------------------+\n| POINT(10 10)                       |\n+------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_difference', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_difference');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (752, 34, 'ST\\_DISJOINT', 'Syntax\n------\n\nST_DISJOINT(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry _g1_ is spatially disjoint from (does not intersect with) geometry _g2_.\n\nST_DISJOINT() uses object shapes, while DISJOINT(), based on the original MySQL implementation, uses object bounding rectangles.\n\nST_DISJOINT() tests the opposite relationship to ST_INTERSECTS().\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(''POINT(0 0)'');\n\nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(2 0, 0 2)'');\n\nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n|                    1 |\n+----------------------+\n\nSET @g2 = ST_GEOMFROMTEXT(''LINESTRING(0 0, 0 2)'');\n\nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n|                    0 |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_disjoint', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_disjoint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (753, 34, 'ST\\_DISTANCE', 'Syntax\n------\n\nST_DISTANCE(g1,g2)\n\nDescription\n-----------\n\nReturns the distance between two geometries, or null if not given valid inputs.\n\nExamples\n--------\n\nSELECT ST_Distance(POINT(1,2),POINT(2,2));\n+------------------------------------+\n| ST_Distance(POINT(1,2),POINT(2,2)) |\n+------------------------------------+\n|                                  1 |\n+------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_distance', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_distance');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (754, 34, 'ST\\_DISTANCE\\_SPHERE', 'Syntax\n------\n\nST_DISTANCE_SPHERE(g1,g2,[r])\n\nDescription\n-----------\n\nReturns the spherical distance in meters between two geometries (point or multipoint) on a sphere. The optional radius _r_ is in meters, must be positive, and defaults to the Earth''s radius (6370986 meters) if not specified. If either of the two geometries are not valid, NULL is returned.\n\nExamples\n--------\n\nSET @zenica   = ST_GeomFromText(''POINT(17.907743 44.203438)'');\nSET @sarajevo = ST_GeomFromText(''POINT(18.413076 43.856258)'');\nSELECT ST_Distance_Sphere(@zenica, @sarajevo);\n+----------------------------------------+\n| ST_Distance_Sphere(@zenica, @sarajevo) |\n+----------------------------------------+\n|                      55878.59337591705 |\n+----------------------------------------+\n\nSELECT ST_Distance_Sphere(@zenica, @sarajevo, 6370986);\n+-------------------------------------------------+\n| ST_Distance_Sphere(@zenica, @sarajevo, 6370986) |\n+-------------------------------------------------+\n|                               55878.59337591705 |\n+-------------------------------------------------+\n\nSELECT ST_Distance_Sphere(@zenica, @sarajevo, 200);    \n+---------------------------------------------+\n| ST_Distance_Sphere(@zenica, @sarajevo, 200) |\n+---------------------------------------------+\n|                           1.754158410516584 |\n+---------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_distance_sphere', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_distance_sphere');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (755, 34, 'ST\\_LENGTH', 'Syntax\n------\n\nST_LENGTH(ls)\n\nDescription\n-----------\n\nReturns as a double-precision number the length of the LineString value _ls_ in its associated spatial reference.\n\nExamples\n--------\n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n\nSELECT ST_LENGTH(ST_GeomFromText(@ls));\n+---------------------------------+\n| ST_LENGTH(ST_GeomFromText(@ls)) |\n+---------------------------------+\n|                2.82842712474619 |\n+---------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_length', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_length');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (756, 34, 'TOUCHES', 'Syntax\n------\n\nTouches(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 spatially touches g2. Two geometries spatially touch if the interiors of the geometries do not intersect, but the boundary of one of the geometries intersects either the boundary or the interior of the other.\n\nTOUCHES() is based on the original MySQL implementation and uses object bounding rectangles, while ST_TOUCHES() uses object shapes.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/touches', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/touches');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (757, 34, 'WITHIN', 'Syntax\n------\n\nWithin(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 is spatially within g2. This tests the opposite relationship as Contains().\n\nWITHIN() is based on the original MySQL implementation, and uses object bounding rectangles, while ST_WITHIN() uses object shapes.\n\nExamples\n--------\n\nSET @g1 = GEOMFROMTEXT(''POINT(174 149)'');\nSET @g2 = GEOMFROMTEXT(''POINT(176 151)'');\nSET @g3 = GEOMFROMTEXT(''POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))'');\n\nSELECT within(@g1,@g3);\n+-----------------+\n| within(@g1,@g3) |\n+-----------------+\n|               1 |\n+-----------------+\n\nSELECT within(@g2,@g3);\n+-----------------+\n| within(@g2,@g3) |\n+-----------------+\n|               0 |\n+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/within', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/within');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (758, 34, 'GLENGTH', 'Syntax\n------\n\nGLength(ls)\n\nDescription\n-----------\n\nReturns as a double-precision number the length of the LineString value _ls_ in its associated spatial reference.\n\nExamples\n--------\n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n\nSELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n|           2.82842712474619 |\n+----------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/glength', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/glength');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (759, 34, 'ENDPOINT', 'Description\n-----------\n\nA synonym for ST_ENDPOINT.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/linestring-properties-endpoint', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/linestring-properties-endpoint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (760, 34, 'NumPoints', 'Description\n-----------\n\nA synonym for ST_NumPoints.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/linestring-properties-numpoints', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/linestring-properties-numpoints');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (761, 34, 'PointN', 'Description\n-----------\n\nA synonym for ST_PointN.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/linestring-properties-pointn', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/linestring-properties-pointn');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (762, 34, 'STARTPOINT', 'Description\n-----------\n\nA synonym for ST_STARTPOINT.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/linestring-properties-startpoint', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/linestring-properties-startpoint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (763, 34, 'ST\\_ENDPOINT', 'Syntax\n------\n\nST_EndPoint(ls)\nEndPoint(ls)\n\nDescription\n-----------\n\nReturns the Point that is the endpoint of the LineString value ls.\n\nST_EndPoint() and EndPoint() are synonyms.\n\nExamples\n--------\n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n\nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3)                          |\n+-------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/st_endpoint', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/st_endpoint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (764, 34, 'ST\\_NUMPOINTS', 'Syntax\n------\n\nST_NumPoints(ls)\nNumPoints(ls)\n\nDescription\n-----------\n\nReturns the number of Point objects in the LineString value ls.\n\nST_NumPoints() and NumPoints() are synonyms.\n\nExamples\n--------\n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n\nSELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n|                            3 |\n+------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/st_numpoints', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/st_numpoints');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (765, 34, 'ST\\_POINTN', 'Syntax\n------\n\nST_PointN(ls,N)\nPointN(ls,N)\n\nDescription\n-----------\n\nReturns the N-th Point in the LineString value ls. Points are numbered beginning with 1.\n\nST_PointN() and PointN() are synonyms.\n\nExamples\n--------\n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n\nSELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2)                          |\n+-------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/st_pointn', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/st_pointn');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (766, 34, 'ST\\_STARTPOINT', 'Syntax\n------\n\nST_StartPoint(ls)\nStartPoint(ls)\n\nDescription\n-----------\n\nReturns the Point that is the start point of the LineString value ls.\n\nST_StartPoint() and StartPoint() are synonyms.\n\nExamples\n--------\n\nSET @ls = ''LineString(1 1,2 2,3 3)'';\n\nSELECT AsText(StartPoint(GeomFromText(@ls)));\n+---------------------------------------+\n| AsText(StartPoint(GeomFromText(@ls))) |\n+---------------------------------------+\n| POINT(1 1)                            |\n+---------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/st_startpoint', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/linestring-properties/st_startpoint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (767, 34, 'MBR Definition', 'Description\n-----------\n\nThe MBR (Minimum Bounding Rectangle), or Envelope is the bounding geometry, formed by the minimum and maximum (X,Y) coordinates:\n\nExamples\n--------\n\n((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbr-definition', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbr-definition');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (768, 34, 'MBRContains', 'Syntax\n------\n\nMBRContains(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1 contains the Minimum Bounding Rectangle of g2. This tests the opposite relationship as MBRWithin().\n\nExamples\n--------\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\n\nSET @g2 = GeomFromText(''Point(1 1)'');\n\nSELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n+----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n|                    1 |                    0 |\n+----------------------+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrcontains', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrcontains');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (769, 34, 'MBRCoveredBy', 'Syntax\n------\n\nMBRCoveredBy(g1, g2)\n\nDescription\n-----------\n\nReturns 1 if the minimum bounding rectangle of g1 is covered by the minimum bounding rectangle of g2, otherwise 0.\n\nReturns NULL If any argument is NULL, or an argument is an empty geometry.\n\nExamples\n--------\n\nSET @g1a = ST_GeomFromText(''Point(5 6)'');\nSET @g1b = ST_GeomFromText(''Point(5 11)'');\nSET @g2 = ST_GeomFromText(''Polygon((0 0,0 10,10 10,10 0,0 0))'');\n\nSELECT MBRCoveredby(@g1a,@g2), MBRCoveredby(@g1b,@g2);\n+------------------------+------------------------+\n| MBRCoveredby(@g1a,@g2) | MBRCoveredby(@g1b,@g2) |\n+------------------------+------------------------+\n|                      1 |                      0 |\n+------------------------+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrcoveredby', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrcoveredby');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (770, 34, 'MBRDisjoint', 'Syntax\n------\n\nMBRDisjoint(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two geometries g1 and g2 are disjoint. Two geometries are disjoint if they do not intersect, that is touch or overlap.\n\nExamples\n--------\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((4 4,4 7,7 7,7 4,4 4))'');\nSELECTmbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n|                    1 |\n+----------------------+\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n|                    0 |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrdisjoint', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrdisjoint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (771, 34, 'MBREqual', 'Syntax\n------\n\nMBREqual(g1,g2)\nMBREquals(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two geometries g1 and g2 are the same.\n\nMBREquals is a synonym.\n\nExamples\n--------\n\nSET @g1=GEOMFROMTEXT(''LINESTRING(0 0, 1 2)'');\nSET @g2=GEOMFROMTEXT(''POLYGON((0 0, 0 2, 1 2, 1 0, 0 0))'');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n|                 1 |\n+-------------------+\n\nSET @g1=GEOMFROMTEXT(''LINESTRING(0 0, 1 3)'');\nSET @g2=GEOMFROMTEXT(''POLYGON((0 0, 0 2, 1 4, 1 0, 0 0))'');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n|                 0 |\n+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrequal', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrequal');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (772, 34, 'MBRIntersects', 'Syntax\n------\n\nMBRIntersects(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two geometries g1 and g2 intersect.\n\nExamples\n--------\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n|                      1 |\n+------------------------+\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((4 4,4 7,7 7,7 4,4 4))'');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n|                      0 |\n+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrintersects', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrintersects');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (773, 34, 'MBROverlaps', 'Syntax\n------\n\nMBROverlaps(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two geometries g1 and g2 overlap. The term spatially overlaps is used if two geometries intersect and their intersection results in a geometry of the same dimension but not equal to either of the given geometries.\n\nExamples\n--------\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((4 4,4 7,7 7,7 4,4 4))'');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n|                    0 |\n+----------------------+\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n|                    0 |\n+----------------------+\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 4,4 4,4 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n|                    1 |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbroverlaps', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbroverlaps');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (774, 34, 'MBRTouches', 'Syntax\n------\n\nMBRTouches(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two geometries g1 and g2 touch. Two geometries spatially touch if the interiors of the geometries do not intersect, but the boundary of one of the geometries intersects either the boundary or the interior of the other.\n\nExamples\n--------\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((4 4,4 7,7 7,7 4,4 4))'');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n|                   0 |\n+---------------------+\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n|                   1 |\n+---------------------+\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 4,4 4,4 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((3 3,3 6,6 6,6 3,3 3))'');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n|                   0 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrtouches', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrtouches');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (775, 34, 'MBRWithin', 'Syntax\n------\n\nMBRWithin(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1 is within the Minimum Bounding Rectangle of g2. This tests the opposite relationship as MBRContains().\n\nExamples\n--------\n\nSET @g1 = GeomFromText(''Polygon((0 0,0 3,3 3,3 0,0 0))'');\nSET @g2 = GeomFromText(''Polygon((0 0,0 5,5 5,5 0,0 0))'');\nSELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n|                  1 |                  0 |\n+--------------------+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrwithin', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/mbr-minimum-bounding-rectangle/mbrwithin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (776, 34, 'ST\\_Collect', 'Syntax\n------\n\nST_Collect(g)\n\nDescription\n-----------\n\nST_Collect is an aggregate function that can also be used as a window function.\n\nGiven multiple geometries, returns the aggregation of the distinct geometry arguments. This function also supports the DISTINCT option. If DISTINCT is used, it returns the aggregation of the distinct geometry arguments.\n\nThe resulting value type is chosen using the following policy:\n\n If all arguments are Point values, the result is a MultiPoint value.\n If all arguments are LineString values, the result is a MultiLineString value.\n If all arguments are Polygon values, the result is a MultiPolygon value.\n Otherwise, the result is a GeometryCollection value.\n\nIf there are multiple geometry arguments and those arguments are in the same spatial reference system (SRS), the return value is in that SRS. If those arguments are not in the same SRS, an ER_GIS_DIFFERENT_SRIDS_AGGREGATION error occurs.\n\nExamples\n--------\n\nCREATE OR REPLACE TABLE t1 ( running_number INTEGER NOT NULL\n  AUTO_INCREMENT, grouping_condition INTEGER, location GEOMETRY , PRIMARY KEY (\n  running_number));\n\nINSERT INTO t1 ( grouping_condition, location ) VALUES\n  ( 0,ST_GEOMFROMTEXT(''POINT(0 0)'',4326)),\n  ( 1,ST_GEOMFROMTEXT(''POINT(0 0)'',4326)),\n  ( 0,ST_GEOMFROMTEXT(''POINT(1 0)'',4326)),\n  ( 1,ST_GEOMFROMTEXT(''POINT(2 0)'',4326)),\n  ( 0,ST_GEOMFROMTEXT(''POINT(3 0)'',4326));\n\nSELECT ST_EQUALS( (SELECT ST_COLLECT( location ) AS t FROM t1), \n  ST_GEOMFROMTEXT(''MULTIPOINT(0 0,0 0,1 0,2 0,3 0) '',4326)) AS equals;\n+--------+\n| equals |\n+--------+\n|      1 |\n+--------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_collect', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_collect');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (777, 34, 'ST\\_GeoHash', 'Syntax\n------\n\nST_GeoHash(longitude, latitude, max_length)\nST_GeoHash(point, max_length)\n\nDescription\n-----------\n\nReturns the geohash corresponding to the input values, or NULL if any argument is NULL. Geohashes encode latitude and longitude coordinates into a text string made up only of numeric and lowercase latin letter characters.\n\nThe longitude parameter is a numeric value in the interval \\[180, -180]. latitude is a numeric value in the interval \\[90, -90].\n\nIn the case of point, the x coordinate is treated as the longitude and the y coordinate is treated as the latitude. The same constraints apply.\n\nThe max_length parameter is the upper limit on the resulting string size and cannot exceed 100.\n\nThe ST_LatFromGeoHash function decodes a given geohash and returns the latitude.\n\nExamples\n--------\n\nSELECT ST_GeoHash(ST_GeomFromText(''POINT(1 1)''),15), ST_GeoHash(0,30,15);\n+----------------------------------------------+---------------------+\n| ST_GeoHash(ST_GeomFromText(''POINT(1 1)''),15) | ST_GeoHash(0,30,15) |\n+----------------------------------------------+---------------------+\n| s00twy01mtw037m                              | sj248j248j248j2     |\n+----------------------------------------------+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_geohash', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_geohash');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (778, 34, 'ST\\_IsValid', 'Syntax\n------\n\nST_IsValid(g)\n\nDescription\n-----------\n\nGiven a geometry input, returns 1 if the argument is geometrically valid according to the OGC specifications, 0 if the argument is not geometrically valid.\n\nUnlike ST_Validate, requires valid GIS data, or ERROR 3037 (22023): Invalid GIS data provided to function st_isvalid is returned.\n\nExamples\n--------\n\nSELECT ST_IsValid(ST_GeomFromText(''LINESTRING (0 0, 1 1)''));\n+------------------------------------------------------+\n| ST_IsValid(ST_GeomFromText(''LINESTRING (0 0, 1 1)'')) |\n+------------------------------------------------------+\n|                                                    1 |\n+------------------------------------------------------+\n\nSELECT ST_IsValid(ST_GeomFromText(''LINESTRING (0 0, 0 0)''));\n+------------------------------------------------------+\n| ST_IsValid(ST_GeomFromText(''LINESTRING (0 0, 0 0)'')) |\n+------------------------------------------------------+\n|                                                    0 |\n+------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_isvalid', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_isvalid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (779, 34, 'ST\\_LatFromGeoHash', 'Syntax\n------\n\nST_LatFromGeoHash(geohash)\n\nDescription\n-----------\n\nDecodes a given geohash string and returns the latitude in the interval \\[90, -90].\n\nIf the argument is NULL, the return value is NULL. If the argument is invalid, an ER_INCORRECT_TYPE error is thrown.\n\nThe ST_GeoHash function can be used to generate geohashes.\n\nExamples\n--------\n\nSELECT ST_LatFromGeoHash(''zzzzzzzzz''), ST_LatFromGeoHash(''xvrfxvrfxvrfxvr'');\n+--------------------------------+--------------------------------------+\n| ST_LatFromGeoHash(''zzzzzzzzz'') | ST_LatFromGeoHash(''xvrfxvrfxvrfxvr'') |\n+--------------------------------+--------------------------------------+\n|                             90 |                                   30 |\n+--------------------------------+--------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_latfromgeohash', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_latfromgeohash');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (780, 34, 'ST\\_LongFromGeoHash', 'Syntax\n------\n\nST_LongFromGeoHash(geohash)\n\nDescription\n-----------\n\nDecodes a given geohash string and returns the longitude in the interval \\[180, -180].\n\nIf the argument is NULL, the return value is NULL. If the argument is invalid, an ER_INCORRECT_TYPE error is thrown.\n\nThe ST_GeoHash function can be used to generate geohashes.\n\nExamples\n--------\n\nSELECT ST_LongFromGeoHash(''zzzzzzzzz''), ST_LongFromGeoHash(''sj248j248j248j2'');           \n+---------------------------------+---------------------------------------+\n| ST_LongFromGeoHash(''zzzzzzzzz'') | ST_LongFromGeoHash(''sj248j248j248j2'') |\n+---------------------------------+---------------------------------------+\n|                             180 |                                     0 |\n+---------------------------------+---------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_longfromgeohash', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_longfromgeohash');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (781, 34, 'ST\\_PointFromGeoHash', 'Syntax\n------\n\nST_PointFromGeoHash(geohash, srid)\n\nDescription\n-----------\n\nTakes a given geohash string and returns a point where the x is the longitude and the y is the latitude.\n\nThe latitude is returned as a numeric value in the interval \\[180, -180]. The longitude is returned as a numeric value in the interval \\[90, -90]. If the argument is NULL, the return value is NULL. If the argument is invalid, an ER_GIS_INVALID_DATA is thrown.\n\nExamples\n--------\n\nSELECT ST_ASTEXT(ST_POINTFROMGEOHASH("s00twy01mtw037m",0));\n+-----------------------------------------------------+\n| ST_ASTEXT(ST_POINTFROMGEOHASH("s00twy01mtw037m",0)) |\n+-----------------------------------------------------+\n| POINT(1 1)                                          |\n+-----------------------------------------------------+\n\nSELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(180,90,20),0));\n+---------------------------------------------------------+\n| ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(180,90,20),0)) |\n+---------------------------------------------------------+\n| POINT(180 90)                                           |\n+---------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_pointfromgeohash', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_pointfromgeohash');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (782, 34, 'ST\\_Simplify', 'Syntax\n------\n\nST_Simplify(g, max_distance)\n\nDescription\n-----------\n\nTakes as input a geometry (g) and a double (max_distance). It applies the Ramer–Douglas–Peucker algorithm on g and returns the resulting geometry.\n\nThe goal of the Douglas-Peucker algorithm is to provide generalized simplifications by returning a geometry that is similar to g but uses only a subset of points. To perform the simplification, all the vertices that are shorter than max_distance are removed.\n\nThe algorithm may produce self-intersections and therefore result in invalid geometries. ST_IsValid can be used to test validity of the result.\n\nIf the max_distance is not positive or is NULL, an ER_WRONG_ARGUMENT will occur.\n\nExamples\n--------\n\nSELECT ST_AsText(ST_Simplify(ST_GeomFromText(''LINESTRING(0 0,0 2,2 2,2 4,4 4,4 6,6 6)''), 0.5));\n+-----------------------------------------------------------------------------------------+\n| ST_AsText(ST_Simplify(ST_GeomFromText(''LINESTRING(0 0,0 2,2 2,2 4,4 4,4 6,6 6)''), 0.5)) |\n+-----------------------------------------------------------------------------------------+\n| LINESTRING(0 0,0 2,2 2,2 4,4 4,4 6,6 6)                                                 |\n+-----------------------------------------------------------------------------------------+\n\nSELECT ST_AsText(ST_Simplify(ST_GeomFromText(''LINESTRING(0 0,0 2,2 2,2 4,4 4,4 6,6 6)''), 1));  \n+---------------------------------------------------------------------------------------+\n| ST_AsText(ST_Simplify(ST_GeomFromText(''LINESTRING(0 0,0 2,2 2,2 4,4 4,4 6,6 6)''), 1)) |\n+---------------------------------------------------------------------------------------+\n| LINESTRING(0 0,0 2,2 2,2 4,6 6)                                                       |\n+---------------------------------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_simplify', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_simplify');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (783, 34, 'ST\\_Validate', 'Syntax\n------\n\nST_Validate(g)\n\nDescription\n-----------\n\nThe function checks that a given geometry is compliant with the Well-Known Binary (WKB) format and Spatial Reference System Identifier (SRID) syntax, and is geometrically valid.\n\nIt returns the geometry if it''s valid, or NULL if not.\n\nThe function is useful to filter out invalid geometry data.\n\nExamples\n--------\n\nSELECT ST_ASTEXT(ST_VALIDATE(ST_GeomFromText(''POINT(1 0)'')));          \n+-------------------------------------------------------+\n| ST_ASTEXT(ST_VALIDATE(ST_GeomFromText(''POINT(1 0)''))) |\n+-------------------------------------------------------+\n| POINT(1 0)                                            |\n+-------------------------------------------------------+\n\nSELECT ST_ASTEXT(ST_VALIDATE(ST_GeomFromText(''POINT(1)'')));  \n+-----------------------------------------------------+\n| ST_ASTEXT(ST_VALIDATE(ST_GeomFromText(''POINT(1)''))) |\n+-----------------------------------------------------+\n| NULL                                                |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_validate', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_validate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (784, 34, 'X', 'Description\n-----------\n\nA synonym for ST_X.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/point-properties/point-properties-x', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/point-properties/point-properties-x');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (785, 34, 'Y', 'Description\n-----------\n\nA synonym for ST_Y.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/point-properties/point-properties-y', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/point-properties/point-properties-y');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (786, 34, 'ST\\_X', 'Syntax\n------\n\nST_X(p)\nX(p)\n\nDescription\n-----------\n\nReturns the X-coordinate value for the point p as a double-precision number.\n\nST_X() and X() are synonyms.\n\nExamples\n--------\n\nSET @pt = ''Point(56.7 53.34)'';\n\nSELECT X(GeomFromText(@pt));\n+----------------------+\n| X(GeomFromText(@pt)) |\n+----------------------+\n|                 56.7 |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/point-properties/st_x', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/point-properties/st_x');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (787, 34, 'ST\\_Y', 'Syntax\n------\n\nST_Y(p)\nY(p)\n\nDescription\n-----------\n\nReturns the Y-coordinate value for the point p as a double-precision number.\n\nST_Y() and Y() are synonyms.\n\nExamples\n--------\n\nSET @pt = ''Point(56.7 53.34)'';\n\nSELECT Y(GeomFromText(@pt));\n+----------------------+\n| Y(GeomFromText(@pt)) |\n+----------------------+\n|                53.34 |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/point-properties/st_y', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/point-properties/st_y');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (788, 34, 'CENTROID', 'Description\n-----------\n\nA synonym for ST_CENTROID.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/centroid', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/centroid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (789, 34, 'AREA', 'Description\n-----------\n\nA synonym for ST_AREA.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/polygon-properties-area', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/polygon-properties-area');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (790, 34, 'ExteriorRing', 'Description\n-----------\n\nA synonym for ST_ExteriorRing.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/polygon-properties-exteriorring', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/polygon-properties-exteriorring');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (791, 34, 'InteriorRingN', 'Description\n-----------\n\nA synonym for ST_InteriorRingN.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/polygon-properties-interiorringn', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/polygon-properties-interiorringn');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (792, 34, 'NumInteriorRings', 'Description\n-----------\n\nA synonym for ST_NumInteriorRings.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/polygon-properties-numinteriorrings', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/polygon-properties-numinteriorrings');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (793, 34, 'ST\\_AREA', 'Syntax\n------\n\nST_Area(poly)\nArea(poly)\n\nDescription\n-----------\n\nReturns as a double-precision number the area of the Polygon value poly, as measured in its spatial reference system.\n\nST_Area() and Area() are synonyms.\n\nExamples\n--------\n\nSET @poly = ''Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))'';\n\nSELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n|                         4 |\n+---------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/st_area', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/st_area');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (794, 34, 'ST\\_CENTROID', 'Syntax\n------\n\nST_Centroid(mpoly)\nCentroid(mpoly)\n\nDescription\n-----------\n\nReturns a point reflecting the mathematical centroid (geometric center) for the MultiPolygon _mpoly_. The resulting point will not necessarily be on the MultiPolygon.\n\nST_Centroid() and Centroid() are synonyms.\n\nExamples\n--------\n\nSET @poly = ST_GeomFromText(''POLYGON((0 0,20 0,20 20,0 20,0 0))'');\nSELECT ST_AsText(ST_Centroid(@poly)) AS center;\n+--------------+\n| center       |\n+--------------+\n| POINT(10 10) |\n+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/st_centroid', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/st_centroid');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (795, 34, 'ST\\_ExteriorRing', 'Syntax\n------\n\nST_ExteriorRing(poly)\nExteriorRing(poly)\n\nDescription\n-----------\n\nReturns the exterior ring of the Polygon value poly as a LineString.\n\nST_ExteriorRing() and ExteriorRing() are synonyms.\n\nExamples\n--------\n\nSET @poly = ''Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))'';\n\nSELECT AsText(ExteriorRing(GeomFromText(@poly)));\n+-------------------------------------------+\n| AsText(ExteriorRing(GeomFromText(@poly))) |\n+-------------------------------------------+\n| LINESTRING(0 0,0 3,3 3,3 0,0 0)           |\n+-------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/st_exteriorring', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/st_exteriorring');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (796, 34, 'ST\\_InteriorRingN', 'Syntax\n------\n\nST_InteriorRingN(poly,N)\nInteriorRingN(poly,N)\n\nDescription\n-----------\n\nReturns the N-th interior ring for the Polygon value poly as a LineString. Rings are numbered beginning with 1.\n\nST_InteriorRingN() and InteriorRingN() are synonyms.\n\nExamples\n--------\n\nSET @poly = ''Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))'';\n\nSELECT AsText(InteriorRingN(GeomFromText(@poly),1));\n+----------------------------------------------+\n| AsText(InteriorRingN(GeomFromText(@poly),1)) |\n+----------------------------------------------+\n| LINESTRING(1 1,1 2,2 2,2 1,1 1)              |\n+----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/st_interiorringn', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/st_interiorringn');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (797, 34, 'ST\\_NumInteriorRings', 'Syntax\n------\n\nST_NumInteriorRings(poly)\nNumInteriorRings(poly)\n\nDescription\n-----------\n\nReturns an integer containing the number of interior rings in the Polygon value poly.\n\nNote that according the OpenGIS standard, a POLYGON should have exactly one ExteriorRing and all other rings should lie within that ExteriorRing and thus be the InteriorRings. Practically, however, some systems, including MariaDB''s, permit polygons to have several ''ExteriorRings''. In the case of there being multiple, non-overlapping exterior rings ST_NumInteriorRings() will return 1.\n\nST_NumInteriorRings() and NumInteriorRings() are synonyms.\n\nExamples\n--------\n\nSET @poly = ''Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))'';\n\nSELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n|                                     1 |\n+---------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/st_numinteriorrings', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/polygon-properties/st_numinteriorrings');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (798, 34, 'AsWKB', 'Description\n-----------\n\nA synonym for ST_AsBinary().\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/aswkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/aswkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (799, 34, 'GeometryCollectionFromWKB', 'Description\n-----------\n\nA synonym for ST_GeomCollFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/geometrycollectionfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/geometrycollectionfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (800, 34, 'GeometryFromWKB', 'Description\n-----------\n\nA synonym for ST_GeomFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/geometryfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/geometryfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (801, 34, 'LineStringFromWKB', 'Description\n-----------\n\nA synonym for ST_LineFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/linestringfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/linestringfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (802, 34, 'MLineFromWKB', 'Syntax\n------\n\nMLineFromWKB(wkb[,srid])\nMultiLineStringFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a MULTILINESTRING value using its WKB representation and SRID.\n\nMLineFromWKB() and MultiLineStringFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MLineFromText(''MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))''));\n\nSELECT ST_AsText(MLineFromWKB(@g));\n+--------------------------------------------------------+\n| ST_AsText(MLineFromWKB(@g))                            |\n+--------------------------------------------------------+\n| MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) |\n+--------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/mlinefromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/mlinefromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (803, 34, 'MPointFromWKB', 'Syntax\n------\n\nMPointFromWKB(wkb[,srid])\nMultiPointFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a MULTIPOINT value using its WKB representation and SRID.\n\nMPointFromWKB() and MultiPointFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MPointFromText(''MultiPoint( 1 1, 2 2, 5 3, 7 2, 9 3, 8 4, 6 6, 6 9, 4 9, 1 5 )''));\n\nSELECT ST_AsText(MPointFromWKB(@g));\n+-----------------------------------------------------+\n| ST_AsText(MPointFromWKB(@g))                        |\n+-----------------------------------------------------+\n| MULTIPOINT(1 1,2 2,5 3,7 2,9 3,8 4,6 6,6 9,4 9,1 5) |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/mpointfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/mpointfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (804, 34, 'MPolyFromWKB', 'Syntax\n------\n\nMPolyFromWKB(wkb[,srid])\nMultiPolygonFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a MULTIPOLYGON value using its WKB representation and SRID.\n\nMPolyFromWKB() and MultiPolygonFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MPointFromText(''MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))''));\n\nSELECT ST_AsText(MPolyFromWKB(@g))\\G\n************************ 1. row ************************\nST_AsText(MPolyFromWKB(@g)): MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/mpolyfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/mpolyfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (805, 34, 'MultiLineStringFromWKB', 'Description\n-----------\n\nA synonym for MLineFromWKB().\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/multilinestringfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/multilinestringfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (806, 34, 'MultiPointFromWKB', 'Description\n-----------\n\nA synonym for MPointFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/multipointfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/multipointfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (807, 34, 'MultiPolygonFromWKB', 'Description\n-----------\n\nSynonym for MPolyFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/multipolygonfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/multipolygonfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (808, 34, 'PolygonFromWKB', 'Description\n-----------\n\nA synonym for ST_PolyFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/polygonfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/polygonfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (809, 34, 'ST\\_AsBinary', 'Syntax\n------\n\nST_AsBinary(g)\nAsBinary(g)\nST_AsWKB(g)\nAsWKB(g)\n\nDescription\n-----------\n\nConverts a value in internal geometry format to its WKB representation and returns the binary result.\n\nST_AsBinary(), AsBinary(), ST_AsWKB() and AsWKB() are synonyms,\n\nExamples\n--------\n\nSET @poly = ST_GeomFromText(''POLYGON((0 0,0 1,1 1,1 0,0 0))'');\nSELECT ST_AsBinary(@poly);\n\nSELECT ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly)));\n+--------------------------------------------+\n| ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly))) |\n+--------------------------------------------+\n| POLYGON((0 0,0 1,1 1,1 0,0 0))             |\n+--------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_asbinary', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_asbinary');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (810, 34, 'ST\\_AsWKB', 'Description\n-----------\n\nA synonym for ST_AsBinary().\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_aswkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_aswkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (811, 34, 'ST\\_GeomCollFromWKB', 'Syntax\n------\n\nST_GeomCollFromWKB(wkb[,srid])\nST_GeometryCollectionFromWKB(wkb[,srid])\nGeomCollFromWKB(wkb[,srid])\nGeometryCollectionFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a GEOMETRYCOLLECTION value using its WKB representation and SRID.\n\nST_GeomCollFromWKB(), ST_GeometryCollectionFromWKB(), GeomCollFromWKB() and GeometryCollectionFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_GeomFromText(''GEOMETRYCOLLECTION(\n   POLYGON((5 5,10 5,10 10,5 5)),POINT(10 10))''));\n\nSELECT ST_AsText(ST_GeomCollFromWKB(@g));\n+----------------------------------------------------------------+\n| ST_AsText(ST_GeomCollFromWKB(@g))                              |\n+----------------------------------------------------------------+\n| GEOMETRYCOLLECTION(POLYGON((5 5,10 5,10 10,5 5)),POINT(10 10)) |\n+----------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_geomcollfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_geomcollfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (812, 34, 'ST\\_GeometryCollectionFromWKB', 'Description\n-----------\n\nA synonym for ST_GeomCollFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_geometrycollectionfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_geometrycollectionfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (813, 34, 'ST\\_GeometryFromWKB', 'Description\n-----------\n\nA synonym for ST_GeomFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_geometryfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_geometryfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (814, 34, 'ST\\_GeomFromWKB', 'Syntax\n------\n\nST_GeomFromWKB(wkb[,srid])\nST_GeometryFromWKB(wkb[,srid])\nGeomFromWKB(wkb[,srid])\nGeometryFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a geometry value of any type using its WKB representation and SRID.\n\nST_GeomFromWKB(), ST_GeometryFromWKB(), GeomFromWKB() and GeometryFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_LineFromText(''LINESTRING(0 4, 4 6)''));\n\nSELECT ST_AsText(ST_GeomFromWKB(@g));\n+-------------------------------+\n| ST_AsText(ST_GeomFromWKB(@g)) |\n+-------------------------------+\n| LINESTRING(0 4,4 6)           |\n+-------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_geomfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_geomfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (815, 34, 'ST\\_LineFromWKB', 'Syntax\n------\n\nST_LineFromWKB(wkb[,srid])\nLineFromWKB(wkb[,srid])\nST_LineStringFromWKB(wkb[,srid])\nLineStringFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a LINESTRING value using its WKB representation and SRID.\n\nST_LineFromWKB(), LineFromWKB(), ST_LineStringFromWKB(), and LineStringFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_LineFromText(''LineString(0 4,4 6)''));\n\nSELECT ST_AsText(ST_LineFromWKB(@g)) AS l;\n+---------------------+\n| l                   |\n+---------------------+\n| LINESTRING(0 4,4 6) |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_linefromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_linefromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (816, 34, 'ST\\_LineStringFromWKB', 'Description\n-----------\n\nA synonym for ST_LineFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_linestringfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_linestringfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (817, 34, 'ST\\_MPointFromWKB', 'Description\n-----------\n\nA synonym for ST_GeomFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_mpointfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_mpointfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (818, 34, 'ST\\_MPolyFromWKB', 'Description\n-----------\n\nA synonym for ST_GeomFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_mpolyfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_mpolyfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (819, 34, 'ST\\_MultiPointFromWKB', 'Description\n-----------\n\nA synonym for ST_GeomFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_multipointfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_multipointfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (820, 34, 'ST\\_MultiPolygonFromWKB', 'Description\n-----------\n\nA synonym for ST_GeomFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_multipolygonfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_multipolygonfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (821, 34, 'ST\\_PointFromWKB', 'Syntax\n------\n\nST_PointFromWKB(wkb[,srid])\nPointFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a POINT value using its WKB representation and SRID.\n\nST_PointFromWKB() and PointFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_PointFromText(''POINT(0 4)''));\n\nSELECT ST_AsText(ST_PointFromWKB(@g)) AS p;\n+------------+\n| p          |\n+------------+\n| POINT(0 4) |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_pointfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_pointfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (822, 34, 'ST\\_PolyFromWKB', 'Syntax\n------\n\nST_PolyFromWKB(wkb[,srid])\nST_PolygonFromWKB(wkb[,srid])\nPolyFromWKB(wkb[,srid])\nPolygonFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a POLYGON value using its WKB representation and SRID.\n\nST_PolyFromWKB(), ST_PolygonFromWKB(), PolyFromWKB() and PolygonFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_PolyFromText(''POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1))''));\n\nSELECT ST_AsText(ST_PolyFromWKB(@g)) AS p;\n+----------------------------------------+\n| p                                      |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\n+----------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_polyfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_polyfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (823, 34, 'ST\\_PolygonFromWKB', 'Description\n-----------\n\nA synonym for ST_PolyFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_polygonfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/st_polygonfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (824, 34, 'Well-Known Binary (WKB) Format', 'Description\n-----------\n\nWKB stands for Well-Known Binary, a format for representing geographical and geometrical data.\n\nWKB uses 1-byte unsigned integers, 4-byte unsigned integers, and 8-byte double-precision numbers.\n\n The first byte indicates the byte order. 00 for big endian, or 01 for little endian.\n The next 4 bytes indicate the geometry type. Values from 1 to 7 indicate whether the type is Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, or GeometryCollection respectively.\n The 8-byte floats represent the co-ordinates.\n\nTake the following example, a sequence of 21 bytes each represented by two hex digits:\n\n``\n000000000140000000000000004010000000000000\n``\n\n It''s big endian\n   000000000140000000000000004010000000000000\n It''s a POINT\n   000000000140000000000000004010000000000000\n The X co-ordinate is 2.0\n   000000000140000000000000004010000000000000\n The Y-co-ordinate is 4.0\n  * 000000000140000000000000004010000000000000\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/well-known-binary-wkb-format', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/well-known-binary-wkb-format');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (825, 34, 'AsBinary', 'Description\n-----------\n\nA synonym for ST_AsBinary().\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-asbinary', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-asbinary');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (826, 34, 'GeomCollFromWKB', 'Description\n-----------\n\nA synonym for ST_GeomCollFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-geomcollfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-geomcollfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (827, 34, 'GeomFromWKB', 'Description\n-----------\n\nA synonym for ST_GeomFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-geomfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-geomfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (828, 34, 'LineFromWKB', 'Description\n-----------\n\nA synonym for ST_LineFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-linefromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-linefromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (829, 34, 'PointFromWKB', 'Description\n-----------\n\nA synonym for ST_PointFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-pointfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-pointfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (830, 34, 'PolyFromWKB', 'Description\n-----------\n\nA synonym for ST_PolyFromWKB.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-polyfromwkb', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkb/wkb-polyfromwkb');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (831, 34, 'GeometryCollectionFromText', 'Description\n-----------\n\nA synonym for ST_GeomCollFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/geometrycollectionfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/geometrycollectionfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (832, 34, 'GeometryFromText', 'Description\n-----------\n\nA synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/geometryfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/geometryfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (833, 34, 'LineStringFromText', 'Description\n-----------\n\nA synonym for ST_LineFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/linestringfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/linestringfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (834, 34, 'MLineFromText', 'Syntax\n------\n\nMLineFromText(wkt[,srid])\nMultiLineStringFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a MULTILINESTRING value using its WKT representation and SRID.\n\nMLineFromText() and MultiLineStringFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\nINSERT INTO gis_multi_line VALUES\n    (MultiLineStringFromText(''MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'')),\n    (MLineFromText(''MULTILINESTRING((10 48,10 21,10 0))'')),\n    (MLineFromWKB(AsWKB(MultiLineString(\n      LineString(Point(1, 2), Point(3, 5)), \n      LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/mlinefromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/mlinefromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (835, 34, 'MPointFromText', 'Syntax\n------\n\nMPointFromText(wkt[,srid])\nMultiPointFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a MULTIPOINT value using its WKT representation and SRID.\n\nMPointFromText() and MultiPointFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\nINSERT INTO gis_multi_point VALUES\n    (MultiPointFromText(''MULTIPOINT(0 0,10 10,10 20,20 20)'')),\n    (MPointFromText(''MULTIPOINT(1 1,11 11,11 21,21 21)'')),\n    (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/mpointfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/mpointfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (836, 34, 'MPolyFromText', 'Syntax\n------\n\nMPolyFromText(wkt[,srid])\nMultiPolygonFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a MULTIPOLYGON value using its WKT representation and SRID.\n\nMPolyFromText() and MultiPolygonFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_multi_polygon  (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\nINSERT INTO gis_multi_polygon VALUES\n    (MultiPolygonFromText(''MULTIPOLYGON(\n       ((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),\n       ((59 18,67 18,67 13,59 13,59 18)))'')),\n    (MPolyFromText(''MULTIPOLYGON(\n       ((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),\n       ((59 18,67 18,67 13,59 13,59 18)))'')),\n    (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(\n       LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/mpolyfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/mpolyfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (837, 34, 'MultiLineStringFromText', 'Description\n-----------\n\nA synonym for MLineFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/multilinestringfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/multilinestringfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (838, 34, 'MultiPointFromText', 'Description\n-----------\n\nA synonym for MPointFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/multipointfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/multipointfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (839, 34, 'MultiPolygonFromText', 'Description\n-----------\n\nA synonym for MPolyFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/multipolygonfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/multipolygonfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (840, 34, 'PolygonFromText', 'Description\n-----------\n\nA synonym for ST_PolyFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/polygonfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/polygonfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (841, 34, 'ST\\_AsText', 'Syntax\n------\n\nST_AsText(g)\nAsText(g)\nST_AsWKT(g)\nAsWKT(g)\n\nDescription\n-----------\n\nConverts a value in internal geometry format to its WKT representation and returns the string result.\n\nST_AsText(), AsText(), ST_AsWKT() and AsWKT() are all synonyms.\n\nExamples\n--------\n\nSET @g = ''LineString(1 1,4 4,6 6)'';\n\nSELECT ST_AsText(ST_GeomFromText(@g));\n+--------------------------------+\n| ST_AsText(ST_GeomFromText(@g)) |\n+--------------------------------+\n| LINESTRING(1 1,4 4,6 6)        |\n+--------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_astext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_astext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (842, 34, 'ST\\_ASWKT', 'Description\n-----------\n\nA synonym for ST_ASTEXT().\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_aswkt', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_aswkt');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (843, 34, 'ST\\_GeomCollFromText', 'Syntax\n------\n\nST_GeomCollFromText(wkt[,srid])\nST_GeometryCollectionFromText(wkt[,srid])\nGeomCollFromText(wkt[,srid])\nGeometryCollectionFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a GEOMETRYCOLLECTION value using its WKT representation and SRID.\n\nST_GeomCollFromText(), ST_GeometryCollectionFromText(), GeomCollFromText() and GeometryCollectionFromText() are all synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_geometrycollection  (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\nINSERT INTO gis_geometrycollection VALUES\n    (GeomCollFromText(''GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))'')),\n    (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),\n    (GeomFromText(''GeometryCollection()'')),\n    (GeomFromText(''GeometryCollection EMPTY''));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_geomcollfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_geomcollfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (844, 34, 'ST\\_GeometryCollectionFromText', 'Description\n-----------\n\nA synonym for ST_GeomCollFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_geometrycollectionfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_geometrycollectionfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (845, 34, 'ST\\_GeometryFromText', 'Description\n-----------\n\nA synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_geometryfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_geometryfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (846, 34, 'ST\\_GeomFromText', 'Syntax\n------\n\nST_GeomFromText(wkt[,srid])\nST_GeometryFromText(wkt[,srid])\nGeomFromText(wkt[,srid])\nGeometryFromText(wkt[,srid])\n\nST_MultiLineStringFromText(wkt[,srid])\nST_MLineFromText(wkt[,srid])\nST_MPointFromText(wkt[,srid])\nST_MultiPointFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a geometry value of any type using its WKT representation and SRID.\n\nGeomFromText(), GeometryFromText(), ST_GeomFromText(), ST_GeometryFromText(), ST_MultiLineStringFromText, ST_MLineFromText, ST_MultiPolyFromText and ST_MPolygonFromText are all synonyms.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT(''POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1))'');\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_geomfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_geomfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (847, 34, 'ST\\_LineFromText', 'Syntax\n------\n\nST_LineFromText(wkt[,srid])\nST_LineStringFromText(wkt[,srid])\nLineFromText(wkt[,srid])\nLineStringFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a LINESTRING value using its WKT representation and SRID.\n\nST_LineFromText(), ST_LineStringFromText(), ST_LineFromText() and ST_LineStringFromText() are all synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_line  (g LINESTRING);\nSHOW FIELDS FROM gis_line;\nINSERT INTO gis_line VALUES\n    (LineFromText(''LINESTRING(0 0,0 10,10 0)'')),\n    (LineStringFromText(''LINESTRING(10 10,20 10,20 20,10 20,10 10)'')),\n    (LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_linefromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_linefromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (848, 34, 'ST\\_LineStringFromText', 'Description\n-----------\n\nA synonym for ST_LineFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_linestringfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_linestringfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (849, 34, 'ST\\_MPointFromText', 'Description\n-----------\n\nA synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_mpointfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_mpointfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (850, 34, 'ST\\_MPolyFromText', 'Description\n-----------\n\nA synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_mpolyfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_mpolyfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (851, 34, 'ST\\_MultiLineStringFromText', 'Description\n-----------\n\nA synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_multilinestringfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_multilinestringfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (852, 34, 'ST\\_MultiPointFromText', 'Description\n-----------\n\nA synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_multipointfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_multipointfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (853, 34, 'ST\\_MultiPolygonFromText', 'Description\n-----------\n\nA synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_multipolygonfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_multipolygonfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (854, 34, 'ST\\_PointFromText', 'Syntax\n------\n\nST_PointFromText(wkt[,srid])\nPointFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a POINT value using its WKT representation and SRID.\n\nST_PointFromText() and PointFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_point  (g POINT);\nSHOW FIELDS FROM gis_point;\nINSERT INTO gis_point VALUES\n    (PointFromText(''POINT(10 10)'')),\n    (PointFromText(''POINT(20 10)'')),\n    (PointFromText(''POINT(20 20)'')),\n    (PointFromWKB(AsWKB(PointFromText(''POINT(10 20)''))));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_pointfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_pointfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (855, 34, 'ST\\_PolyFromText', 'Syntax\n------\n\nST_PolyFromText(wkt[,srid])\nST_PolygonFromText(wkt[,srid])\nPolyFromText(wkt[,srid])\nPolygonFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a POLYGON value using its WKT representation and SRID.\n\nST_PolyFromText(), ST_PolygonFromText(), PolyFromText() and ST_PolygonFromText() are all synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_polygon   (g POLYGON);\nINSERT INTO gis_polygon VALUES\n    (PolygonFromText(''POLYGON((10 10,20 10,20 20,10 20,10 10))'')),\n    (PolyFromText(''POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))''));\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_polyfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_polyfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (856, 34, 'ST\\_PolygonFromText', 'Description\n-----------\n\nA synonym for ST_PolyFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_polygonfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/st_polygonfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (857, 34, 'AsText', 'Description\n-----------\n\nA synonym for ST_AsText().\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-astext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-astext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (858, 34, 'AsWKT', 'Description\n-----------\n\nA synonym for ST_AsText().\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-aswkt', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-aswkt');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (859, 34, 'WKT Definition', 'Description\n-----------\n\nThe Well-Known Text (WKT) representation of Geometry is designed to exchange geometry data in ASCII form. Examples of the basic geometry types include:\n\n| Geometry Types                                                       |\n| -------------------------------------------------------------------- |\n| POINT                           |\n| LINESTRING                 |\n| POLYGON                       |\n| MULTIPOINT                 |\n| MULTILINESTRING       |\n| MULTIPOLYGON             |\n| GEOMETRYCOLLECTION |\n| GEOMETRY        |\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-definition', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-definition');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (860, 34, 'GeomCollFromText', 'Description\n-----------\n\nA synonym for ST_GeomCollFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-geomcollfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-geomcollfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (861, 34, 'GeomFromText', 'Description\n-----------\n\nA synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-geomfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-geomfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (862, 34, 'LineFromText', 'Description\n-----------\n\nA synonym for ST_LineFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-linefromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-linefromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (863, 34, 'PointFromText', 'Description\n-----------\n\nA synonym for ST_PointFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-pointfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-pointfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (864, 34, 'PolyFromText', 'Description\n-----------\n\nA synonym for ST_PolyFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-polyfromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-polyfromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (865, 34, 'ST\\_MLineFromText', 'Description\n-----------\n\nA synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-st_mlinefromtext', '', 'https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/wkt/wkt-st_mlinefromtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (866, 35, 'DEALLOCATE / DROP PREPARE', 'Syntax\n------\n\n{DEALLOCATE | DROP} PREPARE stmt_name\n\nDescription\n-----------\n\nTo deallocate a prepared statement produced with PREPARE, use aDEALLOCATE PREPARE statement that refers to the prepared statement name.\n\nA prepared statement is implicitly deallocated when a new PREPARE command is issued. In that case, there is no need to use DEALLOCATE.\n\nAttempting to execute a prepared statement after deallocating it results in an error, as if it was not prepared at all:\n\n``sql\nERROR 1243 (HY000): Unknown prepared statement handler (stmt_name) given to EXECUTE\n`\n\nIf the specified statement has not been PREPAREd, an error similar to the following will be produced:\n\n`sql\nERROR 1243 (HY000): Unknown prepared statement handler (stmt_name) given to DEALLOCATE PREPARE\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/deallocate-drop-prepare', '', 'https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/deallocate-drop-prepare');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (867, 35, 'EXECUTE IMMEDIATE', 'Syntax\n------\n\nEXECUTE IMMEDIATE statement\n    [USING param[, param] ...]\n\nparam:\n    expression | IGNORE | DEFAULT\n\nDescription\n-----------\n\nEXECUTE IMMEDIATE executes a dynamic SQL statement created on the fly, which can reduce performance overhead. For example:\n\n``sql\nEXECUTE IMMEDIATE ''SELECT 1''\n`\n\nwhich is shorthand for:\n\n`sql\nPREPARE stmt FROM "select 1";\nEXECUTE stmt;\nDEALLOCATE PREPARE stmt;\n`\n\nEXECUTE IMMEDIATE supports complex expressions as prepare source and parameters:\n\n`sql\nEXECUTE IMMEDIATE CONCAT(''SELECT COUNT() FROM '', ''t1'', '' WHERE a=?'') USING 5+5;\n`\n\nLimitations: subselects and stored function calls are not supported as a prepare source.\n\nThe following examples return an error:\n\n`sql\nCREATE OR REPLACE FUNCTION f1() RETURNS VARCHAR(64) RETURN ''SELECT  FROM t1'';\nEXECUTE IMMEDIATE f1();\nERROR 1970 (42000): EXECUTE IMMEDIATE does not support subqueries or stored functions\n\nEXECUTE IMMEDIATE (SELECT ''SELECT  FROM t1'');\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that \n  corresponds to your MariaDB server version for the right syntax to use near \n  ''SELECT ''SELECT  FROM t1'')'' at line 1\n\nCREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 10;\nEXECUTE IMMEDIATE ''SELECT  FROM t1 WHERE a=?'' USING f1();\nERROR 1970 (42000): EXECUTE..USING does not support subqueries or stored functions\n\nEXECUTE IMMEDIATE ''SELECT  FROM t1 WHERE a=?'' USING (SELECT 10);\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that \n  corresponds to your MariaDB server version for the right syntax to use near \n  ''SELECT 10)'' at line 1\n`\n\nOne can use a user or an SP variable as a workaround:\n\n`sql\nCREATE OR REPLACE FUNCTION f1() RETURNS VARCHAR(64) RETURN ''SELECT  FROM t1'';\nSET @stmt=f1();\nEXECUTE IMMEDIATE @stmt;\n\nSET @stmt=(SELECT ''SELECT 1'');\nEXECUTE IMMEDIATE @stmt;\n\nCREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 10;\nSET @param=f1();\nEXECUTE IMMEDIATE ''SELECT  FROM t1 WHERE a=?'' USING @param;\n\nSET @param=(SELECT 10);\nEXECUTE IMMEDIATE ''SELECT  FROM t1 WHERE a=?'' USING @param;\n`\n\nEXECUTE IMMEDIATE supports user variables and SP variables as OUT parameters:\n\n`sql\nDELIMITER $$\nCREATE OR REPLACE PROCEDURE p1(OUT a INT)\nBEGIN\n  SET a:= 10;\nEND;\n$$\nDELIMITER ;\nSET @a=2;\nEXECUTE IMMEDIATE ''CALL p1(?)'' USING @a;\nSELECT @a;\n+------+\n| @a   |\n+------+\n|   10 |\n+------+\n`\n\nSimilar to PREPARE, EXECUTE IMMEDIATE is allowed in stored procedures but is not allowed in stored functions.\n\nThis example uses EXECUTE IMMEDIATE inside a stored procedure:\n\n`sql\nDELIMITER $$\nCREATE OR REPLACE PROCEDURE p1()\nBEGIN\n  EXECUTE IMMEDIATE ''SELECT 1'';\nEND;\n$$\nDELIMITER ;\nCALL p1;\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n`\n\nThis script returns an error:\n\n`sql\nDELIMITER $$\nCREATE FUNCTION f1() RETURNS INT\nBEGIN\n  EXECUTE IMMEDIATE ''DO 1'';\n  RETURN 1;\nEND;\n$$\nERROR 1336 (0A000): Dynamic SQL is not allowed in stored function or trigger\n`\n\nEXECUTE IMMEDIATE can use DEFAULT and IGNORE indicators as bind parameters:\n\n`sql\nCREATE OR REPLACE TABLE t1 (a INT DEFAULT 10);\nEXECUTE IMMEDIATE ''INSERT INTO t1 VALUES (?)'' USING DEFAULT;\nSELECT  FROM t1;\n+------+\n| a    |\n+------+\n|   10 |\n+------+\n`\n\nEXECUTE IMMEDIATE increments the Com_execute_immediate status variable, as well as the Com_stmt_prepare, Com_stmt_execute and Com_stmt_close status variables.\n\nNote, EXECUTE IMMEDIATE does not increment the Com_execute_sql status variable. _Com_execute_sql_ is used only for PREPARE..EXECUTE.\n\nThis session screenshot demonstrates how EXECUTE IMMEDIATE affects status variables:\n\n`sql\nSELECT  FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME RLIKE \n  (''COM_(EXECUTE|STMT_PREPARE|STMT_EXECUTE|STMT_CLOSE)'');\n\n+-----------------------+----------------+\n| VARIABLE_NAME         | VARIABLE_VALUE |\n+-----------------------+----------------+\n| COM_EXECUTE_IMMEDIATE | 0              |\n| COM_EXECUTE_SQL       | 0              |\n| COM_STMT_CLOSE        | 0              |\n| COM_STMT_EXECUTE      | 0              |\n| COM_STMT_PREPARE      | 0              |\n+-----------------------+----------------+\n\nEXECUTE IMMEDIATE ''SELECT 1'';\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n\nSELECT  FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME RLIKE \n  (''COM_(EXECUTE|STMT_PREPARE|STMT_EXECUTE|STMT_CLOSE)'');\n+-----------------------+----------------+\n| VARIABLE_NAME         | VARIABLE_VALUE |\n+-----------------------+----------------+\n| COM_EXECUTE_IMMEDIATE | 1              |\n| COM_EXECUTE_SQL       | 0              |\n| COM_STMT_CLOSE        | 1              |\n| COM_STMT_EXECUTE      | 1              |\n| COM_STMT_PREPARE      | 1              |\n+-----------------------+----------------+\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/execute-immediate', '', 'https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/execute-immediate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (868, 35, 'EXECUTE Statement', 'Syntax\n------\n\nEXECUTE stmt_name\n    [USING expression[, expression] ...]\n\nDescription\n-----------\n\nAfter preparing a statement with PREPARE, you execute it with anEXECUTE statement that refers to the prepared statement name. If the prepared statement contains any parameter markers, you must supply aUSING clause that lists expressions containing the values to be bound to the parameters. The USING clause must name exactly as many expressions as the number of parameter markers in the statement.\n\nYou can execute a given prepared statement multiple times, passing different variables to it or setting the variables to different values before each execution.\n\nIf the specified statement has not been PREPAREd, an error similar to the following is produced:\n\n``sql\nERROR 1243 (HY000): Unknown prepared statement handler (stmt_name) given to EXECUTE\n`\n\nEXECUTE` with arbitrary expression as parameters can be used, not just user variables (@var_name).\n\nYou can only use user variables (@var_name) as parameters.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/execute-statement', '', 'https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/execute-statement');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (869, 35, 'PREPARE Statement', 'Syntax\n------\n\nPREPARE stmt_name FROM preparable_stmt\n\nDescription\n-----------\n\nThe PREPARE statement prepares a statement and assigns it a name,stmt_name, by which to refer to the statement later. Statement names are not case sensitive. preparable_stmt is an expression with the text of the statement. It cannot contain stored function calls or subqueries. The text must represent a single SQL statement, not multiple statements. Within the statement, ? characters can be used as parameter markers to indicate where data values are to be bound to the query later when you execute it. The ? characters should not be enclosed within quotes, even if you intend to bind them to string values. Parameter markers can be used only where expressions should appear, not for SQL keywords, identifiers, and so forth.\n\nThe scope of a prepared statement is the session within which it is created. Other sessions cannot see it.\n\nIf a prepared statement with the given name already exists, it is deallocated implicitly before the new statement is prepared. This means that if the new statement contains an error and cannot be prepared, an error is returned and no statement with the given name exists.\n\nPrepared statements can be PREPARE and EXECUTE in a stored procedure, but not in a stored function or trigger. Also, even if the statement is prepared with PREPARE in a procedure, it will not be deallocated when the procedure execution ends.\n\nA prepared statement can access user-defined variables, but not local variables or procedure''s parameters.\n\nIf the prepared statement contains a syntax error, PREPARE will fail. As a side effect, stored procedures can use it to check if a statement is valid. For example:\n\n``sql\nCREATE PROCEDURE test_stmt(IN sql_text TEXT)\nBEGIN\n        DECLARE EXIT HANDLER FOR SQLEXCEPTION\n        BEGIN\n                SELECT CONCAT(sql_text, '' is not valid'');\n        END;\n        SET @SQL := sql_text;\n        PREPARE stmt FROM @SQL;\n        DEALLOCATE PREPARE stmt;\nEND;\n`\n\nThe FOUND_ROWS() and ROW_COUNT() functions, if called immediately after EXECUTE, return the number of rows read or affected by the prepared statements; however, if they are called after DEALLOCATE PREPARE, they provide information about this statement. If the prepared statement produces errors or warnings, GET DIAGNOSTICS return information about them. DEALLOCATE PREPARE shouldn''t clear the diagnostics area, unless it produces an error.\n\nA prepared statement is executed with EXECUTE and released with DEALLOCATE PREPARE.\n\nThe max_prepared_stmt_count server system variable determines the number of allowed prepared statements that can be prepared on the server. If it is set to 0, prepared statements are not allowed. If the limit is reached, an error similar to the following will be produced:\n\n`sql\nERROR 1461 (42000): Can''t create more than max_prepared_stmt_count statements \n  (current value: 0)\n`\n\nOracle Mode\n\nIn Oracle mode, PREPARE stmt FROM ''SELECT :1, :2'' is used instead of ?.\n\nPermitted Statements\n\nThe following is valid from MariaDB 10.6.2.\n\nAll statements can be prepared, except PREPARE, EXECUTE, and DEALLOCATE / DROP PREPARE.\n\nPrior to this, not all statements can be prepared. Only the following SQL commands are permitted:\n\n ALTER TABLE\n ANALYZE TABLE\n BINLOG\n CACHE INDEX\n CALL\n CHANGE MASTER\n CHECKSUM {TABLE | TABLES}\n COMMIT\n {CREATE | DROP} DATABASE\n {CREATE | DROP} INDEX\n {CREATE | RENAME | DROP} TABLE\n {CREATE | RENAME | DROP} USER\n {CREATE | DROP} VIEW\n DELETE\n DESCRIBE\n DO\n EXPLAIN\n FLUSH {TABLE | TABLES | TABLES WITH READ LOCK | HOSTS | PRIVILEGES | LOGS | STATUS |\\\n  MASTER | SLAVE | DES_KEY_FILE | USER_RESOURCES | QUERY CACHE | TABLE_STATISTICS |\\\n  INDEX_STATISTICS | USER_STATISTICS | CLIENT_STATISTICS}\n GRANT\n INSERT\n INSTALL {PLUGIN | SONAME}\n HANDLER READ\n KILL\n LOAD INDEX INTO CACHE\n OPTIMIZE TABLE\n REPAIR TABLE\n REPLACE\n RESET {MASTER | SLAVE | QUERY CACHE}\n REVOKE\n ROLLBACK\n SELECT\n SET\n SET GLOBAL SQL_SLAVE_SKIP_COUNTER\n SET ROLE\n SET SQL_LOG_BIN\n SET TRANSACTION ISOLATION LEVEL\n SHOW EXPLAIN\n SHOW {DATABASES | TABLES | OPEN TABLES | TABLE STATUS | COLUMNS | INDEX | TRIGGERS |EVENTS | GRANTS | CHARACTER SET | COLLATION | ENGINES | \\PLUGINS [SONAME] | PRIVILEGES |PROCESSLIST | PROFILE | PROFILES | VARIABLES | STATUS | WARNINGS | ERRORS |TABLE_STATISTICS | INDEX_STATISTICS | USER_STATISTICS | CLIENT_STATISTICS | AUTHORS |CONTRIBUTORS}\n SHOW CREATE {DATABASE | TABLE | VIEW | PROCEDURE | FUNCTION | TRIGGER | EVENT}\n SHOW {FUNCTION | PROCEDURE} CODE\n SHOW BINLOG EVENTS\n SHOW SLAVE HOSTS\n SHOW {MASTER | BINARY} LOGS\n SHOW {MASTER | SLAVE | TABLES | INNODB | FUNCTION | PROCEDURE} STATUS\n SLAVE {START | STOP}\n TRUNCATE TABLE\n SHUTDOWN\n UNINSTALL {PLUGIN | SONAME}\n UPDATE\n\nSynonyms are not listed here, but can be used. For example, DESC can be used instead of DESCRIBE.\n\nCompound statements can be prepared too.\n\nNote that if a statement can be run in a stored routine, it will work even if it is called by a prepared statement. For example, SIGNAL can''t be directly prepared. However, it is allowed in stored routines. If the x() procedure contains SIGNAL, you can still prepare and execute the ''CALL x();'' prepared statement.\n\nPREPARE supports most kinds of expressions as well, for example:\n\n`sql\nPREPARE stmt FROM CONCAT(''SELECT  FROM '', table_name);\n`\n\nWhen PREPARE is used with a statement which is not supported, the following error is produced:\n\n`sql\nERROR 1295 (HY000): This command is not supported in the prepared statement protocol yet\n``\n\nExamples\n--------\n\nCREATE TABLE t1 (a INT,b CHAR(10));\nINSERT INTO t1 VALUES (1,"one"),(2, "two"),(3,"three");\nPREPARE test FROM "select * from t1 where a=?";\nSET @param=2;\nEXECUTE test USING @param;\n+------+------+\n| a    | b    |\n+------+------+\n|    2 | two  |\n+------+------+\nSET @param=3;\nEXECUTE test USING @param;\n+------+-------+\n| a    | b     |\n+------+-------+\n|    3 | three |\n+------+-------+\nDEALLOCATE PREPARE test;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/prepare-statement', '', 'https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/prepare-statement');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (870, 35, 'BEGIN END', 'Syntax\n------\n\n[begin_label:] BEGIN [NOT ATOMIC]\n    [statement_list]\nEND [end_label]\n\nDescription\n-----------\n\nBEGIN ... END syntax is used for writing compound statements. A compound statement can contain multiple statements, enclosed by the BEGIN and END keywords. statement_list represents a list of one or more statements, each terminated by a semicolon (i.e., ;) statement delimiter. statement_list is\\\noptional, which means that the empty compound statement (BEGIN END) is legal.\n\nNote that END will perform a commit. If you are running in autocommit mode, every statement will be committed separately. If you are not running in autocommit mode, you must execute a COMMIT or ROLLBACK after END to get the database up to date.\n\nUse of multiple statements requires that a client is able to send statement strings containing the statement delimiter. This is handled in the mysql command-line client with the DELIMITER command.\\\nChanging the ; end-of-statement delimiter (for example, to//) allows ; to be used in a program body.\n\nA compound statement within a stored program can be labeled. end_label cannot be given unless begin_label also is present. If both are present, they must be the same.\n\nBEGIN ... END constructs can be nested. Each block can define its own variables, a CONDITION, a HANDLER and a CURSOR, which don''t exist in the outer blocks. The most local declarations override the outer objects which use the same name (see example below).\n\nThe declarations order is the following:\n\n DECLARE local variables\n DECLARE CONDITIONs\n DECLARE CURSORs\n DECLARE HANDLERs\n\nNote that DECLARE HANDLER contains another BEGIN ... END construct.\n\nHere is an example of a very simple, anonymous block:\n\n``sql\nBEGIN NOT ATOMIC\nSET @a=1;\nCREATE TABLE test.t1(a INT);\nEND|\n`\n\nBelow is an example of nested blocks in a stored procedure:\n\n`sql\nCREATE PROCEDURE t( )\nBEGIN\n   DECLARE x TINYINT UNSIGNED DEFAULT 1;\n   BEGIN\n      DECLARE x CHAR(2) DEFAULT ''02'';\n       DECLARE y TINYINT UNSIGNED DEFAULT 10;\n       SELECT x, y;\n   END;\n   SELECT x;\nEND;\n`\n\nIn this example, a TINYINT variable, x is declared in the outter block. But in the inner block x is re-declared as a CHAR and an y variable is declared. The inner SELECT shows the "new" value of x, and the value of y. But when x is selected in the outer block, the "old" value is returned. The final SELECT doesn''t try to read y`, because it doesn''t exist in that context.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/begin-end', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/begin-end');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (871, 35, 'CASE Statement', 'Syntax\n------\n\nCASE case_value\n    WHEN when_value THEN statement_list\n    [WHEN when_value THEN statement_list] ...\n    [ELSE statement_list]\nEND CASE\n\nDescription\n-----------\n\nThe text on this page describes the CASE statement for stored programs. See the CASE OPERATOR for details on the CASE operator outside of stored programs.\n\nThe CASE statement for stored programs implements a complex conditional construct. If a search_condition evaluates to true, the corresponding SQL statement list is executed. If no search condition matches, the statement list in the ELSE clause is executed. Each statement_list consists of one or more statements.\n\nThe CASE statement cannot have an ELSE NULL clause, and it is terminated with END CASE instead of END. implements a complex conditional construct. If a search_condition evaluates to true, the corresponding SQL statement list is executed. If no search condition matches, the statement list in the ELSE clause is executed. Each statement_list consists of one or more statements.\n\nIf no when_value or search_condition matches the value tested and the CASE statement contains no ELSE clause, a Case not found for CASE statement error results.\n\nEach statement_list consists of one or more statements; an empty statement_list is not allowed. To handle situations where no value is matched by any WHEN clause, use an ELSE containing an empty BEGIN ... END block, as shown in this example:\n\n``sql\nDELIMITER |\nCREATE PROCEDURE p()\nBEGIN\n  DECLARE v INT DEFAULT 1;\n  CASE v\n    WHEN 2 THEN SELECT v;\n    WHEN 3 THEN SELECT 0;\n    ELSE BEGIN END;\n  END CASE;\nEND;\n|\n`\n\nThe indentation used here in the ELSE clause is for purposes of clarity only and is not otherwise significant. See Delimiters in the mariadb client for more on the use of the delimiter command.\n\nNote: The syntax of the CASE statement used inside stored programs differs slightly from that of the SQL CASE expression described in CASE OPERATOR. The CASE statement cannot have an ELSE NULL clause, and it is terminated with END CASE instead of END`.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/case-statement', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/case-statement');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (872, 35, 'DECLARE CONDITION', 'Syntax\n------\n\nDECLARE condition_name CONDITION FOR condition_value\n\ncondition_value:\n    SQLSTATE [VALUE] sqlstate_value\n  | mysql_error_code\n\nDescription\n-----------\n\nThe DECLARE ... CONDITION statement defines a named error condition. It specifies a condition that needs specific handling and associates a name with that condition. Later, the name can be used in a DECLARE ... HANDLER, SIGNAL or RESIGNAL statement (as long as the statement is located in the same BEGIN ... END block).\n\nConditions must be declared after local variables, but before CURSORs and HANDLERs.\n\nA condition_value for DECLARE ... CONDITION can be an SQLSTATE value (a 5-character string literal) or a MySQL error code (a number). You should not use SQLSTATE value ''00000'' or MySQL error code 0, because those indicate success rather than an error condition. If you try, or if you specify an invalid SQLSTATE value, an error like this is produced:\n\n``sql\nERROR 1407 (42000): Bad SQLSTATE: ''00000''\n`\n\nFor a list of SQLSTATE` values and MariaDB error codes, see MariaDB Error Codes.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/declare-condition', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/declare-condition');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (873, 35, 'DECLARE HANDLER', 'Syntax\n------\n\nDECLARE handler_type HANDLER\n    FOR condition_value [, condition_value] ...\n    statement\n\nhandler_type:\n    CONTINUE\n  | EXIT \n  | UNDO\n\ncondition_value:\n    SQLSTATE [VALUE] sqlstate_value\n  | condition_name\n  | SQLWARNING\n  | NOT FOUND\n  | SQLEXCEPTION\n  | mariadb_error_code\n\nDescription\n-----------\n\nThe DECLARE ... HANDLER statement specifies handlers that each may deal with one or more conditions. If one of these conditions occurs, the specified statement is executed. statement can be a simple statement (for example, SET var_name = value), or it can be a compound statement written using BEGIN and END.\n\nHandlers must be declared after local variables, a CONDITION and a CURSOR.\n\nFor a CONTINUE handler, execution of the current program continues after execution of the handler statement. For an EXIT handler, execution terminates for the BEGIN ... END compound statement in which the handler is declared. (This is true even if the condition occurs in an inner block.) The UNDO handler type statement is not supported.\n\nIf a condition occurs for which no handler has been declared, the default action is EXIT.\n\nA condition_value for DECLARE ... HANDLER can be any of the following values:\n\n An SQLSTATE value (a 5-character string literal) or a MariaDB error code (a number). You should not use SQLSTATE value ''00000'' or MariaDB error code 0, because those indicate success rather than an error condition. For a list of SQLSTATE values and MariaDB error codes, see MariaDB Error Codes.\n A condition name previously specified with DECLARE ... CONDITION. It must be in the same stored program. See DECLARE CONDITION.\n SQLWARNING is shorthand for the class of SQLSTATE values that begin with ''01''.\n NOT FOUND is shorthand for the class of SQLSTATE values that begin with ''02''. This is relevant only the context of cursors and is used to control what happens when a cursor reaches the end of a data set. If no more rows are available, a No Data condition occurs with SQLSTATE value 02000. To detect this condition, you can set up a handler for it (or for a NOT FOUND condition). An example is shown in Cursor Overview. This condition also occurs for SELECT ... INTO var_list statements that retrieve no rows.\n SQLEXCEPTION is shorthand for the class of SQLSTATE values that do not begin with ''00'', ''01'', or ''02''.\n\nWhen an error raises, in some cases it could be handled by multiple HANDLERs. For example, there may be an handler for 1050 error, a separate handler for the 42S01 SQLSTATE, and another separate handler for the SQLEXCEPTION class: in theory all occurrences of HANDLER may catch the 1050 error, but MariaDB chooses the HANDLER with the highest precedence. Here are the precedence rules:\n\n Handlers which refer to an error code have the highest precedence.\n Handlers which refer to a SQLSTATE come next.\n Handlers which refer to an error class have the lowest precedence.\n\nIn some cases, a statement could produce multiple errors. If this happens, in some cases multiple handlers could have the highest precedence. In such cases, the choice of the handler is indeterminate.\n\nNote that if an error occurs within a CONTINUE HANDLER block, it can be handled by another HANDLER. However, a HANDLER which is already in the stack (that is, it has been called to handle an error and its execution didn''t finish yet) cannot handle new errors—this prevents endless loops. For example, suppose that a stored procedure contains a CONTINUE HANDLER for SQLWARNING and another CONTINUE HANDLER for NOT FOUND. At some point, a NOT FOUND error occurs, and the execution enters the NOT FOUND HANDLER. But within that handler, a warning occurs, and the execution enters the SQLWARNING HANDLER. If another NOT FOUND error occurs, it cannot be handled again by the NOT FOUND HANDLER, because its execution is not finished.\n\nWhen a DECLARE HANDLER block can handle more than one error condition, it may be useful to know which errors occurred. To do so, you can use the GET DIAGNOSTICS statement.\n\nAn error that is handled by a DECLARE HANDLER construct can be issued again using the RESIGNAL statement.\n\nBelow is an example using DECLARE HANDLER:\n\n``sql\nCREATE TABLE test.t (s1 INT, PRIMARY KEY (s1));\n\nDELIMITER //\n\nCREATE PROCEDURE handlerdemo ( )\n     BEGIN\n       DECLARE CONTINUE HANDLER FOR SQLSTATE ''23000'' SET @x2 = 1;\n       SET @x = 1;\n       INSERT INTO test.t VALUES (1);\n       SET @x = 2;\n       INSERT INTO test.t VALUES (1);\n       SET @x = 3;\n     END;\n     //\n\nDELIMITER ;\n\nCALL handlerdemo( );\n\nSELECT @x;\n+------+\n| @x   |\n+------+\n|    3 |\n+------+\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/declare-handler', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/declare-handler');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (874, 35, 'DECLARE TYPE', 'Description\n-----------\n\nThe DECLARE TYPE declaration specifies user-defined data types that must be compatible with Oracle within stored procedures and anonymous blocks. It provides Oracle-compatible type declarations, such as record types, associative arrays, and REF CURSOR types, which allows for more flexible data handling and better compatibility with Oracle PL/SQL.\n\nAssociative arrays (INDEX BY tables) offer an in-memory key-value structure for quick data storage and effective lookups. REF CURSOR types allow for the creation of cursor variables that refer to query result sets and can be passed between program blocks.\n\nThe general syntax for defining associative array types is as follows:\n\n``sql\nDECLARE\n   TYPE type_name TABLE OF rec_type_name INDEX BY idx_type_name\n`\n\n type_name supports explicit and anchored data types (for instance, t1.col1%TYPE).\n rec_type_name supports scalar and record data types.\n The INDEX BY clause defines the key type using idx_type_name, which supports integer and string data types.\n\nAssociative Arrays\n\nIn Oracle, associative arrays (called index-by tables) are sparse collections of elements indexed by keys, which can be integers or strings.\n\nHere’s an example of how to declare an associative array in Oracle:\n\n`sql\nDECLARE\n  TYPE array_t IS TABLE OF VARCHAR2(64) INDEX BY PLS_INTEGER;\n  array array_t;\nBEGIN\n  array(1) := ''Hello'';\n  array(2) := ''World'';\n  DBMS_OUTPUT.PUT_LINE(array(1));\nEND;\n`\n\nMethods\n\nAssociative arrays support the following methods:\n\n FIRST — a function that returns the first key\n LAST — a function that returns the last key\n NEXT — a function that returns the key after the given one\n PRIOR — a function that returns the key before the given one\n COUNT — a function that returns the number of elements\n EXISTS — a function that returns TRUE if the key exists\n DELETE — a procedure that removes a specific key, or clears the array\n\nWhile the MariaDB implementation is largely aligned with Oracle’s implementation, there are a few differences:\n\n Only literals as keys in the constructor: When using constructors, keys must be literals — Oracle allows expressions.\n Collation control: Instead of NLS_SORT or NLS_COMP, MariaDB uses the SQL-standard COLLATE` clause.\n* No nested associative arrays: Arrays of arrays are not supported.\n\nThese differences are largely rooted in architectural constraints — MariaDB is aiming at staying as close to Oracle semantics as possible while maintaining performance and predictability.\n\nExamples\n--------\n\nDECLARE\n  TYPE salary IS TABLE OF NUMBER INDEX BY VARCHAR2(20);\n  salary_list salary;\n  name VARCHAR2(20);\nBEGIN\n  salary_list(''Rajnisj'') := 62000;\n  salary_list(''James'') := 78000;\n  name:= salary_list.FIRST;\n  WHILE name IS NOT NULL\n  LOOP\n    dbms_output.put_line(name || '' '' || TO_CHAR(salary_list(name)));\n    name:= salary_list.NEXT(name);\n  END LOOP;\nEND;\n/\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/declare-type', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/declare-type');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (875, 35, 'DECLARE Variable', 'Syntax\n------\n\nDECLARE var_name [, var_name] ... [[ROW] TYPE OF]] type [DEFAULT value]\n\nDescription\n-----------\n\nThis statement is used to declare local variables within stored programs. To provide a default value for the variable, include a DEFAULT clause. The value can be specified as an expression (even subqueries are permitted); it need not be a constant. If theDEFAULT clause is missing, the initial value is NULL.\n\nLocal variables are treated like stored routine parameters with respect to data type and overflow checking. See CREATE PROCEDURE.\n\nLocal variables must be declared before CONDITIONs, CURSORs and HANDLERs.\n\nLocal variable names are not case sensitive.\n\nThe scope of a local variable is within the BEGIN ... END block where it is declared. The variable can be referred to in blocks nested within the declaring block, except those blocks that declare a variable with the same name.\n\nTYPE OF / ROW TYPE OF\n\nAnchored data types allow a data type to be defined based on another object, such as a table row, rather than specifically set in the declaration. If the anchor object changes, so will the anchored data type. This can lead to routines being easier to maintain, so that if the data type in the table is changed, it will automatically be changed in the routine as well.\n\nVariables declared with ROW TYPE OF will have the same features as implicit ROW variables. It is not possible to use ROW TYPE OF variables in a LIMIT clause.\n\nThe real data type of TYPE OF and ROW TYPE OF table_name will become known at the very beginning of the stored routine call. ALTER TABLE or DROP TABLE statements performed inside the current routine on the tables that appear in anchors won''t affect the data type of the anchored variables, even if the variable is declared after an ALTER TABLE or DROP TABLE statement.\n\nThe real data type of a ROW TYPE OF cursor_name variable will become known when execution enters into the block where the variable is declared. Data type instantiation will happen only once. In a cursor ROW TYPE OF variable that is declared inside a loop, its data type will become known on the very first iteration and won''t change on further loop iterations.\n\nThe tables referenced in TYPE OF and ROW TYPE OF declarations will be checked for existence at the beginning of the stored routine call. CREATE PROCEDURE or CREATE FUNCTION will not check the referenced tables for existence.\n\nDynamic Cursors Limitation&#x20;\n\nROW TYPE OF is not supported for dynamic cursors (cursors declared for a prepared statement). This is because the cursor''s structure is dependent on the prepared statement, which is not known at the time the stored procedure context is created.\n\nExamples\n--------\n\nDECLARE name VARCHAR(5) DEFAULT ''monty'';\n  DECLARE x INT DEFAULT 10;\n  DECLARE Y SMALLINT;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/declare-variable', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/declare-variable');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (876, 35, 'FOR', 'Syntax\n------\n\n[begin_label:]\nFOR var_name IN [ REVERSE ] lower_bound .. upper_bound\nDO statement_list\nEND FOR [ end_label ]\n\nDescription\n-----------\n\nFOR loops allow code to be executed a fixed number of times.\n\nIn an integer range FOR loop, MariaDB will compare the lower bound and upper bound values, and assign the lower bound value to a counter. If REVERSE is not specified, and the upper bound value is greater than or equal to the counter, the counter will be incremented and the statement will continue, after which the loop is entered again. If the upper bound value is greater than the counter, the loop will be exited.\n\nDynamic Cursors Limitation\n\nFOR loops cannot be used with dynamic cursors (cursors declared for prepared statement names). To handle dynamic cursors, employ explicit OPEN, FETCH, and CLOSE statements inside a LOOP or similar construct.\n\nIf REVERSE is specified, the counter is decremented, and the upper bound value needs to be less than or equal for the loop to continue.\n\nExamples\n--------\n\nCREATE TABLE t1 (a INT);\n\nDELIMITER //\n\nFOR i IN 1..3\nDO\n  INSERT INTO t1 VALUES (i);\nEND FOR;\n//\n\nDELIMITER ;\n\nSELECT * FROM t1;\n+------+\n| a    |\n+------+\n|    1 |\n|    2 |\n|    3 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/for', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/for');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (877, 35, 'GOTO', 'Syntax\n------\n\nGOTO label\n\nDescription\n-----------\n\nThe GOTO statement causes the code to jump to the specified label, and continue operating from there. It is only accepted when in Oracle mode.\n\nExamples\n--------\n\nSET sql_mode=ORACLE;\n\nDELIMITER //\n\nCREATE OR REPLACE PROCEDURE p1 AS\n\nBEGIN\n\n  SELECT 1;\n  GOTO label;\n  SELECT 2;\n  <<label>>\n  SELECT 3;\n\nEND;\n\n//\n\nDELIMITER \n\nCALL p1();\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n1 row in set (0.000 sec)\n\n+---+\n| 3 |\n+---+\n| 3 |\n+---+\n1 row in set (0.000 sec)\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/goto', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/goto');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (878, 35, 'IF', 'Syntax\n------\n\nIF search_condition THEN statement_list\n    [ELSEIF search_condition THEN statement_list] ...\n    [ELSE statement_list]\nEND IF;\n\nDescription\n-----------\n\nIF implements a basic conditional construct. If the search_condition evaluates to true, the corresponding SQL statement list is executed. If no search_condition matches, the statement list in the ELSE clause is executed. Each statement_list consists of one or more statements.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/if', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/if');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (879, 35, 'ITERATE', 'Description\n-----------\n\nSyntax\n\n``sql\nITERATE label\n`\n\nITERATE can appear only within LOOP, REPEAT, and WHILE statements.ITERATE means "do the loop again", and uses the statement''s label to determine which statements to repeat. The label must be in the same stored program, not in a caller procedure.\n\nIf you try to use ITERATE with a non-existing label, or if the label is associated to a construct which is not a loop, the following error will be produced:\n\n`sql\nERROR 1308 (42000): ITERATE with no matching label: <label_name>\n`\n\nBelow is an example of how ITERATE might be used:\n\n`sql\nCREATE PROCEDURE doiterate(p1 INT)\nBEGIN\n  label1: LOOP\n    SET p1 = p1 + 1;\n    IF p1 < 10 THEN ITERATE label1; END IF;\n    LEAVE label1;\n  END LOOP label1;\n  SET @x = p1;\nEND\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/iterate', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/iterate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (880, 35, 'Labels', 'Description\n-----------\n\nSyntax\n\n``sql\nlabel: <construct>\n[label]\n`\n\nLabels are MariaDB identifiers which can be used to identify a BEGIN ... END construct or a loop. They have a maximum length of 16 characters and can be quoted with backticks (i.e.., \\\\\\).\n\nLabels have a start part and an end part. The start part must precede the portion of code it refers to, must be followed by a colon (:) and can be on the same or different line. The end part is optional and adds nothing, but can make the code more readable. If used, the end part must precede the construct''s delimiter (;). Constructs identified by a label can be nested. Each construct can be identified by only one label.\n\nLabels need not be unique in the stored program they belong to. However, a label for an inner loop cannot be identical to a label for an outer loop. In this case, the following error would be produced:\n\n``sql\nERROR 1309 (42000): Redefining label <label_name>\n`\n\nLEAVE and ITERATE statements can be used to exit or repeat a portion of code identified by a label. They must be in the same Stored Routine, Trigger or Event which contains the target label.\n\nBelow is an example using a simple label that is used to exit a LOOP:\n\n`sql\nCREATE PROCEDURE test_sp()\nBEGIN\n   my_label:\n   LOOP\n      SELECT ''looping'';\n      LEAVE my_label;\n   END LOOP;\n   SELECT ''out of loop'';\nEND;\n`\n\nThe following label is used to exit a procedure, and has an end part:\n\n`sql\nCREATE PROCEDURE test_sp()\nmy_label:\nBEGIN\n   IF @var = 1 THEN\n      LEAVE my_label;\n   END IF;\n   DO something();\nEND my_label;\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/labels', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/labels');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (881, 35, 'LEAVE', 'Description\n-----------\n\nSyntax\n\n``sql\nLEAVE label\n`\n\nThis statement is used to exit the flow control construct that has the given label. The label must be in the same stored program, not in a caller procedure. LEAVE can be used within BEGIN ... END or loop constructs (LOOP, REPEAT, WHILE). In Stored Procedures, Triggers and Events, LEAVE can refer to the outmost BEGIN ... END construct; in that case, the program exits the procedure. In Stored Functions, RETURN can be used instead.\n\nLEAVE cannot be used to exit a DECLARE HANDLER block.\n\nIf you try to LEAVE a non-existing label, or if you try to LEAVE a HANDLER block, the following error will be produced:\n\n`sql\nERROR 1308 (42000): LEAVE with no matching label: <label_name>\n`\n\nThe following example uses LEAVE to exit the procedure if a condition is true:\n\n`sql\nCREATE PROCEDURE proc(IN p TINYINT)\nCONTAINS SQL\nwhole_proc:\nBEGIN\n   SELECT 1;\n   IF p < 1 THEN\n      LEAVE whole_proc;\n   END IF;\n   SELECT 2;\nEND;\n\nCALL proc(0);\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/leave', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/leave');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (882, 35, 'LOOP', 'Syntax\n------\n\n[begin_label:] LOOP\n    statement_list\nEND LOOP [end_label]\n\nDescription\n-----------\n\nLOOP implements a simple loop construct, enabling repeated execution of the statement list, which consists of one or more statements, each terminated by a semicolon (i.e., ;) statement delimiter. The statements within the loop are repeated until the loop is exited; usually this is accomplished with a LEAVE statement.\n\nA LOOP statement can be labeled. end_label cannot be given unlessbegin_label also is present. If both are present, they must be the same.\n\nSee Delimiters in the mariadb client for more on delimiter usage in the client.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/loop', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/loop');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (883, 35, 'CLOSE', 'Syntax\n------\n\nCLOSE cursor_name\n\nDescription\n-----------\n\nThis statement closes a previously opened cursor. The cursor must have been previously opened or else an error occurs.\n\nIf not closed explicitly, a cursor is closed at the end of the compound statement in which it was declared.\n\nSee Cursor Overview for an example.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/close', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/close');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (884, 35, 'Cursor Overview', 'Description\n-----------\n\nA cursor is a structure that allows you to go over records sequentially, and perform processing based on the result.\n\nMariaDB permits cursors inside stored programs, and MariaDB cursors are non-scrollable, read-only and case-insensitive.\n\n Non-scrollable means that the rows can only be fetched in the order specified by the SELECT statement. Rows cannot be skipped, you cannot jump to a specific row, and you cannot fetch rows in reverse order.\n Read-only means that data cannot be updated through the cursor.\n Assensitive means that the cursor points to the actual underlying data. This kind of cursor is quicker than the alternative, an insensitive cursor, as no data is copied to a temporary table. However, changes to the data being used by the cursor will affect the cursor data.\n\nCursors are created with a DECLARE CURSOR statement and opened with an OPEN statement. Rows are read with a FETCH statement before the cursor is finally closed with a CLOSE statement.\n\nWhen FETCH is issued and there are no more rows to extract, the following error is produced:\n\n``sql\nERROR 1329 (02000): No data - zero rows fetched, selected, or processed\n`\n\nTo avoid problems, a DECLARE HANDLER statement is generally used. The HANDLER should handler the 1329 error, or the ''02000'' SQLSTATE, or the NOT FOUND error class.\n\nCursors can be declared for a prepared statement name, enabling full support for Dynamic SQL within stored routines. The SQL Standard syntax for  <dynamic declare cursor> is supported: a cursor is declared with the FOR clause to bind it to a prepared statement name, which is then prepared and opened normally. Cursors may also still SELECT from views, which can be created dynamically via prepared statements.&#x20;\n\nOnly SELECT statements are allowed for cursors, and they cannot be contained in a variable - so, they cannot be composed dynamically. However, it is possible to SELECT from a view. Since the CREATE VIEW statement can be executed as a prepared statement, it is possible to dynamically create the view that is queried by the cursor.&#x20;\n\nCursors can have parameters. Cursor parameters can appear in any part of the DECLARE CURSOR select_statement where a stored procedure variable is allowed (select list, WHERE, HAVING, LIMIT` etc). See DECLARE CURSOR and OPEN for syntax, and below for an example.\n\nCursors cannot have parameters.\n\nExamples\n--------\n\nCREATE TABLE c1(i INT);\n\nCREATE TABLE c2(i INT);\n\nCREATE TABLE c3(i INT);\n\nDELIMITER //\n\nCREATE PROCEDURE p1()\nBEGIN\n  DECLARE done INT DEFAULT FALSE;\n  DECLARE x, y INT;\n  DECLARE cur1 CURSOR FOR SELECT i FROM test.c1;\n  DECLARE cur2 CURSOR FOR SELECT i FROM test.c2;\n  DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;\n\n  OPEN cur1;\n  OPEN cur2;\n\n  read_loop: LOOP\n    FETCH cur1 INTO x;\n    FETCH cur2 INTO y;\n    IF done THEN\n      LEAVE read_loop;\n    END IF;\n    IF x < y THEN\n      INSERT INTO test.c3 VALUES (x);\n    ELSE\n      INSERT INTO test.c3 VALUES (y);\n    END IF;\n  END LOOP;\n\n  CLOSE cur1;\n  CLOSE cur2;\nEND; //\n\nDELIMITER ;\n\nINSERT INTO c1 VALUES(5),(50),(500);\n\nINSERT INTO c2 VALUES(10),(20),(30);\n\nCALL p1;\n\nSELECT  FROM c3;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/cursor-overview', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/cursor-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (885, 35, 'DECLARE CURSOR', 'Syntax\n------\n\nDECLARE cursor_name CURSOR [(cursor_formal_parameter[,...])] FOR {select_statement | prepared_statement_name}\n\ncursor_formal_parameter:\n    [IN] name type [collate clause]\n\nDescription\n-----------\n\nThis statement declares a cursor. Multiple cursors may be declared in a stored program, but each cursor in a given block must have a unique name.\n\nselect_statement is not executed until the OPEN statement is executed. It is important to remember this if the query produces an error, or calls functions which have side effects.\n\nA SELECT associated to a cursor can use variables, but the query itself cannot be a variable, and cannot be dynamically composed. The SELECT statement cannot have an INTO clause.\n\nStarting with MariaDB 12.3, the query can also be a prepared statement name, which allows the query to be dynamically composed. The SELECT statement cannot have an INTO clause.\n\nCursors must be declared before HANDLERs, but after local variables and CONDITIONs.\n\n> The DECLARE CURSOR statement provides a cursor to a specified SELECT statement.\n>\n> To declare a cursor variable type that can be connected with multiple queries at runtime (REF CURSOR), use DECLARE TYPE... IS REF CURSOR in Oracle mode. See DECLARE TYPE.\n\nDynamic Cursors\n\nStarting with MariaDB 12.3, a cursor can be declared for a prepared statement. This allows the use of Dynamic SQL within stored routines. The cursor is bound to a prepared statement name, which must be defined using the PREPARE statement before the cursor is opened.\n\n``sql\nCREATE OR REPLACE PROCEDURE p1(tab VARCHAR(64), min_id INTEGER)\nBEGIN\n  DECLARE v_id INT;\n  DECLARE v_c1 VARCHAR(100);\n  DECLARE no_data BOOL DEFAULT FALSE;\n  \n  -- 1. Declare cursor for the statement name ''s1''\n  DECLARE c1 CURSOR FOR s1;\n  DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_data = TRUE;\n\n  -- 2. Prepare the statement dynamically\n  PREPARE s1 FROM CONCAT(''SELECT id, c1 FROM '', tab, '' WHERE id >= ?'');\n  \n  -- 3. Open cursor and bind parameters\n  OPEN c1 USING min_id;\n  \n  fetch_loop: LOOP\n    FETCH c1 INTO v_id, v_c1;\n    IF no_data THEN\n      LEAVE fetch_loop;\n    END IF;\n    SELECT v_id, v_c1;\n  END LOOP;\n  \n  CLOSE c1;\n  DEALLOCATE PREPARE s1;\nEND;\n$$\n\nDELIMITER ;\n`\n\nParameters\n\nCursors can have parameters. This is a non-standard SQL extension. Cursor parameters can appear in any part of the DECLARE CURSOR select_statement where a stored procedure variable is allowed (select list, WHERE, HAVING, LIMIT , and so forth).\n\nIN\n\nThe IN qualifier is supported in the cursor_formal_parameter part of the syntax.\n\nThe IN qualifier is not supported in the cursor_formal_parameter` part of the syntax.\n\nSee Cursor Overview for an example.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/declare-cursor', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/declare-cursor');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (886, 35, 'FETCH', 'Syntax\n------\n\nFETCH cursor_name INTO var_name [, var_name] ...\n\nDescription\n-----------\n\nThis statement fetches the next row (if a row exists) using the specified open cursor, and advances the cursor pointer.\n\nvar_name can be a local variable, but _not_ a user-defined variable.\n\nIf no more rows are available, a No Data condition occurs withSQLSTATE value 02000. To detect this condition, you can set up a handler for it (or for a NOT FOUND condition).\n\nSee Cursor Overview for an example.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/fetch', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/fetch');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (887, 35, 'OPEN', 'Syntax\n------\n\nOPEN cursor_name [[USING variable[,...]] | [expression[,...]]];\n\nDescription\n-----------\n\nThis statement opens a cursor which was previously declared with DECLARE CURSOR.\n\nThe query associated to the DECLARE CURSOR is executed when OPEN is executed. It is important to remember this if the query produces an error, or calls functions which have side effects.\n\nThis is necessary in order to FETCH rows from a cursor.\n\nSee Cursor Overview for an example.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/open', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/open');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (888, 35, 'Diagnostics Area', 'Description\n-----------\n\nThe diagnostics area contains information about the error conditions which were produced by an SQL statement, as well as some information about the statement which generated them.\n\nStatement Information\n\nThe statement information area contains the following data:\n\n NUMBER is the number of conditions which are present in the diagnostics area.\n ROW_COUNT has the same value as the ROW_COUNT() function for the statement that produced the conditions.\n\nCondition Information\n\nEach condition has several properties, which are explained here.\n\nData Types and Sizes\n\nThe following table shows the type and size of all the properties:\n\n| Property name       | Property type     |\n| ------------------- | ----------------- |\n| RETURNED_SQLSTATE  | VARCHAR(5)        |\n| MYSQL_ERRNO        | SMALLINT UNSIGNED |\n| MESSAGE_TEXT       | VARCHAR(512)      |\n| CLASS_ORIGIN       | VARCHAR(64)       |\n| SUBCLASS_ORIGIN    | VARCHAR(64)       |\n| CONSTRAINT_CATALOG | VARCHAR(64)       |\n| CONSTRAINT_SCHEMA  | VARCHAR(64)       |\n| CONSTRAINT_NAME    | VARCHAR(64)       |\n| CATALOG_NAME       | VARCHAR(64)       |\n| SCHEMA_NAME        | VARCHAR(64)       |\n| TABLE_NAME         | VARCHAR(64)       |\n| COLUMN_NAME        | VARCHAR(64)       |\n| CURSOR_NAME        | VARCHAR(64)       |\n\nThese properties can never be set to NULL. If they are empty, the empty string is used.\n\nCommon Condition Properties\n\nThe most common ones have a value for all built-in errors, and can be read both via SQL and via the API:\n\nRETURNED_SQLSTATE is the SQLSTATE of the condition. It is a five characters code, composed by a class (first two characters) and a subclass (last three characters). For more information about this property, refer to the SQLSTATE page.\n\nMYSQL_ERRNO is the error code. Each built-in condition has a unique numeric code. 0 indicates success, but it cannot be explicitly set or read via SQL. For a list of built-in error codes, refer to MariaDB Error Codes. The API function to read it is mysql_errno().\n\nMESSAGE_TEXT is a descriptive, human-readable message. For built-in errors, parsing this string is the only way to get more information about the error. For example, parsing a message like "Table ''tab1'' already exists", a program can find out that the missing table is tab1. The API function to read it is mysql_error().\n\nFor conditions generated by the user via SIGNAL, if MYSQL_ERRNO and MESSAGE_TEXT are not specified, their default values depend on the first two SQLSTATE characters:\n\n ''00'' means ''success''. It can not be set in any way, and can only be read via the API.\n For ''01'' class, default MYSQL_ERRNO is 1642 and default MESSAGE_TEXT is ''Unhandled user-defined warning condition''.\n For ''02'' class, default MYSQL_ERRNO is 1643 and default MESSAGE_TEXT is ''Unhandled user-defined not found condition''.\n For all other cases, including the ''45000'' value, default MYSQL_ERRNO is 1644 and default MESSAGE_TEXT is ''Unhandled user-defined exception condition''.\n\nSpecial Condition Properties\n\nThere are more condition properties, which are never set for built-in errors. They can only be set via SIGNAL and RESIGNAL statements, and can only be read via GET DIAGNOSTICS - not via the API. Such properties are:\n\nCLASS_ORIGIN indicates whether the SQLSTATE uses a standard class or a software-specific class. If it is defined in the SQL standards document ISO 9075-2 (section 24.1, SQLSTATE), this property''s value is supposed to be ''ISO 9075'', otherwise it is supposed to be ''MySQL''. However, any string is accepted.\n\nSUBCLASS_ORIGIN indicates whether the SQLSTATE uses a standard subclass or a software-specific class. If the SQLSTATE is defined in the SQL standards document ISO 9075-2 (section 24.1, SQLSTATE), this property''s value is supposed to be ''ISO 9075'', otherwise it is supposed to be ''MySQL''. However, any string is accepted.\n\nSCHEMA_NAME indicates in which schema (database) the error occurred.\n\nTABLE_NAME indicates the name of the table which was accessed by the failed statement.\n\nCOLUMN_NAME indicates the name of the column which was accessed by the failed statement.\n\nCONSTRAINT_NAME indicates the name of the constraint that was violated.\n\nCONSTRAINT_SCHEMA indicates in which schema the violated constraint is located.\n\nCURSOR_NAME indicates the name of the cursor which caused the error.\n\nThe following properties can be used and are defined in the standard SQL, but have no meaning because MariaDB doesn''t currently support catalogs:\n\nCATALOG_NAME is used by the standard SQL to indicate in which catalog the error occurred.\n\nCONSTRAINT_CATALOG is used by the standard SQL to indicate in which catalog the violated constraint is located.\n\nHow the Diagnostics Area is Populated and Cleared\n\nWhen a statement produces one or more error conditions (errors, warnings, notes) the conditions are inserted into the diagnostics area, and the statement information area is updated with that statement’s information. Usually, this also clears all the old conditions from the diagnostics area, but there is an exception: if the new statement is a correctly parsed RESIGNAL or GET DIAGNOSTICS, the old contents will remain in the diagnostics area. SIGNAL clears the old conditions.\n\nWhen a table-based statement (like INSERT) is executed, the old data in the diagnostics area is cleared even if the statement doesn''t produce any condition. However, statements which don''t access any table (like SET, or a SELECT with no FROM clause) is executed and produces no warnings, the diagnostics area remains unchanged.\n\nThe maximum number of conditions that can be in the diagnostics area is max_error_count. If this value is 0, the diagnostics area is empty. If this variable is changed, the new value takes effect with the next statement (that is, the diagnostics area is not immediately truncated).\n\nHow to Access the Diagnostics Area\n\nThe following statements explicitly add conditions to the diagnostics area:\n\n SIGNAL: produces a custom error.\n RESIGNAL: after an error is produced, generates a modified version of that error.\n\nThe following statements read contents from the diagnostics area:\n\n GET DIAGNOSTICS is the only way to read all information.\n SHOW WARNINGS shows a summary of errors, warnings and notes.\n* SHOW ERRORS shows a summary of errors.\n\nDECLARE HANDLER can be used to handle error conditions within stored programs.\n\nDECLARE CONDITION can be used to associate an SQLSTATE or an error code to a name. That name can be referenced in DECLARE HANDLER, SIGNAL and RESIGNAL statements.\n\nAll these statements can also be executed inside a stored routine. However, only SHOW WARNINGS and SHOW ERRORS can be executed as a prepared statement. After an EXECUTE statement, the diagnostics area contains information about the prepared statement, if it produces error conditions.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-diagnostics/diagnostics-area', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-diagnostics/diagnostics-area');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (889, 35, 'GET DIAGNOSTICS', 'Description\n-----------\n\n``sql\nGET [CURRENT] DIAGNOSTICS\n{\n    statement_property\n    [, statement_property] ... \n  | CONDITION condition_number\n    condition_property\n    [, condition_property] ...\n}\n\nstatement_property:\n    variable = statement_property_name\n\ncondition_property:\n    variable  = condition_property_name\n\nstatement_property_name:\n    NUMBER\n  | ROW_COUNT\n\ncondition_property_name:\n    CLASS_ORIGIN\n  | SUBCLASS_ORIGIN\n  | RETURNED_SQLSTATE\n  | MESSAGE_TEXT\n  | MYSQL_ERRNO\n  | CONSTRAINT_CATALOG\n  | CONSTRAINT_SCHEMA\n  | CONSTRAINT_NAME\n  | CATALOG_NAME\n  | SCHEMA_NAME\n  | TABLE_NAME\n  | COLUMN_NAME\n  | CURSOR_NAME\n  | ROW_NUMBER\n`\n\nThe diagnostics area contains information about the errors, warnings and notes which were produced by the last SQL statement. If that statement didn''t produce any warnings, the diagnostics area contains information about the last executed statement which involved a table. The GET DIAGNOSTICS statement copies the requested information from the diagnostics area to the specified variables. It is possible to use both user variables or local variables.\n\nTo use GET DIAGNOSTICS, it is important to know how the diagnostics area is structured. It has two sub-areas: the statement information area and the error conditions information area. For details, please refer to the diagnostics area page.\n\nEach single GET DIAGNOSTICS command can read information from the statement information area or from a single error condition. This means that, if you have two warnings and you want to know the number of warnings, and read both the warnings, you need to issue GET DIAGNOSTICS three times.\n\nThe CURRENT keywords adds nothing to the statement, because MariaDB has only one diagnostics area.\n\nIf GET DIAGNOSTICS produces an error condition (because the command is properly parsed but not correctly used), the diagnostics area is not emptied, and the new condition is added.\n\nGetting Information from a Condition\n\nTo read information from a condition, the CONDITION keyword must be specified and it must be followed by the condition number. This number can be specified as a constant value or as a variable. The first condition''s index is 1. If the error condition does not exist, the variables will not change their value and a 1758 error will be produced ("Invalid condition number").\n\nThe condition properties that can be read with GET DIAGNOSTICS are the same that can be set with SIGNAL and RESIGNAL statements. They are explained in the diagnostics area page. However, there is one more property: RETURNED_SQLSTATE, which indicates the condition''s SQLSTATE.\n\nFor a list of SQLSTATE values and MariaDB error codes, see MariaDB Error Codes.\n\nThe type for all the condition properties is VARCHAR(64), except for MYSQL_ERRNO, whose valid range is 1 to 65534.\n\nROW_NUMBER\n\nYou can use the ROW_NUMBER property to retrieve the row number, too, even if the error text does not mention it. This property is named ERROR_INDEX . ROW_NUMBER is a reserved word.\n\nThere is no way, short of parsing the error text, to know in what row an error had happened.\n\nExamples\n--------\n\nCREATE TABLE test.t (c` INT) ENGINE = x;\nQuery OK, 0 rows affected, 2 warnings (0.19 sec)\n\nGET DIAGNOSTICS @num_conditions = NUMBER;\n\nSELECT @num_conditions;\n+-----------------+\n| @num_conditions |\n+-----------------+\n|               2 |\n+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-diagnostics/get-diagnostics', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-diagnostics/get-diagnostics');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (890, 35, 'SQLSTATE', 'Description\n-----------\n\nSQLSTATE is a code which identifies SQL error conditions. It composed by five characters, which can be numbers or uppercase ASCII letters. An SQLSTATE value consists of a class (first two characters) and a subclass (last three characters).\n\nThere are three important standard classes. They all indicate in which logical group of errors the condition falls. They match to a particular keyword which can be used with DECLARE HANDLER. Also, the SQLSTATE class determines the default value for the MYSQL_ERRNO and MESSAGE_TEXT condition properties.\n\n ''00'' means ''success''. It can not be set in any way and can only be read via the API.\n ''01'' contains all warnings and matches to the SQLWARNING keyword. The default MYSQL_ERRNO is 1642 and default MESSAGE_TEXT is ''Unhandled user-defined warning condition''.\n ''02'' is the NOT FOUND class. The default MYSQL_ERRNO is 1643 and default MESSAGE_TEXT is ''Unhandled user-defined not found condition''.\n All other classes match the SQLEXCEPTION keyword. The default MYSQL_ERRNO is 1644 and default MESSAGE_TEXT is ''Unhandled user-defined exception condition''.\n\nThe subclass, if it is set, indicates a particular condition, or a particular group of conditions within the class. However, the ''000'' sequence means ''no subclass''.\n\nFor example, if you try to SELECT from a table which does not exist, a 1109 error is produced, with a ''42S02'' SQLSTATE. ''42'' is the class and ''S02'' is the subclass. This value matches to the SQLEXCEPTION keyword. When FETCH is called for a cursor which has already reached the end, a 1329 error is produced, with a ''02000'' SQLSTATE. The class is ''02'' and there is no subclass (because ''000'' means ''no subclass''). It can be handled by a NOT FOUND handlers.\n\nThe standard SQL specification says that classes beginning with 0, 1, 2, 3, 4, A, B, C, D, E, F and G are reserved for standard-defined classes, while other classes are vendor-specific. It also says that, when the class is standard-defined, subclasses starting with those characters (except for ''000'') are standard-defined subclasses, while other subclasses are vendor-defined. However, MariaDB and MySQL do not strictly obey this rule.\n\nTo read the SQLSTATE of a particular condition which is in the diagnostics area, the GET DIAGNOSTICS statement can be used: the property is called RETURNED_SQLSTATE. For user-defined conditions (SIGNAL and RESIGNAL statements), a SQLSTATE value must be set via the SQLSTATE clause. However, SHOW WARNINGS and SHOW ERRORS do not display the SQLSTATE.\n\nFor user-defined conditions, MariaDB and MySQL recommend the ''45000'' SQLSTATE class.\n\n''HY000'' is called the "general error": it is the class used for built-in conditions which do not have a specific SQLSTATE class.\n\nA partial list of error codes and matching SQLSTATE values can be found under MariaDB Error Codes.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-diagnostics/sqlstate', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-diagnostics/sqlstate');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (891, 35, 'REPEAT LOOP', 'Description\n-----------\n\nSyntax\n\n``sql\n[begin_label:] REPEAT\n    statement_list\nUNTIL search_condition\nEND REPEAT [end_label]\n`\n\nThe statement list within a REPEAT statement is repeated until the search_condition is true. Thus, a REPEAT always enters the loop at least once. statement_list consists of one or more statements, each\\\nterminated by a semicolon (i.e., ;) statement delimiter.\n\nA REPEAT statement can be labeled. end_label cannot be given unless begin_label is also present. If both are present, they must be the same.\n\nSee Delimiters in the mariadb client for more on client delimiter usage.\n\n`sql\nDELIMITER //\n\nCREATE PROCEDURE dorepeat(p1 INT)\n  BEGIN\n    SET @x = 0;\n    REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;\n  END\n//\n\nCALL dorepeat(1000)//\n\nSELECT @x//\n+------+\n| @x   |\n+------+\n| 1001 |\n+------+\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/repeat-loop', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/repeat-loop');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (892, 35, 'RESIGNAL', 'Syntax\n------\n\nRESIGNAL [error_condition]\n    [SET error_property\n    [, error_property] ...]\n\nerror_condition:\n    SQLSTATE [VALUE] ''sqlstate_value''\n  | condition_name\n\nerror_property:\n    error_property_name = <error_property_value>\n\nerror_property_name:\n    CLASS_ORIGIN\n  | SUBCLASS_ORIGIN\n  | MESSAGE_TEXT\n  | MYSQL_ERRNO\n  | CONSTRAINT_CATALOG\n  | CONSTRAINT_SCHEMA\n  | CONSTRAINT_NAME\n  | CATALOG_NAME\n  | SCHEMA_NAME\n  | TABLE_NAME\n  | COLUMN_NAME\n  | CURSOR_NAME\n\nDescription\n-----------\n\nThe syntax of RESIGNAL and its semantics are very similar to SIGNAL. This statement can only be used within an error HANDLER. It produces an error, like SIGNAL. RESIGNAL clauses are the same as SIGNAL, except that they all are optional, even SQLSTATE. All the properties which are not specified in RESIGNAL, will be identical to the properties of the error that was received by the error HANDLER. For a description of the clauses, see diagnostics area.\n\nRESIGNAL does not empty the diagnostics area. It just appends another error condition.\n\nRESIGNAL, without any clauses, produces an error which is identical to the error that was received by HANDLER.\n\nIf used out of a HANDLER construct, RESIGNAL produces the following error:\n\n``sql\nERROR 1645 (0K000): RESIGNAL when handler not active\n`\n\nIf a HANDLER contains a CALL to another procedure, that procedure can use RESIGNAL, but trying to do this raises the above error.\n\nIf a HANDLER contains a CALL to another procedure, that procedure can use RESIGNAL.\n\nFor a list of SQLSTATE values and MariaDB error codes, see MariaDB Error Codes.\n\nThe following procedure tries to query two tables which don''t exist, producing a 1146 error in both cases. Those errors will trigger the HANDLER. The first time the error will be ignored, and the client will not receive it, but the second time, the error is re-signaled, so the client will receive it.\n\n`sql\nCREATE PROCEDURE test_error( )\nBEGIN\n   DECLARE CONTINUE HANDLER\n      FOR 1146\n   BEGIN\n   IF @hide_errors IS FALSE THEN\n      RESIGNAL;\n   END IF;\n   END;\n   SET @hide_errors = TRUE;\n   SELECT ''Next error will be ignored'' AS msg;\n   SELECT c FROM temptab_one;\n   SELECT ''Next error won''''t be ignored'' AS msg;\n   SET @hide_errors = FALSE;\n   SELECT c FROM temptab_two;\nEND;\n\nCALL test_error( );\n\n+----------------------------+\n| msg                        |\n+----------------------------+\n| Next error will be ignored |\n+----------------------------+\n\n+-----------------------------+\n| msg                         |\n+-----------------------------+\n| Next error won''t be ignored |\n+-----------------------------+\n\nERROR 1146 (42S02): Table ''test.temptab_two'' doesn''t exist\n`\n\nThe following procedure re-signals an error, modifying only the error message to clarify the cause of the problem.\n\n`sql\nCREATE PROCEDURE test_error()\nBEGIN\n   DECLARE CONTINUE HANDLER\n   FOR 1146\n   BEGIN\n      RESIGNAL SET\n      MESSAGE_TEXT = ''temptab does not exist'';\n   END;\n   SELECT c FROM temptab;\nEND;\n\nCALL test_error( );\nERROR 1146 (42S02): temptab does not exist\n`\n\n`sql\nCREATE PROCEDURE handle_error()\nBEGIN\n  RESIGNAL;\nEND;\nCREATE PROCEDURE p()\nBEGIN\n  DECLARE EXIT HANDLER FOR SQLEXCEPTION CALL p();\n  SIGNAL SQLSTATE ''45000'';\nEND;\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/resignal', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/resignal');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (893, 35, 'RETURN', 'Description\n-----------\n\nSyntax\n\n``sql\nRETURN expr\n`\n\nThe RETURN statement terminates execution of a stored function and returns the value _expr_ to the function caller. There must be at least one RETURN statement in a stored function. If the function has multiple exit points, all exit points must have a RETURN.\n\nThis statement is not used in stored procedures, triggers, or events. LEAVE can be used instead.\n\nThe following example shows that RETURN can return the result of a scalar subquery:\n\n`sql\nCREATE FUNCTION users_count() RETURNS BOOL\n   READS SQL DATA\nBEGIN\n   RETURN (SELECT COUNT(DISTINCT User) FROM mysql.user);\nEND;\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/return', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/return');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (894, 35, 'SELECT INTO', 'Syntax\n------\n\nSELECT col_name [, col_name] ...\n    INTO var_name [, var_name] ...\n    table_expr\n\nDescription\n-----------\n\nSELECT ... INTO enables selected columns to be stored directly into variables. No resultset is produced. The query should return a single row. If the query returns no rows, a warning with error code 1329 occurs (No data), and the variable values remain unchanged. If the query returns multiple rows, error 1172 occurs (Result consisted of more than one row). If it is possible that the statement may retrieve multiple rows, you can useLIMIT 1 to limit the result set to a single row.\n\nThe INTO clause can also be specified at the end of the statement.\n\nIn the context of such statements that occur as part of events executed by the Event Scheduler, diagnostics messages (not only errors, but also warnings) are written to the error log, and, on\\\nWindows, to the application event log.\n\nThis statement can be used with both local variables and user-defined variables.\n\nFor the complete syntax, see SELECT.\n\nAnother way to set a variable''s value is the SET statement.\n\nSELECT ... INTO results are not stored in the query cache even if SQL_CACHE is specified.\n\nExamples\n--------\n\nSELECT id, data INTO @x,@y \nFROM test.t1 LIMIT 1;\nSELECT * FROM t1 WHERE t1.a=@x AND t1.b=@y\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/selectinto', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/selectinto');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (895, 35, 'SET Variable', 'Syntax\n------\n\nSET var_name = expr [, var_name = expr] ...\n\nDescription\n-----------\n\nThe SET statement in stored programs is an extended version of the general SET statement. Referenced variables may be ones declared inside a stored program, global system variables, or user-defined variables.\n\nThe SET statement in stored programs is implemented as part of the pre-existing SET syntax. This allows an extended syntax of SET a=x, b=y, ... where different variable types (locally declared variables, global and session server variables, user-defined variables) can be mixed. This also allows combinations of local variables and some options that make sense only for system variables; in that case, the options are recognized but ignored.\n\nSET can be used with both local variables and user-defined variables.\n\nWhen setting several variables using the columns returned by a query, SELECT INTO should be preferred.\n\nTo set many variables to the same value, the LAST_VALUE( ) function can be used.\n\nBelow is an example of how a user-defined variable may be set:\n\n``sql\nSET @x = 1;\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/set-variable', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/set-variable');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (896, 35, 'SIGNAL', 'Description\n-----------\n\nSyntax\n\n``sql\nSIGNAL error_condition\n    [SET error_property\n    [, error_property] ...]\n\nerror_condition:\n    SQLSTATE [VALUE] ''sqlstate_value''\n  | condition_name\n\nerror_property:\n    error_property_name = <error_property_value>\n\nerror_property_name:\n    CLASS_ORIGIN\n  | SUBCLASS_ORIGIN\n  | MESSAGE_TEXT\n  | MYSQL_ERRNO\n  | CONSTRAINT_CATALOG\n  | CONSTRAINT_SCHEMA\n  | CONSTRAINT_NAME\n  | CATALOG_NAME\n  | SCHEMA_NAME\n  | TABLE_NAME\n  | COLUMN_NAME\n  | CURSOR_NAME\n`\n\nSIGNAL empties the diagnostics area and produces a custom error. This statement can be used anywhere but is generally useful when used inside a stored program. When the error is produced, it can be caught by a HANDLER. If not, the current stored program, or the current statement, will terminate with the specified error.\n\nSometimes an error HANDLER just needs to SIGNAL the same error it received, optionally with some changes. Usually, the RESIGNAL statement is the most convenient way to do this.\n\nerror_condition can be an SQLSTATE value, or a named error condition defined via DECLARE CONDITION. SQLSTATE must be a constant string consisting of five characters. These codes are standard to ODBC and ANSI SQL. For customized errors, the recommended SQLSTATE is ''45000''. For a list of SQLSTATE values used by MariaDB, see the MariaDB Error Codes page. The SQLSTATE can be read via the API method mysql_sqlstate( ).\n\nTo specify error properties user-defined variables and local variables can be used, as well as character set conversions (but you can''t set a collation).\n\nThe error properties, their type and their default values are explained in the diagnostics area page.\n\nErrors\n\nIf the SQLSTATE is not valid, the following error like this will be produced:\n\n`sql\nERROR 1407 (42000): Bad SQLSTATE: ''123456''\n`\n\nIf a property is specified more than once, an error like this will be produced:\n\n`sql\nERROR 1641 (42000): Duplicate condition information item ''MESSAGE_TEXT''\n`\n\nIf you specify a condition name which is not declared, an error like this will be produced:\n\n`sql\nERROR 1319 (42000): Undefined CONDITION: cond_name\n`\n\nIf MYSQL_ERRNO is out of range, you will get an error like this:\n\n`sql\nERROR 1231 (42000): Variable ''MYSQL_ERRNO'' can''t be set to the value of ''0''\n``\n\nExamples\n--------\n\nSIGNAL SQLSTATE ''01000'';\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n\n+---------+------+------------------------------------------+\n| Level   | Code | Message                                  |\n+---------+------+------------------------------------------+\n| Warning | 1642 | Unhandled user-defined warning condition |\n+---------+------+------------------------------------------+\n1 row in set (0.06 sec)\n\nSIGNAL SQLSTATE ''02000'';\nERROR 1643 (02000): Unhandled user-defined not found condition\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/signal', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/signal');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (897, 35, 'Using Compound Statements Outside of Stored Programs', 'Description\n-----------\n\nCompound statements can also be used outside of stored programs.\n\n``sql\ndelimiter |\nIF @have_innodb THEN\n  CREATE TABLE IF NOT EXISTS innodb_index_stats (\n    database_name    VARCHAR(64) NOT NULL,\n    table_name       VARCHAR(64) NOT NULL,\n    index_name       VARCHAR(64) NOT NULL,\n    last_update      TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n    stat_name        VARCHAR(64) NOT NULL,\n    stat_value       BIGINT UNSIGNED NOT NULL,\n    sample_size      BIGINT UNSIGNED,\n    stat_description VARCHAR(1024) NOT NULL,\n    PRIMARY KEY (database_name, table_name, index_name, stat_name)\n  ) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;\nEND IF|\nQuery OK, 0 rows affected, 2 warnings (0.00 sec)\n`\n\nUsing compound statements this way is subject to following limitations:\n\n Only BEGIN, IF, CASE, LOOP, WHILE, REPEAT statements may start a compound statement outside of stored programs.\n BEGIN must use the BEGIN NOT ATOMIC syntax (otherwise it''ll be confused with BEGIN that starts a transaction).\n A compound statement might not start with a label.\n A compound statement is parsed completely—note "2 warnings" in the above example, even if the condition was false (InnoDB was, indeed, disabled), and the CREATE TABLE statement was not executed, it was still parsed and the parser produced "Unknown storage engine" warning.\n\nInside a compound block first three limitations do not apply, one can use anything that can be used inside a stored program — including labels, condition handlers, variables, and so on:\n\n`sql\nBEGIN NOT ATOMIC\n    DECLARE foo CONDITION FOR 1146;\n    DECLARE x INT DEFAULT 0;\n    DECLARE CONTINUE HANDLER FOR SET x=1;\n    INSERT INTO test.t1 VALUES ("hndlr1", val, 2);\n    END|\n`\n\nExample how to use IF:\n\n`sql\nIF (1>0) THEN BEGIN NOT ATOMIC SELECT 1; END ; END IF;;\n`\n\nExample of how to use WHILE loop:\n\n`sql\nDELIMITER |\nBEGIN NOT ATOMIC\n    DECLARE x INT DEFAULT 0;\n    WHILE x <= 10 DO\n        SET x = x + 1;\n        SELECT x;\n    END WHILE;\nEND|\nDELIMITER ;\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/using-compound-statements-outside-of-stored-programs', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/using-compound-statements-outside-of-stored-programs');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (898, 35, 'WHILE', 'Syntax\n------\n\n[begin_label:] WHILE search_condition DO\n    statement_list\nEND WHILE [end_label]\n\nDescription\n-----------\n\nThe statement list within a WHILE statement is repeated as long as thesearch_condition is true. statement_list consists of one or more statements. If the loop must be executed at least once, REPEAT ... LOOP can be used instead.\n\nA WHILE statement can be labeled. end_label cannot be given unless begin_label also is present. If both are present, they must be the same.\n\nExamples\n--------\n\nCREATE PROCEDURE dowhile()\nBEGIN\n  DECLARE v1 INT DEFAULT 5;\n\n  WHILE v1 > 0 DO\n    ...\n    SET v1 = v1 - 1;\n  END WHILE;\nEND\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/while', '', 'https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/while');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (899, 35, 'Stored Routine Statements', 'Description\n-----------\n\ncall.md\n\nInvoke a stored procedure. This statement executes a previously created stored procedure, optionally passing parameters and returning results.\n\ndo.md\n\nExecute expressions without returning a result set. This statement runs functions or expressions, often used for side effects like releasing locks.\n\ncreate-procedure.md\n\nDefine a new stored procedure, specifying its name, parameters (IN, OUT, INOUT), and the SQL statements it executes.\n\nalter-procedure.md\n\nModify the characteristics of an existing stored procedure, such as its security context or comment, without changing its logic.\n\ndrop-procedure.md\n\nRemove a stored procedure and its associated privileges from the database.\n\ndrop-function.md\n\nRemove a stored function from the database, deleting its definition and associated privileges.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/stored-routine-statements/README', '', 'https://mariadb.com/docs/server/reference/sql-statements/stored-routine-statements/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (900, 35, 'CALL', 'Syntax\n------\n\nCALL sp_name([parameter[,...]])\nCALL sp_name[()]\n\nDescription\n-----------\n\nThe CALL statement invokes a stored procedure that was defined previously with CREATE PROCEDURE.\n\nStored procedure names can be specified as database_name.procedure_name. Procedure names and database names can be quoted with backticks (). This is necessary if they are reserved words, or contain special characters. See identifier qualifiers for details.\n\nCALL p() and CALL p are equivalent.\n\nIf parentheses are used, any number of spaces, tab characters and newline characters are allowed between the procedure''s name and the open parenthesis.\n\nCALL can pass back values to its caller using parameters that are declared as OUT or INOUT\\\nparameters. If no value is assigned to an OUT parameter, NULL is assigned (and its former value is lost). To pass such values from another stored program you can use user-defined variables, local variables or routine''s parameters; in other contexts, you can only use user-defined variables.\n\nCALL can also be executed as a prepared statement. Placeholders can be used for IN parameters in all versions of MariaDB; for OUT and INOUT parameters, placeholders can be used since MariaDB 5.5.\n\nWhen the procedure returns, a client program can also obtain the number of rows affected for the final statement executed within the routine: At the SQL level, call the ROW_COUNT() function; from the C\\\nAPI, call the mysql_affected_rows() function.\n\nIf the CLIENT_MULTI_RESULTS API flag is set, CALL can return any number of result sets and the called stored procedure can execute prepared statements. If it is not set, at most one result set can be returned and prepared statements cannot be used within procedures.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/stored-routine-statements/call', '', 'https://mariadb.com/docs/server/reference/sql-statements/stored-routine-statements/call');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (901, 35, 'DO', 'Syntax\n------\n\nDO expr [, expr] ...\n\nDescription\n-----------\n\nDO executes the expressions but does not return any results. In most respects, DO is shorthand forSELECT expr, ..., but has the advantage that it is slightly faster when you do not care about the result.\n\nDO is useful primarily with functions that have side effects, such as RELEASE_LOCK().\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/stored-routine-statements/do', '', 'https://mariadb.com/docs/server/reference/sql-statements/stored-routine-statements/do');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (902, 35, 'Table Statements', 'Description\n-----------\n\nalter\n\nAccess the reference for ALTER statements. This section lists commands to modify existing database objects, including tables, databases, users, and servers.\n\nalter-table\n\nComplete ALTER TABLE guide for MariaDB. Complete syntax for modifying columns, indexes, constraints, and table properties with comprehensive examples.\n\nanalyze-table.md\n\nAnalyze and store key distribution. This statement updates index statistics used by the optimizer to choose the best execution plan.\n\ncheck-table.md\n\nCheck tables or views for errors. This statement verifies the integrity of table structure and data for supported storage engines.\n\ncheck-view.md\n\nVerify the validity of a view''s algorithm. This statement checks if the view definition is correct and references existing tables.\n\nchecksum-table.md\n\nReport a checksum for table contents. This statement calculates a value to compare tables, useful for verifying replication consistency.\n\ncreate-table.md\n\nComplete guide to creating tables in MariaDB. Complete CREATE TABLE syntax for data types, constraints, indexes, and storage engines for production use.\n\ndelete.md\n\nComplete guide to deleting data in MariaDB. Complete DELETE syntax with WHERE filtering, JOIN operations, and safety considerations for production use.\n\ndrop-table.md\n\nComplete DROP TABLE syntax: TEMPORARY, IF EXISTS, WAIT/NOWAIT, RESTRICT/CASCADE options, metadata locks, atomic DROP, and replication behavior.\n\ninsert.md\n\nComplete guide to inserting data in MariaDB. Complete INSERT syntax for single rows, bulk operations, and ON DUPLICATE KEY handling for production use.\n\noptimize-table.md\n\nComplete MariaDB performance optimization guide. Complete reference for query tuning, indexing strategies, and configuration improvements for production use.\n\nrename-table.md\n\nChange the name of one or more tables atomically. This command moves tables within or between databases while preserving their data and structure.\n\nrepair-table.md\n\nRepair corrupted tables. This statement fixes errors in tables for supported storage engines like MyISAM, Aria, and Archive.\n\nrepair-view.md\n\nCheck and correct a view''s algorithm. This statement is primarily used by upgrade scripts to ensure view definitions are compatible.\n\nreplace.md\n\nInsert or replace rows based on unique keys. This statement acts like INSERT, but if a duplicate key exists, it deletes the old row and inserts the new one.\n\nshow-columns.md\n\nComplete guide to displaying table columns in MariaDB. Complete SHOW COLUMNS syntax with field types, keys, and filtering options for production use.\n\nshow-create-table.md\n\nGet the SQL statement to recreate a table. This statement shows the complete CREATE TABLE syntax, including column definitions and indexes.\n\nshow-index.md\n\nComplete SHOW INDEX reference: SHOW INDEX FROM _tbl_name_ syntax, output fields, and WHERE/LIKE filters.\n\ntruncate-table.md\n\nComplete TRUNCATE TABLE reference with [WAIT n|NOWAIT] syntax, InnoDB FOREIGN KEY constraints, implicit commit, and AUTO_INCREMENT reset.\n\nupdate.md\n\nComplete UPDATE statement guide for MariaDB. Complete syntax reference with WHERE conditions, JOIN operations, and multi-table updates for production use.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/table-statements/README', '', 'https://mariadb.com/docs/server/reference/sql-statements/table-statements/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (903, 35, 'ANALYZE TABLE', 'Syntax\n------\n\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name [,tbl_name ...]\n  [PERSISTENT FOR \n    { ALL\n      | COLUMNS ([col_name [,col_name ...]]) INDEXES ([index_name [,index_name ...]])\n    }\n  ]\n\nDescription\n-----------\n\nANALYZE TABLE analyzes and stores the key distribution for a table (index statistics). This statement works with MyISAM, Aria, and InnoDB tables. During the analysis, InnoDB will allow reads/writes, and MyISAM/Aria reads/inserts. For MyISAM tables, this statement is equivalent to using myisamchk --analyze.\n\nANALYZE uses histograms, which can provide a better selectivity than InnoDB statistics offer. InnoDB statistics work with a limited sample set and are therefore not as accurate as persistent statistics can be. For more information on how the analysis works within InnoDB, see InnoDB Limitations.\n\nMariaDB uses the stored key distribution to decide the order in which tables should be joined when you perform a join on something other than a constant. In addition, key distributions can be used when deciding which indexes to use for a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBy default, ANALYZE TABLE statements are written to the binary log and will be replicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the statement is not written to the binary log.\n\nANALYZE TABLE statements are not logged to the binary log if read_only is set. See also Read-Only Slaves.\n\nANALYZE TABLE is non-blocking and non-intrusive. A connection will start using new statistics for the query following the completion of the ANALYZE TABLE.\n\nANALYZE TABLE is blocking and intrusive.\n\nANALYZE TABLE is also supported for partitioned tables. You can use ALTER TABLE ... ANALYZE PARTITION to analyze one or more partitions.\n\nThe Aria storage engine supports progress reporting for the ANALYZE TABLE statement.\n\nSkipping Long CHAR/VARCHAR Columns\n\nWhen using ANALYZE TABLE PERSISTENT, MariaDB skips long CHAR/VARCHAR columns during statistics collection if they exceed the value of the analyze_max_length system variable.\n\nThis prevents excessive disk usage when analyzing tables with large text columns.\n\n If a column is longer than analyze_max_length, it is excluded from stats.\n If a long column is explicitly specified in FOR COLUMNS(), it is still analyzed, regardless of its size.\n\nExample:\n\n``sql\nSET GLOBAL analyze_max_length = 50000;\nANALYZE TABLE large_text_table PERSISTENT;\n`\n\n`sql\nANALYZE TABLE large_text_table PERSISTENT FOR COLUMNS(long_description);\n`\n\n`sql\nCREATE TABLE product_data (\n    id INT PRIMARY KEY,\n    name VARCHAR(100),\n    description VARCHAR(50000), -- long column\n    specs VARCHAR(1000)\n);\n\n-- Set limit\nSET SESSION analyze_max_length = 10000;\n\n-- Run analysis without explicitly selecting columns\nANALYZE TABLE product_data PERSISTENT;\n\n-- ''description'' will be skipped due to length > 10000\n\n-- To include it anyway\nANALYZE TABLE product_data PERSISTENT FOR COLUMNS(description);\n`\n\nThe functionality for skipping long CHAR and VARCHAR columns isn''t available.\n\nPerformance Impact\n\nNote that analyzing tables with ANALYZE can have a performance impact and can use a lot of disk space for big tables. As column statistics usually do not change much over time, even when the table grows, there is no benefit to running ANALYZE very often.\n\nRunning ANALYZE is indicated:\n\n for newly populated tables,\n for tables that have additional columns added that are used in WHERE clauses,\n when a table has doubled in size,\n when you note that a query becomes slow because the table order has changed, and you can see from EXPLAIN or ANALYZE FORMAT=JSON that the selectivity is wrong for a table,\n when the distribution of data in a table has changed significantly, for example, if you have loaded a batch of data or deleted a large amount of data.\n\nANALYZE isn’t useful for table columns of type UNIQUE, PRIMARY KEY, TIME, or CURRENT_TIME. In ANALYZE queries, you should omit columns of those types.\n\nEITS Statistics / PERSISTENT FOR\n\nOverview\n\nANALYZE TABLE supports engine-independent table statistics (EITS). See Engine-Independent Table Statistics: Collecting Statistics with the ANALYZE TABLE Statement for more information.\n\nYou can run the statement on all columns with this statement — however, be aware that this can take a long time for very large (500+ GB) tables:\n\n`sql\nANALYZE TABLE tbl PERSISTENT FOR ALL\n`\n\nFocusing on particular columns, the statement looks like this — it collects statistics only for the specified table columns:\n\n`sql\nANALYZE TABLE tbl PERSISTENT FOR COLUMS (column1, column2, ...) INDEXES (index1, ...)\n`\n\nFocusing on columns helps, among other things, avoid including BLOB columns, for which MariaDB doesn''t collect statistics.\n\nIt''s recommended to collect statistics for columns that do _not_ have an index starting from that column (if the index starts with a column, the index itself is used as a source for statistics), and which are used in WHERE conditions of your queries.\n\nQueries That Benefit\n\nQueries that benefit most are those where the query plan depends on the optimizer knowing condition selectivities, the most important ones being JOIN queries and those with an ORDER BY ... LIMIT clause. To benefit, the query must have a condition that may or may not be selective, for example:\n\n`sql\nSELECT \nFROM orders, customer\nWHERE\n       orders.o_custkey = customer.c_custkey  -- join condition\n  AND  customer.c_area = ''EMEA''  -- (1)\n  AND  orders.o_priority= ''URGENT'' -- (2)\n`\n\nHere, the optimizer benefits from knowing these statistics:\n\n1. Which fraction of customers are in the EMEA region?\n2. Which fraction of orders are URGENT?\n\nFor that situation, you can issue this statement:\n\n`sql\nANALYZE TABLE orders, customer PERSISTENT FOR ALL\n`\n\nEITS vs. InnoDB-Internal Statistics\n\nEITS (engine-independent table statistics) provide way more data than InnoDB-internal statistics. The downside is that EITS are never automatically updated, and it takes time to collect them.\n\nInnoDB statistics, on the other hand, provide less data, but they are automatically updated.\n\nControlling Statistics\n\nEngine-independent statistics can be controlled (enabled and disabled) using the use_stat_tables variable and the optimizer_use_condition_selectivity variable. InnoDB-persistent statistics are controlled with the innodb_stats_persistent variable (allowing you to turn InnoDB statistics on or off). Combining both kinds of statistics is possible.\n\nThe server relies on InnoDB statistics by default. That way, it can use some statistics even if ANALYZE TABLE is never run (or not often enough). This gives good enough results for the majority of queries. Some queries, however, need more statistical data so the optimizer can create a good plan. Slow queries indicate there aren''t enough statistical data. Those queries can be accelerated by running ANALYZE TABLE tbl PERSISTENT FOR ..., where tbl indicates a table used by a slow query. You can also run ANALYZE TABLE ... PERSISTENT FOR ALL, but that has a significant performance impact.\n\nUseful Variables\n\nThe following overview indicates when a particular variable was introduced. When multiple versions are given, it means variable options (like the default value) changed between the indicated versions.\n\n| Variable                                                                                                                                                  | Introduced in MariaDB version                                  | Description                                                                                                                                                                                                                                                                                                                                            |\n| --------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| analyze_max_length                | MariaDB 10.6.23 / 10.11.14 / 11.4.8 / 11.8.3 / 12.0.2 / 12.1.1 | Prevents the collection of column statistics for CHAR/VARCHAR columns that can be analyzed automatically by ANALYZE TABLE PERSISTENT. Columns exceeding this threshold in bytes will be skipped unless included explicitly in FOR COLUMNS(...)`. |\n| analyze_sample_percentage  | 10.4.3                                                         | Percentage of rows from the table ANALYZE TABLE will sample to collect table statistics. Set to 0 to let MariaDB decide what percentage of rows to sample.                                                                                                                                                                                             |\n| histogram_type                         | 10.4.3-11.0                                                    | Specifies the type of histograms created by ANALYZE. Options are #SINGLE_PREC_HB,DOUBLE_PREC_HB or JSON_HB.                                                                                                                                                                                                                                       |\n| histogram_size                         | 10.7                                                           | Number of bytes or buckets (in case of JSON_HB) used for storing the histogram. If set to 0, no histograms are created by ANALYZE.]]                                                                                                                                                                                                                  |\n| log_slow_admin_statements | 11.0.1                                                         | Log slow OPTIMIZE, ANALYZE, ALTER, and other administrative statements to the slow log if it is open. Deprecated. Use log_slow_filter instead.                                                                                    |\n| log_slow_filter                      | (all versions)                                                 | Having an admin in the log_slow_filter will add slow ANALYZE_TABLE statements to the slow log.                                                                                                                                                                                                                                                      |\n| sort_buffer_size                    | (all versions)                                                 | For calculating the number of duplicates, ANALYZE TABLE uses a buffer of sort_buffer_size bytes per column. You can slightly increase the speed of ANALYZE TABLE by increasing this variable.                                    |\n\nExamples\n--------\n\n-- update all engine-independent statistics for all columns and indexes\nANALYZE TABLE tbl PERSISTENT FOR ALL;\n\n-- update specific columns and indexes:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS (col1,col2,...) INDEXES (idx1,idx2,...);\n\n-- empty lists are allowed:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS (col1,col2,...) INDEXES ();\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS () INDEXES (idx1,idx2,...);\n\n-- the following will only update mysql.table_stats fields:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS () INDEXES ();\n\n-- when use_stat_tables is set to ''COMPLEMENTARY'' or ''PREFERABLY'', \n-- a simple ANALYZE TABLE  collects engine-independent statistics for all columns and indexes.\nSET SESSION use_stat_tables=''COMPLEMENTARY'';\nANALYZE TABLE tbl;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/table-statements/analyze-table', '', 'https://mariadb.com/docs/server/reference/sql-statements/table-statements/analyze-table');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (904, 35, 'CHECK TABLE', 'Syntax\n------\n\nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n\noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}\n\nDescription\n-----------\n\nCHECK TABLE checks a table or tables for errors. CHECK TABLE works for Archive, Aria, CSV, InnoDB, MyISAM, and, from MariaDB 12.0, Sequence tables. For Aria and MyISAM tables, the key statistics are updated as well. For CSV, see also Checking and Repairing CSV Tables.\n\nAs an alternative, myisamchk is a command-line tool for checking MyISAM tables when the tables are not being accessed. For Aria tables, there is a similar tool: aria_chk.\n\nFor checking dynamic columns'' integrity, COLUMN_CHECK() can be used.\n\nCHECK TABLE can also check views for problems, such as tables that are referenced in the view definition that no longer exist.\n\nCHECK TABLE is also supported for partitioned tables. You can use ALTER TABLE ... CHECK PARTITION to check one or more partitions.\n\nThe meaning of the different options is as follows - note that this can vary a bit between storage engines:\n\n| Option      | Explanation                                                                                                                                                                                                                                                                        |\n| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| FOR UPGRADE | Do a very quick check if the storage format for the table has changed so that one needs to do a REPAIR. This is only needed when one upgrades between major versions of MariaDB or MySQL. This is usually done by running mariadb-upgrade. |\n| FAST        | Only check tables that has not been closed properly or are marked as corrupt. Only supported by the MyISAM and Aria engines. For other engines the table is checked normally                                                                                                       |\n| CHANGED     | Check only tables that have changed since the last REPAIR / CHECK. Only supported by the MyISAM and Aria engines. For other engines, the table is checked normally.                                                                                                            |\n| QUICK       | Do a fast check. For MyISAM and Aria, this means skipping the check of the delete link chain, which may take some time.                                                                                                                                                            |\n| MEDIUM      | Scan also the data files. Checks the integrity between data and index files with checksums. In most cases, this should find all possible errors.                                                                                                                                   |\n| EXTENDED    | Does a full check to verify every possible error. For InnoDB, Aria, and MyISAM, verify for each row that all its keys exist, and for those index keys, they point back to the primary clustered key. This may take a long time on large tables.                                    |\n\nThe EXTENDED option is available to InnoDB, too.\n\nThe EXTENDED option is ignored by InnoDB.\n\nWhen the EXTENDED option is given, MariaDB also checks for referential integrity.\n\nMariaDB does not check for referential integrity, even if the EXTENDED option is given.\n\nFor most cases, running CHECK TABLE without options or MEDIUM should be good enough.\n\nThe Aria storage engine supports progress reporting for this statement.\n\nIf you want to know if two tables are identical, take a look at CHECKSUM TABLE.\n\nInnoDB\n\nIf CHECK TABLE finds an error in an InnoDB table, MariaDB might shut down to prevent the error propagation. In this case, the problem will be reported in the error log. Otherwise, the table or an index might be marked as corrupted, to prevent use. This does not happen with some minor problems, like a wrong number of entries in a secondary index. Those problems are reported in the output of CHECK TABLE.\n\nEach tablespace contains a header with metadata. This header is not checked by this statement.\n\nDuring the execution of CHECK TABLE, other threads may be blocked.\n\nExamples\n--------\n\nCHECK TABLE y EXTENDED;\n+--------+-------+----------+----------+\n| Table  | Op    | Msg_type | Msg_text |\n+--------+-------+----------+----------+\n| test.y | check | status   | OK       |\n+--------+-------+----------+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/table-statements/check-table', '', 'https://mariadb.com/docs/server/reference/sql-statements/table-statements/check-table');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (905, 35, 'CHECK VIEW', 'Syntax\n------\n\nCHECK VIEW view_name\n\nDescription\n-----------\n\nThe CHECK VIEW statement checks whether the view algorithm is correct. It is run as part of mariadb-upgrade, and should not normally be required in regular use.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/table-statements/check-view', '', 'https://mariadb.com/docs/server/reference/sql-statements/table-statements/check-view');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (906, 35, 'CHECKSUM TABLE', 'Syntax\n------\n\nCHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]\n\nDescription\n-----------\n\nCHECKSUM TABLE reports a table checksum. This is very useful if you want to know if two tables are the same (for example on a master and a slave).\n\nWith QUICK, the live table checksum is reported if it is available, or NULL otherwise. This is very fast. A live checksum is enabled by specifying the CHECKSUM=1 table option when you create the table; currently, this is supported only for Aria and MyISAM tables.\n\nWith EXTENDED, the entire table is read row by row and the checksum is calculated. This can be very slow for large tables.\n\nIf neither QUICK nor EXTENDED is specified, MariaDB returns a live checksum if the table storage engine supports it and scans the table otherwise.\n\nCHECKSUM TABLE requires the SELECT privilege for the table.\n\nFor a nonexistent table, CHECKSUM TABLE returnsNULL and generates a warning.\n\nThe table row format affects the checksum value. If the row format changes, the checksum will change. This means that when a table created with a MariaDB/MySQL version is upgraded to another version, the checksum value will probably change.\n\nTwo identical tables should always match to the same checksum value; however, also for non-identical tables there is a very slight chance that they will return the same value as the hashing algorithm is not completely collision-free.\n\nIdentical Tables\n\nIdentical tables mean that the CREATE statement is identical and that the following variable, which affects the storage formats, was the same when the tables were created:\n\n* mysql56-temporal-format\n\nDifferences Between MariaDB and MySQL\n\nCHECKSUM TABLE may give a different result as MariaDB doesn''t ignore NULLs in the columns like MySQL 5.1 does (later MySQL versions should calculate checksums the same way as MariaDB).\n\nYou can get the ''old style'' checksum in MariaDB by setting old_mode to COMPAT_5_1_CHECKSUM. Note, however, that the MyISAM and Aria storage engines in MariaDB are using the new checksum internally, so if you are using this old mode, the CHECKSUM command will be slower as it needs to calculate the checksum row by row.\n\nYou can get the ''old style'' checksum in MariaDB by starting mariadbd with the --old option. Note, however, that the MyISAM and Aria storage engines in MariaDB are using the new checksum internally, so if you are using this old mode, the CHECKSUM command will be slower as it needs to calculate the checksum row by row.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/table-statements/checksum-table', '', 'https://mariadb.com/docs/server/reference/sql-statements/table-statements/checksum-table');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (907, 35, 'BACKUP TABLE (removed)', 'Syntax\n------\n\nBACKUP TABLE tbl_name [, tbl_name] ... TO ''/path/to/backup/directory''\n\nDescription\n-----------\n\nNote: Like RESTORE TABLE, this command was not reliable and has been removed in current versions of MariaDB.\n\nFor doing a backup of MariaDB use mysqldump or MariaDB Backup. See Backing Up and Restoring.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/table-statements/obsolete-table-commands/backup-table-removed', '', 'https://mariadb.com/docs/server/reference/sql-statements/table-statements/obsolete-table-commands/backup-table-removed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (908, 35, 'RESTORE TABLE (removed)', 'Syntax\n------\n\nRESTORE TABLE tbl_name [, tbl_name] ... FROM ''/path/to/backup/directory''\n\nDescription\n-----------\n\nNote:\n\nLike BACKUP TABLE, this command was not reliable and has been removed from MariaDB. For doing a backup of MariaDB use mysqldump, mysqlhotcopy or XtraBackup. See Backing Up and Restoring.\n\nRESTORE TABLE restores the table or tables from a backup that was made with BACKUP TABLE. The\\\ndirectory should be specified as a full path name.\n\nExisting tables are not overwritten; if you try to restore over an existing table, an error occurs. Just as for BACKUP TABLE,RESTORE TABLE works only for MyISAM tables. Restored tables are not replicated from master to slave.\n\nThe backup for each table consists of its .frm format file and .MYD data file. The restore operation restores those files, and then uses them to rebuild the .MYI index file. Restoring takes longer than\\\nbacking up due to the need to rebuild the indexes. The more indexes the table has, the longer it takes.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/table-statements/obsolete-table-commands/restore-table-removed', '', 'https://mariadb.com/docs/server/reference/sql-statements/table-statements/obsolete-table-commands/restore-table-removed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (909, 35, 'REPAIR TABLE', 'Syntax\n------\n\nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n    tbl_name [, tbl_name] ...\n    [QUICK] [EXTENDED] [USE_FRM] FORCE\n\nDescription\n-----------\n\nREPAIR TABLE repairs a possibly corrupted table. By default, it has the same effect as\n\n``sql\nmyisamchk --recover tbl_name\n`\n\nor\n\n`sql\naria_chk --recover tbl_name\n`\n\nSee [aria_chk and myisamchk for more.\n\nREPAIR TABLE works for Archive, Aria, CSV, and MyISAM tables. For InnoDB, see recovery modes. For CSV, see also Checking and Repairing CSV Tables. For Archive, this statement also improves compression. If the storage engine does not support this statement, a warning is issued.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBy default, REPAIR TABLE statements are written to the binary log and will be replicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the statement is not written to the binary log.\n\nREPAIR TABLE statements are not logged to the binary log if read_only is set. See also Read-Only Slaves.\n\nREPAIR TABLE statements are logged to the binary log.\n\nWhen an index is recreated, the storage engine may use a configurable buffer in the process. Incrementing the buffer speeds up the index creation. Aria and MyISAM allocate a buffer whose size is defined by aria_sort_buffer_size or myisam_sort_buffer_size, also used for ALTER TABLE.\n\nQUICK\n\nWhen specified, REPAIR TABLE will not modify the data file, only attempting to repair the index file. The same behavior can be achieved with myisamchk --recover --quick.\n\nEXTENDED\n\nCreates the index row by row rather than sorting and creating a single index. Similar to myisamchk --safe-recover.\n\nUSE_FRM\n\nFor use only when the index file is missing or its header corrupted. MariaDB then attempts to recreate it using the .frm file. There is no equivalent myisamchk option.\n\nFORCE\n\nThe FORCE argument allows to first run internal repair to fix damaged blocks and then follow it up with ALTER TABLE (MDEV-33449).\n\nThe FORCE option is not available.\n\nPartitioned Tables\n\nREPAIR TABLE is also supported for partitioned tables with the ALTER TABLE ... REPAIR PARTITION statement. However, the USE_FRM` option cannot be used with this statement on a partitioned table. See Repairing Partitions for details.\n\nProgress Reporting\n\nThe Aria storage engine supports progress reporting for this statement.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/table-statements/repair-table', '', 'https://mariadb.com/docs/server/reference/sql-statements/table-statements/repair-table');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (910, 35, 'REPAIR VIEW', 'Syntax\n------\n\nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] VIEW  view_name[, view_name] ... [FROM MYSQL]\n\nDescription\n-----------\n\nThe REPAIR VIEW statement checks whether the view algorithm is correct. It is run as part of mariadb-upgrade, and should not normally be required in regular use.\n\nBy default it corrects the checksum and if necessary adds the mariadb-version field. If the optional FROM MYSQL clause is used, and no mariadb-version field is present, the MERGE and TEMPTABLE algorithms are toggled.\n\nBy default, REPAIR VIEW statements are written to the binary log and will be replicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the statement is not written to the binary log.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/table-statements/repair-view', '', 'https://mariadb.com/docs/server/reference/sql-statements/table-statements/repair-view');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (911, 35, 'TRUNCATE TABLE', 'Syntax\n------\n\nTRUNCATE [TABLE] tbl_name\n  [WAIT n | NOWAIT]\n\nDescription\n-----------\n\nTRUNCATE TABLE empties a table completely. It requires the DROP privilege. See GRANT.\n\ntbl_name can also be specified in the form db_name.tbl_name (see Identifier Qualifiers).\n\nLogically, TRUNCATE TABLE is equivalent to a DELETE statement that deletes all rows, but there are practical differences under some circumstances.\n\nTRUNCATE TABLE will fail for an InnoDB table if any FOREIGN KEY constraints from other tables reference the table, returning the error:\n\n``sql\nERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint\n`\n\nForeign Key constraints between columns in the same table are permitted.\n\nFor an InnoDB table, if there are no FOREIGN KEY constraints, InnoDB performs fast truncation by dropping the original table and creating an empty one with the same definition, which is much faster than deleting rows one by one. The AUTO_INCREMENT counter is reset by TRUNCATE TABLE, regardless of whether there is a FOREIGN KEY constraint.\n\nThe count of rows affected by TRUNCATE TABLE is accurate only when it is mapped to a DELETE statement.\n\nFor other storage engines, TRUNCATE TABLE differs fromDELETE in the following ways:\n\n Truncate operations drop and re-create the table, which is much faster than deleting rows one by one, particularly for large tables.\n Truncate operations cause an implicit commit.\n Truncation operations cannot be performed if the session holds an active table lock.\n Truncation operations do not return a meaningful value for the number of deleted rows. The usual result is "0 rows affected," which should be interpreted as "no information."\n As long as the table format file tbl_name.frm is valid, the table can be re-created as an empty table with TRUNCATE TABLE, even if the data or index files have become corrupted.\n The table handler does not remember the last used AUTO_INCREMENT value, but starts counting\\\n  from the beginning. This is true even for MyISAM and InnoDB, which normally do not reuse sequence values.\n When used with partitioned tables, TRUNCATE TABLE preserves the partitioning; that is, the data and index files are dropped and re-created, while the partition definitions (.par) file is unaffected.\n Since truncation of a table does not make any use of DELETE, the TRUNCATE statement does not invoke ON DELETE triggers.\n* TRUNCATE TABLE will only reset the values in the Performance Schema summary tables to zero or null, and will not remove the rows.\n\nFor the purposes of binary logging and replication, TRUNCATE TABLE is treated as DROP TABLE followed by CREATE TABLE (DDL rather than DML).\n\nTRUNCATE TABLE does not work on views. Currently, TRUNCATE TABLE drops all historical records from a system-versioned table.\n\nWAIT/NOWAIT\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nOracle-mode\n\nOracle-mode permits the optional keywords REUSE STORAGE or DROP STORAGE to be used.\n\n`sql\nTRUNCATE [TABLE] tbl_name [{DROP | REUSE} STORAGE] [WAIT n | NOWAIT]\n`\n\nThese have no effect on the operation.\n\nPerformance\n\nTRUNCATE TABLE is faster than DELETE, because it drops and re-creates a table.\n\nWith InnoDB, TRUNCATE TABLE is slower if innodb_file_per_table=ON is set (the default). This is because TRUNCATE TABLE unlinks the underlying tablespace file, which can be an expensive operation. See MDEV-8069 for more details.\n\nThe performance issues with innodb_file_per_table=ON can be exacerbated in cases where the InnoDB buffer pool is very large and innodb_adaptive_hash_index=ON is set. In that case, using DROP TABLE followed by CREATE TABLE instead of TRUNCATE TABLE may perform better. Setting innodb_adaptive_hash_index=OFF can also help.\n\nSetting innodb_adaptive_hash_index=OFF can also improve TRUNCATE TABLE` performance in general. See MDEV-16796 for more details.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/table-statements/truncate-table', '', 'https://mariadb.com/docs/server/reference/sql-statements/table-statements/truncate-table');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (912, 8, 'COMMIT', 'Description\n-----------\n\nThe COMMIT statement ends a transaction, saving any changes to the data so that they become visible to subsequent transactions. Also, unlocks metadata changed by current transaction. If autocommit is set to 1, an implicit commit is performed after each statement. Otherwise, all transactions which don''t end with an explicit COMMIT are implicitly rollbacked and the changes are lost. The ROLLBACK statement can be used to do this explicitly.\n\nThe required syntax for the COMMIT statement is as follows:\n\n``sql\nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\n`\n\nCOMMIT is the more important transaction terminator, as well as the more interesting one. The basic form of the COMMIT statement is simply the keyword COMMIT (the keyword WORK is simply noise and can be omitted without changing the effect).\n\nThe optional AND CHAIN clause is a convenience for initiating a new transaction as soon as the old transaction terminates. If AND CHAIN is specified, then there is effectively nothing between the old and new transactions, although they remain separate. The characteristics of the new transaction will be the same as the characteristics of the old one — that is, the new transaction will have the same access mode, isolation level and diagnostics area size (we''ll discuss all of these shortly) as the transaction just terminated.\n\nRELEASE tells the server to disconnect the client immediately after the current transaction.\n\nThere are NO RELEASE and AND NO CHAIN options. By default, commits do not RELEASE or CHAIN, but it''s possible to change this default behavior with the completion_type server system variable. In this case, the AND NO CHAIN and NO RELEASE` options override the server default.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/commit', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/commit');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (913, 8, 'LOCK TABLES', 'Syntax\n------\n\nLOCK TABLE[S]\n    tbl_name [[AS] alias] lock_type\n    [, tbl_name [[AS] alias] lock_type] ...\n    [WAIT n|NOWAIT]\n\nlock_type:\n    READ [LOCAL]\n  | [LOW_PRIORITY] WRITE\n  | WRITE CONCURRENT\n\nUNLOCK TABLES\n\nDescription\n-----------\n\nThe _lock_type_ can be one of:\n\n| Option              | Description                                                                                                  |\n| ------------------- | ------------------------------------------------------------------------------------------------------------ |\n| READ                | Read lock, no writes allowed                                                                                 |\n| READ LOCAL          | Read lock, but allow concurrent inserts |\n| WRITE               | Exclusive write lock. No other connections can read or write to this table                                   |\n| LOW_PRIORITY WRITE | Exclusive write lock, but allow new read locks on the table until we get the write lock.                     |\n| WRITE CONCURRENT    | Exclusive write lock, but allow READ LOCAL locks to the table.                                               |\n\nMariaDB enables client sessions to acquire table locks explicitly for the purpose of cooperating with other sessions for access to tables, or to prevent other sessions from modifying tables during periods when a session requires exclusive access to them. A session can acquire or release locks only for itself. One session cannot acquire locks for another session or release locks held by another session.\n\nLocks may be used to emulate transactions or to get more speed when updating tables.\n\nLOCK TABLES explicitly acquires table locks for the current client session. Table locks can be acquired for base tables or views. To use LOCK TABLES, you must have the LOCK TABLES privilege, and the SELECT privilege for each object to be locked. See GRANT.\n\nFor view locking, LOCK TABLES adds all base tables used in the view to the set of tables to be locked and locks them automatically. If you lock a table explicitly with LOCK TABLES, any tables used in triggers are also locked implicitly, as described in Triggers and Implicit Locks.\n\nUNLOCK TABLES explicitly releases any table locks held by the current session.\n\nAliases\n\nAliases need to correspond to the aliases used in prior SQL statements in the session. For example:\n\n``sql\nLOCK TABLE t1 AS t1_alias1 READ;\n\nSELECT  FROM t1;\nERROR 1100 (HY000): Table ''t1'' was not locked with LOCK TABLES\n\nSELECT  FROM t1 AS t1_alias2;\nERROR 1100 (HY000): Table ''t1_alias2'' was not locked with LOCK TABLES\n\nSELECT  FROM t1 AS t1_alias1;\n`\n\nWAIT/NOWAIT\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nLimitations\n\n LOCK TABLES doesn''t work when using Galera cluster. You may experience crashes or locks when used with Galera.\n LOCK TABLES works on XtraDB/InnoDB tables only if the innodb_table_locks system variable is set to 1 (the default) and autocommit is set to 0 (1 is default). Please note that no error message will be returned on LOCK TABLES with innodb_table_locks = 0.\n LOCK TABLES implicitly commits the active transaction, if any. Also, starting a transaction always releases all table locks acquired with LOCK TABLES. This means that there is no way to have table locks and an active transaction at the same time. The only exceptions are the transactions in autocommit mode. To preserve the data integrity between transactional and non-transactional tables, the GET_LOCK() function can be used.\n When using LOCK TABLES on a TEMPORARY table, it will always be locked with a WRITE lock.\n While a connection holds an explicit read lock on a table, it cannot modify it. If you try, the following error will be produced:\n\n`sql\nERROR 1099 (HY000): Table ''tab_name'' was locked with a READ lock and can''t be updated\n`\n\n While a connection holds an explicit lock on a table, it cannot access a non-locked table. If you try, the following error will be produced:\n\n`sql\nERROR 1100 (HY000): Table ''tab_name'' was not locked with LOCK TABLES\n`\n\n While a connection holds an explicit lock on a table, it cannot issue the following: INSERT DELAYED, CREATE TABLE, CREATE TABLE ... LIKE, and DDL statements involving stored programs and views (except for triggers). If you try, the following error will be produced:\n\n`sql\nERROR 1192 (HY000): Can''t execute the given command because you have active locked tables or an active transaction\n`\n\n* LOCK TABLES can not be used in stored routines - if you try, the following error will be produced on creation:\n\n`sql\nERROR 1314 (0A000): LOCK is not allowed in stored procedures\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/lock-tables', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/lock-tables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (914, 8, 'Metadata Locking', 'Description\n-----------\n\nMariaDB supports metadata locking. This means that when a transaction (including XA transactions) uses a table, it locks its metadata until the end of transaction. Non-transactional tables are also locked, as well as views and objects which are related to locked tables/views (stored functions, triggers, etc). When a connection tries to use a DDL statement (like an ALTER TABLE) which modifies a table that is locked, that connection is queued, and has to wait until it''s unlocked. Using savepoints and performing a partial rollback does not release metadata locks.\n\nLOCK TABLES ... WRITE are also queued. Some wrong statements which produce an error may not need to wait for the lock to be freed.\n\nThe metadata lock''s timeout is determined by the value of the lock_wait_timeout server system variable (in seconds). However, note that its default value is 31536000 (1 year). If this timeout is exceeded, the following error is returned:\n\n``sql\nERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction\n`\n\nIf the metadata_lock_info plugin is installed, the Information Schema metadata_lock_info table stores information about existing metadata locks.\n\nThe Performance Schema metadata_locks table contains metadata lock information.\n\nExample\n\nLet''s use the following MEMORY (non-transactional) table:\n\n`sql\nCREATE TABLE t (a INT) ENGINE = MEMORY;\n`\n\nConnection 1 starts a transaction, and INSERTs a row into t:\n\n`sql\nSTART TRANSACTION;\n\nINSERT INTO t SET a=1;\n`\n\nt''s metadata is now locked by connection 1. Connection 2 tries to alter t, but has to wait:\n\n`sql\nALTER TABLE t ADD COLUMN b INT;\n`\n\nConnection 2''s prompt is blocked now.\n\nNow connection 1 ends the transaction:\n\n`sql\nCOMMIT;\n`\n\n...and connection 2 finally gets the output of its command:\n\n`sql\nQuery OK, 1 row affected (35.23 sec)\nRecords: 1  Duplicates: 0  Warnings: 0\n``\n\nThe Performance Schema metadata_locks table does not contain metadata lock information.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/metadata-locking', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/metadata-locking');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (915, 8, 'ROLLBACK', 'Description\n-----------\n\nThe ROLLBACK statement rolls back (ends) a transaction, destroying any changes to SQL-data so that they never become visible to subsequent transactions. The required syntax for the ROLLBACK statement is as follows.\n\n``sql\nROLLBACK [ WORK ] [ AND [ NO ] CHAIN ] \n[ TO [ SAVEPOINT ] {<savepoint name> | <simple target specification>} ]\n`\n\nThe ROLLBACK statement will either end a transaction, destroying all data changes that happened during any of the transaction, or it will just destroy any data changes that happened since you established a savepoint. The basic form of the ROLLBACK statement is just the keyword ROLLBACK (the keyword WORK is simply noise and can be omitted without changing the effect).\n\nThe optional AND CHAIN clause is a convenience for initiating a new transaction as soon as the old transaction terminates. If AND CHAIN is specified, then there is effectively nothing between the old and new transactions, although they remain separate. The characteristics of the new transaction will be the same as the characteristics of the old one — that is, the new transaction will have the same access mode, isolation level and diagnostics area size (we''ll discuss all of these shortly) as the transaction just terminated. The AND NO CHAIN option just tells your DBMS to end the transaction — that is, these four SQL statements are equivalent:\n\n`sql\nROLLBACK; \nROLLBACK WORK; \nROLLBACK AND NO CHAIN; \nROLLBACK WORK AND NO CHAIN;\n`\n\nAll of them end a transaction without saving any transaction characteristics. The only other options, the equivalent statements ...\n\n`sql\nROLLBACK AND CHAIN;\nROLLBACK WORK AND CHAIN;\n`\n\n... both tell your DBMS to end a transaction, but to save that transaction''s characteristics for the next transaction.\n\nROLLBACK is much simpler than COMMIT: it may involve no more than a few deletions (of Cursors, locks, prepared SQL statements and log-file entries). It''s usually assumed that ROLLBACK can''t fail, although such a thing is conceivable (for example, an encompassing transaction might reject an attempt to ROLLBACK because it''s lining up for a COMMIT).\n\nROLLBACK cancels all effects of a transaction. It does not cancel effects on objects outside the DBMS''s control (for example the values in host program variables or the settings made by some SQL/CLI function calls). But in general, it is a convenient statement for those situations when you say "oops, this isn''t working" or when you simply don''t care whether your temporary work becomes permanent or not.\n\nHere is a moot question. If all you''ve been doing is SELECTs, so that there have been no data changes, should you end the transaction with ROLLBACK or COMMIT? It shouldn''t really matter because both ROLLBACK and COMMIT do the same transaction-terminating job. However, the popular conception is that ROLLBACK implies failure, so after a successful series of SELECT statements the convention is to end the transaction with COMMIT rather than ROLLBACK.\n\nMariaDB (and most other DBMSs) supports rollback of SQL-data change statements, but not of SQL-Schema statements. This means that if you use any of CREATE, ALTER, DROP, GRANT, REVOKE, you are implicitly committing at execution time.\n\n`sql\nINSERT INTO Table_2 VALUES(5); \nDROP TABLE Table_3 CASCADE; \nROLLBACK;\n`\n\nThe result will be that both the INSERT and the DROP will go through as separate transactions so the ROLLBACK` will have no effect.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/rollback', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/rollback');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (916, 8, 'SAVEPOINT', 'Syntax\n------\n\nSAVEPOINT identifier\nROLLBACK [WORK] TO [SAVEPOINT] identifier\nRELEASE SAVEPOINT identifier\n\nDescription\n-----------\n\nInnoDB supports the SQL statements SAVEPOINT,ROLLBACK TO SAVEPOINT, RELEASE SAVEPOINT\\\nand the optional WORK keyword forROLLBACK.\n\nEach savepoint must have a legal MariaDB identifier. A savepoint is a named sub-transaction.\n\nNormally ROLLBACK undoes the changes performed by the whole transaction. When used with the TO clause, it undoes the changes performed after the specified savepoint, and erases all subsequent savepoints. However, all locks that have been acquired after the save point will survive. RELEASE SAVEPOINT does not rollback or commit any changes, but removes the specified savepoint.\n\nWhen the execution of a trigger or a stored function begins, it is not possible to use statements which reference a savepoint which was defined from out of that stored program.\n\nWhen a COMMIT (including implicit commits) or a ROLLBACK statement (with no TO clause) is performed, they act on the whole transaction, and all savepoints are removed.\n\nErrors\n\nIf COMMIT or ROLLBACK is issued and no transaction was started, no error is reported.\n\nIf SAVEPOINT is issued and no transaction was started, no error is reported but no savepoint is created. When ROLLBACK TO SAVEPOINT or RELEASE SAVEPOINT is called for a savepoint that does not exist, an error like this is issued:\n\n``sql\nERROR 1305 (42000): SAVEPOINT svp_name does not exist\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/savepoint', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/savepoint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (917, 8, 'SET TRANSACTION', 'Syntax\n------\n\nSET [GLOBAL | SESSION] TRANSACTION\n    transaction_property [, transaction_property] ...\n\ntransaction_property:\n    ISOLATION LEVEL level\n  | READ WRITE\n  | READ ONLY\n\nlevel:\n     REPEATABLE READ\n   | READ COMMITTED\n   | READ UNCOMMITTED\n   | SERIALIZABLE\n\nDescription\n-----------\n\nThis statement sets the transaction isolation level or the transaction access mode globally, for the current session, or for the next transaction:\n\n With the GLOBAL keyword, the statement sets the default transaction level globally for all subsequent sessions. Existing sessions are unaffected.\n With the SESSION keyword, the statement sets the default transaction level for all subsequent transactions performed within the current session.\n Without any SESSION or GLOBAL keyword, the statement sets the isolation level for only the next (not started) transaction performed within the current session. After that it reverts to using the session value.\n\nA change to the global default isolation level requires the SUPER privilege. Any session is free to change its session isolation level (even in the middle of a transaction), or the isolation level for its next transaction.\n\nIsolation Level\n\nTo set the global default isolation level at server startup, use the --transaction-isolation=level option on the command line or in an option file. Values of level for this option use dashes rather than spaces, so the allowable values are READ_UNCOMMITTED,READ-COMMITTED, REPEATABLE-READ, or SERIALIZABLE. For example, to set the default isolation level to REPEATABLE READ, use these lines in the [mariadb] section of an option file:\n\n``ini\n[mariadb]\ntransaction-isolation = REPEATABLE-READ\n`\n\nTo determine the global and session transaction isolation levels at runtime, check the value of the transaction_isolation variable.\n\nTo determine the global and session transaction isolation levels at runtime, check the value of the tx_isolation system variable.\n\n`sql\nSELECT @@GLOBAL.transaction_isolation, @@tx_isolation;\n`\n\nInnoDB supports each of the translation isolation levels described here using different locking strategies. The default level isREPEATABLE READ. For additional information about InnoDB record-level locks and how it uses them to execute various types of statements, see InnoDB Lock Modes, and innodb-locks-set.html.\n\nIsolation Levels\n\nThe following sections describe how MariaDB supports the different transaction levels.\n\nREAD UNCOMMITTED\n\nSELECT statements are performed in a non-locking fashion, but a possible earlier version of a row might be used. Thus, using this isolation level, such reads are not consistent. This is also called a "dirty read". Otherwise, this isolation level works likeREAD COMMITTED.\n\nREAD COMMITTED\n\nA somewhat Oracle-like isolation level with respect to consistent (non-locking) reads: Each consistent read, even within the same transaction, sets and reads its own fresh snapshot. See innodb-consistent-read.html.\n\nFor locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE), InnoDB locks only index records, not the gaps before them, and thus allows the free insertion of new records next to locked records. For UPDATE and DELETE statements, locking depends on whether the statement uses a unique index with a unique search condition (such as WHERE id = 100), or a range-type search condition (such as WHERE id > 100). For a unique index with a unique search condition, InnoDB locks only the index record found, not the gap before it. For range-type searches, InnoDB locks the index range scanned, using gap locks or next-key (gap plus index-record) locks to block insertions by other sessions into the gaps covered by the range. This is necessary because "phantom rows" must be blocked for MariaDB replication and recovery to work.\n\nIf the READ COMMITTED isolation level is used or the innodb_locks_unsafe_for_binlog system variable is enabled, there is no InnoDB gap locking except for foreign-key constraint checking and\\\nduplicate-key checking. Also, record locks for non-matching rows are released after MariaDB has evaluated the WHERE condition. If you use READ COMMITTED or enable innodb_locks_unsafe_for_binlog, you must use row-based binary logging.\n\nRows that don''t match are not being locked in a so called semiconsistent read. This means you might see only a partially consistent read when the transaction isolation level is READ COMMITTED or READ UNCOMMITTED.\n\n(A semiconsistent read applies to UPDATE and DELETE statements. Those statements skip locked rows, provided the version in the current read does not match the WHERE condition. Also, if the latest version of a record was successfully locked, but found not to match the condition, the lock is released.)\n\nREPEATABLE READ\n\nThis is the default isolation level for InnoDB. For consistent reads, there is an important difference from the READ COMMITTED isolation level: All consistent reads within the same transaction read the\\\nsnapshot established by the first read. This convention means that if you issue several plain (non-locking) SELECT statements within the same transaction, these SELECT statements are consistent\\\nalso with respect to each other. See innodb-consistent-read.html.\n\nFor locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE), UPDATE, and DELETE statements, locking depends on whether the statement uses a unique index with a unique search condition, or a range-type search condition. MariaDB does not relax the gap locking for unique indexes.\n\nFor locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE), UPDATE, and DELETE statements, locking depends on whether the statement uses a unique index with a unique search condition, or a range-type search condition. For a unique index with a unique search condition, InnoDB locks only the index record found, not the gap before it.\n\nFor other search conditions, InnoDB locks the index range scanned, using gap locks or next-key (gap plus index-record) locks to block insertions by other sessions into the gaps covered by the range.\n\nThis is the minimum isolation level for non-distributed XA transactions.\n\nSnapshot Isolation and DML Operations\n\nThis behavior is available from MariaDB 11.6.2 and 12.3.\n\nThe innodb_snapshot_isolation system variable is enabled by default. This introduces a stricter enforcement of REPEATABLE READ for UPDATE and DELETE statements:<br>\n\n Conflict Detection: If an UPDATE or DELETE attempts to modify a row that has been changed by a concurrent transaction since your snapshot was established, the operation is rejected.\n ER_CHECKREAD (1020): This rejection triggers error ER_CHECKREAD. The revised error message suggests that the user should try restarting the transaction.\n Automatic Rollback: Unlike a simple statement error, ER_CHECKREAD is treated similarly to a deadlock: the entire transaction is rolled back.\n* Purpose: This prevents the transaction from switching to "current-read" mode for that row, which would otherwise allow the transaction to observe concurrent changes it did not make, violating the pure repeatable read invariant.\n\nTraditional Locking Behavior\n\nIf innodb_snapshot_isolation is disabled (set to OFF), InnoDB follows traditional behavior where locking reads (SELECT ... FOR UPDATE), UPDATE, and DELETE statements read the latest committed version of rows. In this mode, subsequent non-locking SELECT statements for those same rows also return the current version rather than the snapshot version, which can lead to non-repeatable read anomalies.\n\nSERIALIZABLE\n\nThis level is like REPEATABLE READ, but InnoDB implicitly converts all plain SELECT statements to SELECT ... LOCK IN SHARE MODE if autocommit is disabled. If autocommit is enabled, the SELECT is its own transaction. It therefore is known to be read only and can be serialized if performed as a consistent (non-locking) read and need not block for other transactions. (This means that to force a plain SELECT to block if other transactions have modified the selected rows, you should disable autocommit.)\n\nDistributed XA transactions should always use this isolation level.\n\ninnodb_snapshop_isolation\n\nIf the innodb_snapshot_isolation system variable is not set to ON, strictly-speaking anything other than READ UNCOMMITTED is not clearly defined. innodb_snapshot_isolation defaults to OFF for backwards compatibility. Setting to ON will result in attempts to acquire a lock on a record that does not exist in the current read view raising an error, and the transaction being rolled back.\n\nIf the innodb_snapshot_isolation system variable is not set to ON, strictly-speaking anything other than READ UNCOMMITTED is not clearly defined.\n\nAccess Mode\n\nThe access mode specifies whether the transaction is allowed to write data or not. By default, transactions are in READ WRITE mode (see the tx_read_only system variable). READ ONLY mode allows the storage engine to apply optimizations that cannot be used for transactions which write data. Note that, unlike the global read_only mode, the READ_ONLY ADMIN privilege doesn''t allow writes, and DDL statements on temporary tables are not allowed either.\n\nThe access mode specifies whether the transaction is allowed to write data or not. By default, transactions are in READ WRITE mode (see the tx_read_only system variable). READ ONLY mode allows the storage engine to apply optimizations that cannot be used for transactions which write data. Note that, unlike the global read_only mode, the SUPER privilege doesn''t allow writes, and DDL statements on temporary tables are not allowed either.\n\nIt is not permitted to specify both READ WRITE and READ ONLY in the same statement.\n\nREAD WRITE and READ ONLY` can also be specified in the START TRANSACTION statement, in which case the specified mode is only valid for one transaction.\n\nExamples\n--------\n\nSET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/set-transaction', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/set-transaction');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (918, 8, 'SQL statements Causing an Implicit Commit', 'Description\n-----------\n\nSome SQL statements cause an implicit commit. As a rule of thumb, such statements are DDL statements. The same statements (except for SHUTDOWN) produce a 1400 error (SQLSTATE ''XAE09'') if a XA transaction is in effect.\n\nHere is the list:\n\n``sql\nALTER DATABASE ... UPGRADE DATA DIRECTORY NAME\nALTER EVENT\nALTER FUNCTION\nALTER PROCEDURE\nALTER SEQUENCE\nALTER SERVER\nALTER TABLE\nALTER VIEW\nANALYZE TABLE\nBEGIN\nCACHE INDEX\nCHANGE MASTER TO\nCHECK TABLE\nCREATE DATABASE\nCREATE EVENT\nCREATE FUNCTION\nCREATE INDEX\nCREATE PROCEDURE\nCREATE ROLE\nCREATE SEQUENCE\nCREATE SERVER\nCREATE TABLE\nCREATE TRIGGER\nCREATE USER\nCREATE VIEW\nDROP DATABASE\nDROP EVENT\nDROP FUNCTION\nDROP INDEX\nDROP PROCEDURE\nDROP ROLE\nDROP SEQUENCE\nDROP SERVER\nDROP TABLE\nDROP TRIGGER\nDROP USER\nDROP VIEW\nFLUSH\nGRANT\nLOAD INDEX INTO CACHE\nLOCK TABLES\nOPTIMIZE TABLE\nRENAME TABLE\nRENAME USER\nREPAIR TABLE\nRESET\nREVOKE\nSET PASSWORD\nSHUTDOWN\nSTART SLAVE\nSTART TRANSACTION\nSTOP SLAVE\nTRUNCATE TABLE\n`\n\nSET autocommit = 1 causes an implicit commit if the value was 0.\n\nAll these statements cause an implicit commit before execution. This means that, even if the statement fails with an error, the transaction is committed. Some of them, like CREATE TABLE ... SELECT, also cause a commit immediatly after execution. Such statements couldn''t be rollbacked in any case.\n\nIf you are not sure whether a statement has implicitly committed the current transaction, you can query the in_transaction server system variable.\n\nNote that when a transaction starts (not in autocommit mode), all locks acquired with LOCK TABLES are released. And acquiring such locks always commits the current transaction. To preserve the data integrity between transactional and non-transactional tables, the GET_LOCK() function can be used.\n\nExceptions\n\nThese statements do not cause an implicit commit in the following cases:\n\n CREATE TABLE and DROP TABLE, when the TEMPORARY` keyword is used.\n   However, TRUNCATE TABLE causes an implicit commit even when used on a temporary table.\n CREATE FUNCTION and DROP FUNCTION, when used to create a UDF (instead of a stored function). However, CREATE INDEX and DROP INDEX cause commits even when used with temporary tables.\n UNLOCK TABLES causes a commit only if a LOCK TABLES was used on non-transactional tables.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/sql-statements-that-cause-an-implicit-commit', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/sql-statements-that-cause-an-implicit-commit');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (919, 8, 'START TRANSACTION', 'Syntax\n------\n\nSTART TRANSACTION [transaction_property [, transaction_property] ...] | BEGIN [WORK]\nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nSET autocommit = {0 | 1}\n\ntransaction_property:\n    WITH CONSISTENT SNAPSHOT\n  | READ WRITE\n  | READ ONLY\n\nDescription\n-----------\n\nThe START TRANSACTION or BEGIN statement begins a new transaction. COMMIT commits the current transaction, making its changes permanent. ROLLBACK rolls back the current transaction, canceling its changes. The SET autocommit statement disables or enables the default autocommit mode for the current session.\n\nSTART TRANSACTION and SET autocommit = 1 implicitly commit the current transaction, if there is one.\n\nThe optional WORK keyword is supported forCOMMIT and ROLLBACK, as are theCHAIN and RELEASE clauses.CHAIN and RELEASE can be used for additional control over transaction completion. The value of the completion_type system variable determines the default completion behavior.\n\nThe AND CHAIN clause causes a new transaction to begin as soon as the current one ends, and the new transaction has the same isolation level as the just-terminated transaction. The RELEASE clause causes the server to disconnect the current client session after terminating the current transaction. Including the NO keyword suppressesCHAIN or RELEASE completion, which can be useful if the completion_type system variable is set to cause chaining or release completion by default.\n\nAccess Mode\n\nThe access mode specifies whether the transaction is allowed to write data or not. By default, transactions are in READ WRITE mode (see the tx_read_only system variable). READ ONLY mode allows the storage engine to apply optimizations that cannot be used for transactions which write data. Note that, unlike the global read_only mode, the READ_ONLY ADMIN privilege doesn''t allow writes and DDL statements on temporary tables are not allowed either.\n\nThe access mode specifies whether the transaction is allowed to write data or not. By default, transactions are in READ WRITE mode (see the tx_read_only system variable). READ ONLY mode allows the storage engine to apply optimizations that cannot be used for transactions which write data. Note that, unlike the global read_only mode, the SUPER privilege doesn''t allow writes and DDL statements on temporary tables are not allowed either.\n\nIt is not permitted to specify both READ WRITE and READ ONLY in the same statement.\n\nREAD WRITE and READ ONLY can also be specified in the SET TRANSACTION statement, in which case the specified mode is valid for all sessions, or for all subsequent transaction used by the current session.\n\nautocommit\n\nBy default, MariaDB runs with autocommit mode enabled. This means that as soon as you execute a statement that updates (modifies) a table, MariaDB stores the update on disk to make it permanent. To disable autocommit mode, use the following statement:\n\n``sql\nSET autocommit=0;\n`\n\nAfter disabling autocommit mode by setting the autocommit variable to zero, changes to transaction-safe tables (such as those for InnoDB orNDBCLUSTER) are not made permanent immediately. You must use COMMIT to store your changes to disk or ROLLBACK to ignore the changes.\n\nTo disable autocommit mode for a single series of statements, use the START TRANSACTION statement.\n\nDDL Statements\n\nDDL statements (CREATE, ALTER, DROP) and administrative statements (FLUSH, RESET, OPTIMIZE, ANALYZE, CHECK, REPAIR, CACHE INDEX), transaction management statements (BEGIN, START TRANSACTION) and LOAD DATA INFILE, cause an implicit COMMIT and start a new transaction. An exception to this rule are the DDL that operate on temporary tables: you can CREATE, ALTER and DROP them without causing any COMMIT, but those actions cannot be rolled back. This means that if you call ROLLBACK, the temporary tables you created in the transaction will remain, while the rest of the transaction will be rolled back.\n\nTransactions cannot be used in Stored Functions or Triggers. In Stored Procedures and Events BEGIN is not allowed, so you should use START TRANSACTION instead.\n\nA transaction acquires a metadata lock on every table it accesses to prevent other connections from altering their structure. The lock is released at the end of the transaction. This happens even with non-transactional storage engines (like MEMORY or CONNECT), so it makes sense to use transactions with non-transactional tables.\n\nin_transaction\n\nThe in_transaction system variable is a session-only, read-only variable that returns 1 inside a transaction, and 0 if not in a transaction.\n\nWITH CONSISTENT SNAPSHOT\n\nThe WITH CONSISTENT SNAPSHOT option starts a consistent read for storage engines such as InnoDB that can do so, the same as if a START TRANSACTION followed by a SELECT` from any InnoDB table was issued.\n\nSee Enhancements for START TRANSACTION WITH CONSISTENT SNAPSHOT.\n\nExamples\n--------\n\nSTART TRANSACTION;\nSELECT @A:=SUM(salary) FROM table1 WHERE type=1;\nUPDATE table2 SET summary=@A WHERE type=1;\nCOMMIT;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/start-transaction', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/start-transaction');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (920, 8, 'Transaction Timeouts', 'Description\n-----------\n\nMariaDB has always had the wait_timeout and interactive_timeout settings, which close connections after a certain period of inactivity.\n\nHowever, these are by default set to a long wait period. In situations where transactions may be started, but not committed or rolled back, more granular control and a shorter timeout may be desirable so as to avoid locks being held for too long.\n\nThese variables help handle this situation:\n\n idle_transaction_timeout (all transactions)\n idle_write_transaction_timeout (write transactions)\n idle_readonly_transaction_timeout (read transactions)\n\nThere is no variables for more granular control.\n\nThese accept a time in seconds to time out, by closing the connection, transactions that are idle for longer than this period. By default all are set to zero, or no timeout.\n\nidle_transaction_timeout affects all transactions, idle_write_transaction_timeout affects write transactions only and idle_readonly_transaction_timeout affects read transactions only. The latter two variables work independently. However, if either is set along with idle_transaction_timeout, the settings for idle_write_transaction_timeout or idle_readonly_transaction_timeout will take precedence.\n\nExamples\n--------\n\nSET SESSION idle_transaction_timeout=2;\nBEGIN;\nSELECT  FROM t;\nEmpty set (0.000 sec)\nwait 3 seconds\nSELECT * FROM t;\nERROR 2006 (HY000): MySQL server has gone away\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/transaction-timeouts', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/transaction-timeouts');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (921, 8, 'READ COMMITTED', 'Description\n-----------\n\nREAD COMMITTED is one of the transaction isolation levels. Each consistent read, even within the same transaction, sets and reads its own fresh snapshot.\n\nSee Isolation Levels for details.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/transactions-read-committed', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/transactions-read-committed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (922, 8, 'READ UNCOMMITTED', 'Description\n-----------\n\nREAD UNCOMMITTED is one of the transaction isolation levels. SELECT statements are performed in a non-locking fashion, but a possible earlier version of a row might be used.\n\nSee Isolation Levels for details.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/transactions-read-uncommitted', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/transactions-read-uncommitted');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (923, 8, 'REPEATABLE READ', 'Description\n-----------\n\nREPEATABLE READ is one of the transaction isolation levels. All consistent reads within the same transaction read the snapshot established by the first read.\n\nSee Isolation Levels for details.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/transactions-repeatable-read', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/transactions-repeatable-read');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (924, 8, 'SERIALIZABLE', 'Description\n-----------\n\nSERIALIZABLE is one of the transaction isolation levels. Similar to REPEATABLE READ, but InnoDB implicitly converts all plain SELECT statements to SELECT ... LOCK IN SHARE MODE if autocommit is disabled.\n\nSee Isolation Levels for details.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/transactions-serializable', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/transactions-serializable');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (925, 8, 'UNLOCK TABLES', 'Syntax\n------\n\nUNLOCK TABLES\n\nDescription\n-----------\n\nUNLOCK TABLES explicitly releases any table locks held by the current session. See LOCK TABLES for more information.\n\nIn addition to releasing table locks acquired by the LOCK TABLES statement, the UNLOCK TABLES statement also releases the global read lock acquired by the FLUSH TABLES WITH READ LOCK statement. The FLUSH TABLES WITH READ LOCK statement is very useful for performing backups. See FLUSH for more information about FLUSH TABLES WITH READ LOCK.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/transactions-unlock-tables', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/transactions-unlock-tables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (926, 8, 'WAIT and NOWAIT', 'Syntax\n------\n\nALTER TABLE tbl_name [WAIT n|NOWAIT] ...\nCREATE ... INDEX ON tbl_name (index_col_name, ...) [WAIT n|NOWAIT] ...\nDROP INDEX ... [WAIT n|NOWAIT]\nDROP TABLE tbl_name [WAIT n|NOWAIT] ...\nLOCK TABLE ... [WAIT n|NOWAIT]\nOPTIMIZE TABLE tbl_name [WAIT n|NOWAIT]\nRENAME TABLE tbl_name [WAIT n|NOWAIT] ...\nSELECT ... FOR UPDATE [WAIT n|NOWAIT]\nSELECT ... LOCK IN SHARE MODE [WAIT n|NOWAIT]\nTRUNCATE TABLE tbl_name [WAIT n|NOWAIT]\n\nDescription\n-----------\n\nThe lock wait timeout can be explicitly set in the statement by using either WAIT n (to set the wait in seconds) or NOWAIT, in which case the statement will immediately fail if the lock cannot be obtained. WAIT 0 is equivalent to NOWAIT.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/wait-and-nowait', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/wait-and-nowait');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (927, 8, 'XA Transactions', 'Description\n-----------\n\nThe MariaDB XA implementation is based on the X/Open CAE document Distributed Transaction Processing: The XA Specification. This document is published by The Open Group and available at c193.htm.\n\nXA transactions are designed to allow distributed transactions, where a transaction manager (the application) controls a transaction which involves multiple resources. Such resources are usually DBMSs, but could be resources of any type. The whole set of required transactional operations is called a global transaction. Each subset of operations which involve a single resource is called a local transaction. XA used a 2-phases commit (2PC). With the first commit, the transaction manager tells each resource to prepare an effective commit, and waits for a confirm message. The changes are not still made effective at this point. If any of the resources encountered an error, the transaction manager will rollback the global transaction. If all resources communicate that the first commit is successful, the transaction manager can require a second commit, which makes the changes effective.\n\nIn MariaDB, XA transactions can only be used with storage engines that support them. At least InnoDB, TokuDB, SPIDER and MyRocks support them. XA transactions are always supported.\n\nLike regular transactions, XA transactions create metadata locks on accessed tables.\n\nXA transactions require REPEATABLE READ as a minimum isolation level. However, distributed transactions should always use SERIALIZABLE.\n\nTrying to start more than one XA transaction at the same time produces a 1400 error (SQLSTATE ''XAE09''). The same error is produced when attempting to start an XA transaction while a regular transaction is in effect. Trying to start a regular transaction while an XA transaction is in effect produces a 1399 error (SQLSTATE ''XAE07'').\n\nThe statements that cause an implicit COMMIT for regular transactions produce a 1400 error (SQLSTATE ''XAE09'') if a XA transaction is in effect.\n\nInternal XA vs External XA\n\nXA transactions are an overloaded term in MariaDB. If a storage engine is XA-capable, it can mean one or both of these:\n\n It supports MariaDB''s internal two-phase commit API. This is transparent to the user. Sometimes this is called "internal XA", since MariaDB''s internal transaction coordinator log can handle coordinating these transactions.\n It supports XA transactions, with the XA START, XA PREPARE, XA COMMIT, etc. statements. Sometimes this is called "external XA", since it requires the use of an external transaction coordinator to use this feature properly.\n\nTransaction Coordinator Log\n\nIf you have two or more XA-capable storage engines enabled, then a transaction coordinator log must be available.\n\nThere are currently two implementations of the transaction coordinator log:\n\n Binary log-based transaction coordinator log\n Memory-mapped file-based transaction coordinator log\n\nIf the binary log is enabled on a server, then the server will use the binary log-based transaction coordinator log. Otherwise, it will use the memory-mapped file-based transaction coordinator log.\n\nSee Transaction Coordinator Log for more information.\n\nSyntax\n\n``sql\nXA {START|BEGIN} xid [JOIN|RESUME]\n\nXA END xid [SUSPEND [FOR MIGRATE]]\n\nXA PREPARE xid\n\nXA COMMIT xid [ONE PHASE]\n\nXA ROLLBACK xid\n\nXA RECOVER [FORMAT=[''RAW''|''SQL'']]\n\nxid: gtrid [, bqual [, formatID ]]\n`\n\nThe interface to XA transactions is a set of SQL statements starting with XA. Each statement changes a transaction''s state, determining which actions it can perform. A transaction which does not exist is in the NON-EXISTING state.\n\nWhen trying to execute an operation which is not allowed for the transaction''s current state, an error is produced:\n\n`sql\nXA COMMIT ''test'' ONE PHASE;\nERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  ACTIVE state\n\nXA COMMIT ''test2'';\nERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  NON-EXISTING state\n`\n\nXA START\n\n`sql\nXA {START|BEGIN} xid [JOIN|RESUME]\n`\n\nXA START (or BEGIN) starts a transaction and defines its xid (a transaction identifier). The new transaction will be in ACTIVE state.\n\nThe xid can have 3 components, though only the first one is mandatory. gtrid is a quoted string representing a global transaction identifier. bqual is a quoted string representing a local transaction identifier. formatID is an unsigned integer indicating the format used for the first two components; if not specified, defaults to 1. MariaDB does not interpret in any way these components, and only uses them to identify a transaction. xids of transactions in effect must be unique.\n\nUsing the JOIN or RESUME keywords will currently cause an error to be returned.\n\n`sql\nXA START ''test'' RESUME;\nERROR 1398 (XAE05): XAER_INVAL: Invalid arguments (or unsupported command)\nXA START ''test'' JOIN;\nERROR 1398 (XAE05): XAER_INVAL: Invalid arguments (or unsupported command)\n`\n\nAn exception to this is that XA START xid RESUME will resume the transaction if the xid is the same as the previous xid used in XA END xid. This simply undoes the XA END and moves it from the IDLE state back into ACTIVE.\n\n`sql\nXA START ''test'';\nINSERT INTO t VALUES (1,2);\nXA END ''test'';\nXA START ''test'' RESUME; -- This reverts the XA END and continues the transaction\nINSERT INTO t VALUES (3,4);\nXA END ''test'';\nXA PREPARE ''test'';\nXA COMMIT ''test'';\n`\n\nXA END\n\n`sql\nXA END xid [SUSPEND [FOR MIGRATE]]\n`\n\nXA END declares that the specified ACTIVE transaction is finished and it changes its state to IDLE. SUSPEND [FOR MIGRATE] has no effect.\n\nXA PREPARE\n\n`sql\nXA PREPARE xid\n`\n\nXA PREPARE prepares an IDLE transaction for commit, changing its state to PREPARED. Prepared transactions are stored persistently and will survive disconnects and server crashes, and must be explicitly committed or rolled back.\n\nPrepared transactions were automatically rolled back on client disconnect, but were not rolled back if the server was crashed or killed. This violated XA guarantees and could have caused inconsistent data, if the transaction in question was already irrevocably committed in another XA participant.\n\nPrepared transactions are automatically rolled back on client disconnect, but are not rolled back if the server was crashed or killed. This violated XA guarantees and can cause inconsistent data, if the transaction in question was already irrevocably committed in another XA participant.\n\nXA COMMIT\n\n`sql\nXA COMMIT xid [ONE PHASE]\n`\n\nXA COMMIT definitely commits and terminates a transaction which has already been PREPARED. If the ONE PHASE clause is specified, this statements performs a 1-phase commit on an IDLE transaction.\n\nXA ROLLBACK\n\n`sql\nXA ROLLBACK xid\n`\n\nXA ROLLBACK rolls back and terminates an IDLE or PREPARED transaction.\n\nXA RECOVER\n\n`sql\nXA RECOVER [FORMAT=[''RAW''|''SQL'']]\n`\n\nThe XA RECOVER statement shows information about all transactions which are in the PREPARED state. It does not matter which connection created the transaction: if it has been PREPARED, it appears. But this does not mean that a connection can commit or rollback a transaction which was started by another connection. Note that transactions using a 1-phase commit are never in the PREPARED state, so they cannot be shown by XA RECOVER.\n\nXA RECOVER produces four columns:\n\n`sql\nXA RECOVER;\n+----------+--------------+--------------+------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+------+\n|        1 |            4 |            0 | test |\n+----------+--------------+--------------+------+\n`\n\nYou can use XA RECOVER FORMAT=''SQL'' to get the data in a human readable form that can be directly copy-pasted into XA COMMIT or XA ROLLBACK. This is particularly useful for binary xid generated by some transaction coordinators.\n\nformatID is the formatID part of xid.\n\ndata are the gtrid and bqual parts of xid, concatenated.\n\ngtrid_length and bqual_length are the lengths of gtrid and bqual`, respectively.\n\nExamples\n--------\n\nXA START ''test'';\n\nINSERT INTO t VALUES (1,2);\n\nXA END ''test'';\n\nXA PREPARE ''test'';\n\nXA COMMIT ''test'';\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/transactions/xa-transactions', '', 'https://mariadb.com/docs/server/reference/sql-statements/transactions/xa-transactions');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (928, 34, 'Geometry Hierarchy', 'Description\n-----------\n\nGeometry is the base class. It is an abstract class. The instantiable subclasses of Geometry are restricted to zero-, one-, and two-dimensional geometric objects that exist in two-dimensional\\\ncoordinate space. All instantiable geometry classes are defined so that valid instances of a geometry class are topologically closed (that is, all defined geometries include their boundary).\n\nThe base Geometry class has subclasses for Point, Curve, Surface, and GeometryCollection:\n\n Point represents zero-dimensional objects.\n Curve represents one-dimensional objects, and has a subclass LineString, with sub-subclasses Line and LinearRing.\n Surface is designed for two-dimensional objects and has a subclass Polygon.\n GeometryCollection has specialized zero-, one-, and two-dimensional collection classes named MultiPoint, MultiLineString, and MultiPolygon for modeling geometries corresponding to collections of Points, LineStrings, and Polygons, respectively. MultiCurve and MultiSurface are introduced as abstract superclasses that generalize the collection interfaces to handle Curves and Surfaces.\n\nGeometry, Curve, Surface, MultiCurve, and MultiSurface are defined as non-instantiable classes. They define a common set of methods for their subclasses and are included for extensibility.\n\nPoint, LineString, Polygon, GeometryCollection, MultiPoint,MultiLineString, and MultiPolygon are instantiable classes.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/geometry/geometry-hierarchy', '', 'https://mariadb.com/docs/server/reference/sql-structure/geometry/geometry-hierarchy');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (929, 34, 'Geometry Types', 'Description\n-----------\n\nMariaDB provides a standard way of creating spatial columns for geometry types, for example, with CREATE TABLE or ALTER TABLE. Spatial columns are supported for MyISAM, InnoDB and ARCHIVE\\\ntables. See also SPATIAL INDEX.\n\nThe basic geometry type is GEOMETRY, but the type can be more specific. The following types are supported:\n\n POINT\n LINESTRING\n POLYGON\n MULTIPOINT\n MULTILINESTRING\n MULTIPOLYGON\n GEOMETRYCOLLECTION\n GEOMETRY\n\nExamples\n--------\n\nCREATE TABLE object (shapeA POLYGON, shapeB LINESTRING);\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/geometry/geometry-types', '', 'https://mariadb.com/docs/server/reference/sql-structure/geometry/geometry-types');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (930, 34, 'GIS Features', 'Description\n-----------\n\nGIS stands for Geographic Information System.\n\nMySQL operates on spatial data based on the OpenGIS standards, particularly the OpenGIS SFS (Simple feature access, SQL option).\n\nInitial support was based on version 05-134 of the standard. MariaDB implements a subset of the ''SQL with Geometry Types'' environment proposed by the OGC. And the SQL environment was extended with a set of geometry types.\n\nMariaDB supports spatial extensions to operate on spatial features. These features are available for Aria, MyISAM, InnoDB, NDB, and ARCHIVE tables.\n\nFor spatial columns, Aria and MyISAM supports both SPATIAL and non-SPATIAL indexes. Other storage engines support non-SPATIAL indexes.\n\nWe aim at meeting the OpenGIS requirements. One thing missed in previous MariaDB versions is that the functions which check spatial relations didn''t consider the actual shape of an object, instead they operate only on their bounding rectangles. These legacy functions have been left as they are and new, properly-working functions are named with an ''ST_'' prefix, in accordance with the latest OpenGIS requirements. Also, operations over geometry features were added.\n\nSpatial Operators\n\nSpatial operators produce new geometries.\n\n| Name                                                                                                            | Description                                                                    |\n| --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |\n| ST_UNION(A, B)                 | union of A and B                                                               |\n| ST_INTERSECTION(A, B)   | intersection of A and B                                                        |\n| ST_SYMDIFFERENCE(A, B) | symdifference, notintersecting parts of A and B                                |\n| ST_BUFFER(A, radius)          | returns the shape of the area that lies in ''radius'' distance from the shape A. |\n\nPredicates\n\nPredicates return a boolean result of the relationship.\n\n| Name                                                                                                   | Description                     |\n| ------------------------------------------------------------------------------------------------------ | ------------------------------- |\n| ST_INTERSECTS(A, B) | if A and B have an intersection |\n| ST_CROSSES(A, B)       | if A and B cross                |\n| ST_EQUALS(A, B)         | if A and B are equal            |\n| ST_WITHIN(A, B)         | if A lies within B              |\n| ST_CONTAINS(A,B)      | if B lies within A              |\n| ST_DISJOINT(A,B)      | if A and B have no intersection |\n| ST_TOUCHES(A,B)        | if A touches B                  |\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/geometry/gis-features-in-533', '', 'https://mariadb.com/docs/server/reference/sql-structure/geometry/gis-features-in-533');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (931, 34, 'GIS Resources', 'Description\n-----------\n\nGIS stands for Geographic Information System.\n\nFurther reading:\n\n OGC Simple Feature Access - the Open Geospatial Consortium''s OpenGIS Simple Features Specifications For SQL.\n Geo/Spatial Search with MySQL - a presentation by Alexander Rubin, from the MySQL Conference in 2006.\n\nThere are no differences between GIS in stable versions of MariaDB and GIS in MySQL. There are, however, some extensions and enhancements being worked on.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/geometry/gis-resources', '', 'https://mariadb.com/docs/server/reference/sql-structure/geometry/gis-resources');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (932, 34, 'SPATIAL INDEX', 'Description\n-----------\n\nOn MyISAM, Aria and InnoDB tables, MariaDB can create spatial indexes (an R-tree index) using syntax similar to that for creating regular indexes, but extended with the SPATIAL keyword. Columns in spatial indexes must be declared NOT NULL.\n\nSpatial indexes can be created when the table is created, or added after the fact:\n\n``sql\nCREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g));\n`\n\n`sql\nALTER TABLE geom ADD SPATIAL INDEX(g);\n`\n\n`sql\nCREATE SPATIAL INDEX sp_index ON geom (g);\n`\n\nSPATIAL INDEX creates an R-tree index. For storage engines that support non-spatial indexing of spatial columns, the engine creates a B-tree index. A B-tree index on spatial values is useful for\\\nexact-value lookups, but not for range scans.\n\nFor more information on indexing spatial columns, see CREATE INDEX.\n\nTo drop spatial indexes, use ALTER TABLE or DROP INDEX:\n\n`sql\nALTER TABLE geom DROP INDEX g;\n`\n\n`sql\nDROP INDEX sp_index ON geom;\n`\n\nData-at-Rest Encryption\n\nIf innodb_checksum_algorithm is set to full_crc32 or strict_full_crc32`, and if the table does not use ROW_FORMAT=COMPRESSED, InnoDB spatial indexes are encrypted if the table is encrypted.\n\nSee MDEV-12026 for more information.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/geometry/spatial-index', '', 'https://mariadb.com/docs/server/reference/sql-structure/geometry/spatial-index');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (933, 35, 'Joins, Subqueries, and Set', 'Description\n-----------\n\nSQL (Structured Query Language) is a highly potent language used in the realm of databases and data analytics. It allows us to create, manipulate, and retrieve data stored in relational databases. While simple SQL commands can handle straightforward tasks, one must delve into advanced aspects such as multiple joins, subqueries, and set operations to unravel the full potential of SQL.\n\nMultiple Joins\n\nJoins are fundamental to SQL, as they enable us to combine rows from two or more tables based on related columns. Several types of joins exist, including INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.\n\nIn real-world scenarios, finding database schemas with multiple tables linked through relationships is common. In such cases, we often need to write SQL queries with multiple joins to fetch the required data.\n\nFor instance, consider a database for a bookstore with three tables: Books, Authors, and Publishers. If we want to get a list of books along with their author names and publishers, you would require multiple joins.\n\n``sql\nSELECT Books.title, Authors.name, Publishers.name\nFROM Books\nINNER JOIN Authors ON Books.author_id = Authors.id\nINNER JOIN Publishers ON Books.publisher_id = Publishers.id;\n`\n\nIn that query, we used two INNER JOIN operations to combine data from the three tables.\n\nSubqueries\n\nA subquery, also known as a nested query or inner query, is a query embedded within another SQL query. The result of the subquery can be used in the outer query. Subqueries can be used in SELECT, INSERT, UPDATE, and DELETE statements and also in conjunction with WHERE and HAVING clauses.\n\nSubqueries can prove powerful in many scenarios. For example, suppose we want to find books that are above the average price in our bookstore database. We could achieve this using a subquery.\n\n`sql\nSELECT title, price\nFROM Books\nWHERE price > (SELECT AVG(price) FROM Books);\n`\n\nIn this query, the subquery calculates the average book price, which the outer query then uses to filter books that are priced above average.\n\nSet Operations\n\nSQL also provides several set operations to combine rows from two or more tables, including UNION, UNION ALL, INTERSECT, and EXCEPT. These operations are instrumental when dealing with large databases where data is spread across multiple tables and we need to perform set-based operations.\n\nFor example, suppose we have two tables, _Books_2019_ and _Books_2020_, listing the books sold in the respective years. If we want to find books sold in both years, we can use the INTERSECT operation.\n\n`sql\nSELECT title FROM Books_2019\nINTERSECT\nSELECT title FROM Books_2020;\n``\n\nIn the above query, INTERSECT returns the common book titles sold in both 2019 and 2020.\n\nConclusion\n\nAdvanced SQL queries that involve multiple joins, subqueries, and set operations can be daunting at first glance. However, these incredibly powerful tools in our SQL toolkit enable us to craft complex data retrieval and manipulation commands. To truly excel in data analytics, mastering these aspects of SQL is not only beneficial but essential.\n\nRemember, practice is the key to mastering these advanced SQL concepts, like any other technical skill. Write queries, solve problems, make mistakes, and learn from them. Over time, you''ll find yourself not only comfortable but proficient in creating intricate SQL queries.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/joins-subqueries-set', '', 'https://mariadb.com/docs/server/reference/sql-structure/joins-subqueries-set');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (934, 35, 'NoSQL', 'Description\n-----------\n\ndynamic-columns.md\n\ndynamic-column-api.md\n\nhandler\n\nhandlersocket\n\njson-functions\n\ncassandra\n\nconnect\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/nosql/README', '', 'https://mariadb.com/docs/server/reference/sql-structure/nosql/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (935, 35, 'Dynamic Column API', 'Description\n-----------\n\nThis page describes the client-side API for reading and writing Dynamic Columns blobs.\n\nNormally, you should use Dynamic column functions which are run inside the MariaDB server and allow one to access Dynamic Columns content without any client-side libraries.\n\nIf you need to read/write dynamic column blobs on the client for some reason, this API enables that.\n\nWhere to get it\n\nThe API is a part of libmysql C client library. In order to use it, you need to include this header file and link against libmysql:\n\n``c\n#include <mysql/ma_dyncol.h>\n`\n\nData structures\n\nDYNAMIC_COLUMN\n\nDYNAMIC_COLUMN represents a packed dynamic column blob. It is essentially a string-with-length and is defined as follows:\n\n`c\n/ A generic-purpose arbitrary-length string defined in MySQL Client API /\ntypedef struct st_dynamic_string\n{\n  char str;\n  size_t length,max_length,alloc_increment;\n} DYNAMIC_STRING;\n\n...\n\ntypedef DYNAMIC_STRING DYNAMIC_COLUMN;\n`\n\nDYNAMIC_COLUMN_VALUE\n\nDynamic columns blobs store {name, value} pairs. The DYNAMIC_COLUMN_VALUE structure is used to represent the value in accessible form.\n\n`c\nstruct st_dynamic_column_value\n{\n  DYNAMIC_COLUMN_TYPE type;\n  union\n  {\n    long long long_value;\n    unsigned long long ulong_value;\n    double double_value;\n    struct {\n      MYSQL_LEX_STRING value;\n      CHARSET_INFO charset;\n    } string;\n    struct {\n      decimal_digit_t buffer[DECIMAL_BUFF_LENGTH];\n      decimal_t value;\n    } decimal;\n    MYSQL_TIME time_value;\n  } x;\n};\ntypedef struct st_dynamic_column_value DYNAMIC_COLUMN_VALUE;\n`\n\nEvery value has a type, which is determined by the type member.\n\n| Type               | Structure field                              |\n| ------------------ | -------------------------------------------- |\n| DYN_COL_NULL     | -                                            |\n| DYN_COL_INT      | value.x.long_value                          |\n| DYN_COL_UINT     | value.x.ulong_value                         |\n| DYN_COL_DOUBLE   | value.x.double_value                        |\n| DYN_COL_STRING   | value.x.string.value, value.x.string.charset |\n| DYN_COL_DECIMAL  | value.x.decimal.value                        |\n| DYN_COL_DATETIME | value.x.time_value                          |\n| DYN_COL_DATE     | value.x.time_value                          |\n| DYN_COL_TIME     | value.x.time_value                          |\n| DYN_COL_DYNCOL   | value.x.string.value                         |\n\nNotes\n\n Values with type DYN_COL_NULL do not ever occur in dynamic columns blobs.\n Type DYN_COL_DYNCOL means that the value is a packed dynamic blob. This is how nested dynamic columns are done.\n Before storing a value to value.x.decimal.value, you must call mariadb_dyncol_prepare_decimal() to initialize the space for storage.\n\nenum_dyncol_func_result\n\nenum enum_dyncol_func_result is used as return value.\n\n| Value | Name                         | Comments                                                             |\n| ----- | ---------------------------- | -------------------------------------------------------------------- |\n| 0     | ER_DYNCOL_OK               | OK                                                                   |\n| 0     | ER_DYNCOL_NO               | (the same as ER_DYNCOL_OK but for functions which return a YES/NO) |\n| 1     | ER_DYNCOL_YES              | YES response or success                                            |\n| 2     | ER_DYNCOL_TRUNCATED        | Operation succeeded but the data was truncated                       |\n| -1    | ER_DYNCOL_FORMAT           | Wrong format of the encoded string                                   |\n| -2    | ER_DYNCOL_LIMIT            | A limit of implementation reached                                    |\n| -3    | ER_DYNCOL_RESOURCE         | Out of resources                                                     |\n| -4    | ER_DYNCOL_DATA             | Incorrect input data                                                 |\n| -5    | ER_DYNCOL_UNKNOWN_CHARSET | Unknown character set                                                |\n\nResult codes that are less than zero represent error conditions.\n\nFunction reference\n\nFunctions come in pairs:\n\n xxx_num() operates on the old (pre-MariaDB-10.0.1) dynamic column blob format, where columns were identified by numbers.\n xxx_named() can operate on both old or new data format. If it modifies the blob, it converts it to the new data format.\n\nYou should use xxx_named() functions, unless you need to keep the data compatible with MariaDB versions before 10.0.1.\n\nmariadb_dyncol_init <a href="#mariadb_dyncol_init" id="mariadb_dyncol_init"></a>\n\nFirst, define mariadb_dyncol_init(A) memset((A), 0, sizeof(\\(A))). It is the correct initialization for an empty packed dynamic blob.\n\nmariadb_dyncol_free <a href="#mariadb_dyncol_free" id="mariadb_dyncol_free"></a>\n\nCopy where str is IN. Packed dynamic blob which memory should be freed.\n\n`c\nvoid mariadb_dyncol_free(DYNAMIC_COLUMN str);\n`\n\nmariadb_dyncol_create_many\n\nCreate a packed dynamic blob from arrays of values and names.\n\n`c\nenum enum_dyncol_func_result\nmariadb_dyncol_create_many(DYNAMIC_COLUMN str,\n                           uint column_count,\n                           uint column_numbers,\n                           DYNAMIC_COLUMN_VALUE values,\n                           my_bool new_string);\nenum enum_dyncol_func_result\nmariadb_dyncol_create_many_named(DYNAMIC_COLUMN str,\n                                 uint column_count,\n                                 MYSQL_LEX_STRING column_keys,\n                                 DYNAMIC_COLUMN_VALUE values,\n                                 my_bool new_string);\n`\n\nHere are the names and values:\n\n| Name            | Value | Comments                                                            |\n| --------------- | ----- | ------------------------------------------------------------------- |\n| str             | OUT   | Packed dynamic blob will be put here                                |\n| column_count   | IN    | Number of columns                                                   |\n| column_numbers | IN    | Column numbers array (old format)                                   |\n| column_keys    | IN    | Column names array (new format)                                     |\n| values          | IN    | Column values array                                                 |\n| new_string     | IN    | If TRUE then the str will be reinitialized (not freed) before usage |\n\nmariadb_dyncol_update_many\n\nAdd or update columns in a dynamic columns blob. To delete a column, update its value to a "non-value" of type DYN_COL_NULL :\n\n`c\nenum enum_dyncol_func_result\nmariadb_dyncol_update_many(DYNAMIC_COLUMN str,\n                           uint column_count,\n                           uint column_numbers,\n                           DYNAMIC_COLUMN_VALUE values);\nenum enum_dyncol_func_result\nmariadb_dyncol_update_many_named(DYNAMIC_COLUMN str,\n                                 uint column_count,\n                                 MYSQL_LEX_STRING column_keys,\n                                 DYNAMIC_COLUMN_VALUE values);\n`\n\n| Name            | Value  | Comments                              |\n| --------------- | ------ | ------------------------------------- |\n| str             | IN/OUT | Dynamic columns blob to be modified   |\n| column_count   | IN     | Number of columns in following arrays |\n| column_numbers | IN     | Column numbers array (old format)     |\n| column_keys    | IN     | Column names array (new format)       |\n| values          | IN     | Column values array                   |\n\nmariadb_dyncol_exists\n\nCheck if column with given names exist in the blob:\n\n`c\nenum enum_dyncol_func_result\nmariadb_dyncol_exists(DYNAMIC_COLUMN str, uint column_number);\nenum enum_dyncol_func_result\nmariadb_dyncol_exists_named(DYNAMIC_COLUMN str, MYSQL_LEX_STRING column_key);\n`\n\n| Name           | Value | Comments                      |\n| -------------- | ----- | ----------------------------- |\n| str            | IN    | Packed dynamic columns string |\n| column_number | IN    | Column number (old format)    |\n| column_key    | IN    | Column name (new format)      |\n\nThe function returns YES, or NO or Error code.\n\nmariadb_dyncol_column_count\n\nGet the number of columns in a dynamic column blob:\n\n`c\nenum enum_dyncol_func_result\nmariadb_dyncol_column_count(DYNAMIC_COLUMN str, uint column_count);\n`\n\n| Name          | Value | Comments                                                 |\n| ------------- | ----- | -------------------------------------------------------- |\n| str           | IN    | Packed dynamic columns string                            |\n| column_count | OUT   | Number of not NULL columns in the dynamic columns string |\n\nmariadb_dyncol_list\n\nList columns in a dynamic column blob:\n\n`c\nenum enum_dyncol_func_result\nmariadb_dyncol_list(DYNAMIC_COLUMN str, uint column_count, uint *column_numbers);\nenum enum_dyncol_func_result\nmariadb_dyncol_list_named(DYNAMIC_COLUMN str, uint column_count,\n                          MYSQL_LEX_STRING column_keys);\n`\n\n|                 |     |                                                                  |\n| --------------- | --- | ---------------------------------------------------------------- |\n| str             | IN  | Packed dynamic columns string                                    |\n| column_count   | OUT | Number of columns in following arrays                            |\n| column_numbers | OUT | Column numbers array (old format). Caller should free this array |\n| column_keys    | OUT | Column names array (new format). Caller should free this array   |\n\nmariadb_dyncol_get\n\nGet a value of one column:\n\n`c\nenum enum_dyncol_func_result\nmariadb_dyncol_get(DYNAMIC_COLUMN org, uint column_number,\n                   DYNAMIC_COLUMN_VALUE value);\nenum enum_dyncol_func_result\nmariadb_dyncol_get_named(DYNAMIC_COLUMN str, MYSQL_LEX_STRING column_key,\n                         DYNAMIC_COLUMN_VALUE value);\n`\n\n| Name           | Value | Comments                          |\n| -------------- | ----- | --------------------------------- |\n| str            | IN    | Packed dynamic columns string     |\n| column_number | IN    | Column numbers array (old format) |\n| column_key    | IN    | Column names array (new format)   |\n| value          | OUT   | Value of the column               |\n\nIf the column is not found, NULL is returned as the value of the column.\n\nmariadb_dyncol_unpack\n\nGet the value of all columns:\n\n`c\nenum enum_dyncol_func_result\nmariadb_dyncol_unpack(DYNAMIC_COLUMN str,\n                      uint column_count,\n                      MYSQL_LEX_STRING column_keys,\n                      DYNAMIC_COLUMN_VALUE values);\n`\n\n| Name          | Value | Comments                                               |\n| ------------- | ----- | ------------------------------------------------------ |\n| str           | IN    | Packed dynamic columns string to unpack                |\n| column_count | OUT   | Number of columns in following arrays                  |\n| column_keys  | OUT   | Column names array (should be free by caller)          |\n| values        | OUT   | Values of the columns array (should be free by caller) |\n\nmariadb_dyncol_has_names\n\nCheck whether the dynamic columns blob uses the new data format (the one where columns are identified by names):\n\n`c\nmy_bool mariadb_dyncol_has_names(DYNAMIC_COLUMN str);\n`\n\n| Name | Value | Comments                      |\n| ---- | ----- | ----------------------------- |\n| str  | IN    | Packed dynamic columns string |\n\nmariadb_dyncol_check\n\nCheck whether the dynamic column blob has the correct data format:\n\n`c\nenum enum_dyncol_func_result\nmariadb_dyncol_check(DYNAMIC_COLUMN str);\n`\n\n| Name | Value | Comments                      |\n| ---- | ----- | ----------------------------- |\n| str  | IN    | Packed dynamic columns string |\n\nmariadb_dyncol_json\n\nGet contents of a dynamic columns blob in a JSON form:\n\n`c\nenum enum_dyncol_func_result\nmariadb_dyncol_json(DYNAMIC_COLUMN str, DYNAMIC_STRING json);\n`\n\n| Name | Value | Comments                      |\n| ---- | ----- | ----------------------------- |\n| str  | IN    | Packed dynamic columns string |\n| json | OUT   | JSON representation           |\n\nmariadb_dyncol_val_TYPE\n\nGet the dynamic column value as one of the base types:\n\n`c\nenum enum_dyncol_func_result\nmariadb_dyncol_val_str(DYNAMIC_STRING str, DYNAMIC_COLUMN_VALUE val,\n                       CHARSET_INFO cs, my_bool quote);\nenum enum_dyncol_func_result\nmariadb_dyncol_val_long(longlong ll, DYNAMIC_COLUMN_VALUE val);\nenum enum_dyncol_func_result\nmariadb_dyncol_val_double(double dbl, DYNAMIC_COLUMN_VALUE val);\n`\n\n| Name             | Value | Comments            |\n| ---------------- | ----- | ------------------- |\n| str or ll or dbl | OUT   | value of the column |\n| val              | IN    | Value               |\n\nmariadb_dyncol_prepare_decimal\n\nInitialize DYNAMIC_COLUMN_VALUE before setting the value of value.x.decimal.value:\n\n`c\nvoid mariadb_dyncol_prepare_decimal(DYNAMIC_COLUMN_VALUE value);\n`\n\n| Name  | Value | Comments            |\n| ----- | ----- | ------------------- |\n| value | OUT   | Value of the column |\n\nThis function links value.x.decimal.value to value.x.decimal.buffer.\n\nmariadb_dyncol_value_init\n\nInitialize a DYNAMIC_COLUMN_VALUE structure to a safe default:\n\n`c\n#define mariadb_dyncol_value_init(V) (V)->type= DYN_COL_NULL\n`\n\nmariadb_dyncol_column_cmp_named\n\nCompare two column names (column names are compared with memcmp()):\n\n`c\nint mariadb_dyncol_column_cmp_named(const MYSQL_LEX_STRING s1,\n                                    const MYSQL_LEX_STRING s2);\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/nosql/dynamic-column-api', '', 'https://mariadb.com/docs/server/reference/sql-structure/nosql/dynamic-column-api');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (936, 35, 'Dynamic Columns', 'Description\n-----------\n\nDynamic columns allow one to store different sets of columns for each row in a table. It works by storing a set of columns in a blob and having a small set of functions to manipulate it.\n\nDynamic columns should be used when it is not possible to use regular columns.\n\nA typical use case is when one needs to store items that may have many different attributes (like size, color, weight, etc), and the set of possible attributes is very large and/or unknown in advance. In that case, attributes can be put into dynamic columns.\n\nDynamic Columns Basics\n\nThe table should have a blob column which will be used as storage for dynamic columns:\n\n``sql\nmain\nCREATE TABLE assets (\n  item_name VARCHAR(32) PRIMARY KEY, -- A common attribute for all items\n  dynamic_cols  BLOB  -- Dynamic columns will be stored here\n);\n`\n\nOnce created, you can access dynamic columns via dynamic column functions.\n\nInsert a row with two dynamic columns: color=blue, size=XL:\n\n`sql\nINSERT INTO assets VALUES \n  (''MariaDB T-shirt'', COLUMN_CREATE(''color'', ''blue'', ''size'', ''XL''));\n`\n\nInsert another row with dynamic columns: color=black, price=500:\n\n`sql\nINSERT INTO assets VALUES\n  (''Thinkpad Laptop'', COLUMN_CREATE(''color'', ''black'', ''price'', 500));\n`\n\nSelect the dynamic column ''color'' for all items:\n\n`sql\nSELECT item_name, COLUMN_GET(dynamic_cols, ''color'' as char) \n  AS color FROM assets;\n+-----------------+-------+\n| item_name       | color |\n+-----------------+-------+\n| MariaDB T-shirt | blue  |\n| Thinkpad Laptop | black |\n+-----------------+-------+\n`\n\nIt is possible to add and remove dynamic columns from a row:\n\n`sql\n-- Remove a column:\nUPDATE assets SET dynamic_cols=COLUMN_DELETE(dynamic_cols, "price") \nWHERE COLUMN_GET(dynamic_cols, ''color'' AS CHAR)=''black''; \n\n-- Add a column:\nUPDATE assets SET dynamic_cols=COLUMN_ADD(dynamic_cols, ''warranty'', ''3 years'')\nWHERE item_name=''Thinkpad Laptop'';\n`\n\nYou can also list all columns, or get them together with their values in JSON format:\n\n`sql\nSELECT item_name, column_list(dynamic_cols) FROM assets;\n+-----------------+---------------------------+\n| item_name       | column_list(dynamic_cols) |\n+-----------------+---------------------------+\n| MariaDB T-shirt | size,color            |\n| Thinkpad Laptop | color,warranty        |\n+-----------------+---------------------------+\n\nSELECT item_name, COLUMN_JSON(dynamic_cols) FROM assets;\n+-----------------+----------------------------------------+\n| item_name       | COLUMN_JSON(dynamic_cols)              |\n+-----------------+----------------------------------------+\n| MariaDB T-shirt | {"size":"XL","color":"blue"}           |\n| Thinkpad Laptop | {"color":"black","warranty":"3 years"} |\n+-----------------+----------------------------------------+\n`\n\nDynamic Columns Reference\n\nThis is a complete reference of dynamic columns in MariaDB.\n\nColumn can be referred to by name (column_name in the following code blocks). This is the preferred method.\\\nIf you need support for old (< 10.0) MariaDB versions, you have to refer to columns by number. In that case, replace _column_name_ with _column_nr_. This method is not recommended.\n\nDynamic Columns Functions\n\nCOLUMN_CREATE\n\n`sql\nCOLUMN_CREATE(column_name, value [as type], [column_name, value \n  [as type]]...);\n`\n\nReturns a dynamic columns blob that stores the specified columns with values. The return value is suitable for\n\n storing in a table,\n further modification with other dynamic columns functions.\n\nThe as type part allows one to specify the value type. In most cases, this is redundant because MariaDB will be able to deduce the type of the value. Explicit type specification may be needed when the type of the value is not apparent. For example, a literal ''2012-12-01'' has a CHAR type by default, one will need to specify ''2012-12-01'' AS DATE to have it stored as a date. See the Datatypes section for further details. Note also MDEV-597.\n\nTypical usage:\n\n`sql\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE("column_name", "value");\n`\n\nCOLUMN_ADD\n\n`sql\nCOLUMN_ADD(dyncol_blob, column_name, value [as type], \n  [column_name, value [as type]]...);\n`\n\nAdds or updates dynamic columns.\n\n dyncol_blob must be either a valid dynamic columns blob (for example, COLUMN_CREATE returns such blob), or an empty string.\n column_name specifies the name of the column to be added. If dyncol_blob already has a column with this name, it will be overwritten.\n value specifies the new value for the column. Passing a NULL value will cause the column to be deleted.\n as type is optional. See the datatypes section for a discussion about types.\n\nThe return value is a dynamic column blob after the modifications.\n\nTypical usage:\n\n`sql\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob, "column_name", "value") \n  WHERE id=1;\n`\n\nNote: COLUMN_ADD() is a regular function (just like CONCAT()), hence, in order to update the value in the table you have to use the UPDATE ... SET dynamic_col=COLUMN_ADD(dynamic_col, ....) pattern.\n\nCOLUMN_GET\n\n`sql\nCOLUMN_GET(dyncol_blob, column_name as type);\n`\n\nRetrieves the value of a dynamic column by its name. If no column with the given name exists, NULL is returned.\n\ncolumn_name as type requires that one specify the datatype of the dynamic column they are reading.\n\nThis may seem counter-intuitive: Why would you need to specify which datatype they''re retrieving? Can''t the dynamic columns system figure the datatype from the data being stored?\n\nThe answer is: SQL is a statically typed language. The SQL interpreter needs to know the datatypes of all expressions before the query is run (for example, when one is using prepared statements and runs"select COLUMN_GET(...)", the prepared statement API requires the server to inform the client about the datatype of the column being read before the query is executed and the server can see what datatype the column actually has).\n\nSee the Datatypes section for more information about datatypes.\n\nCOLUMN_DELETE\n\n`sql\nCOLUMN_DELETE(dyncol_blob, column_name, column_name...);\n`\n\nDeletes a dynamic column with the specified name. Multiple names can be given.\n\nThe return value is a dynamic column blob after the modification.\n\nCOLUMN_EXISTS\n\n`sql\nCOLUMN_EXISTS(dyncol_blob, column_name);\n`\n\nChecks if a column with name column_name exists in dyncol_blob. If yes, return 1, otherwise return 0.\n\nCOLUMN_LIST\n\n`sql\nCOLUMN_LIST(dyncol_blob);\n`\n\nReturns a comma-separated list of column names. The names are quoted with backticks.\n\n`sql\nSELECT column_list(column_create(''col1'',''val1'',''col2'',''val2''));\n+---------------------------------------------------------+\n| column_list(column_create(''col1'',''val1'',''col2'',''val2'')) |\n+---------------------------------------------------------+\n| col1,col2                                           |\n+---------------------------------------------------------+\n`\n\nCOLUMN_CHECK\n\n`sql\nCOLUMN_CHECK(dyncol_blob);\n`\n\nChecks if dyncol_blob is a valid packed dynamic columns blob. A return value of 1 means the blob is valid, a return value of 0 means it is not.\n\nRationale:\\\nNormally, you work with valid dynamic column blobs. Functions likeCOLUMN_CREATE, COLUMN_ADD, COLUMN_DELETE always return valid dynamic column blobs. However, if a dynamic column blob is accidentally truncated, or transcoded from one character set to another, it is corrupted. This function can be used to check if a value in a blob field is a valid dynamic column blob.\n\nIt is possible that a truncation cuts a Dynamic Column "clearly" so that COLUMN_CHECK does not notice the corruption, but, in any case of truncation, a warning is issued during value storing.\n\nCOLUMN_JSON\n\n`sql\nCOLUMN_JSON(dyncol_blob);\n`\n\nReturns a JSON representation of data in dyncol_blob :\n\n`sql\nSELECT item_name, COLUMN_JSON(dynamic_cols) FROM assets;\n+-----------------+----------------------------------------+\n| item_name       | COLUMN_JSON(dynamic_cols)              |\n+-----------------+----------------------------------------+\n| MariaDB T-shirt | {"size":"XL","color":"blue"}           |\n| Thinkpad Laptop | {"color":"black","warranty":"3 years"} |\n+-----------------+----------------------------------------+\n`\n\nLimitation: COLUMN_JSON decodes nested dynamic columns at a nesting level of not more than 10 levels deep. Dynamic columns that are nested deeper than 10 levels are shown as a BINARY string, without encoding.\n\nNesting Dynamic Columns\n\nIt is possible to use nested dynamic columns by putting one dynamic column blob inside another. The COLUMN_JSON function will display nested columns.\n\n`sql\nSET @tmp= column_create(''parent_column'', \n  column_create(''child_column'', 12345));\nQuery OK, 0 rows affected (0.00 sec)\n\nSELECT column_json(@tmp);\n+------------------------------------------+\n| column_json(@tmp)                        |\n+------------------------------------------+\n| {"parent_column":{"child_column":12345}} |\n+------------------------------------------+\n\nSELECT column_get(column_get(@tmp, ''parent_column'' AS char), \n  ''child_column'' AS int);\n+------------------------------------------------------------------------------+\n| column_get(column_get(@tmp, ''parent_column'' as char), ''child_column'' as int) |\n+------------------------------------------------------------------------------+\n|                                                                        12345 |\n+------------------------------------------------------------------------------+\n`\n\nIf you are trying to get a nested dynamic column as a string, use AS BINARY as the last argument of COLUMN_GET . Otherwise, problems with character set conversion and illegal symbols are possible:\n\n`sql\nSELECT column_json( column_get(\n  column_create(''test1'', \n    column_create(''key1'',''value1'',''key2'',''value2'',''key3'',''value3'')),\n  ''test1'' AS BINARY));\n`\n\nDatatypes\n\nIn SQL, one needs to define the type of each column in a table. Dynamic columns do not provide any way to declare a type in advance ("whenever there is a column ''weight'', it should be integer" is not possible). However, each particular dynamic column value is stored together with its datatype.\n\nThe set of possible datatypes is mostly the same as that used by the CAST and CONVERT functions. However, note that there are currently some differences - see MDEV-597.\n\n| Type                | Dynamic column internal type | Description                                                                                                                 |\n| ------------------- | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| BINARY\\[(N)]        | DYN_COL_STRING             | (variable length string with binary charset)                                                                                |\n| CHAR\\[(N)]          | DYN_COL_STRING             | (variable length string with charset)                                                                                       |\n| DATE                | DYN_COL_DATE               | (date - 3 bytes)                                                                                                            |\n| DATETIME\\[(D)]      | DYN_COL_DATETIME           | (date and time (with microseconds) - 9 bytes)         |\n| DECIMAL\\[(M\\[,D])]  | DYN_COL_DECIMAL            | (variable length binary decimal representation with MariaDB limitation)                                                     |\n| DOUBLE\\[(M,D)]      | DYN_COL_DOUBLE             | (64 bit double-precision floating point)                                                                                    |\n| INTEGER             | DYN_COL_INT                | (variable length, up to 64-bit signed integer)                                                                              |\n| SIGNED \\[INTEGER]   | DYN_COL_INT                | (variable length, up to 64-bit signed integer)                                                                              |\n| TIME\\[(D)]          | DYN_COL_TIME               | (time (with microseconds, may be negative) - 6 bytes) |\n| UNSIGNED \\[INTEGER] | DYN_COL_UINT               | (variable length, up to 64bit unsigned integer)                                                                             |\n\nA Note About Lengths\n\nIf you''re running queries without specifying a maximum length (i.e. using #as CHAR#, not as CHAR(n)), MariaDB reports the maximum length of the result set column to be53,6870,911 (bytes or characters?). This may cause excessive memory usage in some client libraries, because they try to pre-allocate a buffer of maximum result set width. If you suspect you''re hitting this problem, use CHAR(n)\\\nwhenever you''re using COLUMN_GET in the select list.\n\n`sql\nSELECT COLUMN_GET(blob, ''colname'' as CHAR) ...\n`\n\nClient-side API\n\nIt is also possible to create or parse dynamic columns blobs on the client side. libmysql` client library now includes an API for writing/reading dynamic column blobs. See dynamic-columns-api for details.\n\nLimitations\n\n| Description                                   | Limit                                                                                                                                           |\n| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |\n| Max number of columns                         | 65535                                                                                                                                           |\n| Maximum total length of packed dynamic column | max_allowed_packet (1G) |\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/nosql/dynamic-columns', '', 'https://mariadb.com/docs/server/reference/sql-structure/nosql/dynamic-columns');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (937, 35, 'HANDLER', 'Syntax\n------\n\nHANDLER tbl_name OPEN [ [AS] alias]\nHANDLER tbl_name READ index_name { = | >= | <= | < } (value1,value2,...)\n    [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST }\n    [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ { FIRST | NEXT }\n    [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name CLOSE\n\nDescription\n-----------\n\nThe HANDLER statement provides direct access to table storage engine interfaces for key lookups and key or table scans. It is available for at least Aria, Memory, MyISAM and InnoDB tables (and should work with most ''normal'' storage engines, but not with system tables, MERGE or views).\n\nHANDLER ... OPEN opens a table, allowing it to be accessible to subsequent HANDLER ... READ statements. The table can either be opened using an alias, or a table name. If opened with an alias, references to this table by further HANDLER statements must use this alias, and not the table name. If opened with a table name qualified by database name, further references to this table must use the unqualified table name. For example, if a table is opened with db1.t1, further references must use t1.\n\nThe table object is only closed when HANDLER ... CLOSE is called by the session, or the session closes, and is not shared by other sessions.\n\nPrepared statements work with HANDLER READ, which gives a much higher performance (50% speedup) as there is no parsing and all data is transformed in binary (without conversions to text, as with the normal protocol).\n\nThe HANDLER command does not work with partitioned tables.\n\nKey Lookup\n\nA key lookup is started with:\n\n``sql\nHANDLER tbl_name READ index_name { = | >= | <= | < }  (value,value) [LIMIT...]\n`\n\nThe values stands for the value of each of the key columns. For most key types, except for HASH keys in MEMORY storage engine, you can use a prefix subset of its columns.\n\nIf you are using LIMIT, then in case of >= or > then there is an implicit NEXT implied, while if you are using <= or < then there is an implicit PREV implied.\n\nAfter the initial read, you can use the following to scan rows in key order:\n\n`sql\nHANDLER tbl_name READ index_name NEXT [ LIMIT ... ]\nor\nHANDLER tbl_name READ index_name PREV [ LIMIT ... ]\n`\n\nNote that the row order is not defined for keys with duplicated values, and will vary from engine to engine.\n\nKey Scans\n\nYou can scan a table in key order by doing this:\n\n`sql\nHANDLER tbl_name READ index_name FIRST [ LIMIT ... ]\nHANDLER tbl_name READ index_name NEXT  [ LIMIT ... ]\n`\n\nAlternatively, if the handler supports backwards key scans (which most do), you can use this:\n\n`sql\nHANDLER tbl_name READ index_name LAST [ LIMIT ... ]\nHANDLER tbl_name READ index_name PREV [ LIMIT ... ]\n`\n\nTable Scans\n\nYou can scan a table in row order by doing this:\n\n`sql\nHANDLER tbl_name READ FIRST [ LIMIT ... ]\nHANDLER tbl_name READ NEXT  [ LIMIT ... ]\n`\n\nLimitations\n\nAs this is a direct interface to the storage engine, some limitations may apply for what you can do and what happens if the table changes. Here are some of the common limitations.\n\nFinding ''Old Rows''\n\nHANDLER READ is not transaction-safe, consistent or atomic. It''s okay for the storage engine to return rows that existed when you started the scan, but that were later deleted. This can happen as the storage engine may cache rows as part of the scan from a previous read.\n\nYou may also find rows committed since the scan originally started.\n\nInvisible Columns\n\nHANDLER ... READ also reads the data of invisible columns.\n\nSystem-Versioned Tables\n\nHANDLER ... READ reads everything from system-versioned tables, and so includes row_start and row_end fields, as well as all rows that have since been deleted or changed, including when history partitions are used.\n\nOther Limitations\n\n If you do an ALTER TABLE, all your HANDLERs for that table are automatically closed.\n If you do an ALTER TABLE for a table that is used by some other connection with HANDLER, the ALTER TABLE query waits for the HANDLER to be closed.\n For HASH keys, you must use all key parts when searching for a row.\n For HASH keys, you can''t do a key scan of all values. You can only find all rows with the same key value.\n While each HANDLER READ command is atomic, if you do a scan in many steps, some engines may give you error 1020 if the table changed between the commands. Please refer to the specific engine handler page if this happens.\n\nError Codes\n\n Error 1031 (ER_ILLEGAL_HA) Table storage engine for ''t1'' doesn''t have this option\n   If you get this for HANDLER OPEN it means the storage engine doesn''t support HANDLER calls.\n   If you get this for HANDLER READ , it means you are trying to use an incomplete HASH key.\n Error 1020 (ER_CHECKREAD`) Record has changed since last read in table ''...''\n   This means that the table changed between two reads, and the handler can''t handle this case for the given scan.\n\nExamples\n--------\n\nCREATE TABLE t1 (f1 INT);\n\nINSERT INTO t1 VALUES (1),(2),(3);\n\nHANDLER t1 OPEN;\n\nHANDLER t1 READ NEXT;\n+------+\n| f1   |\n+------+\n|    1 |\n+------+\n\nHANDLER t1 READ NEXT;\n+------+\n| f1   |\n+------+\n|    2 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/nosql/handler/handler-commands', '', 'https://mariadb.com/docs/server/reference/sql-structure/nosql/handler/handler-commands');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (938, 35, 'HANDLER for MEMORY Tables', 'Description\n-----------\n\nThis article explains how to use HANDLER commands efficiently with MEMORY/HEAP tables.\n\nIf you want to scan a table for different key values, not just search for exact key values, you should create your keys with USING BTREE:\n\n``sql\nCREATE TABLE t1 (a INT, b INT, KEY(a), KEY b USING BTREE (b)) ENGINE=memory;\n`\n\nIn the above table, a is a HASH key that only supports exact matches (=) while b is a BTREE key that you can use to scan the table in key order, starting from start or from a given key value.\n\nThe limitations for HANDLER READ with MEMORY|HEAP tables are:\n\nLimitations for HASH keys\n\n You must use all key parts when searching for a row.\n You can''t do a key scan of all values. You can only find all rows with the same key value.\n READ NEXT gives an error 1031 if the tables changed since last read.\n\nLimitations for BTREE keys\n\n READ NEXT gives an error 1031 if the tables changed since last read. This limitation can be lifted in the future.\n\nLimitations for table scans\n\n* READ NEXT gives an error 1031 if the table was truncated since last READ` call.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/nosql/handler/handler-for-memory-tables', '', 'https://mariadb.com/docs/server/reference/sql-structure/nosql/handler/handler-for-memory-tables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (939, 35, 'HandlerSocket Client Libraries', 'Description\n-----------\n\nIn order to make use of the HandlerSocket plugin in your applications, you will need to use the appropriate client library. The following client libraries are available:\n\n C++\n   libhsclient (included with the HandlerSocket plugin source)\n Perl\n   perl-Net-HandlerSocket (included with the HandlerSocket plugin source)\n PHP\n   Net_HandlerSocket\n   HSPHP\n   php-ext-handlersocketi\n Java\n   hs4j\n   handlersocketforjava\n Python\n   python-handler-socket\n   pyhandlersocket\n Ruby\n   ruby-handlersocket\n   handlersocket\n JavaScript\n   node-handlersocket\n Scala\n   hs2client\n Haskell\n  * HandlerSocket-Haskell-Client\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/nosql/handlersocket/handlersocket-client-libraries', '', 'https://mariadb.com/docs/server/reference/sql-structure/nosql/handlersocket/handlersocket-client-libraries');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (940, 35, 'HandlerSocket Configuration Options', 'Description\n-----------\n\nThe HandlerSocket plugin has the following options.\n\nSee also the Full list of MariaDB options, system and status variables.\n\nAdd the options to the [mysqld] section of your my.cnf file.\n\nhandlersocket_accept_balance\n\n Description: When set to a value other than zero (''0''), handlersocket will try to balance accepted connections among threads. Default is 0 , but if you use persistent connections (for example if you use client-side connection pooling), a non-zero value is recommended.\n Command line: --handlersocket-accept-balance="value"\n Scope: Global\n Dynamic: No\n Type: number\n Range: 0 to 10000\n Default Value: 0\n\nhandlersocket_address\n\n Description: Specify the IP address to bind to.\n Command line: --handlersocket-address="value"\n Scope: Global\n Dynamic: No\n Type: IP Address\n Default Value: Empty, previously 0.0.0.0\n\nhandlersocket_backlog\n\n Description: Specify the listen backlog length.\n Command line: --handlersocket-backlog="value"\n Scope: Global\n Dynamic: No\n Type: number\n Range: 5 to 1000000\n Default Value: 32768\n\nhandlersocket_epoll\n\n Description: Specify whether to use epoll for I/O multiplexing.\n Command line: --handlersocket-epoll="value"\n Scope: Global\n Dynamic: No\n Type: number\n Valid values:\n   Min: 0\n   Max: 1\n Default Value: 1\n\nhandlersocket_plain_secret\n\n Description: When set, enables plain-text authentication for the listener for read requests, with the value of the option specifying the secret authentication key.\n Command line: --handlersocket-plain-secret="value"\n Dynamic: No\n Type: string\n Default Value: Empty\n\nhandlersocket_plain_secret_wr\n\n Description: When set, enables plain-text authentication for the listener for write requests, with the value of the option specifying the secret authentication key.\n Command line: --handlersocket-plain-secret-wr="value"\n Dynamic: No\n Type: string\n Default Value: Empty\n\nhandlersocket_port\n\n Description: Specify the port to bind to for reads. An empty value disables the listener.\n Command line: --handlersocket-port="value"\n Scope: Global\n Dynamic: No\n Type: number\n Default Value: Empty, previously 9998\n\nhandlersocket_port_wr\n\n Description: Specify the port to bind to for writes. An empty value disables the listener.\n Command line: --handlersocket-port-wr="value"\n Scope: Global\n Dynamic: No\n Type: number\n Default Value: Empty, previously 9999\n\nhandlersocket_rcvbuf\n\n Description: Specify the maximum socket receive buffer (in bytes). If ''0'' then the system default is used.\n Command line: --handlersocket-rcvbuf="value"\n Scope: Global\n Dynamic: No\n Type: number\n Range: 0 to 1677216\n Default Value: 0\n\nhandlersocket_readsize\n\n Description: Specify the minimum length of the request buffer. Larger values consume available memory but can make handlersocket faster for large requests.\n Command line: --handlersocket-readsize="value"\n Scope: Global\n Dynamic: No\n Type: number\n Range: 0 to 1677216\n Default Value: 0 (possibly 4096)\n\nhandlersocket_sndbuf\n\n Description: Specify the maximum socket send buffer (in bytes). If ''0'' then the system default is used.\n Command line: --handlersocket-sndbuf="value"\n Scope: Global\n Dynamic: No\n Type: number\n Range: 0 to 1677216\n Default Value: 0\n\nhandlersocket_threads\n\n Description: Specify the number of worker threads for reads. \\\n  Recommended value = number of CPU cores \\ 2.\n Command line: --handlersocket-threads="value"\n Scope: Global\n Dynamic: No\n Type: number\n Range: 1 to 3000\n Default Value: 16\n\nhandlersocket_threads_wr\n\n Description: Specify the number of worker threads for writes. Recommended value = 1.\n Command line: --handlersocket-threads-wr="value"\n Scope: Global\n Dynamic: No\n Type: number\n Range: 1 to 3000\n Default Value: 1\n\nhandlersocket_timeout\n\n Description: Specify the socket timeout in seconds.\n Command line: --handlersocket-timeout="value"\n Scope: Global\n Dynamic: No\n Type: number\n Range: 30 to 3600\n Default Value: 300\n\nhandlersocket_verbose\n\n Description: Specify the logging verbosity.\n Command line: --handlersocket-verbose="value"\n Scope: Global\n Dynamic: No\n Type: number\n Valid values:\n   Min: 0\n   Max: 10000\n Default Value: 10\n\nhandlersocket_wrlock_timeout\n\n Description: The write lock timeout in seconds. When acting on write requests, handlersocket locks an advisory lock named ''handlersocket_wr'' and this option sets the timeout for it.\n Command line: --handlersocket-wrlock-timeout="value"\n Scope: Global\n Dynamic: No\n Type: number\n* Range: 0 to 3600\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/nosql/handlersocket/handlersocket-configuration-options', '', 'https://mariadb.com/docs/server/reference/sql-structure/nosql/handlersocket/handlersocket-configuration-options');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (941, 35, 'HandlerSocket External Resources', 'Description\n-----------\n\nSome resources and documentation about HandlerSocket.\n\n The home of HandlerSocket is here.\n The story of handlersocket can be found here.\n Comparison of HANDLER and HandlerSocket can be found here.\n HandlerSocket plugin for MySQL presentation by Akira Higuchi of DeNA - June 29 2010 - DeNA Technology Seminar\n* HandlerSocket plugin for MySQL presentation by Akira Higuchi of DeNA - June 29 2011 - in Japanese\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/nosql/handlersocket/handlersocket-external-resources', '', 'https://mariadb.com/docs/server/reference/sql-structure/nosql/handlersocket/handlersocket-external-resources');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (942, 35, 'HandlerSocket Installation', 'Description\n-----------\n\nAfter MariaDB is installed, use the INSTALL PLUGIN command (as the root user) to install\\\nthe HandlerSocket plugin. This command only needs to be run once, like so:\n\n``sql\nINSTALL PLUGIN handlersocket SONAME ''handlersocket.so'';\n`\n\nAfter installing the plugin, SHOW PROCESSLIST shows you first need to configure some settings. All HandlerSocket configuration options are placed in the [mysqld] section of your my.cnf file.\n\nAt least the handlersocket_address, handlersocket_port and handlersocket_port_wr options need to be set:\n\n`ini\nhandlersocket_address="127.0.0.1"\nhandlersocket_port="9998"\nhandlersocket_port_wr="9999"\n``\n\nAfter updating the configuration options, restart MariaDB.\n\nOn the client side, to make use of the plugin you will need to install the appropriate client library (that is,  libhsclient for C++ applications and perl-Net-HandlerSocket for perl applications).\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/nosql/handlersocket/handlersocket-installation', '', 'https://mariadb.com/docs/server/reference/sql-structure/nosql/handlersocket/handlersocket-installation');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (943, 38, 'Addition Operator (+)', 'Syntax\n------\n\n+\n\nDescription\n-----------\n\nAddition.\n\nIf both operands are integers, the result is calculated with BIGINT precision. If either integer is unsigned, the result is also an unsigned integer.\n\nFor real or string operands, the operand with the highest precision determines the result precision.\n\nExamples\n--------\n\nSELECT 3+5;\n+-----+\n| 3+5 |\n+-----+\n|   8 |\n+-----+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/arithmetic-operators/addition-operator', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/arithmetic-operators/addition-operator');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (944, 38, 'Division Operator (/)', 'Syntax\n------\n\n/\n\nDescription\n-----------\n\nDivision operator. Dividing by zero will return NULL. By default, returns four digits after the decimal. This is determined by the server system variable div_precision_increment which by default is four. It can be set from 0 to 30.\n\nDividing by zero returns NULL. If the default ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, a division by zero also produces a warning.\n\nExamples\n--------\n\nSELECT 4/5;\n+--------+\n| 4/5    |\n+--------+\n| 0.8000 |\n+--------+\n\nSELECT 300/(2-2);\n+-----------+\n| 300/(2-2) |\n+-----------+\n|      NULL |\n+-----------+\n\nSELECT 300/7;\n+---------+\n| 300/7   |\n+---------+\n| 42.8571 |\n+---------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/arithmetic-operators/division-operator', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/arithmetic-operators/division-operator');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (945, 38, 'Modulo Operator (%)', 'Syntax\n------\n\nN % M\n\nDescription\n-----------\n\nModulo operator. Returns the remainder of N divided by M. See also MOD.\n\nExamples\n--------\n\nSELECT 1042 % 50;\n+-----------+\n| 1042 % 50 |\n+-----------+\n|        42 |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/arithmetic-operators/modulo-operator', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/arithmetic-operators/modulo-operator');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (946, 38, 'Multiplication Operator (\\*)', 'Syntax\n------\n\nDescription\n-----------\n\nMultiplication operator.\n\nExamples\n--------\n\nSELECT 76;\n+-----+\n| 76 |\n+-----+\n|  42 |\n+-----+\n\nSELECT 12345678909876543210;\n+-----------------------+\n| 12345678909876543210 |\n+-----------------------+\n|  -6253480962446024716 |\n+-----------------------+\n\nSELECT 1801439850948198418014398509481984.0;\n+---------------------------------------+\n| 1801439850948198418014398509481984.0 |\n+---------------------------------------+\n|   324518553658426726783156020576256.0 |\n+---------------------------------------+\n\nSELECT 1801439850948198418014398509481984;\n+-------------------------------------+\n| 18014398509481984*18014398509481984 |\n+-------------------------------------+\n|                                   0 |\n+-------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/arithmetic-operators/multiplication-operator', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/arithmetic-operators/multiplication-operator');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (947, 38, 'Subtraction Operator (-)', 'Syntax\n------\n\n-\n\nDescription\n-----------\n\nSubtraction. The operator is also used as the unary minus for changing sign.\n\nIf both operands are integers, the result is calculated with BIGINT precision. If either integer is unsigned, the result is also an unsigned integer, unless the NO_UNSIGNED_SUBTRACTION SQL_MODE is enabled, in which case the result is always signed.\n\nFor real or string operands, the operand with the highest precision determines the result precision.\n\nExamples\n--------\n\nSELECT 96-9;\n+------+\n| 96-9 |\n+------+\n|   87 |\n+------+\n\nSELECT 15-17;\n+-------+\n| 15-17 |\n+-------+\n|    -2 |\n+-------+\n\nSELECT 3.66 + 1.333;\n+--------------+\n| 3.66 + 1.333 |\n+--------------+\n|        4.993 |\n+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/arithmetic-operators/subtraction-operator', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/arithmetic-operators/subtraction-operator');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (948, 38, 'Assignment Operator (:=)', 'Syntax\n------\n\nvar_name := expr\n\nDescription\n-----------\n\nAssignment operator for assigning a value. The value on the right is assigned to the variable on left.\n\nUnlike the = operator, := can always be used to assign a value to a variable.\n\nThis operator works with both user-defined variables and local variables.\n\nWhen assigning the same value to several variables, LAST_VALUE() can be useful.\n\nExamples\n--------\n\nSELECT @x := 10;\n+----------+\n| @x := 10 |\n+----------+\n|       10 |\n+----------+\n\nSELECT @x, @y := @x;\n+------+----------+\n| @x   | @y := @x |\n+------+----------+\n|   10 |       10 |\n+------+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/assignment-operators/assignment-operator', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/assignment-operators/assignment-operator');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (949, 38, 'Assignment Operator (=)', 'Syntax\n------\n\nidentifier = expr\n\nDescription\n-----------\n\nThe equal sign is used as both an assignment operator in certain contexts, and as a comparison operator. When used as assignment operator, the value on the right is assigned to the variable (or column, in some contexts) on the left.\n\nSince its use can be ambiguous, unlike the := assignment operator, the _=_ assignment operator cannot be used in all contexts, and is only valid as part of a SET statement, or the SET clause of an UPDATE statement\n\nThis operator works with both user-defined variables and local variables.\n\nExamples\n--------\n\nUPDATE table_name SET x = 2 WHERE x > 100;\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/assignment-operators/assignment-operators-assignment-operator', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/assignment-operators/assignment-operators-assignment-operator');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (950, 38, 'BETWEEN AND', 'Syntax\n------\n\nexpr BETWEEN min AND max\n\nDescription\n-----------\n\nIf expr is greater than or equal to min and expr is less than or equal to max, BETWEEN returns 1, otherwise it returns 0. This is equivalent to the expression (min <= expr AND expr <= max) if all the arguments are of the same type. Otherwise type conversion takes place according to the rules described at Type Conversion, but applied to all the three arguments.\n\nExamples\n--------\n\nSELECT 1 BETWEEN 2 AND 3;\n+-------------------+\n| 1 BETWEEN 2 AND 3 |\n+-------------------+\n|                 0 |\n+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/between-and', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/between-and');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (951, 38, 'COALESCE', 'Syntax\n------\n\nCOALESCE(value,...)\n\nDescription\n-----------\n\nReturns the first non-NULL value in the list, or NULL if there are no non-NULL values. At least one parameter must be passed.\n\nThe function is useful when substituting a default value for null values when displaying data.\n\nSee also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT COALESCE(NULL,1);\n+------------------+\n| COALESCE(NULL,1) |\n+------------------+\n|                1 |\n+------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/coalesce', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/coalesce');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (952, 38, '=', 'Syntax\n------\n\nleft_expr = right_expr\n\nDescription\n-----------\n\nEqual operator. Evaluates both SQL expressions and returns 1 if they are equal, 0 if they are not equal, or NULL if either expression is NULL. If the expressions return different data types (for example, a number and a string), a type conversion is performed.\n\nWhen used in row comparisons these two queries are synonymous and return the same results:\n\n``sql\nSELECT (t1.a, t1.b) = (t2.x, t2.y) FROM t1 INNER JOIN t2;\n\nSELECT (t1.a = t2.x) AND (t1.b = t2.y) FROM t1 INNER JOIN t2;\n`\n\nTo perform a NULL-safe comparison, use the <=> operator.\n\n=` can also be used as an assignment operator.\n\nExamples\n--------\n\nSELECT 1 = 0;\n+-------+\n| 1 = 0 |\n+-------+\n|     0 |\n+-------+\n\nSELECT ''0'' = 0;\n+---------+\n| ''0'' = 0 |\n+---------+\n|       1 |\n+---------+\n\nSELECT ''0.0'' = 0;\n+-----------+\n| ''0.0'' = 0 |\n+-----------+\n|         1 |\n+-----------+\n\nSELECT ''0.01'' = 0;\n+------------+\n| ''0.01'' = 0 |\n+------------+\n|          0 |\n+------------+\n\nSELECT ''.01'' = 0.01;\n+--------------+\n| ''.01'' = 0.01 |\n+--------------+\n|            1 |\n+--------------+\n\nSELECT (5  2) = CONCAT(''1'', ''0'');\n+----------------------------+\n| (5  2) = CONCAT(''1'', ''0'') |\n+----------------------------+\n|                          1 |\n+----------------------------+\n\nSELECT 1 = NULL;\n+----------+\n| 1 = NULL |\n+----------+\n|     NULL |\n+----------+\n\nSELECT NULL = NULL;\n+-------------+\n| NULL = NULL |\n+-------------+\n|        NULL |\n+-------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/equal', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/equal');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (953, 38, '>=', 'Syntax\n------\n\n>=\n\nDescription\n-----------\n\nGreater than or equal operator. Evaluates both SQL expressions and returns 1 if the left value is greater than or equal to the right value and 0 if it is not, or NULL if either expression is NULL. If the expressions return different data types, (for instance, a number and a string), performs type conversion.\n\nWhen used in row comparisons, these two queries return the same results:\n\n``sql\nSELECT (t1.a, t1.b) >= (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a > t2.x) OR ((t1.a = t2.x) AND (t1.b >= t2.y))\nFROM t1 INNER JOIN t2;\n``\n\nExamples\n--------\n\nSELECT 2 >= 2;\n+--------+\n| 2 >= 2 |\n+--------+\n|      1 |\n+--------+\n\nSELECT ''A'' >= ''a'';\n+------------+\n| ''A'' >= ''a'' |\n+------------+\n|          1 |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/greater-than-or-equal', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/greater-than-or-equal');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (954, 38, '>', 'Syntax\n------\n\n>\n\nDescription\n-----------\n\nGreater than operator. Evaluates both SQL expressions and returns 1 if the left value is greater than the right value and 0 if it is not, or NULL if either expression is NULL. If the expressions return different data types, (for instance, a number and a string), performs type conversion.\n\nWhen used in row comparisons these two queries return the same results:\n\n``sql\nSELECT (t1.a, t1.b) > (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a > t2.x) OR ((t1.a = t2.x) AND (t1.b > t2.y))\nFROM t1 INNER JOIN t2;\n``\n\nExamples\n--------\n\nSELECT 2 > 2;\n+-------+\n| 2 > 2 |\n+-------+\n|     0 |\n+-------+\n\nSELECT ''b'' > ''a'';\n+-----------+\n| ''b'' > ''a'' |\n+-----------+\n|         1 |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/greater-than', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/greater-than');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (955, 38, 'GREATEST', 'Syntax\n------\n\nGREATEST(value1,value2,...)\n\nDescription\n-----------\n\nWith two or more arguments, returns the largest (maximum-valued) argument. The arguments are compared using the same rules as for LEAST().\n\nExamples\n--------\n\nSELECT GREATEST(2,0);\n+---------------+\n| GREATEST(2,0) |\n+---------------+\n|             2 |\n+---------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/greatest', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/greatest');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (956, 38, 'IN', 'Syntax\n------\n\nexpr IN (value,...)\n\nDescription\n-----------\n\nReturns 1 if _expr_ is equal to any of the values in the IN list, else returns 0. If all values are constants, they are evaluated according to the type of _expr_ and sorted. The search for the item then is done\\\nusing a binary search. This means IN is very quick if the IN value list consists entirely of constants. Otherwise, type conversion takes place according to the rules described at Type Conversion, but\\\napplied to all the arguments.\n\nIf _expr_ is NULL, IN always returns NULL. If at least one of the values in the list is NULL, and one of the comparisons is true, the result is 1. If at least one of the values in the list is NULL and none of the comparisons is true, the result is NULL.\n\nExamples\n--------\n\nSELECT 2 IN (0,3,5,7);\n+----------------+\n| 2 IN (0,3,5,7) |\n+----------------+\n|              0 |\n+----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/in', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/in');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (957, 38, 'INTERVAL', 'Syntax\n------\n\nINTERVAL(N0,N1,N2,N3,...)\n\nDescription\n-----------\n\nReturns the index of the last argument that is less than or equal to the first argument, or is NULL.\n\nReturns 0 if N0 < N1, 1 if N1 <= N0 < N2, 2 if N2 <= N0 < N3 and so on or -1 if N0 is NULL. All arguments are treated as integers. It is required that N1 <= N2 <= N3 <= ... <= Nn for this function to work correctly because a fast binary search is used.\n\nExamples\n--------\n\nSELECT INTERVAL(22, 24, 26, 28);\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/interval', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/interval');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (958, 38, 'IS JSON', 'Description\n-----------\n\nThe IS JSON predicate checks whether a given string expression evaluates to valid JSON data in accordance with the SQL:2016 standard (based on RFC 8259).&#x20;\n\nThe predicate returns:\n\n 1  (TRUE) if the JSON expression is valid and satisfies any type constraint that is specified (e.g., OBJECT, ARRAY)\n 0 (FALSE) if the expression is not valid JSON or does not match the  specified type constraints\n &#x20;NULL (UNKNOWN) if the JSON expression itself evaluates to NULL\n\nWhen the value is invalid JSON, the predicate does not show errors. Any valid JSON value is accepted since VALUE is considered when no type constraint is mentioned.\n\nType Constraints\n\nTo limit the permitted top-level JSON value, use the optional type constraints listed below:\n\n| Type     | Description                                                                   |\n| -------- | ----------------------------------------------------------------------------- |\n| VALUE  | Any valid JSON value (object, array, number, string, true, false, null) |\n| ARRAY  | Only JSON arrays (e.g., [1,2,3]                                             |\n| OBJECT | Only JSON objects (e.g., {"key": "value"} = {"a": "42"})                      |\n| SCALAR | A JSON scalar value (strings, numbers, Boolean, or null)                    |\n\nUnique Keys\n\nThe object keys must be unique in order to use WITH UNIQUE KEYS option. WITHOUT UNIQUE KEYS, duplicate keys are accepted.&#x20;\n\nNotes\n\n JSON Validation is based on RFC 8259.\n JSON literal names must be all lowercase: true, false, null.\n Other literal names are not permitted.\n* IS JSON works in in generated columns, CHECK constraints, and DEFAULT expressions.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/is-json', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/is-json');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (959, 38, 'IS NOT NULL', 'Syntax\n------\n\nIS NOT NULL\n\nDescription\n-----------\n\nTests whether a value is not NULL. See also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;\n+---------------+---------------+------------------+\n| 1 IS NOT NULL | 0 IS NOT NULL | NULL IS NOT NULL |\n+---------------+---------------+------------------+\n|             1 |             1 |                0 |\n+---------------+---------------+------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/is-not-null', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/is-not-null');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (960, 38, 'IS NOT', 'Syntax\n------\n\nIS NOT boolean_value\n\nDescription\n-----------\n\nTests a value against a boolean value, where boolean_value can be TRUE, FALSE, or UNKNOWN.\n\nExamples\n--------\n\nSELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT UNKNOWN;\n+------------------+------------------+---------------------+\n| 1 IS NOT UNKNOWN | 0 IS NOT UNKNOWN | NULL IS NOT UNKNOWN |\n+------------------+------------------+---------------------+\n|                1 |                1 |                   0 |\n+------------------+------------------+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/is-not', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/is-not');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (961, 38, 'IS NULL', 'Syntax\n------\n\nIS NULL\n\nDescription\n-----------\n\nTests whether a value is NULL. See also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;\n+-----------+-----------+--------------+\n| 1 IS NULL | 0 IS NULL | NULL IS NULL |\n+-----------+-----------+--------------+\n|         0 |         0 |            1 |\n+-----------+-----------+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/is-null', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/is-null');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (962, 38, 'IS', 'Syntax\n------\n\nIS boolean_value\n\nDescription\n-----------\n\nTests a value against a boolean value, where boolean_value can be TRUE, FALSE, or UNKNOWN.\n\nThere is an important difference between using IS TRUE or comparing a value with TRUE using =. When using =, only 1 equals to TRUE. But when using IS TRUE, all values which are logically true (like a number > 1) return TRUE.\n\nExamples\n--------\n\nSELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;\n+-----------+------------+-----------------+\n| 1 IS TRUE | 0 IS FALSE | NULL IS UNKNOWN |\n+-----------+------------+-----------------+\n|         1 |          1 |               1 |\n+-----------+------------+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/is', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/is');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (963, 38, 'ISNULL', 'Syntax\n------\n\nISNULL(expr)\n\nDescription\n-----------\n\nIf _expr_ is NULL, ISNULL() returns 1, otherwise it returns 0.\n\nSee also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT ISNULL(1+1);\n+-------------+\n| ISNULL(1+1) |\n+-------------+\n|           0 |\n+-------------+\n\nSELECT ISNULL(1/0);\n+-------------+\n| ISNULL(1/0) |\n+-------------+\n|           1 |\n+-------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/isnull', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/isnull');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (964, 38, 'LEAST', 'Syntax\n------\n\nLEAST(value1,value2,...)\n\nDescription\n-----------\n\nWith two or more arguments, returns the smallest (minimum-valued) argument. The arguments are compared using the following rules:\n\n If the return value is used in an INTEGER context or all arguments are integer-valued, they are compared as integers.\n If the return value is used in a REAL context or all arguments are real-valued, they are compared as reals.\n If any argument is a case-sensitive string, the arguments are compared as case-sensitive strings.\n In all other cases, the arguments are compared as case-insensitive strings.\n\nLEAST() returns NULL if any argument is NULL.\n\nExamples\n--------\n\nSELECT LEAST(2,0);\n+------------+\n| LEAST(2,0) |\n+------------+\n|          0 |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/least', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/least');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (965, 38, '<=', 'Syntax\n------\n\n<=\n\nDescription\n-----------\n\nLess than or equal operator. Evaluates both SQL expressions and returns 1 if the left value is less than or equal to the right value and 0 if it is not, or NULL if either expression is NULL. If the expressions return different data types, (for instance, a number and a string), performs type conversion.\n\nWhen used in row comparisons these two queries return the same results:\n\n``sql\nSELECT (t1.a, t1.b) <= (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a < t2.x) OR ((t1.a = t2.x) AND (t1.b <= t2.y))\nFROM t1 INNER JOIN t2;\n``\n\nExamples\n--------\n\nSELECT 0.1 <= 2;\n+----------+\n| 0.1 <= 2 |\n+----------+\n|        1 |\n+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/less-than-or-equal', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/less-than-or-equal');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (966, 38, '<', 'Syntax\n------\n\n<\n\nDescription\n-----------\n\nLess than operator. Evaluates both SQL expressions and returns 1 if the left value is less than the right value and 0 if it is not, or NULL if either expression is NULL. If the expressions return different data types, (for instance, a number and a string), performs type conversion.\n\nWhen used in row comparisons, these two queries return the same results:\n\n``sql\nSELECT (t1.a, t1.b) < (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a < t2.x) OR ((t1.a = t2.x) AND (t1.b < t2.y))\nFROM t1 INNER JOIN t2;\n``\n\nExamples\n--------\n\nSELECT 2 < 2;\n+-------+\n| 2 < 2 |\n+-------+\n|     0 |\n+-------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/less-than', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/less-than');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (967, 38, 'NOT BETWEEN', 'Syntax\n------\n\nexpr NOT BETWEEN min AND max\n\nDescription\n-----------\n\nThis is the same as NOT (expr BETWEEN min AND max).\n\nNote that the meaning of the alternative form NOT expr BETWEEN min AND max is affected by the HIGH_NOT_PRECEDENCE SQL_MODE flag.\n\nExamples\n--------\n\nSELECT 1 NOT BETWEEN 2 AND 3;\n+-----------------------+\n| 1 NOT BETWEEN 2 AND 3 |\n+-----------------------+\n|                     1 |\n+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/not-between', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/not-between');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (968, 38, '!=', 'Syntax\n------\n\n<>, !=\n\nDescription\n-----------\n\nNot equal operator. Evaluates both SQL expressions and returns 1 if they are not equal, and 0 if they are equal, or NULL if either expression is NULL. If the expressions return different data types, (for instance, a number and a string), performs type conversion.\n\nWhen used in row comparisons these two queries return the same results:\n\n``sql\nSELECT (t1.a, t1.b) != (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a != t2.x) OR (t1.b != t2.y)\nFROM t1 INNER JOIN t2;\n``\n\nExamples\n--------\n\nSELECT ''.01'' <> ''0.01'';\n+-----------------+\n| ''.01'' <> ''0.01'' |\n+-----------------+\n|               1 |\n+-----------------+\n\nSELECT .01 <> ''0.01'';\n+---------------+\n| .01 <> ''0.01'' |\n+---------------+\n|             0 |\n+---------------+\n\nSELECT ''zapp'' <> ''zappp'';\n+-------------------+\n| ''zapp'' <> ''zappp'' |\n+-------------------+\n|                 1 |\n+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/not-equal', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/not-equal');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (969, 38, 'NOT IN', 'Syntax\n------\n\nexpr NOT IN (value,...)\n\nDescription\n-----------\n\nThis is the same as NOT (expr IN (value,...)).\n\nExamples\n--------\n\nSELECT 2 NOT IN (0,3,5,7);\n+--------------------+\n| 2 NOT IN (0,3,5,7) |\n+--------------------+\n|                  1 |\n+--------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/not-in', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/not-in');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (970, 38, '<=>', 'Syntax\n------\n\n<=>\n\nDescription\n-----------\n\nNULL-safe equal operator. It performs an equality comparison like the = operator, but returns 1 rather than NULL if both operands are NULL, and 0 rather than NULL if one operand is NULL.\n\na <=> b is equivalent to a = b OR (a IS NULL AND b IS NULL).\n\nWhen used in row comparisons, these two queries return the same results:\n\n``sql\nSELECT (t1.a, t1.b) <=> (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a <=> t2.x) AND (t1.b <=> t2.y)\nFROM t1 INNER JOIN t2;\n``\n\nSee also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT 1 <=> 1, NULL <=> NULL, 1 <=> NULL;\n+---------+---------------+------------+\n| 1 <=> 1 | NULL <=> NULL | 1 <=> NULL |\n+---------+---------------+------------+\n|       1 |             1 |          0 |\n+---------+---------------+------------+\n\nSELECT 1 = 1, NULL = NULL, 1 = NULL;\n+-------+-------------+----------+\n| 1 = 1 | NULL = NULL | 1 = NULL |\n+-------+-------------+----------+\n|     1 |        NULL |     NULL |\n+-------+-------------+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/null-safe-equal', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/comparison-operators/null-safe-equal');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (971, 38, '&&', 'Syntax\n------\n\nAND, &&\n\nDescription\n-----------\n\nLogical AND. Evaluates to 1 if all operands are non-zero and not NULL, to 0 if one or more operands are 0, otherwise NULL is returned.\n\nFor this operator, short-circuit evaluation can be used.\n\nExamples\n--------\n\nSELECT 1 && 1;\n+--------+\n| 1 && 1 |\n+--------+\n|      1 |\n+--------+\n\nSELECT 1 && 0;\n+--------+\n| 1 && 0 |\n+--------+\n|      0 |\n+--------+\n\nSELECT 1 && NULL;\n+-----------+\n| 1 && NULL |\n+-----------+\n|      NULL |\n+-----------+\n\nSELECT 0 && NULL;\n+-----------+\n| 0 && NULL |\n+-----------+\n|         0 |\n+-----------+\n\nSELECT NULL && 0;\n+-----------+\n| NULL && 0 |\n+-----------+\n|         0 |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/logical-operators/and', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/logical-operators/and');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (972, 38, '!', 'Syntax\n------\n\nNOT, !\n\nDescription\n-----------\n\nLogical NOT. Evaluates to 1 if the operand is 0, to 0 if the operand is non-zero, and NOT NULL returns NULL.\n\nBy default, the ! operator has a higher precedence. If the HIGH_NOT_PRECEDENCE SQL_MODE flag is set, NOT and ! have the same precedence.\n\nExamples\n--------\n\nSELECT NOT 10;\n+--------+\n| NOT 10 |\n+--------+\n|      0 |\n+--------+\n\nSELECT NOT 0;\n+-------+\n| NOT 0 |\n+-------+\n|     1 |\n+-------+\n\nSELECT NOT NULL;\n+----------+\n| NOT NULL |\n+----------+\n|     NULL |\n+----------+\n\nSELECT ! (1+1);\n+---------+\n| ! (1+1) |\n+---------+\n|       0 |\n+---------+\n\nSELECT ! 1+1;\n+-------+\n| ! 1+1 |\n+-------+\n|     1 |\n+-------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/logical-operators/not', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/logical-operators/not');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (973, 38, '||', 'Syntax\n------\n\nOR, ||\n\nDescription\n-----------\n\nLogical OR. When both operands are non-NULL, the result is 1 if any operand is non-zero, and 0 otherwise. With a NULL operand, the result is 1 if the other operand is non-zero, and NULL otherwise. If both operands are NULL, the result is NULL.\n\nFor this operator, short-circuit evaluation can be used.\n\nNote that, if the PIPES_AS_CONCAT SQL_MODE is set, || is used as a string concatenation operator. This means that a || b is the same as CONCAT(a,b). See CONCAT() for details.\n\nOracle Mode\n\nIn Oracle mode, || ignores null.\n\nExamples\n--------\n\nSELECT 1 || 1;\n+--------+\n| 1 || 1 |\n+--------+\n|      1 |\n+--------+\n\nSELECT 1 || 0;\n+--------+\n| 1 || 0 |\n+--------+\n|      1 |\n+--------+\n\nSELECT 0 || 0;\n+--------+\n| 0 || 0 |\n+--------+\n|      0 |\n+--------+\n\nSELECT 0 || NULL;\n+-----------+\n| 0 || NULL |\n+-----------+\n|      NULL |\n+-----------+\n\nSELECT 1 || NULL;\n+-----------+\n| 1 || NULL |\n+-----------+\n|         1 |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/logical-operators/or', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/logical-operators/or');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (974, 38, 'XOR', 'Syntax\n------\n\nXOR\n\nDescription\n-----------\n\nXOR stands for eXclusive OR. Returns NULL if either operand is NULL. For non-NULL operands, evaluates to 1 if an odd number of operands is non-zero, otherwise 0 is returned.\n\nExamples\n--------\n\nSELECT 1 XOR 1;\n+---------+\n| 1 XOR 1 |\n+---------+\n|       0 |\n+---------+\n\nSELECT 1 XOR 0;\n+---------+\n| 1 XOR 0 |\n+---------+\n|       1 |\n+---------+\n\nSELECT 1 XOR NULL;\n+------------+\n| 1 XOR NULL |\n+------------+\n|       NULL |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/logical-operators/xor', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/logical-operators/xor');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (975, 38, 'Operator Precedence', 'Description\n-----------\n\nThe precedence is the order in which the SQL operators are evaluated.\n\nThe following list shows the SQL operator precedence. Operators that appear first in the list have a higher precedence. Operators which are listed together have the same precedence.\n\n INTERVAL\n BINARY, COLLATE\n !\n - (unary minus), bitwise not (unary bit inversion)\n || (string concatenation)\n ^ (bitwise XOR)\n \\, /, DIV, %, MOD (multiplication, division, modulo)\n -, + (subtraction, addition)\n <<, >>\n & (bitwise AND)\n | (bitwise OR)\n LIKE, REGEXP, IN\n BETWEEN\n = (comparison), <=>, >=, >, <=, <, <>, !=, IS\n NOT\n &&, AND\n XOR\n || (logical or), OR\n = (assignment), :=\n\nFunctions precedence is always higher than operators precedence.\n\nIf the HIGH_NOT_PRECEDENCE SQL_MODE is set, NOT has the same precedence as !.\n\nThe || operator''s precedence, as well as its meaning, depends on the PIPES_AS_CONCAT SQL_MODE flag: if it is on, || can be used to concatenate strings (like the CONCAT() function) and has a higher precedence.\n\nThe = operator''s precedence depends on the context - it is higher when = is used as a comparison operator.\n\nParentheses can be used to modify the operators precedence in an expression.\n\nShort-Circuit Evaluation\n\nThe AND, OR, && and || operators support short-circuit evaluation. This means that, in some cases, the expression on the right of those operators is not evaluated, because its result cannot affect the result. In the following cases, short-circuit evaluation is used and x() is not evaluated:\n\n FALSE AND x()\n FALSE && x()\n TRUE OR x()\n TRUE || x()\n* NULL BETWEEN x() AND x()\n\nNote however that the short-circuit evaluation does _not_ apply to NULL AND x(). Also, BETWEEN''s right operands are not evaluated if the left operand is NULL, but in all other cases all the operands are evaluated.\n\nThis is a speed optimization. Also, since functions can have side-effects, this behavior can be used to choose whether execute them or not using a concise syntax:\n\n``sql\nSELECT some_function() OR log_error();\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/operators/operator-precedence', '', 'https://mariadb.com/docs/server/reference/sql-structure/operators/operator-precedence');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (976, 35, 'Sequences', 'Description\n-----------\n\nsequence-overview.md\n\ncreate-sequence.md\n\nshow-create-sequence.md\n\nalter-sequence.md\n\ndrop-sequence.md\n\nsequence-functions\n\ninformation-schema-sequences-table.md\n\nshow-tables.md\n\ne4084.md\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sequences/README', '', 'https://mariadb.com/docs/server/reference/sql-structure/sequences/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (977, 35, 'ALTER SEQUENCE', 'Syntax\n------\n\nALTER SEQUENCE [IF EXISTS] sequence_name\n[AS { TINYINT | SMALLINT | |MEDIUMINT | INT | INTEGER | BIGINT } [SIGNED | UNSIGNED]]\n[ INCREMENT [ BY | = ] number ]\n[ MINVALUE [=] number | NO MINVALUE | NOMINVALUE ]\n[ MAXVALUE [=] number | NO MAXVALUE | NOMAXVALUE ]\n[ START [ WITH | = ] number ] [ CACHE [=] number ] [ [ NO ] CYCLE ]\n[ RESTART [[WITH | =] number]\n\nDescription\n-----------\n\nALTER SEQUENCE changes the parameters of an existing sequence generator. Any parameters not specifically set in the ALTER SEQUENCE command retain their prior settings.\n\nALTER SEQUENCE requires the ALTER privilege.\n\nOptions to ALTER SEQUENCE\n\n| Option    | Default value                                                | Description                                                                                                                                                                 |\n| --------- | ------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| INCREMENT | 1                                                            | Increment to use for values. May be negative.                                                                                                                               |\n| MINVALUE  | 1 if INCREMENT > 0 and -9223372036854775807 if INCREMENT < 0 | Minimum value for the sequence.                                                                                                                                             |\n| MAXVALUE  | 9223372036854775806 if INCREMENT > 0 and -1 if INCREMENT < 0 | Max value for sequence.                                                                                                                                                     |\n| START     | MINVALUE if INCREMENT > 0 and MAX_VALUE if INCREMENT< 0     | First value that the sequence will generate.                                                                                                                                |\n| CACHE     | 1000                                                         | Number of values that should be cached. 0 if no CACHE. The underlying table will be updated first time a new sequence number is generated and each time the cache runs out. |\n| CYCLE     | 0 (= NO CYCLE)                                               | 1 if the sequence should start again from MINVALUE                                                                                                                          |\n\nThe optional clause RESTART [ WITH restart ] sets the next value for the sequence. This is equivalent to calling the SETVAL() function with the is_used argument as 0. The specified value will be returned by the next call of nextval. Using RESTART with no restart value is equivalent to supplying the start value that was recorded by CREATE SEQUENCE or last set by ALTER SEQUENCE START WITH.\n\nALTER SEQUENCE does not allow to change the sequence so that it''s inconsistent:\n\n``sql\nCREATE SEQUENCE s1;\nALTER SEQUENCE s1 MINVALUE 10;\nERROR 4061 (HY000): Sequence ''test.t1'' values are conflicting\n\nALTER SEQUENCE s1 MINVALUE 10 RESTART 10;\nERROR 4061 (HY000): Sequence ''test.t1'' values are conflicting\n\nALTER SEQUENCE s1 MINVALUE 10 START 10 RESTART 10;\n`\n\nINSERT\n\nTo allow SEQUENCE objects to be backed up by old tools, like mariadb-dump, one can use SELECT to read the current state of a SEQUENCE object and use an INSERT to update the SEQUENCE object. INSERT is only allowed if all fields are specified:\n\n`sql\nCREATE SEQUENCE s1;\nINSERT INTO s1 VALUES(1000,10,2000,1005,1,1000,0,0);\nSELECT * FROM s1;\n\n+------------+-----------+-----------+-------+-----------+-------+-------+-------+\n| next_value | min_value | max_value | start | increment | cache | cycle | round |\n+------------+-----------+-----------+-------+-----------+-------+-------+-------+\n|       1000 |        10 |      2000 |  1005 |         1 |  1000 |     0 |     0 |\n+------------+-----------+-----------+-------+-----------+-------+-------+-------+\n\nSHOW CREATE SEQUENCE s1;\n+-------+--------------------------------------------------------------------------------------------------------------+\n| Table | Create Table                                                                                                 |\n+-------+--------------------------------------------------------------------------------------------------------------+\n| s1    | CREATE SEQUENCE s1 start with 1005 minvalue 10 maxvalue 2000 increment by 1 cache 1000 nocycle ENGINE=Aria |\n+-------+--------------------------------------------------------------------------------------------------------------+\n`\n\nNotes\n\nALTER SEQUENCE will instantly affect all future SEQUENCE operations. This is in contrast to some other databases where the changes requested by ALTER SEQUENCE will not be seen until the sequence cache has run out.\n\nALTER SEQUENCE will take a full table lock of the sequence object during its (brief) operation. This ensures that ALTER SEQUENCE` is replicated correctly. If you only want to set the next sequence value to a higher value than current, then you should use SETVAL() instead, as this is not blocking.\n\nIf you want to change the storage engine or sequence comment, or rename the sequence, you can use ALTER TABLE for this.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sequences/alter-sequence', '', 'https://mariadb.com/docs/server/reference/sql-structure/sequences/alter-sequence');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (978, 35, 'CREATE SEQUENCE', 'Syntax\n------\n\nCREATE [OR REPLACE] [TEMPORARY] SEQUENCE [IF NOT EXISTS] sequence_name\n[AS { TINYINT | SMALLINT | |MEDIUMINT | INT | INTEGER | BIGINT } [SIGNED | UNSIGNED]]\n[ INCREMENT [ BY | = ] number ]\n[ MINVALUE [=] number | NO MINVALUE | NOMINVALUE ]\n[ MAXVALUE [=] number | NO MAXVALUE | NOMAXVALUE ]\n[ START [ WITH | = ] number ] \n[ CACHE [=] number | NOCACHE ] [ CYCLE | NOCYCLE] \ntable_options\n\nDescription\n-----------\n\nCREATE SEQUENCE creates a sequence that generates new values when called with NEXT VALUE FOR sequence_name. It''s an alternative to AUTO INCREMENT if you want to have more control of how the numbers are generated. As the SEQUENCE caches values (up to CACHE), it can in some cases be much faster than AUTO INCREMENT. Another benefit is that you can access the last value generated by all used sequences, which solves one of the limitations with LAST_INSERT_ID().\n\nCREATE SEQUENCE requires the CREATE privilege.\n\nDROP SEQUENCE can be used to drop a sequence, and ALTER SEQUENCE to change it.\n\nCREATE Options\n\nAS\n\nINT type, that is, one of TINYINT, SMALLINT, MEDIUMINT, INT, INTEGER, BIGINT. Can be signed or unsigned. Maximum value is based on the data type. The use of BIGINT UNSIGNED with this option extends the possible maximum value from 9223372036854775806 to 18446744073709551614. Default is BIGINT.\n\nThe AS option is not available.\n\nINCREMENT\n\nIncrement to use for values. May be negative. Setting an increment of 0 causes the sequence to use the value of the auto_increment_increment system variable at the time of creation, which is always a positive number. (see MDEV-16035). Default 1.\n\nMINVALUE\n\nMinimum value for the sequence. From MariaDB 11.5, the parser permits much smaller numbers, such as -9999999999999999999999999999, but converts to the minimum permitted for the INT type, with a note. Default 1 if INCREMENT > 0 , and -9223372036854775807 (or based on int type) if INCREMENT < 0.\n\nMAXVALUE\n\nMaximum value for sequence. From MariaDB 11.5, the parser permits much larger numbers, such as 9999999999999999999999999999 used in Oracle examples, but converts to the maximum permitted for the INT type, with a note. Default 9223372036854775806 (or based on int type) if INCREMENT > 0 , and -1 if INCREMENT < 0.\n\nSTART\n\nFirst value the sequence will generate. Default MINVALUE if INCREMENT > 0, and MAX_VALUE if INCREMENT< 0.\n\nCACHE / NOCACHE\n\nNumber of values that should be cached. 0 if no CACHE. The underlying table will be updated first time a new sequence number is generated and each time the cache runs out. Default 1000. FLUSH TABLES, shutting down the server, etc. will discard the cached values, and the next sequence number generated will be according to what''s stored in the Sequence object. In effect, this will discard the cached values.\n\nNote that setting the cache to 1 from 1000 can make inserts to tables using sequences for default values 2x slower and increase the binary log sizes up to 7x.\n\nCYCLE / NOCYCLE\n\nIf CYCLE is used, then the sequence should start again from MINVALUE after it has run out of values. Default value is NOCYCLE.\n\nConstraints on Create Arguments\n\nTo be able to create a legal sequence, the following must hold:\n\n MAXVALUE >= start\n MAXVALUE > MINVALUE\n START >= MINVALUE\n MAXVALUE <= 9223372036854775806 (LONGLONG_MAX-1). From MariaDB 11.5, the parser accepts values beyond this, and converts based on the int type.\n* MINVALUE >= -9223372036854775807 (LONGLONG_MIN+1). From MariaDB 11.5, the parser accepts values beyond this, and converts based on the int type.\n\nNote that sequences can''t generate the maximum/minimum 64 bit number because of the constraint ofMINVALUE and MAXVALUE.\n\nAtomic DDL\n\nMariaDB supports Atomic DDL and CREATE SEQUENCE is atomic.\n\nMariaDB does not support Atomic DDL and CREATE SEQUENCE is atomic.\n\nExamples\n--------\n\nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n\nCREATE SEQUENCE s2 START WITH -100 INCREMENT BY -10;\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sequences/create-sequence', '', 'https://mariadb.com/docs/server/reference/sql-structure/sequences/create-sequence');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (979, 35, 'DROP SEQUENCE', 'Syntax\n------\n\nDROP [TEMPORARY] SEQUENCE [IF EXISTS] [/COMMENT TO SAVE/]\n    sequence_name [, sequence_name] ...\n\nDescription\n-----------\n\nDROP SEQUENCE removes one or more sequences created with CREATE SEQUENCE. You must have the DROP privilege for each sequence. MariaDB returns an error indicating by name which non-existing tables it was unable to drop, but it also drops all of the tables in the list that do exist.\n\nImportant: When a table is dropped, user privileges on the table are not automatically dropped. See GRANT.\n\nIf another connection is using the sequence, a metadata lock is active, and this statement will wait until the lock is released. This is also true for non-transactional tables.\n\nFor each referenced sequence, DROP SEQUENCE drops a temporary sequence with that name, if it exists. If it does not exist, and the TEMPORARY keyword is not used, it drops a non-temporary sequence with the same name, if it exists. The TEMPORARY keyword ensures that a non-temporary sequence will not accidentally be dropped.\n\nUse IF EXISTS to prevent an error from occurring for sequences that do not exist. A NOTE is generated for each non-existent sequence when using IF EXISTS. See SHOW WARNINGS.\n\nDROP SEQUENCE requires the DROP privilege.\n\nNotes\n\nDROP SEQUENCE only removes sequences, not tables. However, DROP TABLE can remove both sequences and tables.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sequences/drop-sequence', '', 'https://mariadb.com/docs/server/reference/sql-structure/sequences/drop-sequence');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (980, 35, 'LASTVAL', 'Description\n-----------\n\nLASTVAL is a synonym for PREVIOUS VALUE for sequence_name.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-functions/lastval', '', 'https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-functions/lastval');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (981, 35, 'NEXT VALUE FOR', 'Syntax\n------\n\nNEXT VALUE FOR sequence\n\nDescription\n-----------\n\nGenerate next value for a SEQUENCE.\n\n You can greatly speed up NEXT VALUE by creating the sequence with the CACHE option. If not, every NEXT VALUE usage will cause changes in the stored SEQUENCE table.\n When using NEXT VALUE the value will be reserved at once and will not be reused, except if the SEQUENCE was created with CYCLE. This means that when you are using SEQUENCEs you have to expect gaps in the generated sequence numbers.\n If one updates the SEQUENCE with SETVAL() or ALTER SEQUENCE ... RESTART, NEXT VALUE FOR will notice this and start from the next requested value.\n FLUSH TABLES will close the sequence and the next sequence number generated will be according to what''s stored in the SEQUENCE object. In effect, this will discard the cached values.\n A server restart (or closing the current connection) also causes a drop of all cached values. The cached sequence numbers are reserved only for the current connection.\n NEXT VALUE requires the INSERT privilege.\n* You can also use NEXT VALUE FOR sequence for column DEFAULT.\n\nOnce the sequence is complete, unless the sequence has been created with the CYCLE attribute (not the default), calling the function will result in Error 4084: Sequence has run out.\n\nExamples\n--------\n\nCREATE OR REPLACE SEQUENCE s MAXVALUE=2;\n\nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n|          1 |\n+------------+\n\nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n|          2 |\n+------------+\n\nSELECT NEXTVAL(s);\nERROR 4084 (HY000): Sequence ''test.s'' has run out\n\nALTER SEQUENCE s MAXVALUE=2 CYCLE;\n\nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n|          1 |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-functions/next-value-for-sequence_name', '', 'https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-functions/next-value-for-sequence_name');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (982, 35, 'NEXTVAL', 'Description\n-----------\n\nNEXTVAL is a synonym for NEXT VALUE for sequence_name.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-functions/nextval', '', 'https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-functions/nextval');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (983, 35, 'PREVIOUS VALUE FOR', 'Syntax\n------\n\nPREVIOUS VALUE FOR sequence_name\n\nDescription\n-----------\n\nGets the most recent value in the current connection generated from a sequence.\n\n If the sequence has not yet been used by the connection, PREVIOUS VALUE FOR returns NULL (the same thing applies with a new connection which doesn''t see a last value for an existing sequence).\n If a SEQUENCE has been dropped and re-created then it''s treated as a new SEQUENCE and PREVIOUS VALUE FOR will return NULL.\n Returns NULL if the sequence is complete.\n FLUSH TABLES has no effect on PREVIOUS VALUE FOR.\n Previous values for all used sequences are stored per connection until connection ends.\n PREVIOUS VALUE FOR requires the SELECT privilege.\n\nExamples\n--------\n\nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n\nSELECT PREVIOUS VALUE FOR s;\n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n|                 NULL |\n+----------------------+\n\nThe function works for sequences only, if the table is used an error is generated\nSELECT PREVIOUS VALUE FOR t;\nERROR 4089 (42S02): ''test.t'' is not a SEQUENCE\n\nCall the NEXT VALUE FOR s:\nSELECT NEXT VALUE FOR s;\n+------------------+\n| NEXT VALUE FOR s |\n+------------------+\n|              100 |\n+------------------+\n\nSELECT PREVIOUS VALUE FOR s;\n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n|                  100 |\n+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-functions/previous-value-for-sequence_name', '', 'https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-functions/previous-value-for-sequence_name');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (984, 35, 'SETVAL', 'Syntax\n------\n\nSETVAL(sequence_name, next_value, [is_used, [round]])\n\nDescription\n-----------\n\nSet the next value to be returned for a SEQUENCE.\n\nThis function is compatible with PostgreSQL syntax, extended with the round argument.\n\nIf the is_used argument is not given or is 1 or true, then the next used value will one after the given value. If is_used is 0 or false then the next generated value will be the given value.\n\nIf round is used then it will set the round value (or the internal cycle count, starting at zero) for the sequence. If round is not used, it''s assumed to be 0.\n\nnext_value must be an integer literal.\n\nFor SEQUENCE tables defined with CYCLE (see CREATE SEQUENCE) one should use both next_value and round to define the next value. In this case the current sequence value is defined to be round, next_value.\n\nThe result returned by SETVAL() is next_value or NULL if the given next_value and round is smaller than the current value.\n\nSETVAL() will not set the SEQUENCE value to a something that is less than its current value. This is needed to ensure that SETVAL() is replication-safe. If you want to set the SEQUENCE to a smaller number, use ALTER SEQUENCE.\n\nIf CYCLE is used, first round and then next_value are compared to see if the value is bigger than the current value.\n\nInternally, in the MariaDB server, SETVAL() is used to inform slaves that a SEQUENCE has changed value. The slave may getSETVAL() statements out of order, but this is ok as only the biggest one will have an effect.\n\nSETVAL requires the INSERT privilege.\n\nExamples\n--------\n\nSELECT setval(foo, 42);           -- Next nextval will return 43\nSELECT setval(foo, 42, TRUE);     -- Same as above\nSELECT setval(foo, 42, FALSE);    -- Next nextval will return 42\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-functions/setval', '', 'https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-functions/setval');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (985, 35, 'Sequence Overview', 'Description\n-----------\n\nThis page is about sequence objects. For details about the storage engine, see Sequence Storage Engine.\n\nIntroduction\n\nA sequence is an object that generates a sequence of numeric values, as specified by the CREATE SEQUENCE statement.\n\nCREATE SEQUENCE creates a sequence that generates new values when called with NEXT VALUE FOR sequence_name. It''s an alternative to AUTO INCREMENT when one wants to have more control of how the numbers are generated. As the SEQUENCE caches values (up to the CACHE value in the CREATE SEQUENCE statement, by default 1000) it can in some cases be much faster than AUTO INCREMENT. Another benefit is that one can access the last value generated by all used sequences, which solves one of the limitations with LAST_INSERT_ID().\n\nSequences should not be used with statement-based logging; see this section for details.\n\nCreating a Sequence\n\nThe CREATE SEQUENCE statement is used to create a sequence. Here is an example of a sequence starting at 100, incrementing by 10 each time:\n\n``sql\nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n`\n\nThe CREATE SEQUENCE statement, along with defaults, can be viewd with the SHOW CREATE SEQUENCE STATEMENT, for example:\n\n`sql\nSHOW CREATE SEQUENCE s\\G\n************************ 1. row ***********************\n       Table: s\nCreate Table: CREATE SEQUENCE s start with 100 minvalue 1 maxvalue 9223372036854775806 \n  increment by 10 cache 1000 nocycle ENGINE=InnoDB\n`\n\nUsing Sequence Objects\n\nTo get the next value from a sequence, use\n\n`sql\nNEXT VALUE FOR sequence_name\n`\n\nor\n\n`sql\nNEXTVAL(sequence_name)\n`\n\nor in Oracle mode (SQL_MODE=ORACLE)\n\n`\nsequence_name.nextval\n`\n\nFor retrieving the last value used by the current connection from a sequence use:\n\n`sql\nPREVIOUS VALUE FOR sequence_name\n`\n\nor\n\n`sql\nLASTVAL(sequence_name)\n`\n\nor in Oracle mode (SQL_MODE=ORACLE)\n\n`\nsequence_name.currval\n`\n\nFor example:\n\n`sql\nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n|        100 |\n+------------+\n\nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n|        110 |\n+------------+\n\nSELECT LASTVAL(s);\n+------------+\n| LASTVAL(s) |\n+------------+\n|        110 |\n+------------+\n`\n\nUsing Sequences in DEFAULT\n\nSequences can be used in DEFAULT:\n\n`sql\nCREATE SEQUENCE s1;\nCREATE TABLE t1 (a INT PRIMARY KEY DEFAULT (NEXT VALUE FOR s1), b INT);\nINSERT INTO t1 (b) VALUES (1),(2);\nSELECT  FROM t1;\n+---+------+\n| a | b    |\n+---+------+\n| 1 |    1 |\n| 2 |    2 |\n+---+------+\n`\n\nChanging a Sequence\n\nThe ALTER SEQUENCE statement is used for changing sequences. For example, to restart the sequence at another value:\n\n`sql\nALTER SEQUENCE s RESTART 50;\n\nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n|         50 |\n+------------+\n`\n\nThe SETVAL function can also be used to set the next value to be returned for a SEQUENCE, for example:\n\n`sql\nSELECT SETVAL(s, 100);\n+----------------+\n| SETVAL(s, 100) |\n+----------------+\n|            100 |\n+----------------+\n`\n\nSETVAL can only be used to increase the sequence value. Attempting to set a lower value will fail, returning NULL:\n\n`sql\nSELECT SETVAL(s, 50);\n+---------------+\n| SETVAL(s, 50) |\n+---------------+\n|          NULL |\n+---------------+\n`\n\nDropping a Sequence\n\nThe DROP SEQUENCE statement is used to drop a sequence, for example:\n\n`sql\nDROP SEQUENCE s;\n`\n\nReplication\n\nIf you want to use Sequences in a master-master setup or with Galera, you should use INCREMENT=0. This tells the Sequence to use auto_increment_increment and auto_increment_offset to generate unique values for each server.\n\nStatement-Based Replication Limitation\n\nUsing SELECT NEXT VALUE causes an error for statement-based logging:\n\n`\nERROR 1665 (HY000): Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging.\n`\n\nThis happens because SELECT modifies objects.\n\nStandards Compliance\n\nMariaDB supports both ANSI SQL and Oracle syntax for sequences.\n\nHowever as SEQUENCE is implemented as a special kind of table, it uses the same namespace as tables. The benefits are that sequences show up in SHOW TABLES, and one can also create a sequence with CREATE TABLE and drop it with DROP TABLE. One can SELECT from it as from any other table. This ensures that all old tools that work with tables should work with sequences.\n\nSince sequence objects act as regular tables in many contexts, they will be affected by LOCK TABLES. This is not the case in other DBMS, such as Oracle, where LOCK TABLE does not affect sequences.\n\nNotes\n\nOne of the goals with the Sequence implementation is that all old tools, such as mariadb-dump (previously mysqldump), should work unchanged, while still keeping the normal usage of sequence standard compatibly.\n\nTo make this possible, sequence is currently implemented as a table with a few exclusive properties.\n\nThe special properties for sequence tables are:\n\n A sequence table has always one row.\n When one creates a sequence, either with CREATE TABLE or CREATE SEQUENCE, one row will be inserted.\n If one tries to insert into a sequence table, the single row will be updated. This allows mariadb-dump to work but also gives the additional benefit that one can change all properties of a sequence with a single insert. New applications should of course also use ALTER SEQUENCE.\n UPDATE or DELETE can''t be performed on Sequence objects.\n Doing a select on the sequence shows the current state of the sequence, except the values that are reserved in the cache. The next_value column shows the next value not reserved by the cache.\n FLUSH TABLES will close the sequence and the next sequence number generated will be according to what''s stored in the Sequence object. In effect, this will discard the cached values.\n A number of normal table operations work on Sequence tables. See next section.\n\nTable Operations that Work with Sequences\n\n SHOW CREATE TABLE sequence_name. This shows the table structure that is behind the SEQUENCE including the field names that can be used with SELECT or even CREATE TABLE.\n CREATE TABLE sequence-structure ... SEQUENCE=1\n ALTER TABLE sequence RENAME TO sequence2\n RENAME TABLE sequence_name TO new_sequence_name\n DROP TABLE sequence_name. This is allowed mainly to get old tools like mariadb-dump to work with sequence tables.\n SHOW TABLES\n\nImplementation\n\nInternally, sequence tables are created as a normal table without rollback (the InnoDB, Aria and MySAM engines support this), wrapped by a sequence engine object. This allowed us to create sequences with\\\nalmost no performance impact for normal tables. (The cost is one ''if'' per insert if the binary log is enabled).\n\nUnderlying Table Structure\n\nThe following example shows the table structure of sequences and how it can be used as a table.\\\n(Output of results are slightly edited to make them easier to read.)\n\n`sql\nCREATE SEQUENCE t1;\nSHOW CREATE SEQUENCE t1\\G\n*********************** 1. row *********************\n  CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 9223372036854775806\n  increment by 1 cache 1000 nocycle ENGINE=InnoDB\n\nSHOW CREATE TABLE t1\\G\n********************* 1. row ***********************\nCreate Table: CREATE TABLE t1 (\n  next_not_cached_value bigint(21) NOT NULL,\n  minimum_value bigint(21) NOT NULL,\n  maximum_value bigint(21) NOT NULL,\n  start_value bigint(21) NOT NULL COMMENT ''start value when sequences is created or value if RESTART is used'',\n  increment bigint(21) NOT NULL COMMENT ''increment value'',\n  cache_size bigint(21) unsigned NOT NULL,\n  cycle_option tinyint(1) unsigned NOT NULL COMMENT ''0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed'',\n  cycle_count bigint(21) NOT NULL COMMENT ''How many cycles have been done''\n) ENGINE=InnoDB SEQUENCE=1\n\nSELECT  FROM t1\\G\nnext_not_cached_value: 1\n minimum_value: 1\n maximum_value: 9223372036854775806\n  start_value: 1\n  increment: 1\n  cache_size: 1000\n  cycle_option: 0\n  cycle_count: 0\n`\n\nThe cycle_count column is incremented every time the sequence wraps around.\n\nCredits\n\n Thanks to Jianwe Zhao from Aliyun for his work on SEQUENCE` in AliSQL, which gave ideas and inspiration for this work.\n Thanks to Peter Gulutzan, who helped test and gave useful comments about the implementation.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-overview', '', 'https://mariadb.com/docs/server/reference/sql-structure/sequences/sequence-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (986, 29, 'Binary Literals', 'Description\n-----------\n\nBinary literals can be written in one of the following formats: b''value'', B''value'' or 0bvalue, where value is a string composed by 0 and 1 digits.\n\nBinary literals are interpreted as binary strings, and are convenient to represent VARBINARY, BINARY or BIT values.\n\nTo convert a binary literal into an integer, just add 0.\n\nExamples\n--------\n\nSELECT 0b1000001;\n+-----------+\n| 0b1000001 |\n+-----------+\n| A         |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/binary-literals', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/binary-literals');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (987, 29, 'Date and Time Literals', 'Description\n-----------\n\nStandard syntaxes\n\nMariaDB supports the SQL standard and ODBC syntaxes for DATE, TIME, and TIMESTAMP literals.\n\nSQL standard syntax:\n\n DATE ''string''\n TIME ''string''\n TIMESTAMP ''string''\n\nODBC syntax:\n\n {d ''string''}\n {t ''string''}\n {ts ''string''}\n\nThe timestamp literals are treated as DATETIME literals, because in MariaDB the range of DATETIME is closer to the TIMESTAMP range in the SQL standard.\n\nstring is a string in a proper format, as explained below.\n\nDATE literals\n\nA DATE string is a string in one of the following formats: ''YYYY-MM-DD'' or ''YY-MM-DD''. Note that any punctuation character can be used as delimiter. All delimiters must consist of 1 character. Different delimiters can be used in the same string. Delimiters are optional (but if one delimiter is used, all delimiters must be used).\n\nA DATE literal can also be an integer, in one of the following formats: YYYYMMDD or YYMMDD.\n\nAll the following DATE literals are valid, and they all represent the same value:\n\n``\n''19940101''\n''940101''\n''1994-01-01''\n''94/01/01''\n''1994-01/01''\n''94:01!01''\n19940101\n940101\n`\n\nDATETIME literals\n\nA DATETIME string is a string in one of the following formats: ''YYYY-MM-DD HH:MM:SS'' or ''YY-MM-DD HH:MM:SS''. Note that any punctuation character can be used as delimiter for the date part and for the time part. All delimiters must consist of 1 character. Different delimiters can be used in the same string. The hours, minutes and seconds parts can consist of one character. For this reason, delimiters are mandatory for DATETIME literals.\n\nThe delimiter between the date part and the time part can be a T or any sequence of space characters (including tabs, new lines and carriage returns).\n\nA DATETIME literal can also be a number, in one of the following formats: YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD or YYMMDD. In this case, all the time subparts must consist of 2 digits.\n\nAll the following DATE literals are valid, and they all represent the same value:\n\n`\n''1994-01-01T12:30:03''\n''1994/01/01\\n\\t 12+30+03''\n''1994/01\\\\01\\n\\t 12+30-03''\n''1994-01-01 12:30:3''\n`\n\nTIME literals\n\nA TIME string is a string in one of the following formats: ''D HH:MM:SS'', ''HH:MM:SS, ''D HH:MM'', ''HH:MM'', ''D HH'', or ''SS''. D is a value from 0 to 34 which represents days. : is the only allowed delimiter for TIME literals. Delimiters are mandatory, with an exception: the ''HHMMSS'' format is allowed. When delimiters are used, each part of the literal can consist of one character.\n\nA TIME literal can also be a number in one of the following formats: HHMMSS, MMSS, or SS.\n\nThe following literals are equivalent:\n\n`\n''09:05:00''\n''9:05:0''\n''9:5:0''\n''090500''\n`\n\n2-digit years\n\nThe year part in DATE and DATETIME literals is determined as follows:\n\n 70 - 99 = 1970 - 1999\n 00 - 69 = 2000 - 2069\n\nMicroseconds\n\nDATETIME and TIME literals can have an optional microseconds part. For both string and numeric forms, it is expressed as a decimal part. Up to 6 decimal digits are allowed. Examples:\n\n`\n''12:30:00.123456''\n123000.123456\n`\n\nSee Microseconds in MariaDB for details.\n\nDate and time literals and the SQL_MODE\n\nUnless the SQL_MODE NO_ZERO_DATE flag is set, some special values are allowed: the ''0000-00-00'' DATE, the ''00:00:00'' TIME, and the 0000-00-00 00:00:00 DATETIME.\n\nIf the ALLOW_INVALID_DATES flag is set, the invalid dates (for example, 30th February) are allowed. If not, if the NO_ZERO_DATE is set, an error is produced; otherwise, a zero-date is returned.\n\nUnless the NO_ZERO_IN_DATE flag is set, each subpart of a date or time value (years, hours...) can be set to 0`.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/date-and-time-literals', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/date-and-time-literals');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (988, 29, 'Hexadecimal Literals', 'Description\n-----------\n\nHexadecimal literals can be written using any of the following syntaxes:\n\n x''value''\n X''value'' (SQL standard)\n* 0xvalue (ODBC)\n\nvalue is a sequence of hexadecimal digits (from 0 to 9 and from A to F). The case of the digits does not matter. With the first two syntaxes, value must consist of an even number of digits. With the last syntax, digits can be even, and they are treated as if they had an extra 0 at the beginning.\n\nNormally, hexadecimal literals are interpreted as binary string, where each pair of digits represents a character. When used in a numeric context, they are interpreted as integers. (See the example below). In no case can a hexadecimal literal be a decimal number.\n\nThe first two syntaxes; X''_value_'' and x''_value_, follow the SQL standard, and behave as a string in all contexts in MariaDB. The latter syntax, 0x_value_, is a MySQL/MariaDB extension for hex hybrids and behaves as a string or as a number depending on context. MySQL treats all syntaxes the same, so there may be different results in MariaDB and MySQL (see below).\n\nExamples\n--------\n\nSELECT x''61'', X''61'', 0x61;\n+-------+-------+------+\n| x''61'' | X''61'' | 0x61 |\n+-------+-------+------+\n| a     | a     | a    |\n+-------+-------+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/hexadecimal-literals', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/hexadecimal-literals');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (989, 29, 'Identifier Case Sensitivity', 'Description\n-----------\n\nWhether objects are case sensitive or not is partly determined by the underlying operating system. Unix-based systems are case sensitive, Windows is not, while Mac OS X is usually case insensitive by default, but devices can be configured as case sensitive using Disk Utility.\n\nDatabase, table, table aliases, and trigger names are affected by the system''s case sensitivity, while index, column, column aliases, stored routine, and event names are never case sensitive.\n\nLog file group names are case sensitive.\n\nIn some cases, the table exists but that you are referring to it incorrectly:\n\n  Because MariaDB uses directories and files to store databases and tables, database and table names are case-sensitive if they are located on a file system that has case-sensitive file names.\n Even for file systems that are not case-sensitive, such as on Windows, all references to a given table within a query must use the same lettercase. \n\nThe lower_case_table_names server system variable plays a key role. It determines whether table names, aliases, and database names are compared in a case-sensitive manner. If set to 0 (the default on Unix-based systems), table names and aliases, and database names are compared in a case-sensitive manner. If set to 1 (the default on Windows), names are stored in lowercase and not compared in a case-sensitive manner. If set to 2 (the default on Mac OS X), names are stored as declared, but compared in lowercase.\n\nIt is thus possible to make Unix-based systems behave like Windows and ignore case-sensitivity. The reverse is not true before Windows 10, as the underlying Windows filesystem could not support this. It is possible since Windows 10, although case insensitivity is still the default operating system setting.\n\nEven on case-insensitive systems, you are required to use the same case consistently within the same statement. The following statement fails, as it refers to the table name in a different case.\n\n``sql\nSELECT * FROM a_table WHERE A_table.id>10;\n``\n\nFor a full list of identifiers naming rules, see Identifier Names.\n\nPlease note that lower_case_table_names is a database initialization parameter. This means that, along with innodb_page_size, this variable must be set before running mariadb-install-db, and will not change the behavior of servers unless applied before the creation of core system databases.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/identifier-case-sensitivity', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/identifier-case-sensitivity');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (990, 29, 'Identifier Names', 'Description\n-----------\n\nDatabases, tables, indexes, columns, aliases, views, stored routines, triggers, events, variables, partitions, tablespaces, savepoints, labels, users, roles, are collectively known as identifiers, and have certain rules for naming.\n\nIdentifiers may be quoted using the backtick character (`  `). Quoting is optional for identifiers that don''t contain special characters, or for identifiers that are not reserved words. If the ANSI_QUOTES SQL_MODE flag is set, double quotes (") can also be used to quote identifiers. If the MSSQL flag is set, square brackets ([ and ]) can be used for quoting.\n\nEven when using reserved words as names, fully qualified names do not need to be quoted. For example, test.select has only one possible meaning, so it is correctly parsed even without quotes.\n\nUnquoted\n\nThe following characters are valid, and allow identifiers to be unquoted:\n\n ASCII: \\[0-9,a-z,A-Z$_] (numerals 0-9, basic Latin letters, both lowercase and uppercase, dollar sign, underscore)\n Extended: U+0080 .. U+FFFF\n\nQuoted\n\nThe following characters are valid, but identifiers using them must be quoted:\n\n ASCII: U+0001 .. U+007F (full Unicode Basic Multilingual Plane (BMP) except for U+0000)\n Extended: U+0080 .. U+FFFF\n Identifier quotes can themselves be used as part of an identifier, as long as they are quoted.\n\nFurther Rules\n\nThere are a number of other rules for identifiers:\n\n Identifiers are stored as Unicode (UTF-8)\n Identifiers may or may not be case-sensitive. See Indentifier Case-sensitivity.\n Database, table and column names can''t end with space characters\n Identifier names may begin with a numeral, but can''t only contain numerals unless quoted.\n An identifier starting with a numeral, followed by an ''e'', may be parsed as a floating point number, and needs to be quoted.\n Identifiers are not permitted to contain the ASCII NUL character (U+0000) and supplementary characters (U+10000 and higher).\n Names such as 5e6, 9e are not prohibited, but it''s strongly recommended not to use them, as they could lead to ambiguity in certain contexts, being treated as a number or expression.\n User variables cannot be used as part of an identifier, or as an identifier in an SQL statement.\n\nQuote Character\n\nThe regular quote character is the backtick character - \\\\\\, but if the ANSI_QUOTES SQL_MODE option is specified, a regular double quote - " may be used as well.\n\nThe backtick character can be used as part of an identifier. In that case the identifier needs to be quoted. The quote character can be the backtick, but in that case, the backtick in the name must be escaped with another backtick.\n\nMaximum Length\n\n Databases, tables, columns, indexes, constraints, stored routines, triggers, events, views, tablespaces, servers and log file groups have a maximum length of 64 characters.\n Compound statement labels have a maximum length of 16 characters.\n Aliases have a maximum length of 256 characters, except for column aliases in CREATE VIEW statements, which are checked against the maximum column length of 64 characters (not the maximum alias length of 256 characters).\n Users have a maximum length of 80 characters.\n Roles have a maximum length of 128 characters.\n* Multi-byte characters do not count extra towards the character limit.\n\nMultiple Identifiers\n\nMariaDB allows the column name to be used on its own if the reference will be unambiguous, or the table name to be used with the column name, or all three of the database, table and column names. A period is used to separate the identifiers, and the period can be surrounded by spaces.\n\nExamples\n--------\n\nCREATE TABLE t1 (i int);\n\nINSERT INTO t1(i) VALUES (10);\n\nSELECT i FROM t1;\n+------+\n| i    |\n+------+\n|   10 |\n+------+\n\nSELECT t1.i FROM t1;\n+------+\n| i    |\n+------+\n|   10 |\n+------+\n\nSELECT test.t1.i FROM t1;\n+------+\n| i    |\n+------+\n|   10 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/identifier-names', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/identifier-names');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (991, 29, 'Identifier Qualifiers', 'Description\n-----------\n\nQualifiers are used within SQL statements to reference data structures, such as databases, tables, or columns. For example, typically a SELECT query contains references to some columns and at least one table.\n\nQualifiers can be composed by one or more identifiers, where the initial parts affect the context within which the final identifier is interpreted:\n\n For a database, only the database identifier needs to be specified.\n For objects which are contained in a database (like tables, views, functions, etc.) the database identifier can be specified. If no database is specified, the current database is assumed (see USE and DATABASE() for more details). If there is no default database and no database is specified, an error is issued.\n For column names, the table and the database are generally obvious from the context of the statement. It is however possible to specify the table identifier, or the database identifier plus the table identifier.\n An identifier is fully-qualified if it contains all possible qualifiers, for example, the following column is fully qualified: db_name.tbl_name.col_name.\n\nIf a qualifier is composed by more than one identifier, a dot (.) must be used as a separator. All identifiers can be quoted individually. Extra spacing (including new lines and tabs) is allowed.\n\nAll the following examples are valid:\n\n db_name.tbl_name.col_name\n tbl_name\n db_name.tbl_name.col_name\n db_name . tbl_name\n db_name. tbl_name\n\nIf a table identifier is prefixed with a dot (.), the default database is assumed. This syntax is supported for ODBC compliance, but has no practical effect on MariaDB. These qualifiers are equivalent:\n\n tbl_name\n . tbl_name\n .tbl_name\n* . tbl_name\n\nFor DML statements, it is possible to specify a list of the partitions using the PARTITION clause. See Partition Pruning and Selection for details.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/identifier-qualifiers', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/identifier-qualifiers');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (992, 29, 'Identifier to File Name Mapping', 'Description\n-----------\n\nSome identifiers map to a file name on the filesystem. Databases each have their own directory, while, depending on the storage engine, table names and index names may map to a file name.\n\nNot all characters that are allowed in table names can be used in file names. Every filesystem has its own rules of what characters can be used in file names. To let the user create tables using all characters allowed in the SQL Standard and to not depend on whatever particular filesystem a particular database resides, MariaDB encodes "potentially unsafe" characters in the table name to derive the corresponding file name.\n\nThis is implemented using a special character set. MariaDB converts a table name to the "filename" character set to get the file name for this table. And it converts the file name from the "filename" character set to, for example, utf8 to get the table name for this file name.\n\nThe conversion rules are as follows: if the identifier is made up only of basic Latin numbers, letters and/or the underscore character, the encoding matches the name (see however Identifier Case Sensitivity). Otherwise they are encoded according to the following table:\n\n| Code Range | Pattern            | Number     | Used | Unused | Blocks                                |\n| ---------- | ------------------ | ---------- | ---- | ------ | ------------------------------------- |\n| 00C0..017F | \\[@]\\[0..4]\\[g..z] | 5\\20= 100 | 97   | 3      | Latin-1 Supplement + Latin Extended-A |\n| 0370..03FF | \\[@]\\[5..9]\\[g..z] | 5\\20= 100 | 88   | 12     | Greek and Coptic                      |\n| 0400..052F | \\[@]\\[g..z]\\[0..6] | 20\\7= 140 | 137  | 3      | Cyrillic + Cyrillic Supplement        |\n| 0530..058F | \\[@]\\[g..z]\\[7..8] | 20\\2= 40  | 38   | 2      | Armenian                              |\n| 2160..217F | \\[@]\\[g..z]\\[9]    | 20\\1= 20  | 16   | 4      | Number Forms                          |\n| 0180..02AF | \\[@]\\[g..z]\\[a..k] | 20\\11=220 | 203  | 17     | Latin Extended-B + IPA Extensions     |\n| 1E00..1EFF | \\[@]\\[g..z]\\[l..r] | 20\\7= 140 | 136  | 4      | Latin Extended Additional             |\n| 1F00..1FFF | \\[@]\\[g..z]\\[s..z] | 20\\8= 160 | 144  | 16     | Greek Extended                        |\n| .... ....  | \\[@]\\[a..f]\\[g..z] | 6\\*20= 120 | 0    | 120    | RESERVED                              |\n| 24B6..24E9 | \\[@]\\[@]\\[a..z]    | 26         | 26   | 0      | Enclosed Alphanumerics                |\n| FF21..FF5A | \\[@]\\[a..z]\\[@]    | 26         | 26   | 0      | Halfwidth and Fullwidth forms         |\n\nCode Range values are UCS-2.\n\nAll of this encoding happens transparently at the filesystem level with one exception.\n\nExamples\n--------\n\nSELECT CAST(CONVERT("this_is_таблица" USING filename) AS BINARY);\n+------------------------------------------------------------------+\n| CAST(CONVERT("this_is_таблица" USING filename) AS BINARY)        |\n+------------------------------------------------------------------+\n| this_is_@y0@g0@h0@r0@o0@i1@g0                                    |\n+------------------------------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/identifier-to-file-name-mapping', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/identifier-to-file-name-mapping');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (993, 29, 'Numeric Literals', 'Description\n-----------\n\nNumeric literals are written as a sequence of digits from 0 to 9. Initial zeros are ignored. A sign can always precede the digits, but it is optional for positive numbers. In decimal numbers, the integer part and the decimal part are divided with a dot (.).\n\nIf the integer part is zero, it can be omitted, but the literal must begin with a dot.\n\nThe notation with exponent can be used. The exponent is preceded by an E or e character. The exponent can be preceded by a sign and must be an integer. A number N with an exponent part X, is calculated as N * POW(10, X).\n\nIn some cases, adding zeroes at the end of a decimal number can increment the precision of the expression where the number is used. For example, PI() by default returns a number with 6 decimal digits. But the PI()+0.0000000000 expression (with 10 zeroes) returns a number with 10 decimal digits.\n\nHexadecimal literals are interpreted as numbers when used in numeric contexts.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/numeric-iterals', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/numeric-iterals');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (994, 29, 'Reserved Words', 'Description\n-----------\n\nThe following is a list of all reserved words in MariaDB.\n\nReserved words cannot be used as Identifiers, unless they are quoted.\n\nThe definitive list of reserved words for each version can be found by examining the sql/lex.h and sql/sql_yacc.yy files.\n\nReserved Words\n\n| Keyword                           |\n| --------------------------------- |\n| ACCESSIBLE                        |\n| ADD                               |\n| ALL                               |\n| ALTER                             |\n| ANALYZE                           |\n| AND                               |\n| AS                                |\n| ASC                               |\n| ASENSITIVE                        |\n| BEFORE                            |\n| BETWEEN                           |\n| BIGINT                            |\n| BINARY                            |\n| BLOB                              |\n| BOTH                              |\n| BY                                |\n| CALL                              |\n| CASCADE                           |\n| CASE                              |\n| CHANGE                            |\n| CHAR                              |\n| CHARACTER                         |\n| CHECK                             |\n| COLLATE                           |\n| COLUMN                            |\n| CONDITION                         |\n| CONSTRAINT                        |\n| CONTINUE                          |\n| CONVERT                           |\n| CREATE                            |\n| CROSS                             |\n| CURRENT_DATE                     |\n| CURRENT_ROLE                     |\n| CURRENT_TIME                     |\n| CURRENT_TIMESTAMP                |\n| CURRENT_USER                     |\n| CURSOR                            |\n| DATABASE                          |\n| DATABASES                         |\n| DAY_HOUR                         |\n| DAY_MICROSECOND                  |\n| DAY_MINUTE                       |\n| DAY_SECOND                       |\n| DEC                               |\n| DECIMAL                           |\n| DECLARE                           |\n| DEFAULT                           |\n| DELAYED                           |\n| DELETE                            |\n| DELETE_DOMAIN_ID                |\n| DESC                              |\n| DESCRIBE                          |\n| DETERMINISTIC                     |\n| DISTINCT                          |\n| DISTINCTROW                       |\n| DIV                               |\n| DO_DOMAIN_IDS                   |\n| DOUBLE                            |\n| DROP                              |\n| DUAL                              |\n| EACH                              |\n| ELSE                              |\n| ELSEIF                            |\n| ENCLOSED                          |\n| ESCAPED                           |\n| EXCEPT                            |\n| EXISTS                            |\n| EXIT                              |\n| EXPLAIN                           |\n| FALSE                             |\n| FETCH                             |\n| FLOAT                             |\n| FLOAT4                            |\n| FLOAT8                            |\n| FOR                               |\n| FORCE                             |\n| FOREIGN                           |\n| FROM                              |\n| FULLTEXT                          |\n| GENERAL                           |\n| GRANT                             |\n| GROUP                             |\n| HAVING                            |\n| HIGH_PRIORITY                    |\n| HOUR_MICROSECOND                 |\n| HOUR_MINUTE                      |\n| HOUR_SECOND                      |\n| IF                                |\n| IGNORE                            |\n| IGNORE_DOMAIN_IDS               |\n| IGNORE_SERVER_IDS               |\n| IN                                |\n| INDEX                             |\n| INFILE                            |\n| INNER                             |\n| INOUT                             |\n| INSENSITIVE                       |\n| INSERT                            |\n| INT                               |\n| INT1                              |\n| INT2                              |\n| INT3                              |\n| INT4                              |\n| INT8                              |\n| INTEGER                           |\n| INTERSECT                         |\n| INTERVAL                          |\n| INTO                              |\n| IS                                |\n| ITERATE                           |\n| JOIN                              |\n| KEY                               |\n| KEYS                              |\n| KILL                              |\n| LEADING                           |\n| LEAVE                             |\n| LEFT                              |\n| LIKE                              |\n| LIMIT                             |\n| LINEAR                            |\n| LINES                             |\n| LOAD                              |\n| LOCALTIME                         |\n| LOCALTIMESTAMP                    |\n| LOCK                              |\n| LONG                              |\n| LONGBLOB                          |\n| LONGTEXT                          |\n| LOOP                              |\n| LOW_PRIORITY                     |\n| MASTER_HEARTBEAT_PERIOD         |\n| MASTER_SSL_VERIFY_SERVER_CERT |\n| MATCH                             |\n| MAXVALUE                          |\n| MEDIUMBLOB                        |\n| MEDIUMINT                         |\n| MEDIUMTEXT                        |\n| MIDDLEINT                         |\n| MINUTE_MICROSECOND               |\n| MINUTE_SECOND                    |\n| MOD                               |\n| MODIFIES                          |\n| NATURAL                           |\n| NOT                               |\n| NO_WRITE_TO_BINLOG             |\n| NULL                              |\n| NUMERIC                           |\n| OFFSET (> 10.6)                   |\n| ON                                |\n| OPTIMIZE                          |\n| OPTION                            |\n| OPTIONALLY                        |\n| OR                                |\n| ORDER                             |\n| OUT                               |\n| OUTER                             |\n| OUTFILE                           |\n| OVER                              |\n| PAGE_CHECKSUM                    |\n| PARSE_VCOL_EXPR                 |\n| PARTITION                         |\n| PRECISION                         |\n| PRIMARY                           |\n| PROCEDURE                         |\n| PURGE                             |\n| RANGE                             |\n| READ                              |\n| READS                             |\n| READ_WRITE                       |\n| REAL                              |\n| RECURSIVE                         |\n| REF_SYSTEM_ID                   |\n| REFERENCES                        |\n| REGEXP                            |\n| RELEASE                           |\n| RENAME                            |\n| REPEAT                            |\n| REPLACE                           |\n| REQUIRE                           |\n| RESIGNAL                          |\n| RESTRICT                          |\n| RETURN                            |\n| RETURNING                         |\n| REVOKE                            |\n| RIGHT                             |\n| RLIKE                             |\n| ROW_NUMBER (> 10.7)              |\n| ROWS                              |\n| SCHEMA                            |\n| SCHEMAS                           |\n| SECOND_MICROSECOND               |\n| SELECT                            |\n| SENSITIVE                         |\n| SEPARATOR                         |\n| SET                               |\n| SHOW                              |\n| SIGNAL                            |\n| SLOW                              |\n| SMALLINT                          |\n| SPATIAL                           |\n| SPECIFIC                          |\n| SQL                               |\n| SQLEXCEPTION                      |\n| SQLSTATE                          |\n| SQLWARNING                        |\n| SQL_BIG_RESULT                  |\n| SQL_CALC_FOUND_ROWS            |\n| SQL_SMALL_RESULT                |\n| SSL                               |\n| STARTING                          |\n| STATS_AUTO_RECALC               |\n| STATS_PERSISTENT                 |\n| STATS_SAMPLE_PAGES              |\n| STRAIGHT_JOIN                    |\n| TABLE                             |\n| TERMINATED                        |\n| THEN                              |\n| TINYBLOB                          |\n| TINYINT                           |\n| TINYTEXT                          |\n| TO                                |\n| TRAILING                          |\n| TRIGGER                           |\n| TRUE                              |\n| UNDO                              |\n| UNION                             |\n| UNIQUE                            |\n| UNLOCK                            |\n| UNSIGNED                          |\n| UPDATE                            |\n| USAGE                             |\n| USE                               |\n| USING                             |\n| UTC_DATE                         |\n| UTC_TIME                         |\n| UTC_TIMESTAMP                    |\n| VALUES                            |\n| VARBINARY                         |\n| VARCHAR                           |\n| VARCHARACTER                      |\n| VARYING                           |\n| VECTOR (> 11.6)                   |\n| WHEN                              |\n| WHERE                             |\n| WHILE                             |\n| WINDOW                            |\n| WITH                              |\n| WRITE                             |\n| XOR                               |\n| YEAR_MONTH                       |\n| ZEROFILL                          |\n\nExceptions\n\nSome keywords are exceptions for historical reasons, and are permitted as unquoted identifiers. These include:\n\n| Keyword                                                             |\n| ------------------------------------------------------------------- |\n| ACTION                                                              |\n| BIT                   |\n| DATE           |\n| ENUM                  |\n| NO                                                                  |\n| TEXT                  |\n| TIME           |\n| TIMESTAMP |\n\nOracle Mode\n\nIn Oracle mode, there are a number of extra reserved words:\n\n| Keyword          |\n| ---------------- |\n| BODY             |\n| ELSIF            |\n| GOTO             |\n| HISTORY          |\n| MINUS (> 10.6.0) |\n| OTHERS           |\n| PACKAGE          |\n| PERIOD           |\n| RAISE            |\n| ROWNUM           |\n| ROWTYPE          |\n| SYSDATE          |\n| SYSTEM           |\n| SYSTEM_TIME     |\n| VERSIONING       |\n| WITHOUT          |\n\nContextual Keywords and Parser Limitations\n\nThe lists above indicate words that are always reserved and must be quoted. Some keywords, though, are reserved for specific contexts. In most SQL statements, they operate normally, but in some cases, they activate unique parser rules.\n\nThe Oracle mode term SYSTEM is a prime example. Although it is not a fully reserved word, the parser expects the VERSIONING keyword to follow (as part of the SYSTEM VERSIONING clause for system-versioned tables), which results in a syntax error in an ALTER TABLE ... ADD command.\n\nExample of unexpected behavior\n\nThe following examples show how the keyword SYSTEM behaves as an identifier:\n\n``sql\nCREATE TABLE t1 (system INT);\n`\n\nThis statement works because SYSTEM is a valid column name in this situation.\n\nInvalid usage\n\n`sql\nALTER TABLE t1 ADD system VARCHAR(64);\n`\n\nThis statement fails due to a syntax error.\n\n`\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''VARCHAR(64)'' at line 1\n`\n\nTo avoid any conflict, always quote such keywords when using them as identifiers in statements.\n\n`\nALTER TABLE t1 ADD system VARCHAR(64);\n`\n\nIt is recommended that all identifiers listed as keywords (including those indicated as non-reserved or version-specific) be quoted for maximum compatibility and to prevent unexpected parser errors, especially in ALTER statements.\n\nFunction Names\n\nIf the IGNORE_SPACE` SQL_MODE flag is set, function names become reserved words.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/reserved-words', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/reserved-words');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (995, 29, 'Schema Qualifiers', 'Description\n-----------\n\nMariaDB offers schema qualifiers that allow you to define how data types and functions are managed when SQL modes result in operational differences.\n\nThese qualifiers are used as prefixes and are part of the SQL language structure. These are not system databases or tables.&#x20;\n\nThe schema qualifiers listed below are supported:\n\n mariadb_schema\n oracle_schema\n\nBoth prefixes describe the same mechanism, however the behavior differs based on the desired compatibility.\n\nCertain SQL modes, such as SQL_MODE=ORACLE, affect how MariaDB understands data type and functions. MariaDB translates several data type names and function behaviors according to Oracle Database standards when SQL_MODE=ORACLE is active. This translation may lead to ambiguity: depending on the SQL mode in use, a data type or function name written without a qualifier could be interpreted differently.\n\nFor example, in Oracle mode, the data type DATE is interpreted as DATETIME. This behavior can be explicitly overridden at the statement level using schema qualifiers, without modifying the SQL mode session.\n\nVersion Support\n\n mariadb_schema for data type qualification is supported since:\n   MariaDB 10.3.24\n   MariaDB 10.4.14\n   MariaDB 10.5.5\n oracle_schema is supported as part of the same schema qualifier mechanism.\n Functional qualification using schema qualifiers is supported since:\n   MariaDB 10.6.17 (see MDEV-27744)\n\nWhy Schema Qualifiers are Needed\n\nSpecific SQL modes, for example SQL_MODE=ORACLE, determine how MariaDB handles data types and functions.\n\nThis may result in ambiguity when:\n\n Switching between SQL modes\n Evaluating table definitions using SHOW CREATE TABLE\n Syncing data across servers\n\nRegardless of the SQL mode that is currently in use, schema qualifiers provide explicit control over interpretation, ensuring reliable and consistent behavior.\n\nmariadb_schema\n\nThe mariadb_schema qualifier forces MariaDB-native interpretation of the data type or function, regardless of the active SQL mode.\n\nWhen the server sees the mariadb_schema qualifier, it disables sql_mode-specific data type translation and interprets the data type literally. For example, mariadb_schema.DATE is interpreted as the traditional MariaDB DATE data type, regardless of the current SQL mode.\n\nData Type Qualification\n\nIn Oracle mode, the DATE type is translated to DATETIME:\n\n``sql\nSET sql_mode=ORACLE;\n\nCREATE TABLE t1 (\nd DATE\n);\n`\n\nTo specifically use the MariaDB-native DATE type while in Oracle mode:\n\n`sql\nCREATE TABLE t1 (\n  d mariadb_schema.DATE\n);\n`\n\nExample\n\n`sql\nSET sql_mode=ORACLE;\n\nCREATE TABLE t1 (\n  d DATE,\n  d_m mariadb_schema.DATE\n);\n\nDESCRIBE t1;\n`\n\nOutput\n\n`sql\n+-------+----------+\n| Field | Type     | \n+-------+----------+\n| d     | datetime |\n| d_m   | date     |\n+-------+----------+\n`\n\noracle_schema\n\nThe oracle_schema qualifier enforces Oracle-compatible behavior of the data type or function, regardless of the active SQL mode. It supports Oracle semantics but acts similarly to mariadb_schema.\n\nFor example:\n\n In Oracle mode, the DATE data types behaves like DATETIME.\n Using oracle_schema.DATE ensures Oracle-compatible interpretation even when Oracle mode is not enabled.\n\nData Type Qualification\n\n`sql\nSET sql_mode=ORACLE;\n\nCREATE TABLE t1 (\n  d DATE,\n  d_m mariadb_schema.DATE,\n  d_o oracle_schema.DATE\n);\n\nDESCRIBE t1;\n`\n\nOutput\n\n`sql\n+-------+----------+\n| Field | Type     | \n+-------+----------+\n| d     | datetime |\n| d_m   | date     |\n| d_o   | datetime |\n+-------+----------+\n`\n\nUsing Both Qualifiers Together\n\nThe following example demonstrates how to use both qualifiers together in a single table definition to control data type behavior.&#x20;\n\nTo explicitly use Oracle-compatible behavior outside Oracle mode:\n\n`sql\nSET sql_mode=DEFAULT;\n\nCREATE TABLE t1 (\nd oracle_schema.DATE\n);\n`\n\nWhen running in Oracle mode, both qualifiers can be used to explicitly control behavior.\n\n`sql\nSET sql_mode=ORACLE;\n\nCREATE TABLE t1 (\nd DATE,                  # Oracle-compatible (stored as DATETIME)\nd_m mariadb_schema.DATE, # MariaDB-native DATE\nd_o oracle_schema.DATE   # Oracle-compatible DATE\n);\n\nDESCRIBE t1;\n`\n\nOutput\n\n`sql\n+-------+----------+------+-----+---------+-------+\n| Field | Type     | Null | Key | Default | Extra |\n+-------+----------+------+-----+---------+-------+\n| d     | datetime | YES  |     | NULL    |       |\n| d_m   | date     | YES  |     | NULL    |       |\n| d_o   | datetime | YES  |     | NULL    |       |\n+-------+----------+------+-----+---------+-------+  \n`\n\nFunction Qualification\n\nStarting with MariaDB 10.6.17, schema qualifiers can also be added to functions.&#x20;\n\nRegardless of the current SQL mode, this enables the explicit selection of MariaDB-native or Oracle-compatible behavior.\n\nExample syntax:\n\n`sql\nMariaDB-native function behavior in any SQL mode\nmariadb_schema.function_name(...) \n\nOracle-compatible function behavior in any SQL mode\noracle_schema.function_name(...)\n`\n\nBehavior\n\n mariadb_schema.function_name(...): MariaDB-native behavior\n oracle_schema.function_name(...): Oracle-compatible behavior\n\nNote: Function behavior varies depending on the SQL mode and function.\n\\\nDetailed function-level differences are not fully listed here and may differ by version.\n\nSHOW CREATE TABLE\n\nTo prevent ambiguity in data type interpretation, MariaDB may display schema qualifiers when SHOW CREATE TABLE is executed.\n\n`sql\nSET sql_mode=DEFAULT;\nCREATE OR REPLACE TABLE t1 (\n  d DATE\n);\nSET SQL_mode=ORACLE;\nSHOW CREATE TABLE t1;\n+-------+--------------------------------------------------------------+\n| Table | Create Table                                                 |\n+-------+--------------------------------------------------------------+\n| t1    | CREATE TABLE "t1" (                                          |\n|       |   "d" mariadb_schema.DATE DEFAULT NULL                       |\n|       |  )                                                           |\n+-------+--------------------------------------------------------------+\n`\n\nThe prefix is displayed to indicate that the column uses MariaDB''s native DATE type rather than the Oracle-compatible translated version.\n\nThe mariadb_schema prefix is only displayed when the data type is ambiguous. When the type is non-ambiguous or the SQL mode is set to default, it is not displayed.\n\nThis makes it easier to determine whether a column uses MariaDB-native or Oracle-compatible semantics.\n\nHistory\n\nWhen running with SQL_MODE=ORACLE, MariaDB server translates the DATE data type to DATETIME, for Oracle compatibility.&#x20;\n\n`sql\nSET SQL_mode=ORACLE;\nCREATE OR REPLACE TABLE t1 (\n  d DATE\n);\nSHOW CREATE TABLE t1;\n+-------+--------------------------------------------------------------+\n| Table | Create Table                                                 |\n+-------+--------------------------------------------------------------+\n| t1    | CREATE TABLE "t1" (                                          |\n|       |   "d" datetime DEFAULT NULL                       |\n|       |  )                                                           |\n+-------+--------------------------------------------------------------+\n`\n\nNote: DATE was converted to DATETIME.\n\nThis translation can cause ambiguity. For example, if a table is created in default SQL mode and then evaluated in Oracle mode:\n\n`sql\nSET sql_mode=DEFAULT;\nCREATE OR REPLACE TABLE t1 (\n  d DATE\n);\nSET SQL_mode=ORACLE;\nSHOW CREATE TABLE t1;\n`\n\nBefore schema qualifiers were introduced, this would display:\n\n`sql\nCREATE TABLE "t1" (\n  "d" DATE DEFAULT NULL\n);\n`\n\nThis created two problems:\n\n It was not clear whether DATE referred to the MariaDB DATE type or the Oracle-compatible DATETIME.\n It broke replication, causing a data type mismatch between the master and the slave. (see MDEV-19632).\n\nTo address this problem, MariaDB included schema qualifiers to explicitly qualify data types:\n\n`sql\nSET sql_mode=DEFAULT;\nCREATE OR REPLACE TABLE t1 (\n  d DATE\n);\nSET SQL_mode=ORACLE;\nSHOW CREATE TABLE t1;\n+-------+--------------------------------------------------------------+\n| Table | Create Table                                                 |\n+-------+--------------------------------------------------------------+\n| t1    | CREATE TABLE "t1" (                                          |\n|       |   "d" mariadb_schema.DATE DEFAULT NULL                       |\n|       |  )                                                           |\n+-------+--------------------------------------------------------------+\n``\n\nThis enables consistent and unambiguous behavior across all SQL modes.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/schema-qualifiers', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/schema-qualifiers');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (996, 29, 'Boolean Literals', 'Description\n-----------\n\nIn MariaDB, FALSE is a synonym of 0 and TRUE is a synonym of 1. These constants are case insensitive, so TRUE, True, and true are equivalent.\n\nThese terms are not synonyms of 0 and 1 when used with the IS operator. So, for example, 10 IS TRUE returns 1, while 10 = TRUE returns 0 (because 1 != 10).\n\nThe IS operator accepts a third constant exists: UNKNOWN. It is always a synonym of NULL.\n\nTRUE and FALSE are reserved words, while UNKNOWN is not.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/sql-language-structure-boolean-literals', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/sql-language-structure-boolean-literals');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (997, 29, 'String Literals', 'Description\n-----------\n\nStrings are sequences of characters and enclosed with quotes.\n\nThe syntax is:\n\n``sql\n[_charset_name]''string'' [COLLATE collation_name]\n`\n\nFor example:\n\n`sql\n''The MariaDB Foundation''\n_utf8 ''Foundation'' COLLATE utf8_unicode_ci;\n`\n\nStrings can either be enclosed in single quotes or in double quotes (the same character must be used to both open and close the string).\n\nThe ANSI SQL-standard does not permit double quotes for enclosing strings, and although MariaDB does by default, if the MariaDB server has enabled the ANSI_QUOTES_SQL SQL_MODE, double quotes will be treated as being used for identifiers instead of strings.\n\nStrings that are next to each other are automatically concatenated. The following are equivalent:\n\n`\n''The '' ''MariaDB '' ''Foundation''\n`\n\n`\n''The MariaDB Foundation''\n`\n\nThe \\ (backslash character) is used to escape characters (unless the SQL_MODE hasn''t been set to NO_BACKSLASH_ESCAPES):\n\n`\n''MariaDB''s new features''\n`\n\nThat is not a valid string because of the single quote in the middle of the string, which is treated as if it closes the string, but is actually meant as part of the string, an apostrophe. The backslash character helps in situations like this:\n\n`\n''MariaDB\\''s new features''\n`\n\nThat is now a valid string, and if displayed, will appear without the backslash.\n\n`sql\nSELECT ''MariaDB\\''s new features'';\n+------------------------+\n| MariaDB''s new features |\n+------------------------+\n| MariaDB''s new features |\n+------------------------+\n`\n\nAnother way to escape the quoting character is repeating it twice:\n\n`sql\nSELECT ''I''''m here'', """Double""";\n+----------+----------+\n| I''m here | "Double" |\n+----------+----------+\n| I''m here | "Double" |\n+----------+----------+\n`\n\nEscape Sequences\n\nThere are other escape sequences:\n\n| Escape sequence | Character                                           |\n| --------------- | --------------------------------------------------- |\n| \\0              | ASCII NUL (0x00).                                   |\n| ''               | Single quote (“''”).                                 |\n| "               | Double quote (“"”).                                 |\n| \\b              | Backspace.                                          |\n|                 | Newline, or linefeed,.                              |\n|                 | Carriage return.                                    |\n|                 | Tab.                                                |\n| \\Z              | ASCII 26 (Control+Z). See note following the table. |\n| \\\\              | Backslash (“\\”).                                    |\n| %               | “%” character. See note following the table.        |\n| _              | A “_” character. See note following the table.     |\n\nEscaping the % and _ characters can be necessary when using the LIKE operator, which treats them as special characters.\n\nThe ASCII 26 character (\\Z) needs to be escaped when included in a batch file which needs to be executed in Windows. The reason is that ASCII 26, in Windows, is the end of file (EOF).\n\nBackslash (\\`), if not used as an escape character, must always be escaped. When followed by a character that is not in the above table, backslashes will simply be ignored.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/string-literals', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/string-literals');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (998, 29, 'Table Value Constructors', 'Syntax\n------\n\nVALUES ( row_value[, row_value...]), (...)...\n\nDescription\n-----------\n\nIn Unions, Views, and subqueries, a Table Value Constructor (TVC) allows you to inject arbitrary values into the result set. The given values must have the same number of columns as the result set, otherwise it returns Error 1222.\n\nExamples\n--------\n\nCREATE TABLE test.t1 (val1 INT, val2 INT);\nINSERT INTO test.t1 VALUES(5, 8), (3, 4), (1, 2);\n\nSELECT * FROM test.t1\nUNION\nVALUES (70, 90), (100, 110);\n\n+------+------+\n| val1 | val2 |\n+------+------+\n|    5 |    8 | \n|    3 |    4 |\n|    1 |    2 |\n|   70 |   90 |\n|  100 |  110 |\n+------+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/table-value-constructors', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/table-value-constructors');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (999, 29, 'User-Defined Variables', 'Description\n-----------\n\nUser-defined variables are variables which can be created by the user and exist in the session. This means that no one can access user-defined variables that have been set by another user, and when the session is closed these variables expire. However, these variables can be shared between several queries and stored programs.\n\nUser-defined variables names must be preceded by a single _at_ character (@). While it is safe to use a reserved word as a user-variable name, the only allowed characters are ASCII letters, digits, dollar sign ($), underscore (_) and dot (.). If other characters are used, the name can be quoted in one of the following ways:\n\n @var_name\n @''var_name''\n @"var_name"\n\nThese characters can be escaped as usual.\n\nUser-variables names are case insensitive.\n\nUser-defined variables cannot be declared. They can be read even if no value has been set yet; in that case, they are NULL. To set a value for a user-defined variable you can use:\n\n SET statement;\n := operator within a SQL statement;\n SELECT ... INTO.\n\nSince user-defined variables type cannot be declared, the only way to force their type is using CAST() or CONVERT():\n\n``sql\nSET @str = CAST(123 AS CHAR(5));\n`\n\nIf a variable has not been used yet, its value is NULL:\n\n`sql\nSELECT @x IS NULL;\n+------------+\n| @x IS NULL |\n+------------+\n|          1 |\n+------------+\n`\n\nIt is unsafe to read a user-defined variable and set its value in the same statement (unless the command is SET), because the order of these actions is undefined.\n\nUser-defined variables can be used in most MariaDB''s statements and clauses which accept an SQL expression. However there are some exceptions, like the LIMIT clause.\n\nThey must be used to PREPARE a prepared statement:\n\n`sql\n@sql = ''DELETE FROM my_table WHERE c>1;'';\nPREPARE stmt FROM @sql;\nEXECUTE stmt;\nDEALLOCATE PREPARE stmt;\n`\n\nAnother common use is to include a counter in a query:\n\n`sql\nSET @var = 0;\nSELECT a, b, c, (@var:=@var+1) AS counter FROM my_table;\n`\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/sql-structure/sql-language-structure/user-defined-variables', '', 'https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/user-defined-variables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1000, 35, 'Temporal Tables', 'Description\n-----------\n\nsystem-versioned-tables.md\n\napplication-time-periods.md\n\nbitemporal-tables.md\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/temporal-tables/README', '', 'https://mariadb.com/docs/server/reference/sql-structure/temporal-tables/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1001, 35, 'Application-Time Periods', 'Description\n-----------\n\nExtending system-versioned tables, MariaDB supports application-time period tables. Time periods are defined by a range between two temporal columns. The columns must be of the same temporal data type, i.e. DATE, TIMESTAMP or DATETIME (TIME and YEAR are not supported), and of the same width.\n\nUsing time periods implicitly defines the two columns as NOT NULL. It also adds a constraint to check whether the first value is less than the second value. The constraint is invisible to SHOW CREATE TABLE statements. The name of this constraint is prefixed by the time period name, to avoid conflict with other constraints.\n\nCreating Tables with Time Periods\n\nTo create a table with a time period, use a CREATE TABLE statement with the PERIOD table option.\n\n``sql\nCREATE TABLE t1(\n   name VARCHAR(50), \n   date_1 DATE,\n   date_2 DATE,\n   PERIOD FOR date_period(date_1, date_2));\n`\n\nThis creates a table with a time_period period and populates the table with some basic temporal values.\n\nExamples are available in the MariaDB Server source code, at mysql-test/suite/period/r/create.result.\n\nAdding and Removing Time Periods\n\nThe ALTER TABLE statement now supports syntax for adding and removing time periods from a table. To add a period, use the ADD PERIOD clause:\n\n`sql\nCREATE OR REPLACE TABLE rooms (\n room_number INT,\n guest_name VARCHAR(255),\n checkin DATE,\n checkout DATE\n );\n\nALTER TABLE rooms ADD PERIOD FOR p(checkin,checkout);\n`\n\nTo remove a period, use the DROP PERIOD clause:\n\n`sql\nALTER TABLE rooms DROP PERIOD FOR p;\n`\n\nBoth ADD PERIOD and DROP PERIOD clauses include an option to handle whether the period already exists:\n\n`sql\nALTER TABLE rooms ADD PERIOD IF NOT EXISTS FOR p(checkin,checkout);\n\nALTER TABLE rooms DROP PERIOD IF EXISTS FOR p;\n`\n\nDeletion by Portion\n\nYou can also remove rows that fall within certain time periods.\n\nWhen MariaDB executes a DELETE FOR PORTION statement, it removes the row:\n\n When the row period falls completely within the delete period, it removes the row.\n When the row period overlaps the delete period, it shrinks the row, removing the overlap from the first or second row period value.\n When the delete period falls completely within the row period, it splits the row into two rows. The first row runs from the starting row period to the starting delete period. The second runs from the ending delete period to the ending row period.\n\nTo test this, first populate the table with some data to operate on:\n\n`sql\nCREATE TABLE t1(\n   name VARCHAR(50), \n   date_1 DATE,\n   date_2 DATE,\n   PERIOD FOR date_period(date_1, date_2));\n\nINSERT INTO t1 (name, date_1, date_2) VALUES\n    (''a'', ''1999-01-01'', ''2000-01-01''),\n    (''b'', ''1999-01-01'', ''2018-12-12''),\n    (''c'', ''1999-01-01'', ''2017-01-01''),\n    (''d'', ''2017-01-01'', ''2019-01-01'');\n\nSELECT  FROM t1;\n+------+------------+------------+\n| name | date_1     | date_2     |\n+------+------------+------------+\n| a    | 1999-01-01 | 2000-01-01 |\n| b    | 1999-01-01 | 2018-12-12 |\n| c    | 1999-01-01 | 2017-01-01 |\n| d    | 2017-01-01 | 2019-01-01 |\n+------+------------+------------+\n`\n\nThen, run the DELETE FOR PORTION statement:\n\n`sql\nDELETE FROM t1\nFOR PORTION OF date_period\n    FROM ''2001-01-01'' TO ''2018-01-01'';\nQuery OK, 3 rows affected (0.028 sec)\n\nSELECT  FROM t1 ORDER BY name;\n+------+------------+------------+\n| name | date_1     | date_2     |\n+------+------------+------------+\n| a    | 1999-01-01 | 2000-01-01 |\n| b    | 1999-01-01 | 2001-01-01 |\n| b    | 2018-01-01 | 2018-12-12 |\n| c    | 1999-01-01 | 2001-01-01 |\n| d    | 2018-01-01 | 2019-01-01 |\n+------+------------+------------+\n`\n\nHere:\n\n a is unchanged, as the range falls entirely out of the specified portion to be deleted.\n b, with values ranging from 1999 to 2018, is split into two rows, 1999 to 2000 and 2018-01 to 2018-12 (i.e. one extra row has been inserted).\n c, with values ranging from 1999 to 2017, where only the upper value falls within the portion to be deleted, has been shrunk to 1999 to 2001.\n d, with values ranging from 2017 to 2019, where only the lower value falls within the portion to be deleted, has been shrunk to 2018 to 2019.\n\nThe DELETE FOR PORTION statement has the following restrictions\n\n The FROM...TO clause must be constant.\n Multi-delete is not supported.\n\nIf there are DELETE or INSERT triggers, any matched row is deleted, and then one or two rows are inserted. If the record is deleted completely, nothing is inserted.\n\nUpdating by Portion\n\nThe UPDATE syntax now supports UPDATE FOR PORTION, which modifies rows based on their occurrence in a range:\n\nTo test it, first populate the table with some data:\n\n`sql\nTRUNCATE t1;\n\nINSERT INTO t1 (name, date_1, date_2) VALUES\n    (''a'', ''1999-01-01'', ''2000-01-01''),\n    (''b'', ''1999-01-01'', ''2018-12-12''),\n    (''c'', ''1999-01-01'', ''2017-01-01''),\n    (''d'', ''2017-01-01'', ''2019-01-01'');\n\nSELECT  FROM t1;\n+------+------------+------------+\n| name | date_1     | date_2     |\n+------+------------+------------+\n| a    | 1999-01-01 | 2000-01-01 |\n| b    | 1999-01-01 | 2018-12-12 |\n| c    | 1999-01-01 | 2017-01-01 |\n| d    | 2017-01-01 | 2019-01-01 |\n+------+------------+------------+\n`\n\nThen run the update:\n\n`sql\nUPDATE t1 FOR PORTION OF date_period\n  FROM ''2000-01-01'' TO ''2018-01-01'' \nSET name = CONCAT(name,''_original'');\n\nSELECT  FROM t1 ORDER BY name;\n+------------+------------+------------+\n| name       | date_1     | date_2     |\n+------------+------------+------------+\n| a          | 1999-01-01 | 2000-01-01 |\n| b          | 1999-01-01 | 2000-01-01 |\n| b          | 2018-01-01 | 2018-12-12 |\n| b_original | 2000-01-01 | 2018-01-01 |\n| c          | 1999-01-01 | 2000-01-01 |\n| c_original | 2000-01-01 | 2017-01-01 |\n| d          | 2018-01-01 | 2019-01-01 |\n| d_original | 2017-01-01 | 2018-01-01 |\n+------------+------------+------------+\n`\n\n a is unchanged, as the range falls entirely out of the specified portion to be updated.\n For b, with years ranging from 1999 to 2018, two extra rows are inserted, with ranges 1999-01 to 2000-01 and 2018-01 to 2018-12. The original row''s period has been shrunk to years 2000 and 2018, and the name field has got "_original" appended.\n c, with values ranging from 1999 to 2017, where only the upper value falls within the portion to be updated, has been shrunk to 1999 to 2001.\n d, with values ranging from 2017 to 2019, where only the lower value falls within the portion to be updated, has been shrunk to 2018 to 2019.\n Original rows affected by the update have "_original" appended to the name.\n\nThe UPDATE FOR PORTION statement has the following limitations:\n\n The operation cannot modify the two temporal columns used by the time period.\n The operation cannot reference period values in the SET expression.\n FROM...TO expressions must be constant.\n\nWITHOUT OVERLAPS\n\nThis clause is available from MariaDB 10.5.3.\n\nWITHOUT OVERLAPS allows to create an index specifying that application time periods should not overlap. An index constrained by WITHOUT OVERLAPS is required to be either a primary key or a unique index.\n\nTake the following example, an application time period table for a booking system:\n\n`sql\nCREATE OR REPLACE TABLE rooms (\n room_number INT,\n guest_name VARCHAR(255),\n checkin DATE,\n checkout DATE,\n PERIOD FOR p(checkin,checkout)\n );\n\nINSERT INTO rooms VALUES \n (1, ''Regina'', ''2020-10-01'', ''2020-10-03''),\n (2, ''Cochise'', ''2020-10-02'', ''2020-10-05''),\n (1, ''Nowell'', ''2020-10-03'', ''2020-10-07''),\n (2, ''Eusebius'', ''2020-10-04'', ''2020-10-06'');\n`\n\nOur system is not intended to permit overlapping bookings, so the fourth record above should not have been inserted. Using WITHOUT OVERLAPS in a unique index (in this case based on a combination of room number and the application time period) allows to specify this constraint in the table definition.\n\n`sql\nCREATE OR REPLACE TABLE rooms (\n room_number INT,\n guest_name VARCHAR(255),\n checkin DATE,\n checkout DATE,\n PERIOD FOR p(checkin,checkout),\n UNIQUE (room_number, p WITHOUT OVERLAPS)\n );\n\nINSERT INTO rooms VALUES \n (1, ''Regina'', ''2020-10-01'', ''2020-10-03''),\n (2, ''Cochise'', ''2020-10-02'', ''2020-10-05''),\n (1, ''Nowell'', ''2020-10-03'', ''2020-10-07''),\n (2, ''Eusebius'', ''2020-10-04'', ''2020-10-06'');\nERROR 1062 (23000): Duplicate entry ''2-2020-10-06-2020-10-04'' for key ''room_number''\n`\n\nInformation Schema\n\nInformation Schema support for application time period tables is available from MariaDB 11.4.\n\nInformation Schema contains the following support for application time period tables:\n\n INFORMATION_SCHEMA.PERIODS view.\n INFORMATION_SCHEMA.KEY_PERIOD_USAGE view.\n Additional columns IS_SYSTEM_TIME_PERIOD_START and IS_SYSTEM_TIME_PERIOD_END in the INFORMATION_SCHEMA.COLUMNS view.\n\nFurther Examples\n\nThe implicit change from NULL to NOT NULL:\n\n`sql\nCREATE TABLE t2 (\n  id int(11) DEFAULT NULL,\n  d1 datetime DEFAULT NULL,\n  d2 datetime DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n\nALTER TABLE t2 ADD PERIOD FOR p(d1,d2);\n\nSHOW CREATE TABLE t2\\G\n************************ 1. row ***********************\n       Table: t2\nCreate Table: CREATE TABLE t2 (\n //a// is unchanged, as the range falls entirely out of the specified portion to be updated.\n For //b//, with years ranging from 1999 to 2018, two extra rows are inserted, with ranges 1999-01 to 2000-01 and 2018-01 to 2018-12. The original row''s period has been shrunk to years 2000 and 2018, and the _name_ field has got "_original" appended.\n //c//, with values ranging from 1999 to 2017, where only the upper value falls within the portion to be updated, has been shrunk to 1999 to 2001.\n //d//, with values ranging from 2017 to 2019, where only the lower value falls within the portion to be updated, has been shrunk to 2018 to 2019. \n Original rows affected by the update have "_original" appended to the ##name## field.\n  id int(11) DEFAULT NULL,\n  d1 datetime NOT NULL,\n  d2 datetime NOT NULL,\n  PERIOD FOR p (d1, d2)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n`\n\nDue to this constraint, trying to add a time period where NULL data already exist fails:\n\n`sql\nCREATE OR REPLACE TABLE t2 (\n  id int(11) DEFAULT NULL,\n  d1 datetime DEFAULT NULL,\n  d2 datetime DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n\nINSERT INTO t2(id) VALUES(1);\n\nALTER TABLE t2 ADD PERIOD FOR p(d1,d2);\nERROR 1265 (01000): Data truncated for column ''d1'' at row 1\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/temporal-tables/application-time-periods', '', 'https://mariadb.com/docs/server/reference/sql-structure/temporal-tables/application-time-periods');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1002, 35, 'Bitemporal Tables', 'Description\n-----------\n\nBitemporal tables are tables that use versioning both at the system and application-time period levels.\n\nUsing Bitemporal Tables\n\nTo create a bitemporal table, use:\n\n``sql\nCREATE TABLE test.t3 (\n   date_1 DATE,\n   date_2 DATE,\n   row_start TIMESTAMP(6) AS ROW START INVISIBLE,\n   row_end TIMESTAMP(6) AS ROW END INVISIBLE,\n   PERIOD FOR application_time(date_1, date_2),\n   PERIOD FOR system_time(row_start, row_end))\nWITH SYSTEM VERSIONING;\n`\n\nNote that, while system_time here is also a time period, it cannot be used in DELETE FOR PORTION or UPDATE FOR PORTION statements:\n\n`sql\nDELETE FROM test.t3 \nFOR PORTION OF system_time \n    FROM ''2000-01-01'' TO ''2018-01-01'';\nERROR 42000: You have an error in your SQL syntax; check the manual that corresponds \n  to your MariaDB server version for the right syntax to use near\n  ''of system_time from ''2000-01-01'' to ''2018-01-01'''' at line 1\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/temporal-tables/bitemporal-tables', '', 'https://mariadb.com/docs/server/reference/sql-structure/temporal-tables/bitemporal-tables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1003, 35, 'System-Versioned Tables', 'Description\n-----------\n\nMariaDB supports temporal data tables in the form of system-versioning tables (allowing you to query and operate on historic data, discussed below), application-time periods (allow you to query and operate on a temporal range of data), and bitemporal tables (which combine both system-versioning and application-time periods).\n\nSystem-Versioned Tables\n\nSystem-versioned tables store the history of all changes, not only data which is currently applicable. This allows data analysis for any point in time, auditing of changes and comparison of data from different points in time. Typical uses cases are:\n\n Forensic analysis & legal requirements to store data for N years.\n Data analytics (retrospective, trends etc.), e.g. to get your staff information as of one year ago.\n Point-in-time recovery - recover a table state as of particular point in time.\n\nSystem-versioned tables were first introduced in the SQL:2011 standard.\n\nThe keyword SYSTEM is used in the SYSTEM VERSIONING clause. Using SYSTEM as an unquoted column name in an ALTER TABLE is not permitted by some parser rules. Even though SYSTEM is not a fully reserved word in Oracle mode, the ADD statement will result in a syntax error.\n\nAlways provide SYSTEM when using it as a column name: system. See the Reserved Words page for additional examples and a detailed explanation.\n\nCreating a System-Versioned Table\n\nThe CREATE TABLE syntax has been extended to permit creating a system-versioned table. To be system-versioned, according to SQL:2011, a table must have two generated columns, a period, and a special table option clause:\n\n``sql\nCREATE TABLE t(\n   x INT,\n   start_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW START,\n   end_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW END,\n   PERIOD FOR SYSTEM_TIME(start_timestamp, end_timestamp)\n) WITH SYSTEM VERSIONING;\n`\n\nIn MariaDB, you can use a simplified syntax:\n\n`sql\nCREATE TABLE t (\n   x INT\n) WITH SYSTEM VERSIONING;\n`\n\nIn the latter case, no extra columns will be created, and they won''t clutter the output of, say, SELECT  FROM t. The versioning information will still be stored, and it can be accessed via the pseudo-columns ROW_START and ROW_END:\n\n`sql\nSELECT x, ROW_START, ROW_END FROM t;\n`\n\nAdding or Removing System Versioning To/From a Table\n\nAn existing table can be altered to enable system versioning for it.\n\n`sql\nCREATE TABLE t(\n  x INT\n);\n`\n\n`sql\nALTER TABLE t ADD SYSTEM VERSIONING;\n`\n\n`sql\nSHOW CREATE TABLE t\\G\n************************ 1. row *********************\n       Table: t\nCreate Table: CREATE TABLE t (\n  x int(11) DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING\n`\n\nSimilarly, system versioning can be removed from a table:\n\n`sql\nALTER TABLE t DROP SYSTEM VERSIONING;\n`\n\n`sql\nSHOW CREATE TABLE t\\G\n********************* 1. row *********************\n       Table: t\nCreate Table: CREATE TABLE t (\n  x int(11) DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n`\n\nYou can also add system versioning with all columns created explicitly:\n\n`sql\nALTER TABLE t ADD COLUMN ts TIMESTAMP(6) GENERATED ALWAYS AS ROW START,\n              ADD COLUMN te TIMESTAMP(6) GENERATED ALWAYS AS ROW END,\n              ADD PERIOD FOR SYSTEM_TIME(ts, te),\n              ADD SYSTEM VERSIONING;\n`\n\n`sql\nSHOW CREATE TABLE t\\G\n********************* 1. row *********************\n       Table: t\nCreate Table: CREATE TABLE t (\n  x int(11) DEFAULT NULL,\n  ts timestamp(6) GENERATED ALWAYS AS ROW START,\n  te timestamp(6) GENERATED ALWAYS AS ROW END,\n  PERIOD FOR SYSTEM_TIME (ts, te)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING\n`\n\nMariaDB starting with 11.7\n\nIt is possible to convert a versioned table from implicit to explicit row_start/row_end columns. Note that, in order to do any ALTER on a system versioned table, system_versioning_alter_history must be set to KEEP.\n\n`sql\nCREATE OR REPLACE TABLE t1 (x INT) WITH SYSTEM VERSIONING;\n\nSET system_versioning_alter_history = keep;\n\nALTER TABLE t1 ADD COLUMN rs TIMESTAMP(6) AS ROW START, \n  ADD COLUMN re TIMESTAMP(6) AS ROW END, ADD PERIOD FOR SYSTEM_TIME (rs,re)\n`\n\nIt is not possible to convert a versioned table from implicit to explicit row_start/row_end columns. Doing so results in a duplicate row error:\n\n`sql\nCREATE OR REPLACE TABLE t1 (x INT) WITH SYSTEM VERSIONING;\n\nSET system_versioning_alter_history = keep;\n\nALTER TABLE t1 ADD COLUMN rs TIMESTAMP(6) AS ROW START, \n  ADD COLUMN re TIMESTAMP(6) AS ROW END, ADD PERIOD FOR SYSTEM_TIME (rs,re);\n\nERROR 4134 (HY000): Duplicate ROW START column rs\n`\n\nInserting Data\n\nWhen data is inserted into a system-versioned table, it is given a _row_start_ value of the current timestamp, and a _row_end_ value of FROM_UNIXTIME (2147483647.999999). The current timestamp can be adjusted by setting the timestamp system variable:\n\n`sql\nSELECT NOW();\n+---------------------+\n| NOW()               |\n+---------------------+\n| 2022-10-24 23:09:38 |\n+---------------------+\n \nINSERT INTO t VALUES(1);\n \nSET @@timestamp = UNIX_TIMESTAMP(''2033-10-24'');\n\nINSERT INTO t VALUES(2);\n \nSET @@timestamp = default;\n\nINSERT INTO t VALUES(3);\n \nSELECT a,row_start,row_end FROM t;\n+------+----------------------------+----------------------------+\n| a    | row_start                  | row_end                    |\n+------+----------------------------+----------------------------+\n|    1 | 2022-10-24 23:09:38.951347 | 2038-01-19 05:14:07.999999 |\n|    2 | 2033-10-24 00:00:00.000000 | 2038-01-19 05:14:07.999999 |\n|    3 | 2022-10-24 23:09:38.961857 | 2038-01-19 05:14:07.999999 |\n+------+----------------------------+----------------------------+\n`\n\nQuerying Historical Data\n\nSELECT\n\nTo query the historical data one uses the clause FOR SYSTEM_TIME directly after the table name (before the table alias, if any). SQL:2011 provides three syntactic extensions:\n\n AS OF is used to see the table as it was at a specific point in time in the past:\n\n`sql\nSELECT  FROM t FOR SYSTEM_TIME AS OF TIMESTAMP''2016-10-09 08:07:06'';\n`\n\n BETWEEN start AND end will show all rows that were visible at any point between two specified points in time. It works inclusively, a row visible exactly at start or exactly at end will be shown too.\n\n`sql\nSELECT  FROM t FOR SYSTEM_TIME BETWEEN (NOW() - INTERVAL 1 YEAR) AND NOW();\n`\n\n FROM start TO end will also show all rows that were visible at any point between two specified points in time, including start, but excluding end.\n\n`sql\nSELECT  FROM t FOR SYSTEM_TIME FROM ''2016-01-01 00:00:00'' TO ''2017-01-01 00:00:00'';\n`\n\nAdditionally, MariaDB implements a non-standard extension.\n\n ALL will show all rows, historical and current.\n\n`sql\nSELECT  FROM t FOR SYSTEM_TIME ALL;\n`\n\nIf the FOR SYSTEM_TIME clause is not used, the table shows the _current_ data. This is usually the same as if you had specified FOR SYSTEM_TIME AS OF CURRENT_TIMESTAMP, unless you''ve adjusted the _row_start_ value:\n\n`sql\nCREATE OR REPLACE TABLE t (a int) WITH SYSTEM VERSIONING;\n\nSELECT NOW();\n+---------------------+\n| NOW()               |\n+---------------------+\n| 2022-10-24 23:43:37 |\n+---------------------+\n\nINSERT INTO t VALUES (1);\n\nSET @@timestamp = UNIX_TIMESTAMP(''2033-03-03'');\n\nINSERT INTO t VALUES (2);\n\nDELETE FROM t;\n\nSET @@timestamp = default;\n\nSELECT a, row_start, row_end FROM t FOR SYSTEM_TIME ALL;\n+------+----------------------------+----------------------------+\n| a    | row_start                  | row_end                    |\n+------+----------------------------+----------------------------+\n|    1 | 2022-10-24 23:43:37.192725 | 2033-03-03 00:00:00.000000 |\n|    2 | 2033-03-03 00:00:00.000000 | 2033-03-03 00:00:00.000000 |\n+------+----------------------------+----------------------------+\n2 rows in set (0.000 sec)\n\nSELECT a, row_start, row_end FROM t FOR SYSTEM_TIME AS OF CURRENT_TIMESTAMP;\n+------+----------------------------+----------------------------+\n| a    | row_start                  | row_end                    |\n+------+----------------------------+----------------------------+\n|    1 | 2022-10-24 23:43:37.192725 | 2033-03-03 00:00:00.000000 |\n+------+----------------------------+----------------------------+\n1 row in set (0.000 sec)\n\nSELECT a, row_start, row_end FROM t;\nEmpty set (0.001 sec)\n`\n\nIf the FOR SYSTEM_TIME clause is not used, the table shows the _current_ data. This is usually the same as if you had specified FOR SYSTEM_TIME AS OF CURRENT_TIMESTAMP, unless you''ve adjusted the _row_start_ value (only possible by setting the secure_timestamp variable):\n\n`sql\nCREATE OR REPLACE TABLE t (a int) WITH SYSTEM VERSIONING;\n\nSELECT NOW();\n+---------------------+\n| NOW()               |\n+---------------------+\n| 2022-10-24 23:43:37 |\n+---------------------+\n\nINSERT INTO t VALUES (1);\n\nSET @@timestamp = UNIX_TIMESTAMP(''2033-03-03'');\n\nINSERT INTO t VALUES (2);\n\nDELETE FROM t;\n\nSET @@timestamp = default;\n\nSELECT a, row_start, row_end FROM t FOR SYSTEM_TIME ALL;\n+------+----------------------------+----------------------------+\n| a    | row_start                  | row_end                    |\n+------+----------------------------+----------------------------+\n|    1 | 2022-10-24 23:43:37.192725 | 2033-03-03 00:00:00.000000 |\n|    2 | 2033-03-03 00:00:00.000000 | 2033-03-03 00:00:00.000000 |\n+------+----------------------------+----------------------------+\n2 rows in set (0.000 sec)\n\nSELECT a, row_start, row_end FROM t FOR SYSTEM_TIME AS OF CURRENT_TIMESTAMP;\n+------+----------------------------+----------------------------+\n| a    | row_start                  | row_end                    |\n+------+----------------------------+----------------------------+\n|    1 | 2022-10-24 23:43:37.192725 | 2033-03-03 00:00:00.000000 |\n+------+----------------------------+----------------------------+\n1 row in set (0.000 sec)\n\nSELECT a, row_start, row_end FROM t;\nEmpty set (0.001 sec)\n`\n\nViews and Subqueries\n\nWhen a system-versioned table is used in a view or in a subquery in the from clause, FOR SYSTEM_TIME can be used directly in the view or subquery body, or (non-standard) applied to the whole view when it''s being used in a SELECT:\n\n`sql\nCREATE VIEW v1 AS SELECT  FROM t FOR SYSTEM_TIME AS OF TIMESTAMP''2016-10-09 08:07:06'';\n`\n\nOr:\n\n`sql\nCREATE VIEW v1 AS SELECT  FROM t;\nSELECT  FROM v1 FOR SYSTEM_TIME AS OF TIMESTAMP''2016-10-09 08:07:06'';\n`\n\nUse in Replication and Binary Logs\n\nTables that use system-versioning implicitly add the row_end column to the Primary Key. While this is generally not an issue for most use cases, it can lead to problems when re-applying write statements from the binary log or in replication environments, where a master retries an SQL statement on the slave.\n\nSpecifically, these writes include a value on the row_end column containing the timestamp from when the write was initially made. The re-occurrence of the Primary Key with the old system-versioning columns raises an error due to the duplication.\n\nTo mitigate this with MariaDB Replication, set the secure_timestamp system variable to YES on the slave. When set, the slave uses its own system clock when applying to the row log, meaning that the primary can retry as many times as needed without causing a conflict. The retries generate new historical rows with new values for the row_start and row_end columns.\n\nTransaction-Precise History in InnoDB\n\nA point in time when a row was inserted or deleted does not necessarily mean that a change became visible at the same moment. With transactional tables, a row might have been inserted in a long transaction, and became visible hours after it was inserted.\n\nFor some applications — for example, when doing data analytics on one-year-old data — this distinction does not matter much. For others — forensic analysis — it might be crucial.\n\nMariaDB supports transaction-precise history (only for the InnoDB storage engine) that allows seeing the data exactly as it would''ve been seen by a new connection doing a SELECT at the specified point in time — rows inserted _before_ that point, but committed _after_ will not be shown.\n\nTo use transaction-precise history, InnoDB needs to remember not timestamps, but transaction identifier per row. This is done by creating generated columns as BIGINT UNSIGNED, not TIMESTAMP(6):\n\n`sql\nCREATE TABLE t(\n   x INT,\n   start_trxid BIGINT UNSIGNED GENERATED ALWAYS AS ROW START,\n   end_trxid BIGINT UNSIGNED GENERATED ALWAYS AS ROW END,\n   PERIOD FOR SYSTEM_TIME(start_trxid, end_trxid)\n) WITH SYSTEM VERSIONING;\n`\n\nThese columns must be specified explicitly, but they can be made INVISIBLE to avoid cluttering SELECT  output.\n\nNote that if you are using an engine that does not support system versioning with transaction ids, you will get an error like "start_trxid must be of type TIMESTAMP(6) for system-versioned table t".\n\nWhen one uses transaction-precise history, one can optionally use transaction identifiers in the FOR SYSTEM_TIME clause:\n\n`sql\nSELECT  FROM t FOR SYSTEM_TIME AS OF TRANSACTION 12345;\n`\n\nThis shows the data, exactly as it was seen by the transaction with the identifier 12345.\n\nData for this feature is stored in the mysql.transaction_registry table.\n\nLimitations\n\nPARTITION BY SYSTEM_TIME is not supported when using transaction-precise system versioning. Transaction-precise history tracks row versions using transaction identifiers instead of timestamps, so, SYSTEM_TIME cannot be used to partition transaction-precise system history. If partitioning is required, use the default timestamp-based versioning.\n\nStoring the History Separately\n\nWhen the history is stored together with the current data, it increases the size of the table, so current data queries — table scans and index searches — will take more time, because they will need to skip over historical data. If most queries on that table use only current data, it might make sense to store the history separately, to reduce the overhead from versioning.\n\nThis is done by partitioning the table by SYSTEM_TIME. Because of the partition pruning optimization, all current data queries will only access one partition, the one that stores current data.\n\nThis example shows how to create such a partitioned table:\n\n`sql\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING\n  PARTITION BY SYSTEM_TIME (\n    PARTITION p_hist HISTORY,\n    PARTITION p_cur CURRENT\n  );\n`\n\nIn this example, all history will be stored in the partition p_hist while all current data will be in the partition p_cur. The table must have exactly one current partition and at least one historical partition.\n\nPartitioning by SYSTEM_TIME also supports automatic partition rotation. You can rotate historical partitions by time or by size. This example shows how to rotate partitions by size:\n\n`sql\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING\n  PARTITION BY SYSTEM_TIME LIMIT 100000 (\n    PARTITION p0 HISTORY,\n    PARTITION p1 HISTORY,\n    PARTITION pcur CURRENT\n  );\n`\n\nMariaDB starts writing history rows into partition p0, and at the end of the statement that wrote the 100000th row, MariaDB will s\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/sql-structure/temporal-tables/system-versioned-tables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1004, 35, 'Vectors', 'Description\n-----------\n\nvector-overview.md\n\ncreate-table-with-vectors.md\n\nvector-system-variables.md\n\nvector-functions\n\nvector.md\n\nvector-framework-integrations.md\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/vectors/README', '', 'https://mariadb.com/docs/server/reference/sql-structure/vectors/README');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1005, 35, 'CREATE TABLE with Vectors', 'Description\n-----------\n\nMariaDB has a dedicated VECTOR(N) data type with a built-in data validation. N is the number of dimensions that all vector values in the column have.\n\n Vector indexes are dimensionality-specific.\n All vectors inserted into an indexed column must match the index''s target dimensionality.\n Inserting vectors with different dimensionalities will result in an error.\n\nConsider the following table:\n\n``sql\nCREATE TABLE embeddings (\n        doc_id BIGINT UNSIGNED PRIMARY KEY,\n        embedding VECTOR(1536)\n);\n`\n\nTo have a fast vector search, you have to index the vector column, creating a VECTOR index:\n\n`sql\nCREATE TABLE embeddings (\n        doc_id BIGINT UNSIGNED PRIMARY KEY,\n        embedding VECTOR(1536) NOT NULL,\n        VECTOR INDEX (embedding)\n);\n`\n\nNote that there can be only one vector index in the table, and the indexed vector column must be NOT NULL.\n\nThere are two options that can be used to configure the vector index:\n\n M — Larger values mean slower SELECT and INSERT statements, larger index size and higher memory consumption, but more accurate results. The valid range is from 3 to 200.\n* DISTANCE — Distance function to build the vector index for. Searches using a different distance function will not be able to use a vector index. Valid values are cosine and euclidean (the default).\n\n`sql\nCREATE TABLE embeddings (\n        doc_id BIGINT UNSIGNED PRIMARY KEY,\n        embedding VECTOR(1536) NOT NULL,\n        VECTOR INDEX (embedding) M=8 DISTANCE=cosine\n);\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/vectors/create-table-with-vectors', '', 'https://mariadb.com/docs/server/reference/sql-structure/vectors/create-table-with-vectors');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1006, 35, 'Optimizing Hybrid Search Query with Reciprocal Rank Fusion (RRF)', 'Description\n-----------\n\nHybrid search combines the keyword precision of full-text search with the conceptual understanding of vector search to produce a single, superior set of results.\n\nFull-Text Search\n\nFull-text search is the traditional keyword-based search, excelling at finding documents that contain the exact words from your query. Behind the scenes, it relies on a data structure called an inverted index—a dictionary that maps each word to a list of documents it appears in, allowing for very fast lookups. For instance, a search for ''apple pie recipe'' will instantly find all documents indexed under those three words: ‘apple‘, ‘pie‘ & ‘recipe‘.\n\nVector Search\n\nVector search is a modern search method based on meaning. It finds documents that are conceptually similar to your query, even if they don''t share any keywords. It works by converting both the query and the documents into numerical representations called "vector embeddings." These vectors exist as points in a high-dimensional conceptual space. A search then finds the "nearest neighbors"—the document points that are closest to the query point. For instance, a vector search for "apple pie recipe" might also return a document titled "how to bake a Granny Smith tart," because the model understands that "tart" is similar to "pie" and "Granny Smith" is a type of "apple."\n\nThe Power of Hybrid Search\n\nFull-text search offers precise keyword matching, while vector search provides nuanced understanding of concepts. Together, they handle ambiguity and ensure critical queries aren''t missed, resulting in a robust, intelligent search experience.\n\nCombining Full-Text and Vector Search\n\nA Search for "Sustainable Coffee Pods"\n\nWhen a user searches for "sustainable coffee pods," the two search systems return the following ranked lists.\n\nFull-Text Search Results\n\n| Rank | ID | Title                         |\n| ---- | -- | ----------------------------- |\n| 1    | 1  | ''Eco Coffee Pods - 100 Count'' |\n| 2    | 3  | ''Recyclable Coffee Capsules''  |\n| 3    | 4  | ''Morning Roast Coffee Beans''  |\n\nVector Search Results\n\n| Rank | ID | Title                           |\n| ---- | -- | ------------------------------- |\n| 1    | 2  | ''Compostable Espresso Pods''     |\n| 2    | 3  | ''Recyclable Coffee Capsules''    |\n| 3    | 6  | ''Bamboo Reusable Coffee Filter'' |\n\nWhen two search systems produce distinct lists of titles, a traditional merging approach would prioritize titles that appear in both lists, similar to an INNER JOIN operation.\n\nWhy a Simple INNER JOIN Is Insufficient\n\nAn INNER JOIN only returns results found by both search systems, discarding valuable items that appear in only one list.\n\nIf we were to INNER JOIN the two lists from our "sustainable coffee pods" search, the result would be:\n\n| ID | Title                        |\n| -- | ---------------------------- |\n| 3  | ''Recyclable Coffee Capsules'' |\n\nThis result is severely incomplete. It correctly finds the one common item but completely discards the #1 ranked result from both searches (''Eco Coffee Pods'' and ''Compostable Espresso Pods'') simply because they were specialists found by only one system.\n\nReciprocal Rank Fusion (RRF)\n\nTo solve the problem of discarded results, we use Reciprocal Rank Fusion (RRF). The power of RRF lies in its simplicity: it operates on the rank of an item (1st, 2nd, 3rd) in a list, not its raw, non-comparable score. This makes it highly effective for merging lists from different systems without needing to normalize their scores.\n\nA helpful way to think of this is to imagine your different search systems as a "panel of expert advisors"; RRF intelligently combines their opinions using the formula:\n\n$$\nRRF_{score} = \\sum_{i} \\frac{1}{k + \\text{rank}_i}\n$$\n\nWhere rank is the position of a document in a list, and k is a tuning constant that moderates the influence of that rank.\n\nRRF''s k Parameter\n\nThe k parameter is the primary tuning knob for the RRF algorithm, acting as a smoothing factor that controls how results are weighted. A low k gives immense power to a top-ranked result, while a high k is more skeptical of a single top pick and rewards items found by multiple systems (consensus). A value of k=60 is a robust and effective baseline for general use.\n\nA key advantage of RRF is that it ignores the raw scores from the search systems and uses only the rank. The table below shows the partial RRF score for the top items in our "sustainable coffee pods" search, calculated with k=60.\n\nBuilding the Hybrid Query Optimization model with CTEs\n\n``mermaid\n\ngraph TD\n    subgraph "1. Configuration & Parameters"\n        param_k[/"Parameter: k (e.g., 60)"/]\n    end\n    subgraph "2. Initial Searches (CTEs)"\n        A[CTE: vector_limit_search] -->|Outputs ''dist'' score| C\n        B[CTE: fulltext_limit_search] -->|Outputs ''match_score''| D\n    end\n    subgraph "3. Score Calculation & Merging (CTEs)"\n        C[CTE: vector_score]\n        D[CTE: fulltext_score]\n        param_k --> C & D\n        C -->|"Calculates partial_rrf"| E[CTE: full_outer_join_output <br> Implemented with UNION]\n        D -->|"Calculates partial_rrf"| E\n    end\n    subgraph "4. Final Output"\n        E --> F[Final SELECT & ORDER BY total_rrf]\n    end\n    style F fill:#f5ddb3\n`\n\nTo build the model, our query uses the following Common Table Expressions (CTEs). \n\n| CTE Name                  | Purpose                                                                                    |\n| ------------------------- | ------------------------------------------------------------------------------------------ |\n| vector_limit_search     | Runs the initial vector search to retrieve the top N conceptually similar items.           |\n| fulltext_limit_search   | Runs the initial full-text search to retrieve the top N keyword matches.                   |\n| vector_score             | Calculates a partial_rrf score for each item from the vector search based on its rank.    |\n| fulltext_score           | Calculates a partial_rrf score for each item from the full-text search based on its rank. |\n| full_outer_join_output | Merges the two score lists and sums the partial scores into a total_rrf.                  |\n\nThe annotated SQL query uses the CTEs to perform the hybrid search:\n\n`sql\n-- Set the parameters for our query.\nSET @k = 60; -- The RRF smoothing constant.\nSET @search_term = "sustainable coffee pods";\n-- The vector for the search term would be set here.\n-- SET @search_term_vector = VEC_FromText("...");\n\n-- Use CTEs to break the logic into sequential steps.\nWITH\n-- STEP 1: Get top results from each search method.\nvector_limit_search AS (\n  SELECT id, title, VEC_DISTANCE_EUCLIDEAN(embedding, @search_term_vector) AS dist\n  FROM products ORDER BY dist ASC LIMIT 10\n),\nfulltext_limit_search AS (\n  SELECT id, title, MATCH(title) AGAINST (@search_term) AS match_score\n  FROM products WHERE MATCH(title) AGAINST (@search_term)\n  ORDER BY match_score DESC LIMIT 10\n),\n-- STEP 2: Calculate partial RRF scores for each list.\nvector_score AS (\n  SELECT id, title, 1 / (@k + RANK() OVER (ORDER BY dist ASC)) AS partial_rrf\n  FROM vector_limit_search\n),\nfulltext_score AS (\n  SELECT id, title, 1 / (@k + RANK() OVER (ORDER BY match_score DESC)) AS partial_rrf\n  FROM fulltext_limit_search\n),\n-- STEP 3: Merge the two lists and sum the scores.\nfull_outer_join_output AS (\n  SELECT v.id, v.title, (v.partial_rrf + IFNULL(f.partial_rrf, 0)) AS total_rrf\n  FROM vector_score v LEFT JOIN fulltext_score f USING (id)\n  UNION\n  SELECT f.id, f.title, (IFNULL(v.partial_rrf, 0) + f.partial_rrf) AS total_rrf\n  FROM fulltext_score f LEFT JOIN vector_score v USING (id)\n)\n-- STEP 4: Select the final, unified list.\nSELECT id, title, total_rrf FROM full_outer_join_output\nORDER BY total_rrf DESC\nLIMIT 10;\n``\n\nFinal Calculation for "Sustainable Coffee Pods"\n\nWith k=60, the final CTE merges and sums the partial scores. The consensus item, found in both lists, rises to the top.\n\n| ID | Title                      | fulltext_rrf | vector_rrf | total_rrf | Final Rank |\n| -- | -------------------------- | ------------- | ----------- | ---------- | ---------- |\n| 3  | Recyclable Coffee Capsules | 0.01613       | 0.01613     | 0.03226    | 1          |\n| 1  | Eco Coffee Pods            | 0.01639       | 0           | 0.01639    | 2          |\n| 2  | Compostable Espresso Pods  | 0             | 0.01639     | 0.01639    | 2          |\n\nTuning the k Parameter\n\nAs introduced earlier, the k parameter can be fine-tuned for specific situations. Here are three common scenarios to consider.\n\n1. Combining Diverse, Specialist Systems\n\nFor merging results from different methods like keyword and vector search, a higher k (such as 60) is ideal to balance their contributions. Our main "sustainable coffee pods" search is a perfect illustration of this, where the consensus item wins but the high-quality specialists are ranked immediately after.\n\n| Final Rank | ID | Title                      | Total RRF | Note             |\n| ---------- | -- | -------------------------- | --------- | ---------------- |\n| 1          | 3  | Recyclable Coffee Capsules | 0.03226   | Consensus Winner |\n| 2          | 1  | Eco Coffee Pods            | 0.01639   | Specialist       |\n| 2          | 2  | Compostable Espresso Pods  | 0.01639   | Specialist       |\n\n2. Handling Mixed-Quality or "Noisy" Systems\n\nIf you are fusing results from reliable systems and one experimental, less predictable system, a higher k (60 or more) is the safest choice to prevent an outlier from disproportionately influencing the final rank.\n\nConsider our search with a third, "noisy" system that incorrectly ranks ''Eco-Friendly Car Wax'' (ID 8) at #1. A high k value minimizes the impact of this error.\n\n<table><thead><tr><th>Product</th><th>FT Rank</th><th width="129.44140625">Vector Rank</th><th width="122.640625">Noisy Rank</th><th>Total RRF (k=60)</th></tr></thead><tbody><tr><td>Recyclable Coffee Capsules</td><td>2</td><td>2</td><td>-</td><td>1/62 + 1/62 = 0.03226</td></tr><tr><td>Eco-Friendly Car Wax</td><td>-</td><td>-</td><td>1</td><td>1/61 = 0.01639</td></tr></tbody></table>\n\nThe high k value correctly ensures that the consensus result from the two reliable systems easily beats the single, erroneous result from the noisy system.\n\n3. Fusing High-Quality, Similar Systems\n\nIf you are combining lists from two very similar, high-performing algorithms, you can experiment with a slightly lower k (30-50) to give more weight to a top-ranked document.\n\nConsider a case where we fuse two similar vector models (Vector_A, Vector_B) that both rank ''Compostable Espresso Pods'' as #1 and ''Recyclable Coffee Capsules'' as #2. A lower k makes the winner more decisive.\n\n| Product             | Ranks       | Total RRF (k=30)     | Total RRF (k=60)     |\n| ------------------- | ----------- | -------------------- | -------------------- |\n| Compostable Pods    | 1, 1        | 1/31 + 1/31 = 0.0645 | 1/61 + 1/61 = 0.0328 |\n| Recyclable Capsules | 2, 2        | 1/32 + 1/32 = 0.0625 | 1/62 + 1/62 = 0.0322 |\n| Score Difference    | <p><br></p> | 0.0020               | 0.0006               |\n\nWith k=30, the score separation between the #1 and #2 results is more than three times larger, showing higher confidence in the top result, which is desirable when you trust both systems.\n\nDetermining the Best k (The Experimental Method)\n\nA formal, 3-step process can be used to scientifically determine the best k value for your data through offline evaluation. To illustrate this process, which requires a pre-judged "ground truth" set with graded relevance, we will use a separate, self-contained case study.\n\n1. Gather Prerequisites\n\nYou need: Multiple Ranked Lists, a "Ground Truth" Set, and an Evaluation Metric (like NDCG). With a query like "healthy breakfast", your ground truth might look like this:\n\n| Doc ID | Title                  | Relevance  |\n| ------ | ---------------------- | ---------- |\n| A      | ''Oatmeal with Berries'' | 3 (High)   |\n| B      | ''Green Smoothie''       | 3 (High)   |\n| C      | ''Avocado Toast''        | 2 (Medium) |\n| D      | ''Bacon and Eggs''       | 1 (Low)    |\n| E      | ''Cinnamon Roll''        | 0 (None)   |\n\nAnd your raw ranked lists might be:\n\n Full-Text Results: \\[D, A, E]\n Vector Results: \\[B, C, A]\n\n2. Run the Experiment\n\nYou iterate through k values, applying the RRF formula to the raw lists to generate a final ranking for each k.\n\n Final Ranked List (k=10):\n\n| Rank | ID | Title                  |\n| ---- | -- | ---------------------- |\n| 1    | B  | ''Green Smoothie''       |\n| 2    | D  | ''Bacon and Eggs''       |\n| 3    | A  | ''Oatmeal with Berries'' |\n| 4    | C  | ''Avocado Toast''        |\n| 5    | E  | ''Cinnamon Roll''        |\n\n Final Ranked List (k=60):\n\n| Rank | ID | Title                  |\n| ---- | -- | ---------------------- |\n| 1    | A  | ''Oatmeal with Berries'' |\n| 2    | B  | ''Green Smoothie''       |\n| 3    | C  | ''Avocado Toast''        |\n| 4    | D  | ''Bacon and Eggs''       |\n| 5    | E  | ''Cinnamon Roll''        |\n\n3. Analyze and Select\n\nYou use your metric to "grade" each list against the Ground Truth and choose the k with the highest score. The k=60 list is clearly better as it placed the two "Highly Relevant" documents (A and B) at the top.\n\n| k Value | Performance Score (NDCG) |\n| ------- | ------------------------ |\n| 10      | 0.85                     |\n| 60      | 0.92                     |\n\nIn this experiment, k=60 is the winner. A key advantage of RRF is that its performance is "not critically sensitive to the choice of k, making it a robust and reliable method" for improving search relevance.\n\nFurther Reading\n\n* Reciprocal Rank Fusion for IR (SIGIR ''09): The original research paper that proposed the RRF method.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/vectors/optimizing-hybrid-search-query-with-reciprocal-rank-fusion-rrf', '', 'https://mariadb.com/docs/server/reference/sql-structure/vectors/optimizing-hybrid-search-query-with-reciprocal-rank-fusion-rrf');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1007, 35, 'Vector Framework Integrations', 'Description\n-----------\n\nMariaDB Vector has integrations in several frameworks.\n\nAI Framework Integrations\n\n LangChain, MariaDB Vector Store - Python\n LangChain.js, MariaDB Vector Store - Node.js\n LangChain4j, MariaDB Embedding Store - Java\n LlamaIndex, MariaDB Vector Store - Python\n MCP (Model Context Protocol), MariaDB MCP server - Python\n Spring AI, MariaDB Vector Store - Java\n VectorDBBench - benchmarking for vector databases\n\nPotential Future Vector or AI Integrations\n AutoGen - Agent to agent, Python\n DB-GPT - private LLM, vector search and text2sql, see integration docs, Python\n DSPy - Workflow, not accepting external integrations anymore, Python\n Feast - machine learning (not GenAI), Python\n Firebase Studio template for MariaDB Vector - visit link to vote for suggestion\n LangGraph - Agentic workflow, Python\n MindSQL - Text-to-SQL RAG Library simplifying database interactions, Python\n Open WebUI - AI Interface, Python & Javascript\n Vanna AI - Vector search and text2sql, Python\n\nFor further alternatives, see Qdrant''s list of framework integrations.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/vectors/vector-framework-integrations', '', 'https://mariadb.com/docs/server/reference/sql-structure/vectors/vector-framework-integrations');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1008, 35, 'Vector Overview', 'Description\n-----------\n\nMariaDB Vector is a feature that allows MariaDB Server to perform as a relational vector database. Vectors generated by an AI model can be stored and searched in MariaDB.\n\nThe initial implementation uses the modified HNSW[^1] algorithm for searching in the vector index (to solve the so-called Approximate Nearest Neighbor problem), and defaults to Euclidean distance. Concurrent reads/writes and all transaction isolation levels are supported.\n\nMariaDB uses int16 for indexes, which gives 15 bits to store the value, rather than 10 bits for float16.\n\nCreating\n\nVectors can be defined using VECTOR INDEX for the index definition, and using the VECTOR data type in the CREATE TABLE statement.\n\n``sql\nCREATE TABLE v (\n     id INT PRIMARY KEY,\n     v VECTOR(5) NOT NULL,\n     VECTOR INDEX (v)\n);\n`\n\nThe distance function used to build the vector index can be euclidean (the default) or cosine. An additional option, M, can be used to configure the vector index. Larger values mean slower SELECT and INSERT statements, larger index size and higher memory consumption but more accurate results. The valid range is from 3 to 200.\n\n`sql\nCREATE TABLE embeddings (\n        doc_id BIGINT UNSIGNED PRIMARY KEY,\n        embedding VECTOR(1536) NOT NULL,\n        VECTOR INDEX (embedding) M=8 DISTANCE=cosine\n);\n`\n\nInserting\n\nVector columns store 32-bit IEEE 754 floating point numbers.\n\n`sql\nINSERT INTO v VALUES \n     (1, x''e360d63ebe554f3fcdbc523f4522193f5236083d''),\n     (2, x''f511303f72224a3fdd05fe3eb22a133ffae86a3f''),\n     (3,x''f09baa3ea172763f123def3e0c7fe53e288bf33e''),\n     (4,x''b97a523f2a193e3eb4f62e3f2d23583e9dd60d3f''),\n     (5,x''f7c5df3e984b2b3e65e59d3d7376db3eac63773e''),\n     (6,x''de01453ffa486d3f10aa4d3fdd66813c71cb163f''),\n     (7,x''76edfc3e4b57243f10f8423fb158713f020bda3e''),\n     (8,x''56926c3fdf098d3e2c8c5e3d1ad4953daa9d0b3e''),\n     (9,x''7b713f3e5258323f80d1113d673b2b3f66e3583f''),\n     (10,x''6ca1d43e9df91b3fe580da3e1c247d3f147cf33e'');\n`\n\nAlternatively, you can use VEC_FromText() function:\n\n`sql\nINSERT INTO v VALUES\n  (1,Vec_FromText(''[0.418708,0.809902,0.823193,0.598179,0.0332549]'')),\n  (2,Vec_FromText(''[0.687774,0.789588,0.496138,0.57487,0.917617]'')),\n  (3,Vec_FromText(''[0.333221,0.962687,0.467263,0.448235,0.475671]'')),\n  (4,Vec_FromText(''[0.822185,0.185643,0.683452,0.211072,0.554056]'')),\n  (5,Vec_FromText(''[0.437057,0.167281,0.0770977,0.428638,0.241591]'')),\n  (6,Vec_FromText(''[0.76956,0.926895,0.803376,0.0157961,0.589042]'')),\n  (7,Vec_FromText(''[0.493999,0.641957,0.761598,0.94276,0.425865]'')),\n  (8,Vec_FromText(''[0.924108,0.275466,0.0543329,0.0731585,0.136344]'')),\n  (9,Vec_FromText(''[0.186956,0.69666,0.0356002,0.668875,0.84722]'')),\n  (10,Vec_FromText(''[0.415294,0.609278,0.426765,0.988832,0.475556]''));\n`\n\nQuerying\n\nFor vector indexes built with the euclidean function, VEC_DISTANCE_EUCLIDEAN can be used. It calculates a Euclidean (L2) distance between two points:\n\n`sql\nSELECT id FROM v ORDER BY \n  VEC_DISTANCE_EUCLIDEAN(v, x''6ca1d43e9df91b3fe580da3e1c247d3f147cf33e'');\n+----+\n| id |\n+----+\n| 10 |\n|  7 |\n|  3 |\n|  9 |\n|  2 |\n|  1 |\n|  5 |\n|  4 |\n|  6 |\n|  8 |\n+----+\n`\n\nMost commonly, this kind of query is done with a limit, for example to return vectors that are closest to a given vector, such as from a user search query, image or a song fragment:\n\n`sql\nSELECT id FROM v \n  ORDER BY VEC_DISTANCE_EUCLIDEAN(v, x''6ca1d43e9df91b3fe580da3e1c247d3f147cf33e'') \n  LIMIT 2;\n+----+\n| id |\n+----+\n| 10 |\n|  7 |\n+----+\n`\n\nFor vector indexes built with the cosine function, VEC_DISTANCE_COSINE can be used. It calculates a Cosine distance between two vectors:\n\n`sql\nSELECT VEC_DISTANCE_COSINE(VEC_FROMTEXT(''[1,2,3]''), VEC_FROMTEXT(''[3,5,7]''));\n`\n\nThe VEC_DISTANCE function is a generic function that behaves either as VEC_DISTANCE_EUCLIDEAN or VEC_DISTANCE_COSINE, depending on the underlying index type:\n\n`sql\nSELECT id FROM v \n  ORDER BY VEC_DISTANCE(v, x''6ca1d43e9df91b3fe580da3e1c247d3f147cf33e'');\n+----+\n| id |\n+----+\n| 10 |\n|  7 |\n|  3 |\n|  9 |\n|  2 |\n|  1 |\n|  5 |\n|  4 |\n|  6 |\n|  8 |\n+----+\n``\n\nThere is no function for _dot product_ (also called _inner product_) distance available in many other vector databases. Dot product is not a proper distance measure (for example, vector''s closest match is not necessarily itself) and is only used for performance reasons, because it is often faster than cosine or euclidean and produces the same results if vectors are normalized. In MariaDB optimized implementation euclidean and cosine measures are the fastest, and dot product, if implemented, would not provide any performance benefits. Use euclidean or cosine (they are equally fast) for normalized vectors.\n\nSystem Variables\n\nThere are a number of system variables used for vectors. See Vector System Variables.\n\nVector Framework Integrations\n\nMariaDB Vector is integrated in several frameworks, see Vector Framework Integrations.\n\nWhat is a Vector?\n\nWhat exactly is a vector in AI and RAG (1 minute • 2026)\n\nVideo summary\n\n A vector (an _embedding_) is an ordered list of numbers.\n AI models map content (like text) into vectors.\n Similar meanings end up close together in vector space.\n RAG and semantic search retrieve relevant items by finding the nearest vectors.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/vectors/vector-overview', '', 'https://mariadb.com/docs/server/reference/sql-structure/vectors/vector-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1009, 35, 'Vector System Variables', 'Description\n-----------\n\nThis page documents system variables related to Vectors.\n\nSee Server System Variables for instructions on setting them.\n\nAlso see the Full list of MariaDB options, system and status variables.\n\nmhnsw_default_distance\n\n Description: Specifies the default distance metric for MHNSW vector indexing. This is used when the DISTANCE option is not explicitly defined during index creation.\n Command line: --mhnsw-default-distance=val\n Scope: Global, Session\n Dynamic: Yes\n Data Type: enum\n Default Value: euclidean\n Valid Values:\n   euclidean Calculates straight-line distance between vectors. Best for spatial data, images, etc, when absolute magnitude matters.\n   cosine Measures directional similarity between vectors. Ideal for text embeddings, semantic search, and when vector magnitude is less important.\n Introduced: MariaDB 11.7.1\n\nmhnsw_default_m\n\n Description: Defines the default value for the M parameter in MHNSW vector indexing. The M parameter controls the number of connections per layer in the graph structure, influencing the balance between search performance and index size.\n   Larger M → Better search accuracy, but larger index size and slower updates and searches.\n   Smaller M → Faster updates and searches, smaller index, but potentially less accurate search.\n Command line: --mhnsw-default-m=#\n Scope: Global, Session\n Dynamic: Yes\n Data Type: int unsigned\n Default Value: 6\n Range: 3 to 200\n Introduced: MariaDB 11.7.1\n\nmhnsw_ef_search\n\n Description: Defines the minimal number of result candidates to look for in the vector index for ORDER BY ... LIMIT N queries. The search will never search for less rows than that, even if LIMIT is smaller. This notably improves the search quality at low LIMIT values, at the expense of search time. Higher values may increase search quality but will also impact query performance.\n Command line: --mhnsw-ef-search=#\n Scope: Global, Session\n Dynamic: Yes\n Data Type: int unsigned\n Default Value: 20\n Range: 1 to 10000\n Introduced: MariaDB 11.7.1\n\nmhnsw_max_cache_size\n\n Description: Upper limit for one MHNSW vector index cache. This limits the amount of memory that can be used for caching the index, ensuring efficient memory utilization.\n Command line: --mhnsw-max-cache-size=#\n Scope: Global\n Dynamic: Yes\n Data Type: bigint unsigned\n Default Value: 16777216 (16 MB)\n Range: 1048576 to 18446744073709551615\n Introduced: MariaDB 11.7.1\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/vectors/vector-system-variables', '', 'https://mariadb.com/docs/server/reference/sql-structure/vectors/vector-system-variables');

insert into help_keyword (help_keyword_id,name) values (0,'AUTO_INCREMENT');
insert into help_keyword (help_keyword_id,name) values (1,'FAQ');
insert into help_keyword (help_keyword_id,name) values (2,'DATA');
insert into help_keyword (help_keyword_id,name) values (3,'TYPE');
insert into help_keyword (help_keyword_id,name) values (4,'STORAGE');
insert into help_keyword (help_keyword_id,name) values (5,'REQUIREMENTS');
insert into help_keyword (help_keyword_id,name) values (6,'DATE');
insert into help_keyword (help_keyword_id,name) values (7,'DATETIME');
insert into help_keyword (help_keyword_id,name) values (8,'SQL_TSI_YEAR');
insert into help_keyword (help_keyword_id,name) values (9,'TIME');
insert into help_keyword (help_keyword_id,name) values (10,'TIMESTAMP');
insert into help_keyword (help_keyword_id,name) values (11,'YEAR');
insert into help_keyword (help_keyword_id,name) values (12,'NULL');
insert into help_keyword (help_keyword_id,name) values (13,'VALUES');
insert into help_keyword (help_keyword_id,name) values (14,'BIGINT');
insert into help_keyword (help_keyword_id,name) values (15,'BIT');
insert into help_keyword (help_keyword_id,name) values (16,'BOOL');
insert into help_keyword (help_keyword_id,name) values (17,'BOOLEAN');
insert into help_keyword (help_keyword_id,name) values (18,'DEC');
insert into help_keyword (help_keyword_id,name) values (19,'NUMERIC');
insert into help_keyword (help_keyword_id,name) values (20,'FIXED');
insert into help_keyword (help_keyword_id,name) values (21,'DECIMAL');
insert into help_keyword (help_keyword_id,name) values (22,'DOUBLE');
insert into help_keyword (help_keyword_id,name) values (23,'PRECISION');
insert into help_keyword (help_keyword_id,name) values (24,'FLOAT');
insert into help_keyword (help_keyword_id,name) values (25,'FLOAT4');
insert into help_keyword (help_keyword_id,name) values (26,'FLOAT8');
insert into help_keyword (help_keyword_id,name) values (27,'FLOATING-POINT');
insert into help_keyword (help_keyword_id,name) values (28,'ACCURACY');
insert into help_keyword (help_keyword_id,name) values (29,'INT');
insert into help_keyword (help_keyword_id,name) values (30,'INT1');
insert into help_keyword (help_keyword_id,name) values (31,'INT2');
insert into help_keyword (help_keyword_id,name) values (32,'INT3');
insert into help_keyword (help_keyword_id,name) values (33,'INT4');
insert into help_keyword (help_keyword_id,name) values (34,'INT8');
insert into help_keyword (help_keyword_id,name) values (35,'INTEGER');
insert into help_keyword (help_keyword_id,name) values (36,'MEDIUMINT');
insert into help_keyword (help_keyword_id,name) values (37,'MIDDLEINT');
insert into help_keyword (help_keyword_id,name) values (38,'NUMBER');
insert into help_keyword (help_keyword_id,name) values (39,'OVERVIEW');
insert into help_keyword (help_keyword_id,name) values (40,'REAL');
insert into help_keyword (help_keyword_id,name) values (41,'SMALLINT');
insert into help_keyword (help_keyword_id,name) values (42,'TINYINT');
insert into help_keyword (help_keyword_id,name) values (43,'VECTOR');
insert into help_keyword (help_keyword_id,name) values (44,'ROW');
insert into help_keyword (help_keyword_id,name) values (45,'OF');
insert into help_keyword (help_keyword_id,name) values (46,'SERIAL');
insert into help_keyword (help_keyword_id,name) values (47,'BINARY');
insert into help_keyword (help_keyword_id,name) values (48,'BLOB');
insert into help_keyword (help_keyword_id,name) values (49,'AND');
insert into help_keyword (help_keyword_id,name) values (50,'TEXT');
insert into help_keyword (help_keyword_id,name) values (51,'TYPES');
insert into help_keyword (help_keyword_id,name) values (52,'CHAR');
insert into help_keyword (help_keyword_id,name) values (53,'BYTE');
insert into help_keyword (help_keyword_id,name) values (54,'VARYING');
insert into help_keyword (help_keyword_id,name) values (55,'CHARACTER');
insert into help_keyword (help_keyword_id,name) values (56,'SET');
insert into help_keyword (help_keyword_id,name) values (57,'COLLATION');
insert into help_keyword (help_keyword_id,name) values (58,'COORDINATED');
insert into help_keyword (help_keyword_id,name) values (59,'UNIVERSAL');
insert into help_keyword (help_keyword_id,name) values (60,'LOCALES');
insert into help_keyword (help_keyword_id,name) values (61,'PLUGIN');
insert into help_keyword (help_keyword_id,name) values (62,'SERVER');
insert into help_keyword (help_keyword_id,name) values (63,'LOCALE');
insert into help_keyword (help_keyword_id,name) values (64,'SETTING');
insert into help_keyword (help_keyword_id,name) values (65,'THE');
insert into help_keyword (help_keyword_id,name) values (66,'LANGUAGE');
insert into help_keyword (help_keyword_id,name) values (67,'FOR');
insert into help_keyword (help_keyword_id,name) values (68,'ERROR');
insert into help_keyword (help_keyword_id,name) values (69,'MESSAGES');
insert into help_keyword (help_keyword_id,name) values (70,'ZONES');
insert into help_keyword (help_keyword_id,name) values (71,'NAMES');
insert into help_keyword (help_keyword_id,name) values (72,'SETS');
insert into help_keyword (help_keyword_id,name) values (73,'COLLATIONS');
insert into help_keyword (help_keyword_id,name) values (74,'SUPPORTED');
insert into help_keyword (help_keyword_id,name) values (75,'UNICODE');
insert into help_keyword (help_keyword_id,name) values (76,'CLOB');
insert into help_keyword (help_keyword_id,name) values (77,'ENUM');
insert into help_keyword (help_keyword_id,name) values (78,'INET4');
insert into help_keyword (help_keyword_id,name) values (79,'INET6');
insert into help_keyword (help_keyword_id,name) values (80,'JSON');
insert into help_keyword (help_keyword_id,name) values (81,'LONG');
insert into help_keyword (help_keyword_id,name) values (82,'VARCHAR');
insert into help_keyword (help_keyword_id,name) values (83,'VARBINARY');
insert into help_keyword (help_keyword_id,name) values (84,'VARCHARACTER');
insert into help_keyword (help_keyword_id,name) values (85,'LONGBLOB');
insert into help_keyword (help_keyword_id,name) values (86,'LONGTEXT');
insert into help_keyword (help_keyword_id,name) values (87,'MEDIUMBLOB');
insert into help_keyword (help_keyword_id,name) values (88,'MEDIUMTEXT');
insert into help_keyword (help_keyword_id,name) values (89,'NATIONAL');
insert into help_keyword (help_keyword_id,name) values (90,'NCHAR');
insert into help_keyword (help_keyword_id,name) values (91,'RAW');
insert into help_keyword (help_keyword_id,name) values (92,'TINYBLOB');
insert into help_keyword (help_keyword_id,name) values (93,'TINYTEXT');
insert into help_keyword (help_keyword_id,name) values (94,'UUID');
insert into help_keyword (help_keyword_id,name) values (95,'VARCHAR2');
insert into help_keyword (help_keyword_id,name) values (96,'XMLTYPE');
insert into help_keyword (help_keyword_id,name) values (97,'OPTIONS');
insert into help_keyword (help_keyword_id,name) values (98,'SYSTEM');
insert into help_keyword (help_keyword_id,name) values (99,'&');
insert into help_keyword (help_keyword_id,name) values (100,'STATUS');
insert into help_keyword (help_keyword_id,name) values (101,'VARIABLES');
insert into help_keyword (help_keyword_id,name) values (102,'AUTHENTICATION');
insert into help_keyword (help_keyword_id,name) values (103,'-');
insert into help_keyword (help_keyword_id,name) values (104,'CACHING_SHA2_PASSWORD');
insert into help_keyword (help_keyword_id,name) values (105,'ED25519');
insert into help_keyword (help_keyword_id,name) values (106,'GSSAPI');
insert into help_keyword (help_keyword_id,name) values (107,'MYSQL_NATIVE_PASSWORD');
insert into help_keyword (help_keyword_id,name) values (108,'MYSQL_OLD_PASSWORD');
insert into help_keyword (help_keyword_id,name) values (109,'NAMED');
insert into help_keyword (help_keyword_id,name) values (110,'PIPE');
insert into help_keyword (help_keyword_id,name) values (111,'PARSEC');
insert into help_keyword (help_keyword_id,name) values (112,'SHA-256');
insert into help_keyword (help_keyword_id,name) values (113,'UNIX');
insert into help_keyword (help_keyword_id,name) values (114,'SOCKET');
insert into help_keyword (help_keyword_id,name) values (115,'PAM');
insert into help_keyword (help_keyword_id,name) values (116,'WITH');
insert into help_keyword (help_keyword_id,name) values (117,'JWT');
insert into help_keyword (help_keyword_id,name) values (118,'OIDC');
insert into help_keyword (help_keyword_id,name) values (119,'OAUTH');
insert into help_keyword (help_keyword_id,name) values (120,'2.0');
insert into help_keyword (help_keyword_id,name) values (121,'VIA');
insert into help_keyword (help_keyword_id,name) values (122,'CONFIGURING');
insert into help_keyword (help_keyword_id,name) values (123,'USER');
insert into help_keyword (help_keyword_id,name) values (124,'MAPPING');
insert into help_keyword (help_keyword_id,name) values (125,'LDAP');
insert into help_keyword (help_keyword_id,name) values (126,'AUTHEN');
insert into help_keyword (help_keyword_id,name) values (127,'GROUP');
insert into help_keyword (help_keyword_id,name) values (128,'PLUGGABLE');
insert into help_keyword (help_keyword_id,name) values (129,'MATURITY');
insert into help_keyword (help_keyword_id,name) values (130,'AUDIT');
insert into help_keyword (help_keyword_id,name) values (131,'CONFIGURATION');
insert into help_keyword (help_keyword_id,name) values (132,'INSTALLATION');
insert into help_keyword (help_keyword_id,name) values (133,'LOCATION');
insert into help_keyword (help_keyword_id,name) values (134,'ROTATION');
insert into help_keyword (help_keyword_id,name) values (135,'LOGS');
insert into help_keyword (help_keyword_id,name) values (136,'LOG');
insert into help_keyword (help_keyword_id,name) values (137,'FORMAT');
insert into help_keyword (help_keyword_id,name) values (138,'SETTINGS');
insert into help_keyword (help_keyword_id,name) values (139,'VERSIONS');
insert into help_keyword (help_keyword_id,name) values (140,'MARIADB');
insert into help_keyword (help_keyword_id,name) values (141,'ENTERPRISE');
insert into help_keyword (help_keyword_id,name) values (142,'WSREP_INFO');
insert into help_keyword (help_keyword_id,name) values (143,'WSREP_PROVIDER');
insert into help_keyword (help_keyword_id,name) values (144,'DISKS');
insert into help_keyword (help_keyword_id,name) values (145,'FEEDBACK');
insert into help_keyword (help_keyword_id,name) values (146,'METADATA_LOCK_INFO');
insert into help_keyword (help_keyword_id,name) values (147,'MHNSW');
insert into help_keyword (help_keyword_id,name) values (148,'MYSQL_JSON');
insert into help_keyword (help_keyword_id,name) values (149,'ONLINE_ALTER_LOG');
insert into help_keyword (help_keyword_id,name) values (150,'QUERY');
insert into help_keyword (help_keyword_id,name) values (151,'CACHE');
insert into help_keyword (help_keyword_id,name) values (152,'INFORMATION');
insert into help_keyword (help_keyword_id,name) values (153,'RESPONSE');
insert into help_keyword (help_keyword_id,name) values (154,'CRACKLIB');
insert into help_keyword (help_keyword_id,name) values (155,'PASSWORD');
insert into help_keyword (help_keyword_id,name) values (156,'CHECK');
insert into help_keyword (help_keyword_id,name) values (157,'REUSE');
insert into help_keyword (help_keyword_id,name) values (158,'VALIDATION');
insert into help_keyword (help_keyword_id,name) values (159,'PASSWORD_REUSE_CHECK_INTERVAL');
insert into help_keyword (help_keyword_id,name) values (160,'VARIABLE');
insert into help_keyword (help_keyword_id,name) values (161,'SIMPLE');
insert into help_keyword (help_keyword_id,name) values (162,'AGGREGATE');
insert into help_keyword (help_keyword_id,name) values (163,'FUNCTIONS');
insert into help_keyword (help_keyword_id,name) values (164,'AVG');
insert into help_keyword (help_keyword_id,name) values (165,'BIT_AND');
insert into help_keyword (help_keyword_id,name) values (166,'BIT_OR');
insert into help_keyword (help_keyword_id,name) values (167,'BIT_XOR');
insert into help_keyword (help_keyword_id,name) values (168,'COUNT');
insert into help_keyword (help_keyword_id,name) values (169,'DISTINCT');
insert into help_keyword (help_keyword_id,name) values (170,'GROUP_CONCAT');
insert into help_keyword (help_keyword_id,name) values (171,'MAX');
insert into help_keyword (help_keyword_id,name) values (172,'MIN');
insert into help_keyword (help_keyword_id,name) values (173,'STD');
insert into help_keyword (help_keyword_id,name) values (174,'STDDEV');
insert into help_keyword (help_keyword_id,name) values (175,'STDDEV_POP');
insert into help_keyword (help_keyword_id,name) values (176,'STDDEV_SAMP');
insert into help_keyword (help_keyword_id,name) values (177,'SUM');
insert into help_keyword (help_keyword_id,name) values (178,'VAR_POP');
insert into help_keyword (help_keyword_id,name) values (179,'VAR_SAMP');
insert into help_keyword (help_keyword_id,name) values (180,'VARIANCE');
insert into help_keyword (help_keyword_id,name) values (181,'CASE');
insert into help_keyword (help_keyword_id,name) values (182,'OPERATOR');
insert into help_keyword (help_keyword_id,name) values (183,'DECODE_ORACLE');
insert into help_keyword (help_keyword_id,name) values (184,'IF');
insert into help_keyword (help_keyword_id,name) values (185,'FUNCTION');
insert into help_keyword (help_keyword_id,name) values (186,'IFNULL');
insert into help_keyword (help_keyword_id,name) values (187,'NULLIF');
insert into help_keyword (help_keyword_id,name) values (188,'NVL');
insert into help_keyword (help_keyword_id,name) values (189,'NVL2');
insert into help_keyword (help_keyword_id,name) values (190,'ADD_MONTHS');
insert into help_keyword (help_keyword_id,name) values (191,'ADDDATE');
insert into help_keyword (help_keyword_id,name) values (192,'ADDTIME');
insert into help_keyword (help_keyword_id,name) values (193,'CONVERT_TZ');
insert into help_keyword (help_keyword_id,name) values (194,'CURDATE');
insert into help_keyword (help_keyword_id,name) values (195,'CURRENT_DATE');
insert into help_keyword (help_keyword_id,name) values (196,'CURRENT_TIME');
insert into help_keyword (help_keyword_id,name) values (197,'CURRENT_TIMESTAMP');
insert into help_keyword (help_keyword_id,name) values (198,'CURTIME');
insert into help_keyword (help_keyword_id,name) values (199,'UNITS');
insert into help_keyword (help_keyword_id,name) values (200,'DATE_ADD');
insert into help_keyword (help_keyword_id,name) values (201,'DATE_FORMAT');
insert into help_keyword (help_keyword_id,name) values (202,'DATE_SUB');
insert into help_keyword (help_keyword_id,name) values (203,'DATEDIFF');
insert into help_keyword (help_keyword_id,name) values (204,'DAY');
insert into help_keyword (help_keyword_id,name) values (205,'DAYNAME');
insert into help_keyword (help_keyword_id,name) values (206,'DAYOFMONTH');
insert into help_keyword (help_keyword_id,name) values (207,'DAYOFWEEK');
insert into help_keyword (help_keyword_id,name) values (208,'DAYOFYEAR');
insert into help_keyword (help_keyword_id,name) values (209,'EXTRACT');
insert into help_keyword (help_keyword_id,name) values (210,'FORMAT_PICO_TIME');
insert into help_keyword (help_keyword_id,name) values (211,'FROM_DAYS');
insert into help_keyword (help_keyword_id,name) values (212,'FROM_UNIXTIME');
insert into help_keyword (help_keyword_id,name) values (213,'GET_FORMAT');
insert into help_keyword (help_keyword_id,name) values (214,'HOUR');
insert into help_keyword (help_keyword_id,name) values (215,'LAST_DAY');
insert into help_keyword (help_keyword_id,name) values (216,'LOCALTIME');
insert into help_keyword (help_keyword_id,name) values (217,'LOCALTIMESTAMP');
insert into help_keyword (help_keyword_id,name) values (218,'MAKEDATE');
insert into help_keyword (help_keyword_id,name) values (219,'MAKETIME');
insert into help_keyword (help_keyword_id,name) values (220,'MICROSECOND');
insert into help_keyword (help_keyword_id,name) values (221,'MICROSECONDS');
insert into help_keyword (help_keyword_id,name) values (222,'IN');
insert into help_keyword (help_keyword_id,name) values (223,'MINUTE');
insert into help_keyword (help_keyword_id,name) values (224,'MONTH');
insert into help_keyword (help_keyword_id,name) values (225,'MONTHNAME');
insert into help_keyword (help_keyword_id,name) values (226,'MONTHS_BETWEEN');
insert into help_keyword (help_keyword_id,name) values (227,'NOW');
insert into help_keyword (help_keyword_id,name) values (228,'PERIOD_ADD');
insert into help_keyword (help_keyword_id,name) values (229,'PERIOD_DIFF');
insert into help_keyword (help_keyword_id,name) values (230,'QUARTER');
insert into help_keyword (help_keyword_id,name) values (231,'SEC_TO_TIME');
insert into help_keyword (help_keyword_id,name) values (232,'SECOND');
insert into help_keyword (help_keyword_id,name) values (233,'STR_TO_DATE');
insert into help_keyword (help_keyword_id,name) values (234,'SUBDATE');
insert into help_keyword (help_keyword_id,name) values (235,'SUBTIME');
insert into help_keyword (help_keyword_id,name) values (236,'SYSDATE');
insert into help_keyword (help_keyword_id,name) values (237,'TIME_FORMAT');
insert into help_keyword (help_keyword_id,name) values (238,'TIME_TO_SEC');
insert into help_keyword (help_keyword_id,name) values (239,'TIMEDIFF');
insert into help_keyword (help_keyword_id,name) values (240,'TIMESTAMPADD');
insert into help_keyword (help_keyword_id,name) values (241,'TIMESTAMPDIFF');
insert into help_keyword (help_keyword_id,name) values (242,'TO_DATE');
insert into help_keyword (help_keyword_id,name) values (243,'TO_DAYS');
insert into help_keyword (help_keyword_id,name) values (244,'TO_SECONDS');
insert into help_keyword (help_keyword_id,name) values (245,'TRUNC');
insert into help_keyword (help_keyword_id,name) values (246,'UNIX_TIMESTAMP');
insert into help_keyword (help_keyword_id,name) values (247,'UTC_DATE');
insert into help_keyword (help_keyword_id,name) values (248,'UTC_TIME');
insert into help_keyword (help_keyword_id,name) values (249,'UTC_TIMESTAMP');
insert into help_keyword (help_keyword_id,name) values (250,'WEEK');
insert into help_keyword (help_keyword_id,name) values (251,'WEEKDAY');
insert into help_keyword (help_keyword_id,name) values (252,'WEEKOFYEAR');
insert into help_keyword (help_keyword_id,name) values (253,'YEARWEEK');
insert into help_keyword (help_keyword_id,name) values (254,'OPERATORS');
insert into help_keyword (help_keyword_id,name) values (255,'ABS');
insert into help_keyword (help_keyword_id,name) values (256,'ACOS');
insert into help_keyword (help_keyword_id,name) values (257,'ASIN');
insert into help_keyword (help_keyword_id,name) values (258,'ATAN');
insert into help_keyword (help_keyword_id,name) values (259,'ATAN2');
insert into help_keyword (help_keyword_id,name) values (260,'CEIL');
insert into help_keyword (help_keyword_id,name) values (261,'CEILING');
insert into help_keyword (help_keyword_id,name) values (262,'CONV');
insert into help_keyword (help_keyword_id,name) values (263,'COS');
insert into help_keyword (help_keyword_id,name) values (264,'COT');
insert into help_keyword (help_keyword_id,name) values (265,'CRC32');
insert into help_keyword (help_keyword_id,name) values (266,'CRC32C');
insert into help_keyword (help_keyword_id,name) values (267,'DEGREES');
insert into help_keyword (help_keyword_id,name) values (268,'DIV');
insert into help_keyword (help_keyword_id,name) values (269,'EXP');
insert into help_keyword (help_keyword_id,name) values (270,'FLOOR');
insert into help_keyword (help_keyword_id,name) values (271,'LN');
insert into help_keyword (help_keyword_id,name) values (272,'LOG10');
insert into help_keyword (help_keyword_id,name) values (273,'LOG2');
insert into help_keyword (help_keyword_id,name) values (274,'MOD');
insert into help_keyword (help_keyword_id,name) values (275,'OCT');
insert into help_keyword (help_keyword_id,name) values (276,'PI');
insert into help_keyword (help_keyword_id,name) values (277,'POW');
insert into help_keyword (help_keyword_id,name) values (278,'POWER');
insert into help_keyword (help_keyword_id,name) values (279,'RADIANS');
insert into help_keyword (help_keyword_id,name) values (280,'RAND');
insert into help_keyword (help_keyword_id,name) values (281,'ROUND');
insert into help_keyword (help_keyword_id,name) values (282,'SIGN');
insert into help_keyword (help_keyword_id,name) values (283,'SIN');
insert into help_keyword (help_keyword_id,name) values (284,'SQRT');
insert into help_keyword (help_keyword_id,name) values (285,'TAN');
insert into help_keyword (help_keyword_id,name) values (286,'TO_NUMBER');
insert into help_keyword (help_keyword_id,name) values (287,'TRUNCATE');
insert into help_keyword (help_keyword_id,name) values (288,'_ROWID');
insert into help_keyword (help_keyword_id,name) values (289,'BIT_COUNT');
insert into help_keyword (help_keyword_id,name) values (290,'~');
insert into help_keyword (help_keyword_id,name) values (291,'|');
insert into help_keyword (help_keyword_id,name) values (292,'^');
insert into help_keyword (help_keyword_id,name) values (293,'PARENTHESES');
insert into help_keyword (help_keyword_id,name) values (294,'<<');
insert into help_keyword (help_keyword_id,name) values (295,'>>');
insert into help_keyword (help_keyword_id,name) values (296,'TRUE');
insert into help_keyword (help_keyword_id,name) values (297,'FALSE');
insert into help_keyword (help_keyword_id,name) values (298,'AES_DECRYPT');
insert into help_keyword (help_keyword_id,name) values (299,'AES_ENCRYPT');
insert into help_keyword (help_keyword_id,name) values (300,'COMPRESS');
insert into help_keyword (help_keyword_id,name) values (301,'DECODE');
insert into help_keyword (help_keyword_id,name) values (302,'DES_DECRYPT');
insert into help_keyword (help_keyword_id,name) values (303,'DES_ENCRYPT');
insert into help_keyword (help_keyword_id,name) values (304,'ENCODE');
insert into help_keyword (help_keyword_id,name) values (305,'ENCRYPT');
insert into help_keyword (help_keyword_id,name) values (306,'KDF');
insert into help_keyword (help_keyword_id,name) values (307,'MD5');
insert into help_keyword (help_keyword_id,name) values (308,'OLD_PASSWORD');
insert into help_keyword (help_keyword_id,name) values (309,'RANDOM_BYTES');
insert into help_keyword (help_keyword_id,name) values (310,'SHA1');
insert into help_keyword (help_keyword_id,name) values (311,'SHA2');
insert into help_keyword (help_keyword_id,name) values (312,'UNCOMPRESS');
insert into help_keyword (help_keyword_id,name) values (313,'UNCOMPRESSED_LENGTH');
insert into help_keyword (help_keyword_id,name) values (314,'BENCHMARK');
insert into help_keyword (help_keyword_id,name) values (315,'BINLOG_GTID_POS');
insert into help_keyword (help_keyword_id,name) values (316,'CHARSET');
insert into help_keyword (help_keyword_id,name) values (317,'COERCIBILITY');
insert into help_keyword (help_keyword_id,name) values (318,'CONNECTION_ID');
insert into help_keyword (help_keyword_id,name) values (319,'CURRENT_ROLE');
insert into help_keyword (help_keyword_id,name) values (320,'CURRENT_USER');
insert into help_keyword (help_keyword_id,name) values (321,'DATABASE');
insert into help_keyword (help_keyword_id,name) values (322,'DECODE_HISTOGRAM');
insert into help_keyword (help_keyword_id,name) values (323,'DEFAULT');
insert into help_keyword (help_keyword_id,name) values (324,'FOUND_ROWS');
insert into help_keyword (help_keyword_id,name) values (325,'LAST_INSERT_ID');
insert into help_keyword (help_keyword_id,name) values (326,'LAST_VALUE');
insert into help_keyword (help_keyword_id,name) values (327,'PROCEDURE');
insert into help_keyword (help_keyword_id,name) values (328,'ANALYSE');
insert into help_keyword (help_keyword_id,name) values (329,'ROW_COUNT');
insert into help_keyword (help_keyword_id,name) values (330,'ROWNUM');
insert into help_keyword (help_keyword_id,name) values (331,'SCHEMA');
insert into help_keyword (help_keyword_id,name) values (332,'SESSION_USER');
insert into help_keyword (help_keyword_id,name) values (333,'SYSTEM_USER');
insert into help_keyword (help_keyword_id,name) values (334,'VERSION');
insert into help_keyword (help_keyword_id,name) values (335,'GET_LOCK');
insert into help_keyword (help_keyword_id,name) values (336,'INET6_ATON');
insert into help_keyword (help_keyword_id,name) values (337,'INET6_NTOA');
insert into help_keyword (help_keyword_id,name) values (338,'INET_ATON');
insert into help_keyword (help_keyword_id,name) values (339,'INET_NTOA');
insert into help_keyword (help_keyword_id,name) values (340,'IS_FREE_LOCK');
insert into help_keyword (help_keyword_id,name) values (341,'IS_IPV4');
insert into help_keyword (help_keyword_id,name) values (342,'IS_IPV4_COMPAT');
insert into help_keyword (help_keyword_id,name) values (343,'IS_IPV4_MAPPED');
insert into help_keyword (help_keyword_id,name) values (344,'IS_IPV6');
insert into help_keyword (help_keyword_id,name) values (345,'IS_USED_LOCK');
insert into help_keyword (help_keyword_id,name) values (346,'MASTER_GTID_WAIT');
insert into help_keyword (help_keyword_id,name) values (347,'MASTER_POS_WAIT');
insert into help_keyword (help_keyword_id,name) values (348,'FORMAT_BYTES');
insert into help_keyword (help_keyword_id,name) values (349,'NAME_CONST');
insert into help_keyword (help_keyword_id,name) values (350,'OLD_VALUE');
insert into help_keyword (help_keyword_id,name) values (351,'RELEASE_ALL_LOCKS');
insert into help_keyword (help_keyword_id,name) values (352,'RELEASE_LOCK');
insert into help_keyword (help_keyword_id,name) values (353,'SLEEP');
insert into help_keyword (help_keyword_id,name) values (354,'SYS_GUID');
insert into help_keyword (help_keyword_id,name) values (355,'UUID_SHORT');
insert into help_keyword (help_keyword_id,name) values (356,'UUID_V4');
insert into help_keyword (help_keyword_id,name) values (357,'UUID_V7');
insert into help_keyword (help_keyword_id,name) values (358,'VALUE');
insert into help_keyword (help_keyword_id,name) values (359,'COLUMN_ADD');
insert into help_keyword (help_keyword_id,name) values (360,'COLUMN_CHECK');
insert into help_keyword (help_keyword_id,name) values (361,'COLUMN_CREATE');
insert into help_keyword (help_keyword_id,name) values (362,'COLUMN_DELETE');
insert into help_keyword (help_keyword_id,name) values (363,'COLUMN_EXISTS');
insert into help_keyword (help_keyword_id,name) values (364,'COLUMN_GET');
insert into help_keyword (help_keyword_id,name) values (365,'COLUMN_JSON');
insert into help_keyword (help_keyword_id,name) values (366,'COLUMN_LIST');
insert into help_keyword (help_keyword_id,name) values (367,'WSREP_LAST_SEEN_GTID');
insert into help_keyword (help_keyword_id,name) values (368,'WSREP_LAST_WRITTEN_GTID');
insert into help_keyword (help_keyword_id,name) values (369,'WSREP_SYNC_WAIT_UPTO_GTID');
insert into help_keyword (help_keyword_id,name) values (370,'GEOGRAPHIC');
insert into help_keyword (help_keyword_id,name) values (371,'DIFFERENCES');
insert into help_keyword (help_keyword_id,name) values (372,'BETWEEN');
insert into help_keyword (help_keyword_id,name) values (373,'JSON_QUERY');
insert into help_keyword (help_keyword_id,name) values (374,'JSON_VALUE');
insert into help_keyword (help_keyword_id,name) values (375,'JSON_ARRAY');
insert into help_keyword (help_keyword_id,name) values (376,'JSON_ARRAY_APPEND');
insert into help_keyword (help_keyword_id,name) values (377,'JSON_ARRAY_INSERT');
insert into help_keyword (help_keyword_id,name) values (378,'JSON_ARRAY_INTERSECT');
insert into help_keyword (help_keyword_id,name) values (379,'JSON_ARRAYAGG');
insert into help_keyword (help_keyword_id,name) values (380,'JSON_COMPACT');
insert into help_keyword (help_keyword_id,name) values (381,'JSON_CONTAINS');
insert into help_keyword (help_keyword_id,name) values (382,'JSON_CONTAINS_PATH');
insert into help_keyword (help_keyword_id,name) values (383,'JSON_DEPTH');
insert into help_keyword (help_keyword_id,name) values (384,'JSON_DETAILED');
insert into help_keyword (help_keyword_id,name) values (385,'JSON_EQUALS');
insert into help_keyword (help_keyword_id,name) values (386,'JSON_EXISTS');
insert into help_keyword (help_keyword_id,name) values (387,'JSON_EXTRACT');
insert into help_keyword (help_keyword_id,name) values (388,'JSON_INSERT');
insert into help_keyword (help_keyword_id,name) values (389,'JSON_KEY_VALUE');
insert into help_keyword (help_keyword_id,name) values (390,'JSON_KEYS');
insert into help_keyword (help_keyword_id,name) values (391,'JSON_LENGTH');
insert into help_keyword (help_keyword_id,name) values (392,'JSON_LOOSE');
insert into help_keyword (help_keyword_id,name) values (393,'JSON_MERGE');
insert into help_keyword (help_keyword_id,name) values (394,'JSON_MERGE_PATCH');
insert into help_keyword (help_keyword_id,name) values (395,'JSON_MERGE_PRESERVE');
insert into help_keyword (help_keyword_id,name) values (396,'JSON_NORMALIZE');
insert into help_keyword (help_keyword_id,name) values (397,'JSON_OBJECT');
insert into help_keyword (help_keyword_id,name) values (398,'JSON_OBJECT_FILTER_KEYS');
insert into help_keyword (help_keyword_id,name) values (399,'JSON_OBJECT_TO_ARRAY');
insert into help_keyword (help_keyword_id,name) values (400,'JSON_OBJECTAGG');
insert into help_keyword (help_keyword_id,name) values (401,'JSON_OVERLAPS');
insert into help_keyword (help_keyword_id,name) values (402,'JSON_PRETTY');
insert into help_keyword (help_keyword_id,name) values (403,'JSON_QUOTE');
insert into help_keyword (help_keyword_id,name) values (404,'JSON_REMOVE');
insert into help_keyword (help_keyword_id,name) values (405,'JSON_REPLACE');
insert into help_keyword (help_keyword_id,name) values (406,'JSON_SCHEMA_VALID');
insert into help_keyword (help_keyword_id,name) values (407,'JSON_SEARCH');
insert into help_keyword (help_keyword_id,name) values (408,'JSON_SET');
insert into help_keyword (help_keyword_id,name) values (409,'JSON_TABLE');
insert into help_keyword (help_keyword_id,name) values (410,'JSON_TYPE');
insert into help_keyword (help_keyword_id,name) values (411,'JSON_UNQUOTE');
insert into help_keyword (help_keyword_id,name) values (412,'JSON_VALID');
insert into help_keyword (help_keyword_id,name) values (413,'JSONPATH');
insert into help_keyword (help_keyword_id,name) values (414,'EXPRESSIONS');
insert into help_keyword (help_keyword_id,name) values (415,'CUME_DIST');
insert into help_keyword (help_keyword_id,name) values (416,'DENSE_RANK');
insert into help_keyword (help_keyword_id,name) values (417,'FIRST_VALUE');
insert into help_keyword (help_keyword_id,name) values (418,'LAG');
insert into help_keyword (help_keyword_id,name) values (419,'LEAD');
insert into help_keyword (help_keyword_id,name) values (420,'MEDIAN');
insert into help_keyword (help_keyword_id,name) values (421,'NTH_VALUE');
insert into help_keyword (help_keyword_id,name) values (422,'NTILE');
insert into help_keyword (help_keyword_id,name) values (423,'PERCENT_RANK');
insert into help_keyword (help_keyword_id,name) values (424,'PERCENTILE_CONT');
insert into help_keyword (help_keyword_id,name) values (425,'PERCENTILE_DISC');
insert into help_keyword (help_keyword_id,name) values (426,'RANK');
insert into help_keyword (help_keyword_id,name) values (427,'ROW_NUMBER');
insert into help_keyword (help_keyword_id,name) values (428,'WINDOW');
insert into help_keyword (help_keyword_id,name) values (429,'FRAMES');
insert into help_keyword (help_keyword_id,name) values (430,'COLUMNSTORE');
insert into help_keyword (help_keyword_id,name) values (431,'ASCII');
insert into help_keyword (help_keyword_id,name) values (432,'BIN');
insert into help_keyword (help_keyword_id,name) values (433,'BIT_LENGTH');
insert into help_keyword (help_keyword_id,name) values (434,'CAST');
insert into help_keyword (help_keyword_id,name) values (435,'CHAR_LENGTH');
insert into help_keyword (help_keyword_id,name) values (436,'CHARACTER_LENGTH');
insert into help_keyword (help_keyword_id,name) values (437,'CHR');
insert into help_keyword (help_keyword_id,name) values (438,'CONCAT');
insert into help_keyword (help_keyword_id,name) values (439,'CONCAT_WS');
insert into help_keyword (help_keyword_id,name) values (440,'CONVERT');
insert into help_keyword (help_keyword_id,name) values (441,'ELT');
insert into help_keyword (help_keyword_id,name) values (442,'EXPORT_SET');
insert into help_keyword (help_keyword_id,name) values (443,'EXTRACTVALUE');
insert into help_keyword (help_keyword_id,name) values (444,'FIELD');
insert into help_keyword (help_keyword_id,name) values (445,'FIND_IN_SET');
insert into help_keyword (help_keyword_id,name) values (446,'FROM_BASE64');
insert into help_keyword (help_keyword_id,name) values (447,'HEX');
insert into help_keyword (help_keyword_id,name) values (448,'INSERT');
insert into help_keyword (help_keyword_id,name) values (449,'INSTR');
insert into help_keyword (help_keyword_id,name) values (450,'LCASE');
insert into help_keyword (help_keyword_id,name) values (451,'LEFT');
insert into help_keyword (help_keyword_id,name) values (452,'LENGTH');
insert into help_keyword (help_keyword_id,name) values (453,'LENGTHB');
insert into help_keyword (help_keyword_id,name) values (454,'LIKE');
insert into help_keyword (help_keyword_id,name) values (455,'LOAD_FILE');
insert into help_keyword (help_keyword_id,name) values (456,'LOCATE');
insert into help_keyword (help_keyword_id,name) values (457,'LOWER');
insert into help_keyword (help_keyword_id,name) values (458,'LPAD');
insert into help_keyword (help_keyword_id,name) values (459,'LTRIM');
insert into help_keyword (help_keyword_id,name) values (460,'MAKE_SET');
insert into help_keyword (help_keyword_id,name) values (461,'MATCH');
insert into help_keyword (help_keyword_id,name) values (462,'AGAINST');
insert into help_keyword (help_keyword_id,name) values (463,'MID');
insert into help_keyword (help_keyword_id,name) values (464,'NATURAL_SORT_KEY');
insert into help_keyword (help_keyword_id,name) values (465,'NOT');
insert into help_keyword (help_keyword_id,name) values (466,'REGEXP');
insert into help_keyword (help_keyword_id,name) values (467,'OCTET_LENGTH');
insert into help_keyword (help_keyword_id,name) values (468,'ORD');
insert into help_keyword (help_keyword_id,name) values (469,'POSITION');
insert into help_keyword (help_keyword_id,name) values (470,'QUOTE');
insert into help_keyword (help_keyword_id,name) values (471,'PCRE');
insert into help_keyword (help_keyword_id,name) values (472,'PERL');
insert into help_keyword (help_keyword_id,name) values (473,'COMPATIBLE');
insert into help_keyword (help_keyword_id,name) values (474,'REGULAR');
insert into help_keyword (help_keyword_id,name) values (475,'REGEXP_INSTR');
insert into help_keyword (help_keyword_id,name) values (476,'REGEXP_REPLACE');
insert into help_keyword (help_keyword_id,name) values (477,'REGEXP_SUBSTR');
insert into help_keyword (help_keyword_id,name) values (478,'RLIKE');
insert into help_keyword (help_keyword_id,name) values (479,'REPEAT');
insert into help_keyword (help_keyword_id,name) values (480,'REPLACE');
insert into help_keyword (help_keyword_id,name) values (481,'REVERSE');
insert into help_keyword (help_keyword_id,name) values (482,'RIGHT');
insert into help_keyword (help_keyword_id,name) values (483,'RPAD');
insert into help_keyword (help_keyword_id,name) values (484,'RTRIM');
insert into help_keyword (help_keyword_id,name) values (485,'SFORMAT');
insert into help_keyword (help_keyword_id,name) values (486,'SOUNDEX');
insert into help_keyword (help_keyword_id,name) values (487,'SOUNDS');
insert into help_keyword (help_keyword_id,name) values (488,'SPACE');
insert into help_keyword (help_keyword_id,name) values (489,'STRCMP');
insert into help_keyword (help_keyword_id,name) values (490,'SUBSTR');
insert into help_keyword (help_keyword_id,name) values (491,'SUBSTRING');
insert into help_keyword (help_keyword_id,name) values (492,'SUBSTRING_INDEX');
insert into help_keyword (help_keyword_id,name) values (493,'TO_BASE64');
insert into help_keyword (help_keyword_id,name) values (494,'TO_CHAR');
insert into help_keyword (help_keyword_id,name) values (495,'TRIM');
insert into help_keyword (help_keyword_id,name) values (496,'TRIM_ORACLE');
insert into help_keyword (help_keyword_id,name) values (497,'CONVERSION');
insert into help_keyword (help_keyword_id,name) values (498,'UCASE');
insert into help_keyword (help_keyword_id,name) values (499,'UNHEX');
insert into help_keyword (help_keyword_id,name) values (500,'UPDATEXML');
insert into help_keyword (help_keyword_id,name) values (501,'UPPER');
insert into help_keyword (help_keyword_id,name) values (502,'WEIGHT_STRING');
insert into help_keyword (help_keyword_id,name) values (503,'VEC_DISTANCE_COSINE');
insert into help_keyword (help_keyword_id,name) values (504,'VEC_DISTANCE_EUCLIDEAN');
insert into help_keyword (help_keyword_id,name) values (505,'VEC_FROMTEXT');
insert into help_keyword (help_keyword_id,name) values (506,'VEC_TOTEXT');
insert into help_keyword (help_keyword_id,name) values (507,'VEC_DISTANCE');
insert into help_keyword (help_keyword_id,name) values (508,'SQL');
insert into help_keyword (help_keyword_id,name) values (509,'STATEMENTS');
insert into help_keyword (help_keyword_id,name) values (510,'ALTER');
insert into help_keyword (help_keyword_id,name) values (511,'CREATE');
insert into help_keyword (help_keyword_id,name) values (512,'ROLE');
insert into help_keyword (help_keyword_id,name) values (513,'DROP');
insert into help_keyword (help_keyword_id,name) values (514,'GRANT');
insert into help_keyword (help_keyword_id,name) values (515,'RENAME');
insert into help_keyword (help_keyword_id,name) values (516,'REVOKE');
insert into help_keyword (help_keyword_id,name) values (517,'ANALYZE');
insert into help_keyword (help_keyword_id,name) values (518,'FORMAT=JSON');
insert into help_keyword (help_keyword_id,name) values (519,'EXAMPLES');
insert into help_keyword (help_keyword_id,name) values (520,'ANALYZE:');
insert into help_keyword (help_keyword_id,name) values (521,'INTERPRETING');
insert into help_keyword (help_keyword_id,name) values (522,'ROWS');
insert into help_keyword (help_keyword_id,name) values (523,'FILTERED');
insert into help_keyword (help_keyword_id,name) values (524,'MEMBERS');
insert into help_keyword (help_keyword_id,name) values (525,'STATEMENT');
insert into help_keyword (help_keyword_id,name) values (526,'EXPLAIN');
insert into help_keyword (help_keyword_id,name) values (527,'USING');
insert into help_keyword (help_keyword_id,name) values (528,'BUFFER');
insert into help_keyword (help_keyword_id,name) values (529,'UPDATE');
insert into help_keyword (help_keyword_id,name) values (530,'ALGORITHM');
insert into help_keyword (help_keyword_id,name) values (531,'BACKUP');
insert into help_keyword (help_keyword_id,name) values (532,'LOCK');
insert into help_keyword (help_keyword_id,name) values (533,'STAGE');
insert into help_keyword (help_keyword_id,name) values (534,'SNAPSHOTS');
insert into help_keyword (help_keyword_id,name) values (535,'BINLOG');
insert into help_keyword (help_keyword_id,name) values (536,'INDEX');
insert into help_keyword (help_keyword_id,name) values (537,'DESCRIBE');
insert into help_keyword (help_keyword_id,name) values (538,'FLUSH');
insert into help_keyword (help_keyword_id,name) values (539,'TABLES');
insert into help_keyword (help_keyword_id,name) values (540,'EXPORT');
insert into help_keyword (help_keyword_id,name) values (541,'HELP');
insert into help_keyword (help_keyword_id,name) values (542,'COMMAND');
insert into help_keyword (help_keyword_id,name) values (543,'KILL');
insert into help_keyword (help_keyword_id,name) values (544,'INSTALL');
insert into help_keyword (help_keyword_id,name) values (545,'SONAME');
insert into help_keyword (help_keyword_id,name) values (546,'UNINSTALL');
insert into help_keyword (help_keyword_id,name) values (547,'PURGE');
insert into help_keyword (help_keyword_id,name) values (548,'REPLICATION');
insert into help_keyword (help_keyword_id,name) values (549,'CHANGE');
insert into help_keyword (help_keyword_id,name) values (550,'MASTER');
insert into help_keyword (help_keyword_id,name) values (551,'TO');
insert into help_keyword (help_keyword_id,name) values (552,'RESET');
insert into help_keyword (help_keyword_id,name) values (553,'SLAVE');
insert into help_keyword (help_keyword_id,name) values (554,'SHOW');
insert into help_keyword (help_keyword_id,name) values (555,'HOSTS');
insert into help_keyword (help_keyword_id,name) values (556,'START');
insert into help_keyword (help_keyword_id,name) values (557,'STOP');
insert into help_keyword (help_keyword_id,name) values (558,'REPLICA');
insert into help_keyword (help_keyword_id,name) values (559,'GLOBAL');
insert into help_keyword (help_keyword_id,name) values (560,'SQL_SLAVE_SKIP_COUNTER');
insert into help_keyword (help_keyword_id,name) values (561,'PATH');
insert into help_keyword (help_keyword_id,name) values (562,'SQL_LOG_BIN');
insert into help_keyword (help_keyword_id,name) values (563,'ABOUT');
insert into help_keyword (help_keyword_id,name) values (564,'EXTENDED');
insert into help_keyword (help_keyword_id,name) values (565,'AUTHORS');
insert into help_keyword (help_keyword_id,name) values (566,'EVENTS');
insert into help_keyword (help_keyword_id,name) values (567,'CLIENT_STATISTICS');
insert into help_keyword (help_keyword_id,name) values (568,'COLUMNS');
insert into help_keyword (help_keyword_id,name) values (569,'CONTRIBUTORS');
insert into help_keyword (help_keyword_id,name) values (570,'EVENT');
insert into help_keyword (help_keyword_id,name) values (571,'PACKAGE');
insert into help_keyword (help_keyword_id,name) values (572,'BODY');
insert into help_keyword (help_keyword_id,name) values (573,'SEQUENCE');
insert into help_keyword (help_keyword_id,name) values (574,'TABLE');
insert into help_keyword (help_keyword_id,name) values (575,'TRIGGER');
insert into help_keyword (help_keyword_id,name) values (576,'VIEW');
insert into help_keyword (help_keyword_id,name) values (577,'DATABASES');
insert into help_keyword (help_keyword_id,name) values (578,'ENGINE');
insert into help_keyword (help_keyword_id,name) values (579,'INNODB');
insert into help_keyword (help_keyword_id,name) values (580,'ENGINES');
insert into help_keyword (help_keyword_id,name) values (581,'ERRORS');
insert into help_keyword (help_keyword_id,name) values (582,'CODE');
insert into help_keyword (help_keyword_id,name) values (583,'GRANTS');
insert into help_keyword (help_keyword_id,name) values (584,'INDEX_STATISTICS');
insert into help_keyword (help_keyword_id,name) values (585,'(REMOVED)');
insert into help_keyword (help_keyword_id,name) values (586,'OPEN');
insert into help_keyword (help_keyword_id,name) values (587,'PLUGINS');
insert into help_keyword (help_keyword_id,name) values (588,'PRIVILEGES');
insert into help_keyword (help_keyword_id,name) values (589,'PROCESSLIST');
insert into help_keyword (help_keyword_id,name) values (590,'PROFILE');
insert into help_keyword (help_keyword_id,name) values (591,'PROFILES');
insert into help_keyword (help_keyword_id,name) values (592,'QUERY_RESPONSE_TIME');
insert into help_keyword (help_keyword_id,name) values (593,'RELAYLOG');
insert into help_keyword (help_keyword_id,name) values (594,'TABLE_STATISTICS');
insert into help_keyword (help_keyword_id,name) values (595,'TRIGGERS');
insert into help_keyword (help_keyword_id,name) values (596,'USER_STATISTICS');
insert into help_keyword (help_keyword_id,name) values (597,'USER_VARIABLES');
insert into help_keyword (help_keyword_id,name) values (598,'WARNINGS');
insert into help_keyword (help_keyword_id,name) values (599,'WSREP_MEMBERSHIP');
insert into help_keyword (help_keyword_id,name) values (600,'WSREP_STATUS');
insert into help_keyword (help_keyword_id,name) values (601,'SHUTDOWN');
insert into help_keyword (help_keyword_id,name) values (602,'USE');
insert into help_keyword (help_keyword_id,name) values (603,'[DATABASE]');
insert into help_keyword (help_keyword_id,name) values (604,'COMMENT');
insert into help_keyword (help_keyword_id,name) values (605,'SYNTAX');
insert into help_keyword (help_keyword_id,name) values (606,'LOGFILE');
insert into help_keyword (help_keyword_id,name) values (607,'ONLINE');
insert into help_keyword (help_keyword_id,name) values (608,'TABLESPACE');
insert into help_keyword (help_keyword_id,name) values (609,'ATOMIC');
insert into help_keyword (help_keyword_id,name) values (610,'DDL');
insert into help_keyword (help_keyword_id,name) values (611,'CONSTRAINT');
insert into help_keyword (help_keyword_id,name) values (612,'GENERATED');
insert into help_keyword (help_keyword_id,name) values (613,'INVISIBLE');
insert into help_keyword (help_keyword_id,name) values (614,'SILENT');
insert into help_keyword (help_keyword_id,name) values (615,'COLUMN');
insert into help_keyword (help_keyword_id,name) values (616,'CHANGES');
insert into help_keyword (help_keyword_id,name) values (617,'RENAMING');
insert into help_keyword (help_keyword_id,name) values (618,'DELETE');
insert into help_keyword (help_keyword_id,name) values (619,'HIGH_PRIORITY');
insert into help_keyword (help_keyword_id,name) values (620,'LOW_PRIORITY');
insert into help_keyword (help_keyword_id,name) values (621,'REPLACE...RETURNING');
insert into help_keyword (help_keyword_id,name) values (622,'CONCURRENT');
insert into help_keyword (help_keyword_id,name) values (623,'INSERTS');
insert into help_keyword (help_keyword_id,name) values (624,'IGNORE');
insert into help_keyword (help_keyword_id,name) values (625,'DUPLICATE');
insert into help_keyword (help_keyword_id,name) values (626,'DELAYED');
insert into help_keyword (help_keyword_id,name) values (627,'ON');
insert into help_keyword (help_keyword_id,name) values (628,'KEY');
insert into help_keyword (help_keyword_id,name) values (629,'SELECT');
insert into help_keyword (help_keyword_id,name) values (630,'INSERT...RETURNING');
insert into help_keyword (help_keyword_id,name) values (631,'LOAD');
insert into help_keyword (help_keyword_id,name) values (632,'INFILE');
insert into help_keyword (help_keyword_id,name) values (633,'XML');
insert into help_keyword (help_keyword_id,name) values (634,'NON-RECURSIVE');
insert into help_keyword (help_keyword_id,name) values (635,'COMMON');
insert into help_keyword (help_keyword_id,name) values (636,'RECURSIVE');
insert into help_keyword (help_keyword_id,name) values (637,'DUAL');
insert into help_keyword (help_keyword_id,name) values (638,'BY');
insert into help_keyword (help_keyword_id,name) values (639,'ADVANCED');
insert into help_keyword (help_keyword_id,name) values (640,'JOINS');
insert into help_keyword (help_keyword_id,name) values (641,'SUBQUERIES');
insert into help_keyword (help_keyword_id,name) values (642,'ALL');
insert into help_keyword (help_keyword_id,name) values (643,'ANY');
insert into help_keyword (help_keyword_id,name) values (644,'SOME');
insert into help_keyword (help_keyword_id,name) values (645,'EXISTS');
insert into help_keyword (help_keyword_id,name) values (646,'A');
insert into help_keyword (help_keyword_id,name) values (647,'FROM');
insert into help_keyword (help_keyword_id,name) values (648,'CLAUSE');
insert into help_keyword (help_keyword_id,name) values (649,'(DERIVED');
insert into help_keyword (help_keyword_id,name) values (650,'TABLES)');
insert into help_keyword (help_keyword_id,name) values (651,'SCALAR');
insert into help_keyword (help_keyword_id,name) values (652,'SUBQUERY');
insert into help_keyword (help_keyword_id,name) values (653,'LIMITATIONS');
insert into help_keyword (help_keyword_id,name) values (654,'COMMA');
insert into help_keyword (help_keyword_id,name) values (655,'VS');
insert into help_keyword (help_keyword_id,name) values (656,'JOIN');
insert into help_keyword (help_keyword_id,name) values (657,'LIMIT');
insert into help_keyword (help_keyword_id,name) values (658,'SHARE');
insert into help_keyword (help_keyword_id,name) values (659,'MODE');
insert into help_keyword (help_keyword_id,name) values (660,'ORDER');
insert into help_keyword (help_keyword_id,name) values (661,'INTO');
insert into help_keyword (help_keyword_id,name) values (662,'DUMPFILE');
insert into help_keyword (help_keyword_id,name) values (663,'OUTFILE');
insert into help_keyword (help_keyword_id,name) values (664,'...');
insert into help_keyword (help_keyword_id,name) values (665,'OFFSET');
insert into help_keyword (help_keyword_id,name) values (666,'FETCH');
insert into help_keyword (help_keyword_id,name) values (667,'ROLLUP');
insert into help_keyword (help_keyword_id,name) values (668,'EXCEPT');
insert into help_keyword (help_keyword_id,name) values (669,'INTERSECT');
insert into help_keyword (help_keyword_id,name) values (670,'MINUS');
insert into help_keyword (help_keyword_id,name) values (671,'PRECEDENCE');
insert into help_keyword (help_keyword_id,name) values (672,'CONTROL');
insert into help_keyword (help_keyword_id,name) values (673,'OPERATIONS');
insert into help_keyword (help_keyword_id,name) values (674,'UNION');
insert into help_keyword (help_keyword_id,name) values (675,'CONVEXHULL');
insert into help_keyword (help_keyword_id,name) values (676,'ST_ASGEOJSON');
insert into help_keyword (help_keyword_id,name) values (677,'GEOMETRYCOLLECTION');
insert into help_keyword (help_keyword_id,name) values (678,'LINESTRING');
insert into help_keyword (help_keyword_id,name) values (679,'MULTILINESTRING');
insert into help_keyword (help_keyword_id,name) values (680,'MULTIPOINT');
insert into help_keyword (help_keyword_id,name) values (681,'MULTIPOLYGON');
insert into help_keyword (help_keyword_id,name) values (682,'POINT');
insert into help_keyword (help_keyword_id,name) values (683,'POINTONSURFACE');
insert into help_keyword (help_keyword_id,name) values (684,'POLYGON');
insert into help_keyword (help_keyword_id,name) values (685,'ST_BUFFER');
insert into help_keyword (help_keyword_id,name) values (686,'ST_CONVEXHULL');
insert into help_keyword (help_keyword_id,name) values (687,'ST_GEOMFROMGEOJSON');
insert into help_keyword (help_keyword_id,name) values (688,'ST_INTERSECTION');
insert into help_keyword (help_keyword_id,name) values (689,'ST_POINTONSURFACE');
insert into help_keyword (help_keyword_id,name) values (690,'ST_SYMDIFFERENCE');
insert into help_keyword (help_keyword_id,name) values (691,'ST_UNION');
insert into help_keyword (help_keyword_id,name) values (692,'DIMENSION');
insert into help_keyword (help_keyword_id,name) values (693,'BOUNDARY');
insert into help_keyword (help_keyword_id,name) values (694,'ENVELOPE');
insert into help_keyword (help_keyword_id,name) values (695,'GEOMETRYN');
insert into help_keyword (help_keyword_id,name) values (696,'GEOMETRYTYPE');
insert into help_keyword (help_keyword_id,name) values (697,'ISEMPTY');
insert into help_keyword (help_keyword_id,name) values (698,'ISSIMPLE');
insert into help_keyword (help_keyword_id,name) values (699,'NUMGEOMETRIES');
insert into help_keyword (help_keyword_id,name) values (700,'SRID');
insert into help_keyword (help_keyword_id,name) values (701,'ISCLOSED');
insert into help_keyword (help_keyword_id,name) values (702,'ISRING');
insert into help_keyword (help_keyword_id,name) values (703,'ST_BOUNDARY');
insert into help_keyword (help_keyword_id,name) values (704,'ST_DIMENSION');
insert into help_keyword (help_keyword_id,name) values (705,'ST_ENVELOPE');
insert into help_keyword (help_keyword_id,name) values (706,'ST_GEOMETRYN');
insert into help_keyword (help_keyword_id,name) values (707,'ST_GEOMETRYTYPE');
insert into help_keyword (help_keyword_id,name) values (708,'ST_ISCLOSED');
insert into help_keyword (help_keyword_id,name) values (709,'ST_ISEMPTY');
insert into help_keyword (help_keyword_id,name) values (710,'ST_ISRING');
insert into help_keyword (help_keyword_id,name) values (711,'ST_ISSIMPLE');
insert into help_keyword (help_keyword_id,name) values (712,'ST_NUMGEOMETRIES');
insert into help_keyword (help_keyword_id,name) values (713,'ST_RELATE');
insert into help_keyword (help_keyword_id,name) values (714,'ST_SRID');
insert into help_keyword (help_keyword_id,name) values (715,'CONTAINS');
insert into help_keyword (help_keyword_id,name) values (716,'CROSSES');
insert into help_keyword (help_keyword_id,name) values (717,'DISJOINT');
insert into help_keyword (help_keyword_id,name) values (718,'EQUALS');
insert into help_keyword (help_keyword_id,name) values (719,'INTERSECTS');
insert into help_keyword (help_keyword_id,name) values (720,'OVERLAPS');
insert into help_keyword (help_keyword_id,name) values (721,'ST_CONTAINS');
insert into help_keyword (help_keyword_id,name) values (722,'ST_CROSSES');
insert into help_keyword (help_keyword_id,name) values (723,'ST_EQUALS');
insert into help_keyword (help_keyword_id,name) values (724,'ST_INTERSECTS');
insert into help_keyword (help_keyword_id,name) values (725,'ST_OVERLAPS');
insert into help_keyword (help_keyword_id,name) values (726,'ST_TOUCHES');
insert into help_keyword (help_keyword_id,name) values (727,'ST_WITHIN');
insert into help_keyword (help_keyword_id,name) values (728,'ST_DIFFERENCE');
insert into help_keyword (help_keyword_id,name) values (729,'ST_DISJOINT');
insert into help_keyword (help_keyword_id,name) values (730,'ST_DISTANCE');
insert into help_keyword (help_keyword_id,name) values (731,'ST_DISTANCE_SPHERE');
insert into help_keyword (help_keyword_id,name) values (732,'ST_LENGTH');
insert into help_keyword (help_keyword_id,name) values (733,'TOUCHES');
insert into help_keyword (help_keyword_id,name) values (734,'WITHIN');
insert into help_keyword (help_keyword_id,name) values (735,'GLENGTH');
insert into help_keyword (help_keyword_id,name) values (736,'ENDPOINT');
insert into help_keyword (help_keyword_id,name) values (737,'NUMPOINTS');
insert into help_keyword (help_keyword_id,name) values (738,'POINTN');
insert into help_keyword (help_keyword_id,name) values (739,'STARTPOINT');
insert into help_keyword (help_keyword_id,name) values (740,'ST_ENDPOINT');
insert into help_keyword (help_keyword_id,name) values (741,'ST_NUMPOINTS');
insert into help_keyword (help_keyword_id,name) values (742,'ST_POINTN');
insert into help_keyword (help_keyword_id,name) values (743,'ST_STARTPOINT');
insert into help_keyword (help_keyword_id,name) values (744,'MBR');
insert into help_keyword (help_keyword_id,name) values (745,'DEFINITION');
insert into help_keyword (help_keyword_id,name) values (746,'MBRCONTAINS');
insert into help_keyword (help_keyword_id,name) values (747,'MBRCOVEREDBY');
insert into help_keyword (help_keyword_id,name) values (748,'MBRDISJOINT');
insert into help_keyword (help_keyword_id,name) values (749,'MBREQUAL');
insert into help_keyword (help_keyword_id,name) values (750,'MBRINTERSECTS');
insert into help_keyword (help_keyword_id,name) values (751,'MBROVERLAPS');
insert into help_keyword (help_keyword_id,name) values (752,'MBRTOUCHES');
insert into help_keyword (help_keyword_id,name) values (753,'MBRWITHIN');
insert into help_keyword (help_keyword_id,name) values (754,'ST_COLLECT');
insert into help_keyword (help_keyword_id,name) values (755,'ST_GEOHASH');
insert into help_keyword (help_keyword_id,name) values (756,'ST_ISVALID');
insert into help_keyword (help_keyword_id,name) values (757,'ST_LATFROMGEOHASH');
insert into help_keyword (help_keyword_id,name) values (758,'ST_LONGFROMGEOHASH');
insert into help_keyword (help_keyword_id,name) values (759,'ST_POINTFROMGEOHASH');
insert into help_keyword (help_keyword_id,name) values (760,'ST_SIMPLIFY');
insert into help_keyword (help_keyword_id,name) values (761,'ST_VALIDATE');
insert into help_keyword (help_keyword_id,name) values (762,'X');
insert into help_keyword (help_keyword_id,name) values (763,'Y');
insert into help_keyword (help_keyword_id,name) values (764,'ST_X');
insert into help_keyword (help_keyword_id,name) values (765,'ST_Y');
insert into help_keyword (help_keyword_id,name) values (766,'CENTROID');
insert into help_keyword (help_keyword_id,name) values (767,'AREA');
insert into help_keyword (help_keyword_id,name) values (768,'EXTERIORRING');
insert into help_keyword (help_keyword_id,name) values (769,'INTERIORRINGN');
insert into help_keyword (help_keyword_id,name) values (770,'NUMINTERIORRINGS');
insert into help_keyword (help_keyword_id,name) values (771,'ST_AREA');
insert into help_keyword (help_keyword_id,name) values (772,'ST_CENTROID');
insert into help_keyword (help_keyword_id,name) values (773,'ST_EXTERIORRING');
insert into help_keyword (help_keyword_id,name) values (774,'ST_INTERIORRINGN');
insert into help_keyword (help_keyword_id,name) values (775,'ST_NUMINTERIORRINGS');
insert into help_keyword (help_keyword_id,name) values (776,'ASWKB');
insert into help_keyword (help_keyword_id,name) values (777,'GEOMETRYCOLLECTIONFROMWKB');
insert into help_keyword (help_keyword_id,name) values (778,'GEOMETRYFROMWKB');
insert into help_keyword (help_keyword_id,name) values (779,'LINESTRINGFROMWKB');
insert into help_keyword (help_keyword_id,name) values (780,'MLINEFROMWKB');
insert into help_keyword (help_keyword_id,name) values (781,'MPOINTFROMWKB');
insert into help_keyword (help_keyword_id,name) values (782,'MPOLYFROMWKB');
insert into help_keyword (help_keyword_id,name) values (783,'MULTILINESTRINGFROMWKB');
insert into help_keyword (help_keyword_id,name) values (784,'MULTIPOINTFROMWKB');
insert into help_keyword (help_keyword_id,name) values (785,'MULTIPOLYGONFROMWKB');
insert into help_keyword (help_keyword_id,name) values (786,'POLYGONFROMWKB');
insert into help_keyword (help_keyword_id,name) values (787,'ST_ASBINARY');
insert into help_keyword (help_keyword_id,name) values (788,'ST_ASWKB');
insert into help_keyword (help_keyword_id,name) values (789,'ST_GEOMCOLLFROMWKB');
insert into help_keyword (help_keyword_id,name) values (790,'ST_GEOMETRYCOLLECTIONFROMWKB');
insert into help_keyword (help_keyword_id,name) values (791,'ST_GEOMETRYFROMWKB');
insert into help_keyword (help_keyword_id,name) values (792,'ST_GEOMFROMWKB');
insert into help_keyword (help_keyword_id,name) values (793,'ST_LINEFROMWKB');
insert into help_keyword (help_keyword_id,name) values (794,'ST_LINESTRINGFROMWKB');
insert into help_keyword (help_keyword_id,name) values (795,'ST_MPOINTFROMWKB');
insert into help_keyword (help_keyword_id,name) values (796,'ST_MPOLYFROMWKB');
insert into help_keyword (help_keyword_id,name) values (797,'ST_MULTIPOINTFROMWKB');
insert into help_keyword (help_keyword_id,name) values (798,'ST_MULTIPOLYGONFROMWKB');
insert into help_keyword (help_keyword_id,name) values (799,'ST_POINTFROMWKB');
insert into help_keyword (help_keyword_id,name) values (800,'ST_POLYFROMWKB');
insert into help_keyword (help_keyword_id,name) values (801,'ST_POLYGONFROMWKB');
insert into help_keyword (help_keyword_id,name) values (802,'WELL-KNOWN');
insert into help_keyword (help_keyword_id,name) values (803,'(WKB)');
insert into help_keyword (help_keyword_id,name) values (804,'ASBINARY');
insert into help_keyword (help_keyword_id,name) values (805,'GEOMCOLLFROMWKB');
insert into help_keyword (help_keyword_id,name) values (806,'GEOMFROMWKB');
insert into help_keyword (help_keyword_id,name) values (807,'LINEFROMWKB');
insert into help_keyword (help_keyword_id,name) values (808,'POINTFROMWKB');
insert into help_keyword (help_keyword_id,name) values (809,'POLYFROMWKB');
insert into help_keyword (help_keyword_id,name) values (810,'GEOMETRYCOLLECTIONFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (811,'GEOMETRYFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (812,'LINESTRINGFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (813,'MLINEFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (814,'MPOINTFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (815,'MPOLYFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (816,'MULTILINESTRINGFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (817,'MULTIPOINTFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (818,'MULTIPOLYGONFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (819,'POLYGONFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (820,'ST_ASTEXT');
insert into help_keyword (help_keyword_id,name) values (821,'ST_ASWKT');
insert into help_keyword (help_keyword_id,name) values (822,'ST_GEOMCOLLFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (823,'ST_GEOMETRYCOLLECTIONFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (824,'ST_GEOMETRYFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (825,'ST_GEOMFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (826,'ST_LINEFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (827,'ST_LINESTRINGFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (828,'ST_MPOINTFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (829,'ST_MPOLYFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (830,'ST_MULTILINESTRINGFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (831,'ST_MULTIPOINTFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (832,'ST_MULTIPOLYGONFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (833,'ST_POINTFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (834,'ST_POLYFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (835,'ST_POLYGONFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (836,'ASTEXT');
insert into help_keyword (help_keyword_id,name) values (837,'ASWKT');
insert into help_keyword (help_keyword_id,name) values (838,'WKT');
insert into help_keyword (help_keyword_id,name) values (839,'GEOMCOLLFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (840,'GEOMFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (841,'LINEFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (842,'POINTFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (843,'POLYFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (844,'ST_MLINEFROMTEXT');
insert into help_keyword (help_keyword_id,name) values (845,'DEALLOCATE');
insert into help_keyword (help_keyword_id,name) values (846,'PREPARE');
insert into help_keyword (help_keyword_id,name) values (847,'EXECUTE');
insert into help_keyword (help_keyword_id,name) values (848,'IMMEDIATE');
insert into help_keyword (help_keyword_id,name) values (849,'BEGIN');
insert into help_keyword (help_keyword_id,name) values (850,'END');
insert into help_keyword (help_keyword_id,name) values (851,'DECLARE');
insert into help_keyword (help_keyword_id,name) values (852,'CONDITION');
insert into help_keyword (help_keyword_id,name) values (853,'HANDLER');
insert into help_keyword (help_keyword_id,name) values (854,'GOTO');
insert into help_keyword (help_keyword_id,name) values (855,'ITERATE');
insert into help_keyword (help_keyword_id,name) values (856,'LABELS');
insert into help_keyword (help_keyword_id,name) values (857,'LEAVE');
insert into help_keyword (help_keyword_id,name) values (858,'LOOP');
insert into help_keyword (help_keyword_id,name) values (859,'CLOSE');
insert into help_keyword (help_keyword_id,name) values (860,'CURSOR');
insert into help_keyword (help_keyword_id,name) values (861,'DIAGNOSTICS');
insert into help_keyword (help_keyword_id,name) values (862,'GET');
insert into help_keyword (help_keyword_id,name) values (863,'SQLSTATE');
insert into help_keyword (help_keyword_id,name) values (864,'RESIGNAL');
insert into help_keyword (help_keyword_id,name) values (865,'RETURN');
insert into help_keyword (help_keyword_id,name) values (866,'SIGNAL');
insert into help_keyword (help_keyword_id,name) values (867,'COMPOUND');
insert into help_keyword (help_keyword_id,name) values (868,'OUTSIDE');
insert into help_keyword (help_keyword_id,name) values (869,'STORED');
insert into help_keyword (help_keyword_id,name) values (870,'PROGRAMS');
insert into help_keyword (help_keyword_id,name) values (871,'WHILE');
insert into help_keyword (help_keyword_id,name) values (872,'ROUTINE');
insert into help_keyword (help_keyword_id,name) values (873,'CALL');
insert into help_keyword (help_keyword_id,name) values (874,'DO');
insert into help_keyword (help_keyword_id,name) values (875,'CHECKSUM');
insert into help_keyword (help_keyword_id,name) values (876,'RESTORE');
insert into help_keyword (help_keyword_id,name) values (877,'REPAIR');
insert into help_keyword (help_keyword_id,name) values (878,'COMMIT');
insert into help_keyword (help_keyword_id,name) values (879,'METADATA');
insert into help_keyword (help_keyword_id,name) values (880,'LOCKING');
insert into help_keyword (help_keyword_id,name) values (881,'ROLLBACK');
insert into help_keyword (help_keyword_id,name) values (882,'SAVEPOINT');
insert into help_keyword (help_keyword_id,name) values (883,'TRANSACTION');
insert into help_keyword (help_keyword_id,name) values (884,'CAUSING');
insert into help_keyword (help_keyword_id,name) values (885,'AN');
insert into help_keyword (help_keyword_id,name) values (886,'IMPLICIT');
insert into help_keyword (help_keyword_id,name) values (887,'TIMEOUTS');
insert into help_keyword (help_keyword_id,name) values (888,'READ');
insert into help_keyword (help_keyword_id,name) values (889,'COMMITTED');
insert into help_keyword (help_keyword_id,name) values (890,'UNCOMMITTED');
insert into help_keyword (help_keyword_id,name) values (891,'REPEATABLE');
insert into help_keyword (help_keyword_id,name) values (892,'SERIALIZABLE');
insert into help_keyword (help_keyword_id,name) values (893,'UNLOCK');
insert into help_keyword (help_keyword_id,name) values (894,'WAIT');
insert into help_keyword (help_keyword_id,name) values (895,'NOWAIT');
insert into help_keyword (help_keyword_id,name) values (896,'XA');
insert into help_keyword (help_keyword_id,name) values (897,'TRANSACTIONS');
insert into help_keyword (help_keyword_id,name) values (898,'GEOMETRY');
insert into help_keyword (help_keyword_id,name) values (899,'HIERARCHY');
insert into help_keyword (help_keyword_id,name) values (900,'GIS');
insert into help_keyword (help_keyword_id,name) values (901,'FEATURES');
insert into help_keyword (help_keyword_id,name) values (902,'RESOURCES');
insert into help_keyword (help_keyword_id,name) values (903,'SPATIAL');
insert into help_keyword (help_keyword_id,name) values (904,'NOSQL');
insert into help_keyword (help_keyword_id,name) values (905,'DYNAMIC');
insert into help_keyword (help_keyword_id,name) values (906,'API');
insert into help_keyword (help_keyword_id,name) values (907,'MEMORY');
insert into help_keyword (help_keyword_id,name) values (908,'HANDLERSOCKET');
insert into help_keyword (help_keyword_id,name) values (909,'CLIENT');
insert into help_keyword (help_keyword_id,name) values (910,'LIBRARIES');
insert into help_keyword (help_keyword_id,name) values (911,'EXTERNAL');
insert into help_keyword (help_keyword_id,name) values (912,'ADDITION');
insert into help_keyword (help_keyword_id,name) values (913,'(+)');
insert into help_keyword (help_keyword_id,name) values (914,'DIVISION');
insert into help_keyword (help_keyword_id,name) values (915,'(');
insert into help_keyword (help_keyword_id,name) values (916,')');
insert into help_keyword (help_keyword_id,name) values (917,'MODULO');
insert into help_keyword (help_keyword_id,name) values (918,'(%)');
insert into help_keyword (help_keyword_id,name) values (919,'MULTIPLICATION');
insert into help_keyword (help_keyword_id,name) values (920,'(*)');
insert into help_keyword (help_keyword_id,name) values (921,'SUBTRACTION');
insert into help_keyword (help_keyword_id,name) values (922,'(-)');
insert into help_keyword (help_keyword_id,name) values (923,'ASSIGNMENT');
insert into help_keyword (help_keyword_id,name) values (924,'(:=)');
insert into help_keyword (help_keyword_id,name) values (925,'(=)');
insert into help_keyword (help_keyword_id,name) values (926,'COALESCE');
insert into help_keyword (help_keyword_id,name) values (927,'=');
insert into help_keyword (help_keyword_id,name) values (928,'>=');
insert into help_keyword (help_keyword_id,name) values (929,'>');
insert into help_keyword (help_keyword_id,name) values (930,'GREATEST');
insert into help_keyword (help_keyword_id,name) values (931,'INTERVAL');
insert into help_keyword (help_keyword_id,name) values (932,'IS');
insert into help_keyword (help_keyword_id,name) values (933,'ISNULL');
insert into help_keyword (help_keyword_id,name) values (934,'LEAST');
insert into help_keyword (help_keyword_id,name) values (935,'<=');
insert into help_keyword (help_keyword_id,name) values (936,'<');
insert into help_keyword (help_keyword_id,name) values (937,'!=');
insert into help_keyword (help_keyword_id,name) values (938,'<=>');
insert into help_keyword (help_keyword_id,name) values (939,'&&');
insert into help_keyword (help_keyword_id,name) values (940,'!');
insert into help_keyword (help_keyword_id,name) values (941,'||');
insert into help_keyword (help_keyword_id,name) values (942,'XOR');
insert into help_keyword (help_keyword_id,name) values (943,'SEQUENCES');
insert into help_keyword (help_keyword_id,name) values (944,'LASTVAL');
insert into help_keyword (help_keyword_id,name) values (945,'NEXT');
insert into help_keyword (help_keyword_id,name) values (946,'NEXTVAL');
insert into help_keyword (help_keyword_id,name) values (947,'PREVIOUS');
insert into help_keyword (help_keyword_id,name) values (948,'SETVAL');
insert into help_keyword (help_keyword_id,name) values (949,'LITERALS');
insert into help_keyword (help_keyword_id,name) values (950,'HEXADECIMAL');
insert into help_keyword (help_keyword_id,name) values (951,'IDENTIFIER');
insert into help_keyword (help_keyword_id,name) values (952,'SENSITIVITY');
insert into help_keyword (help_keyword_id,name) values (953,'QUALIFIERS');
insert into help_keyword (help_keyword_id,name) values (954,'FILE');
insert into help_keyword (help_keyword_id,name) values (955,'NAME');
insert into help_keyword (help_keyword_id,name) values (956,'RESERVED');
insert into help_keyword (help_keyword_id,name) values (957,'WORDS');
insert into help_keyword (help_keyword_id,name) values (958,'STRING');
insert into help_keyword (help_keyword_id,name) values (959,'CONSTRUCTORS');
insert into help_keyword (help_keyword_id,name) values (960,'USER-DEFINED');
insert into help_keyword (help_keyword_id,name) values (961,'TEMPORAL');
insert into help_keyword (help_keyword_id,name) values (962,'APPLICATION-TIME');
insert into help_keyword (help_keyword_id,name) values (963,'PERIODS');
insert into help_keyword (help_keyword_id,name) values (964,'BITEMPORAL');
insert into help_keyword (help_keyword_id,name) values (965,'SYSTEM-VERSIONED');
insert into help_keyword (help_keyword_id,name) values (966,'VECTORS');
insert into help_keyword (help_keyword_id,name) values (967,'OPTIMIZING');
insert into help_keyword (help_keyword_id,name) values (968,'HYBRID');
insert into help_keyword (help_keyword_id,name) values (969,'SEARCH');
insert into help_keyword (help_keyword_id,name) values (970,'RECIPROCAL');
insert into help_keyword (help_keyword_id,name) values (971,'FUSION');
insert into help_keyword (help_keyword_id,name) values (972,'(RRF)');
insert into help_keyword (help_keyword_id,name) values (973,'FRAMEWORK');
insert into help_keyword (help_keyword_id,name) values (974,'INTEGRATIONS');

insert into help_relation (help_topic_id,help_keyword_id) values (0,0);
insert into help_relation (help_topic_id,help_keyword_id) values (0,1);
insert into help_relation (help_topic_id,help_keyword_id) values (1,0);
insert into help_relation (help_topic_id,help_keyword_id) values (2,2);
insert into help_relation (help_topic_id,help_keyword_id) values (2,3);
insert into help_relation (help_topic_id,help_keyword_id) values (2,4);
insert into help_relation (help_topic_id,help_keyword_id) values (2,5);
insert into help_relation (help_topic_id,help_keyword_id) values (3,6);
insert into help_relation (help_topic_id,help_keyword_id) values (4,7);
insert into help_relation (help_topic_id,help_keyword_id) values (5,8);
insert into help_relation (help_topic_id,help_keyword_id) values (6,9);
insert into help_relation (help_topic_id,help_keyword_id) values (7,10);
insert into help_relation (help_topic_id,help_keyword_id) values (8,11);
insert into help_relation (help_topic_id,help_keyword_id) values (8,2);
insert into help_relation (help_topic_id,help_keyword_id) values (8,3);
insert into help_relation (help_topic_id,help_keyword_id) values (9,12);
insert into help_relation (help_topic_id,help_keyword_id) values (9,13);
insert into help_relation (help_topic_id,help_keyword_id) values (10,14);
insert into help_relation (help_topic_id,help_keyword_id) values (11,15);
insert into help_relation (help_topic_id,help_keyword_id) values (12,16);
insert into help_relation (help_topic_id,help_keyword_id) values (13,17);
insert into help_relation (help_topic_id,help_keyword_id) values (14,18);
insert into help_relation (help_topic_id,help_keyword_id) values (14,19);
insert into help_relation (help_topic_id,help_keyword_id) values (14,20);
insert into help_relation (help_topic_id,help_keyword_id) values (15,21);
insert into help_relation (help_topic_id,help_keyword_id) values (16,22);
insert into help_relation (help_topic_id,help_keyword_id) values (16,23);
insert into help_relation (help_topic_id,help_keyword_id) values (17,22);
insert into help_relation (help_topic_id,help_keyword_id) values (18,20);
insert into help_relation (help_topic_id,help_keyword_id) values (19,24);
insert into help_relation (help_topic_id,help_keyword_id) values (20,25);
insert into help_relation (help_topic_id,help_keyword_id) values (21,26);
insert into help_relation (help_topic_id,help_keyword_id) values (22,27);
insert into help_relation (help_topic_id,help_keyword_id) values (22,28);
insert into help_relation (help_topic_id,help_keyword_id) values (23,29);
insert into help_relation (help_topic_id,help_keyword_id) values (24,30);
insert into help_relation (help_topic_id,help_keyword_id) values (25,31);
insert into help_relation (help_topic_id,help_keyword_id) values (26,32);
insert into help_relation (help_topic_id,help_keyword_id) values (27,33);
insert into help_relation (help_topic_id,help_keyword_id) values (28,34);
insert into help_relation (help_topic_id,help_keyword_id) values (29,35);
insert into help_relation (help_topic_id,help_keyword_id) values (30,36);
insert into help_relation (help_topic_id,help_keyword_id) values (31,37);
insert into help_relation (help_topic_id,help_keyword_id) values (32,38);
insert into help_relation (help_topic_id,help_keyword_id) values (33,19);
insert into help_relation (help_topic_id,help_keyword_id) values (33,2);
insert into help_relation (help_topic_id,help_keyword_id) values (33,3);
insert into help_relation (help_topic_id,help_keyword_id) values (33,39);
insert into help_relation (help_topic_id,help_keyword_id) values (34,18);
insert into help_relation (help_topic_id,help_keyword_id) values (35,19);
insert into help_relation (help_topic_id,help_keyword_id) values (36,40);
insert into help_relation (help_topic_id,help_keyword_id) values (37,41);
insert into help_relation (help_topic_id,help_keyword_id) values (38,42);
insert into help_relation (help_topic_id,help_keyword_id) values (39,43);
insert into help_relation (help_topic_id,help_keyword_id) values (40,44);
insert into help_relation (help_topic_id,help_keyword_id) values (40,3);
insert into help_relation (help_topic_id,help_keyword_id) values (40,45);
insert into help_relation (help_topic_id,help_keyword_id) values (41,46);
insert into help_relation (help_topic_id,help_keyword_id) values (42,47);
insert into help_relation (help_topic_id,help_keyword_id) values (43,48);
insert into help_relation (help_topic_id,help_keyword_id) values (43,49);
insert into help_relation (help_topic_id,help_keyword_id) values (43,50);
insert into help_relation (help_topic_id,help_keyword_id) values (43,2);
insert into help_relation (help_topic_id,help_keyword_id) values (43,51);
insert into help_relation (help_topic_id,help_keyword_id) values (44,48);
insert into help_relation (help_topic_id,help_keyword_id) values (45,52);
insert into help_relation (help_topic_id,help_keyword_id) values (45,53);
insert into help_relation (help_topic_id,help_keyword_id) values (46,52);
insert into help_relation (help_topic_id,help_keyword_id) values (46,54);
insert into help_relation (help_topic_id,help_keyword_id) values (47,52);
insert into help_relation (help_topic_id,help_keyword_id) values (48,55);
insert into help_relation (help_topic_id,help_keyword_id) values (48,56);
insert into help_relation (help_topic_id,help_keyword_id) values (48,49);
insert into help_relation (help_topic_id,help_keyword_id) values (48,57);
insert into help_relation (help_topic_id,help_keyword_id) values (48,39);
insert into help_relation (help_topic_id,help_keyword_id) values (49,58);
insert into help_relation (help_topic_id,help_keyword_id) values (49,59);
insert into help_relation (help_topic_id,help_keyword_id) values (49,9);
insert into help_relation (help_topic_id,help_keyword_id) values (50,60);
insert into help_relation (help_topic_id,help_keyword_id) values (50,61);
insert into help_relation (help_topic_id,help_keyword_id) values (51,62);
insert into help_relation (help_topic_id,help_keyword_id) values (51,63);
insert into help_relation (help_topic_id,help_keyword_id) values (52,64);
insert into help_relation (help_topic_id,help_keyword_id) values (52,65);
insert into help_relation (help_topic_id,help_keyword_id) values (52,66);
insert into help_relation (help_topic_id,help_keyword_id) values (52,67);
insert into help_relation (help_topic_id,help_keyword_id) values (52,68);
insert into help_relation (help_topic_id,help_keyword_id) values (52,69);
insert into help_relation (help_topic_id,help_keyword_id) values (53,9);
insert into help_relation (help_topic_id,help_keyword_id) values (53,70);
insert into help_relation (help_topic_id,help_keyword_id) values (54,56);
insert into help_relation (help_topic_id,help_keyword_id) values (54,55);
insert into help_relation (help_topic_id,help_keyword_id) values (55,56);
insert into help_relation (help_topic_id,help_keyword_id) values (55,71);
insert into help_relation (help_topic_id,help_keyword_id) values (56,64);
insert into help_relation (help_topic_id,help_keyword_id) values (56,55);
insert into help_relation (help_topic_id,help_keyword_id) values (56,72);
insert into help_relation (help_topic_id,help_keyword_id) values (56,49);
insert into help_relation (help_topic_id,help_keyword_id) values (56,73);
insert into help_relation (help_topic_id,help_keyword_id) values (57,74);
insert into help_relation (help_topic_id,help_keyword_id) values (57,55);
insert into help_relation (help_topic_id,help_keyword_id) values (57,72);
insert into help_relation (help_topic_id,help_keyword_id) values (57,49);
insert into help_relation (help_topic_id,help_keyword_id) values (57,73);
insert into help_relation (help_topic_id,help_keyword_id) values (58,75);
insert into help_relation (help_topic_id,help_keyword_id) values (59,55);
insert into help_relation (help_topic_id,help_keyword_id) values (60,76);
insert into help_relation (help_topic_id,help_keyword_id) values (61,77);
insert into help_relation (help_topic_id,help_keyword_id) values (62,78);
insert into help_relation (help_topic_id,help_keyword_id) values (63,79);
insert into help_relation (help_topic_id,help_keyword_id) values (64,80);
insert into help_relation (help_topic_id,help_keyword_id) values (64,2);
insert into help_relation (help_topic_id,help_keyword_id) values (64,3);
insert into help_relation (help_topic_id,help_keyword_id) values (65,81);
insert into help_relation (help_topic_id,help_keyword_id) values (65,49);
insert into help_relation (help_topic_id,help_keyword_id) values (65,82);
insert into help_relation (help_topic_id,help_keyword_id) values (66,81);
insert into help_relation (help_topic_id,help_keyword_id) values (66,52);
insert into help_relation (help_topic_id,help_keyword_id) values (66,54);
insert into help_relation (help_topic_id,help_keyword_id) values (67,81);
insert into help_relation (help_topic_id,help_keyword_id) values (67,55);
insert into help_relation (help_topic_id,help_keyword_id) values (67,54);
insert into help_relation (help_topic_id,help_keyword_id) values (68,81);
insert into help_relation (help_topic_id,help_keyword_id) values (68,83);
insert into help_relation (help_topic_id,help_keyword_id) values (69,81);
insert into help_relation (help_topic_id,help_keyword_id) values (69,82);
insert into help_relation (help_topic_id,help_keyword_id) values (70,81);
insert into help_relation (help_topic_id,help_keyword_id) values (70,84);
insert into help_relation (help_topic_id,help_keyword_id) values (71,85);
insert into help_relation (help_topic_id,help_keyword_id) values (72,86);
insert into help_relation (help_topic_id,help_keyword_id) values (73,87);
insert into help_relation (help_topic_id,help_keyword_id) values (74,88);
insert into help_relation (help_topic_id,help_keyword_id) values (75,89);
insert into help_relation (help_topic_id,help_keyword_id) values (75,52);
insert into help_relation (help_topic_id,help_keyword_id) values (75,54);
insert into help_relation (help_topic_id,help_keyword_id) values (76,89);
insert into help_relation (help_topic_id,help_keyword_id) values (76,52);
insert into help_relation (help_topic_id,help_keyword_id) values (77,89);
insert into help_relation (help_topic_id,help_keyword_id) values (77,55);
insert into help_relation (help_topic_id,help_keyword_id) values (77,54);
insert into help_relation (help_topic_id,help_keyword_id) values (78,89);
insert into help_relation (help_topic_id,help_keyword_id) values (78,55);
insert into help_relation (help_topic_id,help_keyword_id) values (79,89);
insert into help_relation (help_topic_id,help_keyword_id) values (79,82);
insert into help_relation (help_topic_id,help_keyword_id) values (80,89);
insert into help_relation (help_topic_id,help_keyword_id) values (80,84);
insert into help_relation (help_topic_id,help_keyword_id) values (81,90);
insert into help_relation (help_topic_id,help_keyword_id) values (81,82);
insert into help_relation (help_topic_id,help_keyword_id) values (82,90);
insert into help_relation (help_topic_id,help_keyword_id) values (82,84);
insert into help_relation (help_topic_id,help_keyword_id) values (83,90);
insert into help_relation (help_topic_id,help_keyword_id) values (83,54);
insert into help_relation (help_topic_id,help_keyword_id) values (84,90);
insert into help_relation (help_topic_id,help_keyword_id) values (85,91);
insert into help_relation (help_topic_id,help_keyword_id) values (86,44);
insert into help_relation (help_topic_id,help_keyword_id) values (87,56);
insert into help_relation (help_topic_id,help_keyword_id) values (87,2);
insert into help_relation (help_topic_id,help_keyword_id) values (87,3);
insert into help_relation (help_topic_id,help_keyword_id) values (88,50);
insert into help_relation (help_topic_id,help_keyword_id) values (89,92);
insert into help_relation (help_topic_id,help_keyword_id) values (90,93);
insert into help_relation (help_topic_id,help_keyword_id) values (91,94);
insert into help_relation (help_topic_id,help_keyword_id) values (91,2);
insert into help_relation (help_topic_id,help_keyword_id) values (91,3);
insert into help_relation (help_topic_id,help_keyword_id) values (92,83);
insert into help_relation (help_topic_id,help_keyword_id) values (93,82);
insert into help_relation (help_topic_id,help_keyword_id) values (94,95);
insert into help_relation (help_topic_id,help_keyword_id) values (95,84);
insert into help_relation (help_topic_id,help_keyword_id) values (96,96);
insert into help_relation (help_topic_id,help_keyword_id) values (97,3);
insert into help_relation (help_topic_id,help_keyword_id) values (97,45);
insert into help_relation (help_topic_id,help_keyword_id) values (98,97);
insert into help_relation (help_topic_id,help_keyword_id) values (98,98);
insert into help_relation (help_topic_id,help_keyword_id) values (98,99);
insert into help_relation (help_topic_id,help_keyword_id) values (98,100);
insert into help_relation (help_topic_id,help_keyword_id) values (98,101);
insert into help_relation (help_topic_id,help_keyword_id) values (99,102);
insert into help_relation (help_topic_id,help_keyword_id) values (99,61);
insert into help_relation (help_topic_id,help_keyword_id) values (99,103);
insert into help_relation (help_topic_id,help_keyword_id) values (99,104);
insert into help_relation (help_topic_id,help_keyword_id) values (100,102);
insert into help_relation (help_topic_id,help_keyword_id) values (100,61);
insert into help_relation (help_topic_id,help_keyword_id) values (100,103);
insert into help_relation (help_topic_id,help_keyword_id) values (100,105);
insert into help_relation (help_topic_id,help_keyword_id) values (101,102);
insert into help_relation (help_topic_id,help_keyword_id) values (101,61);
insert into help_relation (help_topic_id,help_keyword_id) values (101,103);
insert into help_relation (help_topic_id,help_keyword_id) values (101,106);
insert into help_relation (help_topic_id,help_keyword_id) values (102,102);
insert into help_relation (help_topic_id,help_keyword_id) values (102,61);
insert into help_relation (help_topic_id,help_keyword_id) values (102,103);
insert into help_relation (help_topic_id,help_keyword_id) values (102,107);
insert into help_relation (help_topic_id,help_keyword_id) values (103,102);
insert into help_relation (help_topic_id,help_keyword_id) values (103,61);
insert into help_relation (help_topic_id,help_keyword_id) values (103,103);
insert into help_relation (help_topic_id,help_keyword_id) values (103,108);
insert into help_relation (help_topic_id,help_keyword_id) values (104,102);
insert into help_relation (help_topic_id,help_keyword_id) values (104,61);
insert into help_relation (help_topic_id,help_keyword_id) values (104,103);
insert into help_relation (help_topic_id,help_keyword_id) values (104,109);
insert into help_relation (help_topic_id,help_keyword_id) values (104,110);
insert into help_relation (help_topic_id,help_keyword_id) values (105,102);
insert into help_relation (help_topic_id,help_keyword_id) values (105,61);
insert into help_relation (help_topic_id,help_keyword_id) values (105,103);
insert into help_relation (help_topic_id,help_keyword_id) values (105,111);
insert into help_relation (help_topic_id,help_keyword_id) values (106,102);
insert into help_relation (help_topic_id,help_keyword_id) values (106,61);
insert into help_relation (help_topic_id,help_keyword_id) values (106,103);
insert into help_relation (help_topic_id,help_keyword_id) values (106,112);
insert into help_relation (help_topic_id,help_keyword_id) values (107,102);
insert into help_relation (help_topic_id,help_keyword_id) values (107,61);
insert into help_relation (help_topic_id,help_keyword_id) values (107,103);
insert into help_relation (help_topic_id,help_keyword_id) values (107,113);
insert into help_relation (help_topic_id,help_keyword_id) values (107,114);
insert into help_relation (help_topic_id,help_keyword_id) values (108,102);
insert into help_relation (help_topic_id,help_keyword_id) values (108,61);
insert into help_relation (help_topic_id,help_keyword_id) values (108,103);
insert into help_relation (help_topic_id,help_keyword_id) values (108,115);
insert into help_relation (help_topic_id,help_keyword_id) values (109,102);
insert into help_relation (help_topic_id,help_keyword_id) values (109,116);
insert into help_relation (help_topic_id,help_keyword_id) values (109,117);
insert into help_relation (help_topic_id,help_keyword_id) values (109,118);
insert into help_relation (help_topic_id,help_keyword_id) values (109,49);
insert into help_relation (help_topic_id,help_keyword_id) values (109,119);
insert into help_relation (help_topic_id,help_keyword_id) values (109,120);
insert into help_relation (help_topic_id,help_keyword_id) values (109,121);
insert into help_relation (help_topic_id,help_keyword_id) values (109,115);
insert into help_relation (help_topic_id,help_keyword_id) values (110,122);
insert into help_relation (help_topic_id,help_keyword_id) values (110,115);
insert into help_relation (help_topic_id,help_keyword_id) values (110,102);
insert into help_relation (help_topic_id,help_keyword_id) values (110,49);
insert into help_relation (help_topic_id,help_keyword_id) values (110,123);
insert into help_relation (help_topic_id,help_keyword_id) values (110,124);
insert into help_relation (help_topic_id,help_keyword_id) values (110,116);
insert into help_relation (help_topic_id,help_keyword_id) values (110,125);
insert into help_relation (help_topic_id,help_keyword_id) values (110,126);
insert into help_relation (help_topic_id,help_keyword_id) values (111,122);
insert into help_relation (help_topic_id,help_keyword_id) values (111,115);
insert into help_relation (help_topic_id,help_keyword_id) values (111,102);
insert into help_relation (help_topic_id,help_keyword_id) values (111,49);
insert into help_relation (help_topic_id,help_keyword_id) values (111,123);
insert into help_relation (help_topic_id,help_keyword_id) values (111,124);
insert into help_relation (help_topic_id,help_keyword_id) values (111,116);
insert into help_relation (help_topic_id,help_keyword_id) values (111,113);
insert into help_relation (help_topic_id,help_keyword_id) values (111,126);
insert into help_relation (help_topic_id,help_keyword_id) values (112,123);
insert into help_relation (help_topic_id,help_keyword_id) values (112,49);
insert into help_relation (help_topic_id,help_keyword_id) values (112,127);
insert into help_relation (help_topic_id,help_keyword_id) values (112,124);
insert into help_relation (help_topic_id,help_keyword_id) values (112,116);
insert into help_relation (help_topic_id,help_keyword_id) values (112,115);
insert into help_relation (help_topic_id,help_keyword_id) values (113,128);
insert into help_relation (help_topic_id,help_keyword_id) values (113,102);
insert into help_relation (help_topic_id,help_keyword_id) values (113,39);
insert into help_relation (help_topic_id,help_keyword_id) values (114,61);
insert into help_relation (help_topic_id,help_keyword_id) values (114,129);
insert into help_relation (help_topic_id,help_keyword_id) values (115,130);
insert into help_relation (help_topic_id,help_keyword_id) values (115,61);
insert into help_relation (help_topic_id,help_keyword_id) values (115,131);
insert into help_relation (help_topic_id,help_keyword_id) values (116,130);
insert into help_relation (help_topic_id,help_keyword_id) values (116,61);
insert into help_relation (help_topic_id,help_keyword_id) values (116,132);
insert into help_relation (help_topic_id,help_keyword_id) values (117,130);
insert into help_relation (help_topic_id,help_keyword_id) values (117,61);
insert into help_relation (help_topic_id,help_keyword_id) values (117,133);
insert into help_relation (help_topic_id,help_keyword_id) values (117,49);
insert into help_relation (help_topic_id,help_keyword_id) values (117,134);
insert into help_relation (help_topic_id,help_keyword_id) values (117,45);
insert into help_relation (help_topic_id,help_keyword_id) values (117,135);
insert into help_relation (help_topic_id,help_keyword_id) values (118,130);
insert into help_relation (help_topic_id,help_keyword_id) values (118,61);
insert into help_relation (help_topic_id,help_keyword_id) values (118,136);
insert into help_relation (help_topic_id,help_keyword_id) values (118,137);
insert into help_relation (help_topic_id,help_keyword_id) values (119,130);
insert into help_relation (help_topic_id,help_keyword_id) values (119,61);
insert into help_relation (help_topic_id,help_keyword_id) values (119,136);
insert into help_relation (help_topic_id,help_keyword_id) values (119,138);
insert into help_relation (help_topic_id,help_keyword_id) values (120,130);
insert into help_relation (help_topic_id,help_keyword_id) values (120,61);
insert into help_relation (help_topic_id,help_keyword_id) values (120,97);
insert into help_relation (help_topic_id,help_keyword_id) values (120,49);
insert into help_relation (help_topic_id,help_keyword_id) values (120,98);
insert into help_relation (help_topic_id,help_keyword_id) values (120,101);
insert into help_relation (help_topic_id,help_keyword_id) values (121,130);
insert into help_relation (help_topic_id,help_keyword_id) values (121,61);
insert into help_relation (help_topic_id,help_keyword_id) values (121,39);
insert into help_relation (help_topic_id,help_keyword_id) values (122,130);
insert into help_relation (help_topic_id,help_keyword_id) values (122,61);
insert into help_relation (help_topic_id,help_keyword_id) values (122,100);
insert into help_relation (help_topic_id,help_keyword_id) values (122,101);
insert into help_relation (help_topic_id,help_keyword_id) values (123,130);
insert into help_relation (help_topic_id,help_keyword_id) values (123,61);
insert into help_relation (help_topic_id,help_keyword_id) values (123,139);
insert into help_relation (help_topic_id,help_keyword_id) values (124,140);
insert into help_relation (help_topic_id,help_keyword_id) values (124,141);
insert into help_relation (help_topic_id,help_keyword_id) values (124,130);
insert into help_relation (help_topic_id,help_keyword_id) values (125,142);
insert into help_relation (help_topic_id,help_keyword_id) values (125,61);
insert into help_relation (help_topic_id,help_keyword_id) values (126,143);
insert into help_relation (help_topic_id,help_keyword_id) values (127,144);
insert into help_relation (help_topic_id,help_keyword_id) values (127,61);
insert into help_relation (help_topic_id,help_keyword_id) values (128,145);
insert into help_relation (help_topic_id,help_keyword_id) values (128,61);
insert into help_relation (help_topic_id,help_keyword_id) values (129,146);
insert into help_relation (help_topic_id,help_keyword_id) values (129,61);
insert into help_relation (help_topic_id,help_keyword_id) values (130,147);
insert into help_relation (help_topic_id,help_keyword_id) values (131,148);
insert into help_relation (help_topic_id,help_keyword_id) values (132,149);
insert into help_relation (help_topic_id,help_keyword_id) values (133,150);
insert into help_relation (help_topic_id,help_keyword_id) values (133,151);
insert into help_relation (help_topic_id,help_keyword_id) values (133,152);
insert into help_relation (help_topic_id,help_keyword_id) values (133,61);
insert into help_relation (help_topic_id,help_keyword_id) values (134,150);
insert into help_relation (help_topic_id,help_keyword_id) values (134,153);
insert into help_relation (help_topic_id,help_keyword_id) values (134,9);
insert into help_relation (help_topic_id,help_keyword_id) values (134,61);
insert into help_relation (help_topic_id,help_keyword_id) values (135,123);
insert into help_relation (help_topic_id,help_keyword_id) values (135,101);
insert into help_relation (help_topic_id,help_keyword_id) values (135,61);
insert into help_relation (help_topic_id,help_keyword_id) values (136,154);
insert into help_relation (help_topic_id,help_keyword_id) values (136,155);
insert into help_relation (help_topic_id,help_keyword_id) values (136,156);
insert into help_relation (help_topic_id,help_keyword_id) values (136,61);
insert into help_relation (help_topic_id,help_keyword_id) values (137,155);
insert into help_relation (help_topic_id,help_keyword_id) values (137,157);
insert into help_relation (help_topic_id,help_keyword_id) values (137,156);
insert into help_relation (help_topic_id,help_keyword_id) values (137,61);
insert into help_relation (help_topic_id,help_keyword_id) values (138,155);
insert into help_relation (help_topic_id,help_keyword_id) values (138,158);
insert into help_relation (help_topic_id,help_keyword_id) values (138,61);
insert into help_relation (help_topic_id,help_keyword_id) values (138,39);
insert into help_relation (help_topic_id,help_keyword_id) values (139,159);
insert into help_relation (help_topic_id,help_keyword_id) values (139,160);
insert into help_relation (help_topic_id,help_keyword_id) values (140,161);
insert into help_relation (help_topic_id,help_keyword_id) values (140,155);
insert into help_relation (help_topic_id,help_keyword_id) values (140,156);
insert into help_relation (help_topic_id,help_keyword_id) values (140,61);
insert into help_relation (help_topic_id,help_keyword_id) values (141,61);
insert into help_relation (help_topic_id,help_keyword_id) values (141,39);
insert into help_relation (help_topic_id,help_keyword_id) values (142,162);
insert into help_relation (help_topic_id,help_keyword_id) values (142,163);
insert into help_relation (help_topic_id,help_keyword_id) values (143,164);
insert into help_relation (help_topic_id,help_keyword_id) values (144,165);
insert into help_relation (help_topic_id,help_keyword_id) values (145,166);
insert into help_relation (help_topic_id,help_keyword_id) values (146,167);
insert into help_relation (help_topic_id,help_keyword_id) values (147,168);
insert into help_relation (help_topic_id,help_keyword_id) values (147,169);
insert into help_relation (help_topic_id,help_keyword_id) values (148,168);
insert into help_relation (help_topic_id,help_keyword_id) values (149,170);
insert into help_relation (help_topic_id,help_keyword_id) values (150,171);
insert into help_relation (help_topic_id,help_keyword_id) values (151,172);
insert into help_relation (help_topic_id,help_keyword_id) values (152,173);
insert into help_relation (help_topic_id,help_keyword_id) values (153,174);
insert into help_relation (help_topic_id,help_keyword_id) values (154,175);
insert into help_relation (help_topic_id,help_keyword_id) values (155,176);
insert into help_relation (help_topic_id,help_keyword_id) values (156,177);
insert into help_relation (help_topic_id,help_keyword_id) values (157,178);
insert into help_relation (help_topic_id,help_keyword_id) values (158,179);
insert into help_relation (help_topic_id,help_keyword_id) values (159,180);
insert into help_relation (help_topic_id,help_keyword_id) values (160,181);
insert into help_relation (help_topic_id,help_keyword_id) values (160,182);
insert into help_relation (help_topic_id,help_keyword_id) values (161,183);
insert into help_relation (help_topic_id,help_keyword_id) values (162,184);
insert into help_relation (help_topic_id,help_keyword_id) values (162,185);
insert into help_relation (help_topic_id,help_keyword_id) values (163,186);
insert into help_relation (help_topic_id,help_keyword_id) values (164,187);
insert into help_relation (help_topic_id,help_keyword_id) values (165,188);
insert into help_relation (help_topic_id,help_keyword_id) values (166,189);
insert into help_relation (help_topic_id,help_keyword_id) values (167,190);
insert into help_relation (help_topic_id,help_keyword_id) values (168,191);
insert into help_relation (help_topic_id,help_keyword_id) values (169,192);
insert into help_relation (help_topic_id,help_keyword_id) values (170,193);
insert into help_relation (help_topic_id,help_keyword_id) values (171,194);
insert into help_relation (help_topic_id,help_keyword_id) values (172,195);
insert into help_relation (help_topic_id,help_keyword_id) values (173,196);
insert into help_relation (help_topic_id,help_keyword_id) values (174,197);
insert into help_relation (help_topic_id,help_keyword_id) values (175,198);
insert into help_relation (help_topic_id,help_keyword_id) values (176,6);
insert into help_relation (help_topic_id,help_keyword_id) values (176,49);
insert into help_relation (help_topic_id,help_keyword_id) values (176,9);
insert into help_relation (help_topic_id,help_keyword_id) values (176,199);
insert into help_relation (help_topic_id,help_keyword_id) values (177,6);
insert into help_relation (help_topic_id,help_keyword_id) values (177,185);
insert into help_relation (help_topic_id,help_keyword_id) values (178,200);
insert into help_relation (help_topic_id,help_keyword_id) values (179,201);
insert into help_relation (help_topic_id,help_keyword_id) values (180,202);
insert into help_relation (help_topic_id,help_keyword_id) values (181,203);
insert into help_relation (help_topic_id,help_keyword_id) values (182,204);
insert into help_relation (help_topic_id,help_keyword_id) values (183,205);
insert into help_relation (help_topic_id,help_keyword_id) values (184,206);
insert into help_relation (help_topic_id,help_keyword_id) values (185,207);
insert into help_relation (help_topic_id,help_keyword_id) values (186,208);
insert into help_relation (help_topic_id,help_keyword_id) values (187,209);
insert into help_relation (help_topic_id,help_keyword_id) values (188,210);
insert into help_relation (help_topic_id,help_keyword_id) values (189,211);
insert into help_relation (help_topic_id,help_keyword_id) values (190,212);
insert into help_relation (help_topic_id,help_keyword_id) values (191,213);
insert into help_relation (help_topic_id,help_keyword_id) values (192,214);
insert into help_relation (help_topic_id,help_keyword_id) values (193,215);
insert into help_relation (help_topic_id,help_keyword_id) values (194,216);
insert into help_relation (help_topic_id,help_keyword_id) values (195,217);
insert into help_relation (help_topic_id,help_keyword_id) values (196,218);
insert into help_relation (help_topic_id,help_keyword_id) values (197,219);
insert into help_relation (help_topic_id,help_keyword_id) values (198,220);
insert into help_relation (help_topic_id,help_keyword_id) values (199,221);
insert into help_relation (help_topic_id,help_keyword_id) values (199,222);
insert into help_relation (help_topic_id,help_keyword_id) values (199,140);
insert into help_relation (help_topic_id,help_keyword_id) values (200,223);
insert into help_relation (help_topic_id,help_keyword_id) values (201,224);
insert into help_relation (help_topic_id,help_keyword_id) values (202,225);
insert into help_relation (help_topic_id,help_keyword_id) values (203,226);
insert into help_relation (help_topic_id,help_keyword_id) values (204,227);
insert into help_relation (help_topic_id,help_keyword_id) values (205,228);
insert into help_relation (help_topic_id,help_keyword_id) values (206,229);
insert into help_relation (help_topic_id,help_keyword_id) values (207,230);
insert into help_relation (help_topic_id,help_keyword_id) values (208,231);
insert into help_relation (help_topic_id,help_keyword_id) values (209,232);
insert into help_relation (help_topic_id,help_keyword_id) values (210,233);
insert into help_relation (help_topic_id,help_keyword_id) values (211,234);
insert into help_relation (help_topic_id,help_keyword_id) values (212,235);
insert into help_relation (help_topic_id,help_keyword_id) values (213,236);
insert into help_relation (help_topic_id,help_keyword_id) values (214,237);
insert into help_relation (help_topic_id,help_keyword_id) values (215,238);
insert into help_relation (help_topic_id,help_keyword_id) values (216,239);
insert into help_relation (help_topic_id,help_keyword_id) values (217,240);
insert into help_relation (help_topic_id,help_keyword_id) values (218,241);
insert into help_relation (help_topic_id,help_keyword_id) values (219,242);
insert into help_relation (help_topic_id,help_keyword_id) values (220,243);
insert into help_relation (help_topic_id,help_keyword_id) values (221,244);
insert into help_relation (help_topic_id,help_keyword_id) values (222,245);
insert into help_relation (help_topic_id,help_keyword_id) values (223,246);
insert into help_relation (help_topic_id,help_keyword_id) values (224,247);
insert into help_relation (help_topic_id,help_keyword_id) values (225,248);
insert into help_relation (help_topic_id,help_keyword_id) values (226,249);
insert into help_relation (help_topic_id,help_keyword_id) values (227,250);
insert into help_relation (help_topic_id,help_keyword_id) values (228,251);
insert into help_relation (help_topic_id,help_keyword_id) values (229,252);
insert into help_relation (help_topic_id,help_keyword_id) values (230,11);
insert into help_relation (help_topic_id,help_keyword_id) values (231,253);
insert into help_relation (help_topic_id,help_keyword_id) values (232,163);
insert into help_relation (help_topic_id,help_keyword_id) values (232,99);
insert into help_relation (help_topic_id,help_keyword_id) values (232,254);
insert into help_relation (help_topic_id,help_keyword_id) values (233,255);
insert into help_relation (help_topic_id,help_keyword_id) values (234,256);
insert into help_relation (help_topic_id,help_keyword_id) values (235,257);
insert into help_relation (help_topic_id,help_keyword_id) values (236,258);
insert into help_relation (help_topic_id,help_keyword_id) values (237,259);
insert into help_relation (help_topic_id,help_keyword_id) values (238,260);
insert into help_relation (help_topic_id,help_keyword_id) values (239,261);
insert into help_relation (help_topic_id,help_keyword_id) values (240,262);
insert into help_relation (help_topic_id,help_keyword_id) values (241,263);
insert into help_relation (help_topic_id,help_keyword_id) values (242,264);
insert into help_relation (help_topic_id,help_keyword_id) values (243,265);
insert into help_relation (help_topic_id,help_keyword_id) values (244,266);
insert into help_relation (help_topic_id,help_keyword_id) values (245,267);
insert into help_relation (help_topic_id,help_keyword_id) values (246,268);
insert into help_relation (help_topic_id,help_keyword_id) values (247,269);
insert into help_relation (help_topic_id,help_keyword_id) values (248,270);
insert into help_relation (help_topic_id,help_keyword_id) values (249,271);
insert into help_relation (help_topic_id,help_keyword_id) values (250,136);
insert into help_relation (help_topic_id,help_keyword_id) values (251,272);
insert into help_relation (help_topic_id,help_keyword_id) values (252,273);
insert into help_relation (help_topic_id,help_keyword_id) values (253,274);
insert into help_relation (help_topic_id,help_keyword_id) values (254,275);
insert into help_relation (help_topic_id,help_keyword_id) values (255,276);
insert into help_relation (help_topic_id,help_keyword_id) values (256,277);
insert into help_relation (help_topic_id,help_keyword_id) values (257,278);
insert into help_relation (help_topic_id,help_keyword_id) values (258,279);
insert into help_relation (help_topic_id,help_keyword_id) values (259,280);
insert into help_relation (help_topic_id,help_keyword_id) values (260,281);
insert into help_relation (help_topic_id,help_keyword_id) values (261,282);
insert into help_relation (help_topic_id,help_keyword_id) values (262,283);
insert into help_relation (help_topic_id,help_keyword_id) values (263,284);
insert into help_relation (help_topic_id,help_keyword_id) values (264,285);
insert into help_relation (help_topic_id,help_keyword_id) values (265,286);
insert into help_relation (help_topic_id,help_keyword_id) values (266,287);
insert into help_relation (help_topic_id,help_keyword_id) values (267,288);
insert into help_relation (help_topic_id,help_keyword_id) values (268,289);
insert into help_relation (help_topic_id,help_keyword_id) values (269,290);
insert into help_relation (help_topic_id,help_keyword_id) values (270,291);
insert into help_relation (help_topic_id,help_keyword_id) values (271,292);
insert into help_relation (help_topic_id,help_keyword_id) values (272,99);
insert into help_relation (help_topic_id,help_keyword_id) values (273,293);
insert into help_relation (help_topic_id,help_keyword_id) values (274,294);
insert into help_relation (help_topic_id,help_keyword_id) values (275,295);
insert into help_relation (help_topic_id,help_keyword_id) values (276,296);
insert into help_relation (help_topic_id,help_keyword_id) values (276,297);
insert into help_relation (help_topic_id,help_keyword_id) values (277,298);
insert into help_relation (help_topic_id,help_keyword_id) values (278,299);
insert into help_relation (help_topic_id,help_keyword_id) values (279,300);
insert into help_relation (help_topic_id,help_keyword_id) values (280,301);
insert into help_relation (help_topic_id,help_keyword_id) values (281,302);
insert into help_relation (help_topic_id,help_keyword_id) values (282,303);
insert into help_relation (help_topic_id,help_keyword_id) values (283,304);
insert into help_relation (help_topic_id,help_keyword_id) values (284,305);
insert into help_relation (help_topic_id,help_keyword_id) values (285,306);
insert into help_relation (help_topic_id,help_keyword_id) values (286,307);
insert into help_relation (help_topic_id,help_keyword_id) values (287,308);
insert into help_relation (help_topic_id,help_keyword_id) values (288,155);
insert into help_relation (help_topic_id,help_keyword_id) values (289,309);
insert into help_relation (help_topic_id,help_keyword_id) values (290,310);
insert into help_relation (help_topic_id,help_keyword_id) values (291,311);
insert into help_relation (help_topic_id,help_keyword_id) values (292,312);
insert into help_relation (help_topic_id,help_keyword_id) values (293,313);
insert into help_relation (help_topic_id,help_keyword_id) values (294,314);
insert into help_relation (help_topic_id,help_keyword_id) values (295,315);
insert into help_relation (help_topic_id,help_keyword_id) values (296,316);
insert into help_relation (help_topic_id,help_keyword_id) values (297,317);
insert into help_relation (help_topic_id,help_keyword_id) values (298,57);
insert into help_relation (help_topic_id,help_keyword_id) values (299,318);
insert into help_relation (help_topic_id,help_keyword_id) values (300,319);
insert into help_relation (help_topic_id,help_keyword_id) values (301,320);
insert into help_relation (help_topic_id,help_keyword_id) values (302,321);
insert into help_relation (help_topic_id,help_keyword_id) values (303,322);
insert into help_relation (help_topic_id,help_keyword_id) values (304,323);
insert into help_relation (help_topic_id,help_keyword_id) values (305,324);
insert into help_relation (help_topic_id,help_keyword_id) values (306,325);
insert into help_relation (help_topic_id,help_keyword_id) values (307,326);
insert into help_relation (help_topic_id,help_keyword_id) values (308,327);
insert into help_relation (help_topic_id,help_keyword_id) values (308,328);
insert into help_relation (help_topic_id,help_keyword_id) values (309,329);
insert into help_relation (help_topic_id,help_keyword_id) values (310,330);
insert into help_relation (help_topic_id,help_keyword_id) values (311,331);
insert into help_relation (help_topic_id,help_keyword_id) values (312,332);
insert into help_relation (help_topic_id,help_keyword_id) values (313,333);
insert into help_relation (help_topic_id,help_keyword_id) values (314,123);
insert into help_relation (help_topic_id,help_keyword_id) values (315,334);
insert into help_relation (help_topic_id,help_keyword_id) values (316,335);
insert into help_relation (help_topic_id,help_keyword_id) values (317,336);
insert into help_relation (help_topic_id,help_keyword_id) values (318,337);
insert into help_relation (help_topic_id,help_keyword_id) values (319,338);
insert into help_relation (help_topic_id,help_keyword_id) values (320,339);
insert into help_relation (help_topic_id,help_keyword_id) values (321,340);
insert into help_relation (help_topic_id,help_keyword_id) values (322,341);
insert into help_relation (help_topic_id,help_keyword_id) values (323,342);
insert into help_relation (help_topic_id,help_keyword_id) values (324,343);
insert into help_relation (help_topic_id,help_keyword_id) values (325,344);
insert into help_relation (help_topic_id,help_keyword_id) values (326,345);
insert into help_relation (help_topic_id,help_keyword_id) values (327,346);
insert into help_relation (help_topic_id,help_keyword_id) values (328,347);
insert into help_relation (help_topic_id,help_keyword_id) values (329,348);
insert into help_relation (help_topic_id,help_keyword_id) values (330,349);
insert into help_relation (help_topic_id,help_keyword_id) values (331,350);
insert into help_relation (help_topic_id,help_keyword_id) values (332,351);
insert into help_relation (help_topic_id,help_keyword_id) values (333,352);
insert into help_relation (help_topic_id,help_keyword_id) values (334,353);
insert into help_relation (help_topic_id,help_keyword_id) values (335,354);
insert into help_relation (help_topic_id,help_keyword_id) values (336,94);
insert into help_relation (help_topic_id,help_keyword_id) values (337,355);
insert into help_relation (help_topic_id,help_keyword_id) values (338,356);
insert into help_relation (help_topic_id,help_keyword_id) values (339,357);
insert into help_relation (help_topic_id,help_keyword_id) values (340,13);
insert into help_relation (help_topic_id,help_keyword_id) values (340,358);
insert into help_relation (help_topic_id,help_keyword_id) values (341,359);
insert into help_relation (help_topic_id,help_keyword_id) values (342,360);
insert into help_relation (help_topic_id,help_keyword_id) values (343,361);
insert into help_relation (help_topic_id,help_keyword_id) values (344,362);
insert into help_relation (help_topic_id,help_keyword_id) values (345,363);
insert into help_relation (help_topic_id,help_keyword_id) values (346,364);
insert into help_relation (help_topic_id,help_keyword_id) values (347,365);
insert into help_relation (help_topic_id,help_keyword_id) values (348,366);
insert into help_relation (help_topic_id,help_keyword_id) values (349,367);
insert into help_relation (help_topic_id,help_keyword_id) values (350,368);
insert into help_relation (help_topic_id,help_keyword_id) values (351,369);
insert into help_relation (help_topic_id,help_keyword_id) values (352,370);
insert into help_relation (help_topic_id,help_keyword_id) values (352,163);
insert into help_relation (help_topic_id,help_keyword_id) values (353,371);
insert into help_relation (help_topic_id,help_keyword_id) values (353,372);
insert into help_relation (help_topic_id,help_keyword_id) values (353,373);
insert into help_relation (help_topic_id,help_keyword_id) values (353,49);
insert into help_relation (help_topic_id,help_keyword_id) values (353,374);
insert into help_relation (help_topic_id,help_keyword_id) values (354,80);
insert into help_relation (help_topic_id,help_keyword_id) values (354,158);
insert into help_relation (help_topic_id,help_keyword_id) values (354,185);
insert into help_relation (help_topic_id,help_keyword_id) values (355,375);
insert into help_relation (help_topic_id,help_keyword_id) values (356,376);
insert into help_relation (help_topic_id,help_keyword_id) values (357,377);
insert into help_relation (help_topic_id,help_keyword_id) values (358,378);
insert into help_relation (help_topic_id,help_keyword_id) values (359,379);
insert into help_relation (help_topic_id,help_keyword_id) values (360,380);
insert into help_relation (help_topic_id,help_keyword_id) values (361,381);
insert into help_relation (help_topic_id,help_keyword_id) values (362,382);
insert into help_relation (help_topic_id,help_keyword_id) values (363,383);
insert into help_relation (help_topic_id,help_keyword_id) values (364,384);
insert into help_relation (help_topic_id,help_keyword_id) values (365,385);
insert into help_relation (help_topic_id,help_keyword_id) values (366,386);
insert into help_relation (help_topic_id,help_keyword_id) values (367,387);
insert into help_relation (help_topic_id,help_keyword_id) values (368,388);
insert into help_relation (help_topic_id,help_keyword_id) values (369,389);
insert into help_relation (help_topic_id,help_keyword_id) values (370,390);
insert into help_relation (help_topic_id,help_keyword_id) values (371,391);
insert into help_relation (help_topic_id,help_keyword_id) values (372,392);
insert into help_relation (help_topic_id,help_keyword_id) values (373,393);
insert into help_relation (help_topic_id,help_keyword_id) values (374,394);
insert into help_relation (help_topic_id,help_keyword_id) values (375,395);
insert into help_relation (help_topic_id,help_keyword_id) values (376,396);
insert into help_relation (help_topic_id,help_keyword_id) values (377,397);
insert into help_relation (help_topic_id,help_keyword_id) values (378,398);
insert into help_relation (help_topic_id,help_keyword_id) values (379,399);
insert into help_relation (help_topic_id,help_keyword_id) values (380,400);
insert into help_relation (help_topic_id,help_keyword_id) values (381,401);
insert into help_relation (help_topic_id,help_keyword_id) values (382,402);
insert into help_relation (help_topic_id,help_keyword_id) values (383,373);
insert into help_relation (help_topic_id,help_keyword_id) values (384,403);
insert into help_relation (help_topic_id,help_keyword_id) values (385,404);
insert into help_relation (help_topic_id,help_keyword_id) values (386,405);
insert into help_relation (help_topic_id,help_keyword_id) values (387,406);
insert into help_relation (help_topic_id,help_keyword_id) values (388,407);
insert into help_relation (help_topic_id,help_keyword_id) values (389,408);
insert into help_relation (help_topic_id,help_keyword_id) values (390,409);
insert into help_relation (help_topic_id,help_keyword_id) values (391,410);
insert into help_relation (help_topic_id,help_keyword_id) values (392,411);
insert into help_relation (help_topic_id,help_keyword_id) values (393,412);
insert into help_relation (help_topic_id,help_keyword_id) values (394,374);
insert into help_relation (help_topic_id,help_keyword_id) values (395,413);
insert into help_relation (help_topic_id,help_keyword_id) values (395,414);
insert into help_relation (help_topic_id,help_keyword_id) values (396,415);
insert into help_relation (help_topic_id,help_keyword_id) values (397,416);
insert into help_relation (help_topic_id,help_keyword_id) values (398,417);
insert into help_relation (help_topic_id,help_keyword_id) values (399,418);
insert into help_relation (help_topic_id,help_keyword_id) values (400,419);
insert into help_relation (help_topic_id,help_keyword_id) values (401,420);
insert into help_relation (help_topic_id,help_keyword_id) values (402,421);
insert into help_relation (help_topic_id,help_keyword_id) values (403,422);
insert into help_relation (help_topic_id,help_keyword_id) values (404,423);
insert into help_relation (help_topic_id,help_keyword_id) values (405,424);
insert into help_relation (help_topic_id,help_keyword_id) values (406,425);
insert into help_relation (help_topic_id,help_keyword_id) values (407,426);
insert into help_relation (help_topic_id,help_keyword_id) values (408,427);
insert into help_relation (help_topic_id,help_keyword_id) values (409,428);
insert into help_relation (help_topic_id,help_keyword_id) values (409,429);
insert into help_relation (help_topic_id,help_keyword_id) values (410,430);
insert into help_relation (help_topic_id,help_keyword_id) values (410,428);
insert into help_relation (help_topic_id,help_keyword_id) values (410,163);
insert into help_relation (help_topic_id,help_keyword_id) values (411,428);
insert into help_relation (help_topic_id,help_keyword_id) values (411,163);
insert into help_relation (help_topic_id,help_keyword_id) values (411,39);
insert into help_relation (help_topic_id,help_keyword_id) values (412,431);
insert into help_relation (help_topic_id,help_keyword_id) values (413,432);
insert into help_relation (help_topic_id,help_keyword_id) values (414,47);
insert into help_relation (help_topic_id,help_keyword_id) values (414,182);
insert into help_relation (help_topic_id,help_keyword_id) values (415,433);
insert into help_relation (help_topic_id,help_keyword_id) values (416,434);
insert into help_relation (help_topic_id,help_keyword_id) values (417,52);
insert into help_relation (help_topic_id,help_keyword_id) values (417,185);
insert into help_relation (help_topic_id,help_keyword_id) values (418,435);
insert into help_relation (help_topic_id,help_keyword_id) values (419,436);
insert into help_relation (help_topic_id,help_keyword_id) values (420,437);
insert into help_relation (help_topic_id,help_keyword_id) values (421,438);
insert into help_relation (help_topic_id,help_keyword_id) values (422,439);
insert into help_relation (help_topic_id,help_keyword_id) values (423,440);
insert into help_relation (help_topic_id,help_keyword_id) values (424,441);
insert into help_relation (help_topic_id,help_keyword_id) values (425,442);
insert into help_relation (help_topic_id,help_keyword_id) values (426,443);
insert into help_relation (help_topic_id,help_keyword_id) values (427,444);
insert into help_relation (help_topic_id,help_keyword_id) values (428,445);
insert into help_relation (help_topic_id,help_keyword_id) values (429,137);
insert into help_relation (help_topic_id,help_keyword_id) values (430,446);
insert into help_relation (help_topic_id,help_keyword_id) values (431,447);
insert into help_relation (help_topic_id,help_keyword_id) values (432,448);
insert into help_relation (help_topic_id,help_keyword_id) values (432,185);
insert into help_relation (help_topic_id,help_keyword_id) values (433,449);
insert into help_relation (help_topic_id,help_keyword_id) values (434,450);
insert into help_relation (help_topic_id,help_keyword_id) values (435,451);
insert into help_relation (help_topic_id,help_keyword_id) values (436,452);
insert into help_relation (help_topic_id,help_keyword_id) values (437,453);
insert into help_relation (help_topic_id,help_keyword_id) values (438,454);
insert into help_relation (help_topic_id,help_keyword_id) values (439,455);
insert into help_relation (help_topic_id,help_keyword_id) values (440,456);
insert into help_relation (help_topic_id,help_keyword_id) values (441,457);
insert into help_relation (help_topic_id,help_keyword_id) values (442,458);
insert into help_relation (help_topic_id,help_keyword_id) values (443,459);
insert into help_relation (help_topic_id,help_keyword_id) values (444,460);
insert into help_relation (help_topic_id,help_keyword_id) values (445,461);
insert into help_relation (help_topic_id,help_keyword_id) values (445,462);
insert into help_relation (help_topic_id,help_keyword_id) values (446,463);
insert into help_relation (help_topic_id,help_keyword_id) values (447,464);
insert into help_relation (help_topic_id,help_keyword_id) values (448,465);
insert into help_relation (help_topic_id,help_keyword_id) values (448,454);
insert into help_relation (help_topic_id,help_keyword_id) values (449,465);
insert into help_relation (help_topic_id,help_keyword_id) values (449,466);
insert into help_relation (help_topic_id,help_keyword_id) values (450,467);
insert into help_relation (help_topic_id,help_keyword_id) values (451,468);
insert into help_relation (help_topic_id,help_keyword_id) values (452,469);
insert into help_relation (help_topic_id,help_keyword_id) values (453,470);
insert into help_relation (help_topic_id,help_keyword_id) values (454,471);
insert into help_relation (help_topic_id,help_keyword_id) values (454,103);
insert into help_relation (help_topic_id,help_keyword_id) values (454,472);
insert into help_relation (help_topic_id,help_keyword_id) values (454,473);
insert into help_relation (help_topic_id,help_keyword_id) values (454,474);
insert into help_relation (help_topic_id,help_keyword_id) values (454,414);
insert into help_relation (help_topic_id,help_keyword_id) values (455,466);
insert into help_relation (help_topic_id,help_keyword_id) values (456,475);
insert into help_relation (help_topic_id,help_keyword_id) values (457,476);
insert into help_relation (help_topic_id,help_keyword_id) values (458,477);
insert into help_relation (help_topic_id,help_keyword_id) values (459,474);
insert into help_relation (help_topic_id,help_keyword_id) values (459,414);
insert into help_relation (help_topic_id,help_keyword_id) values (459,39);
insert into help_relation (help_topic_id,help_keyword_id) values (460,478);
insert into help_relation (help_topic_id,help_keyword_id) values (461,479);
insert into help_relation (help_topic_id,help_keyword_id) values (461,185);
insert into help_relation (help_topic_id,help_keyword_id) values (462,480);
insert into help_relation (help_topic_id,help_keyword_id) values (462,185);
insert into help_relation (help_topic_id,help_keyword_id) values (463,481);
insert into help_relation (help_topic_id,help_keyword_id) values (464,482);
insert into help_relation (help_topic_id,help_keyword_id) values (465,483);
insert into help_relation (help_topic_id,help_keyword_id) values (466,484);
insert into help_relation (help_topic_id,help_keyword_id) values (467,485);
insert into help_relation (help_topic_id,help_keyword_id) values (468,486);
insert into help_relation (help_topic_id,help_keyword_id) values (469,487);
insert into help_relation (help_topic_id,help_keyword_id) values (469,454);
insert into help_relation (help_topic_id,help_keyword_id) values (470,488);
insert into help_relation (help_topic_id,help_keyword_id) values (471,489);
insert into help_relation (help_topic_id,help_keyword_id) values (472,490);
insert into help_relation (help_topic_id,help_keyword_id) values (473,491);
insert into help_relation (help_topic_id,help_keyword_id) values (474,492);
insert into help_relation (help_topic_id,help_keyword_id) values (475,493);
insert into help_relation (help_topic_id,help_keyword_id) values (476,494);
insert into help_relation (help_topic_id,help_keyword_id) values (477,495);
insert into help_relation (help_topic_id,help_keyword_id) values (478,496);
insert into help_relation (help_topic_id,help_keyword_id) values (479,3);
insert into help_relation (help_topic_id,help_keyword_id) values (479,497);
insert into help_relation (help_topic_id,help_keyword_id) values (480,498);
insert into help_relation (help_topic_id,help_keyword_id) values (481,499);
insert into help_relation (help_topic_id,help_keyword_id) values (482,500);
insert into help_relation (help_topic_id,help_keyword_id) values (483,501);
insert into help_relation (help_topic_id,help_keyword_id) values (484,502);
insert into help_relation (help_topic_id,help_keyword_id) values (485,503);
insert into help_relation (help_topic_id,help_keyword_id) values (486,504);
insert into help_relation (help_topic_id,help_keyword_id) values (487,505);
insert into help_relation (help_topic_id,help_keyword_id) values (488,506);
insert into help_relation (help_topic_id,help_keyword_id) values (489,507);
insert into help_relation (help_topic_id,help_keyword_id) values (490,508);
insert into help_relation (help_topic_id,help_keyword_id) values (490,509);
insert into help_relation (help_topic_id,help_keyword_id) values (491,510);
insert into help_relation (help_topic_id,help_keyword_id) values (491,123);
insert into help_relation (help_topic_id,help_keyword_id) values (492,511);
insert into help_relation (help_topic_id,help_keyword_id) values (492,512);
insert into help_relation (help_topic_id,help_keyword_id) values (493,511);
insert into help_relation (help_topic_id,help_keyword_id) values (493,123);
insert into help_relation (help_topic_id,help_keyword_id) values (494,513);
insert into help_relation (help_topic_id,help_keyword_id) values (494,512);
insert into help_relation (help_topic_id,help_keyword_id) values (495,513);
insert into help_relation (help_topic_id,help_keyword_id) values (495,123);
insert into help_relation (help_topic_id,help_keyword_id) values (496,514);
insert into help_relation (help_topic_id,help_keyword_id) values (497,515);
insert into help_relation (help_topic_id,help_keyword_id) values (497,123);
insert into help_relation (help_topic_id,help_keyword_id) values (498,516);
insert into help_relation (help_topic_id,help_keyword_id) values (499,56);
insert into help_relation (help_topic_id,help_keyword_id) values (499,323);
insert into help_relation (help_topic_id,help_keyword_id) values (499,512);
insert into help_relation (help_topic_id,help_keyword_id) values (500,56);
insert into help_relation (help_topic_id,help_keyword_id) values (500,155);
insert into help_relation (help_topic_id,help_keyword_id) values (501,56);
insert into help_relation (help_topic_id,help_keyword_id) values (501,512);
insert into help_relation (help_topic_id,help_keyword_id) values (502,517);
insert into help_relation (help_topic_id,help_keyword_id) values (502,518);
insert into help_relation (help_topic_id,help_keyword_id) values (503,517);
insert into help_relation (help_topic_id,help_keyword_id) values (503,518);
insert into help_relation (help_topic_id,help_keyword_id) values (503,519);
insert into help_relation (help_topic_id,help_keyword_id) values (504,520);
insert into help_relation (help_topic_id,help_keyword_id) values (504,521);
insert into help_relation (help_topic_id,help_keyword_id) values (504,522);
insert into help_relation (help_topic_id,help_keyword_id) values (504,49);
insert into help_relation (help_topic_id,help_keyword_id) values (504,523);
insert into help_relation (help_topic_id,help_keyword_id) values (504,524);
insert into help_relation (help_topic_id,help_keyword_id) values (505,517);
insert into help_relation (help_topic_id,help_keyword_id) values (505,525);
insert into help_relation (help_topic_id,help_keyword_id) values (506,526);
insert into help_relation (help_topic_id,help_keyword_id) values (506,517);
insert into help_relation (help_topic_id,help_keyword_id) values (507,526);
insert into help_relation (help_topic_id,help_keyword_id) values (507,518);
insert into help_relation (help_topic_id,help_keyword_id) values (508,526);
insert into help_relation (help_topic_id,help_keyword_id) values (509,527);
insert into help_relation (help_topic_id,help_keyword_id) values (509,528);
insert into help_relation (help_topic_id,help_keyword_id) values (509,529);
insert into help_relation (help_topic_id,help_keyword_id) values (509,530);
insert into help_relation (help_topic_id,help_keyword_id) values (510,531);
insert into help_relation (help_topic_id,help_keyword_id) values (510,532);
insert into help_relation (help_topic_id,help_keyword_id) values (511,531);
insert into help_relation (help_topic_id,help_keyword_id) values (511,533);
insert into help_relation (help_topic_id,help_keyword_id) values (512,4);
insert into help_relation (help_topic_id,help_keyword_id) values (512,534);
insert into help_relation (help_topic_id,help_keyword_id) values (512,49);
insert into help_relation (help_topic_id,help_keyword_id) values (512,531);
insert into help_relation (help_topic_id,help_keyword_id) values (512,533);
insert into help_relation (help_topic_id,help_keyword_id) values (512,509);
insert into help_relation (help_topic_id,help_keyword_id) values (513,535);
insert into help_relation (help_topic_id,help_keyword_id) values (514,151);
insert into help_relation (help_topic_id,help_keyword_id) values (514,536);
insert into help_relation (help_topic_id,help_keyword_id) values (515,537);
insert into help_relation (help_topic_id,help_keyword_id) values (516,538);
insert into help_relation (help_topic_id,help_keyword_id) values (516,150);
insert into help_relation (help_topic_id,help_keyword_id) values (516,151);
insert into help_relation (help_topic_id,help_keyword_id) values (517,538);
insert into help_relation (help_topic_id,help_keyword_id) values (517,539);
insert into help_relation (help_topic_id,help_keyword_id) values (517,67);
insert into help_relation (help_topic_id,help_keyword_id) values (517,540);
insert into help_relation (help_topic_id,help_keyword_id) values (518,538);
insert into help_relation (help_topic_id,help_keyword_id) values (519,541);
insert into help_relation (help_topic_id,help_keyword_id) values (519,542);
insert into help_relation (help_topic_id,help_keyword_id) values (520,543);
insert into help_relation (help_topic_id,help_keyword_id) values (521,544);
insert into help_relation (help_topic_id,help_keyword_id) values (521,61);
insert into help_relation (help_topic_id,help_keyword_id) values (522,544);
insert into help_relation (help_topic_id,help_keyword_id) values (522,545);
insert into help_relation (help_topic_id,help_keyword_id) values (523,546);
insert into help_relation (help_topic_id,help_keyword_id) values (523,61);
insert into help_relation (help_topic_id,help_keyword_id) values (524,546);
insert into help_relation (help_topic_id,help_keyword_id) values (524,545);
insert into help_relation (help_topic_id,help_keyword_id) values (525,547);
insert into help_relation (help_topic_id,help_keyword_id) values (525,47);
insert into help_relation (help_topic_id,help_keyword_id) values (525,135);
insert into help_relation (help_topic_id,help_keyword_id) values (526,548);
insert into help_relation (help_topic_id,help_keyword_id) values (526,509);
insert into help_relation (help_topic_id,help_keyword_id) values (527,549);
insert into help_relation (help_topic_id,help_keyword_id) values (527,550);
insert into help_relation (help_topic_id,help_keyword_id) values (527,551);
insert into help_relation (help_topic_id,help_keyword_id) values (528,552);
insert into help_relation (help_topic_id,help_keyword_id) values (528,553);
insert into help_relation (help_topic_id,help_keyword_id) values (529,554);
insert into help_relation (help_topic_id,help_keyword_id) values (529,553);
insert into help_relation (help_topic_id,help_keyword_id) values (529,555);
insert into help_relation (help_topic_id,help_keyword_id) values (530,554);
insert into help_relation (help_topic_id,help_keyword_id) values (530,553);
insert into help_relation (help_topic_id,help_keyword_id) values (530,100);
insert into help_relation (help_topic_id,help_keyword_id) values (531,556);
insert into help_relation (help_topic_id,help_keyword_id) values (531,553);
insert into help_relation (help_topic_id,help_keyword_id) values (532,557);
insert into help_relation (help_topic_id,help_keyword_id) values (532,553);
insert into help_relation (help_topic_id,help_keyword_id) values (533,552);
insert into help_relation (help_topic_id,help_keyword_id) values (533,550);
insert into help_relation (help_topic_id,help_keyword_id) values (534,552);
insert into help_relation (help_topic_id,help_keyword_id) values (534,558);
insert into help_relation (help_topic_id,help_keyword_id) values (535,56);
insert into help_relation (help_topic_id,help_keyword_id) values (535,559);
insert into help_relation (help_topic_id,help_keyword_id) values (535,560);
insert into help_relation (help_topic_id,help_keyword_id) values (536,556);
insert into help_relation (help_topic_id,help_keyword_id) values (536,558);
insert into help_relation (help_topic_id,help_keyword_id) values (537,557);
insert into help_relation (help_topic_id,help_keyword_id) values (537,558);
insert into help_relation (help_topic_id,help_keyword_id) values (538,552);
insert into help_relation (help_topic_id,help_keyword_id) values (539,56);
insert into help_relation (help_topic_id,help_keyword_id) values (539,509);
insert into help_relation (help_topic_id,help_keyword_id) values (540,56);
insert into help_relation (help_topic_id,help_keyword_id) values (540,561);
insert into help_relation (help_topic_id,help_keyword_id) values (541,56);
insert into help_relation (help_topic_id,help_keyword_id) values (541,562);
insert into help_relation (help_topic_id,help_keyword_id) values (542,56);
insert into help_relation (help_topic_id,help_keyword_id) values (542,525);
insert into help_relation (help_topic_id,help_keyword_id) values (543,56);
insert into help_relation (help_topic_id,help_keyword_id) values (544,563);
insert into help_relation (help_topic_id,help_keyword_id) values (544,554);
insert into help_relation (help_topic_id,help_keyword_id) values (545,564);
insert into help_relation (help_topic_id,help_keyword_id) values (545,554);
insert into help_relation (help_topic_id,help_keyword_id) values (546,554);
insert into help_relation (help_topic_id,help_keyword_id) values (546,517);
insert into help_relation (help_topic_id,help_keyword_id) values (547,554);
insert into help_relation (help_topic_id,help_keyword_id) values (547,565);
insert into help_relation (help_topic_id,help_keyword_id) values (548,554);
insert into help_relation (help_topic_id,help_keyword_id) values (548,47);
insert into help_relation (help_topic_id,help_keyword_id) values (548,135);
insert into help_relation (help_topic_id,help_keyword_id) values (549,554);
insert into help_relation (help_topic_id,help_keyword_id) values (549,535);
insert into help_relation (help_topic_id,help_keyword_id) values (549,566);
insert into help_relation (help_topic_id,help_keyword_id) values (550,554);
insert into help_relation (help_topic_id,help_keyword_id) values (550,550);
insert into help_relation (help_topic_id,help_keyword_id) values (550,100);
insert into help_relation (help_topic_id,help_keyword_id) values (551,554);
insert into help_relation (help_topic_id,help_keyword_id) values (551,55);
insert into help_relation (help_topic_id,help_keyword_id) values (551,56);
insert into help_relation (help_topic_id,help_keyword_id) values (552,554);
insert into help_relation (help_topic_id,help_keyword_id) values (552,567);
insert into help_relation (help_topic_id,help_keyword_id) values (553,554);
insert into help_relation (help_topic_id,help_keyword_id) values (553,57);
insert into help_relation (help_topic_id,help_keyword_id) values (554,554);
insert into help_relation (help_topic_id,help_keyword_id) values (554,568);
insert into help_relation (help_topic_id,help_keyword_id) values (555,554);
insert into help_relation (help_topic_id,help_keyword_id) values (555,569);
insert into help_relation (help_topic_id,help_keyword_id) values (556,554);
insert into help_relation (help_topic_id,help_keyword_id) values (556,511);
insert into help_relation (help_topic_id,help_keyword_id) values (556,321);
insert into help_relation (help_topic_id,help_keyword_id) values (557,554);
insert into help_relation (help_topic_id,help_keyword_id) values (557,511);
insert into help_relation (help_topic_id,help_keyword_id) values (557,570);
insert into help_relation (help_topic_id,help_keyword_id) values (558,554);
insert into help_relation (help_topic_id,help_keyword_id) values (558,511);
insert into help_relation (help_topic_id,help_keyword_id) values (558,185);
insert into help_relation (help_topic_id,help_keyword_id) values (559,554);
insert into help_relation (help_topic_id,help_keyword_id) values (559,511);
insert into help_relation (help_topic_id,help_keyword_id) values (559,571);
insert into help_relation (help_topic_id,help_keyword_id) values (559,572);
insert into help_relation (help_topic_id,help_keyword_id) values (560,554);
insert into help_relation (help_topic_id,help_keyword_id) values (560,511);
insert into help_relation (help_topic_id,help_keyword_id) values (560,571);
insert into help_relation (help_topic_id,help_keyword_id) values (561,554);
insert into help_relation (help_topic_id,help_keyword_id) values (561,511);
insert into help_relation (help_topic_id,help_keyword_id) values (561,327);
insert into help_relation (help_topic_id,help_keyword_id) values (562,554);
insert into help_relation (help_topic_id,help_keyword_id) values (562,511);
insert into help_relation (help_topic_id,help_keyword_id) values (562,573);
insert into help_relation (help_topic_id,help_keyword_id) values (563,554);
insert into help_relation (help_topic_id,help_keyword_id) values (563,511);
insert into help_relation (help_topic_id,help_keyword_id) values (563,62);
insert into help_relation (help_topic_id,help_keyword_id) values (564,554);
insert into help_relation (help_topic_id,help_keyword_id) values (564,511);
insert into help_relation (help_topic_id,help_keyword_id) values (564,574);
insert into help_relation (help_topic_id,help_keyword_id) values (565,554);
insert into help_relation (help_topic_id,help_keyword_id) values (565,511);
insert into help_relation (help_topic_id,help_keyword_id) values (565,575);
insert into help_relation (help_topic_id,help_keyword_id) values (566,554);
insert into help_relation (help_topic_id,help_keyword_id) values (566,511);
insert into help_relation (help_topic_id,help_keyword_id) values (566,123);
insert into help_relation (help_topic_id,help_keyword_id) values (567,554);
insert into help_relation (help_topic_id,help_keyword_id) values (567,511);
insert into help_relation (help_topic_id,help_keyword_id) values (567,576);
insert into help_relation (help_topic_id,help_keyword_id) values (568,554);
insert into help_relation (help_topic_id,help_keyword_id) values (568,577);
insert into help_relation (help_topic_id,help_keyword_id) values (569,554);
insert into help_relation (help_topic_id,help_keyword_id) values (569,578);
insert into help_relation (help_topic_id,help_keyword_id) values (569,579);
insert into help_relation (help_topic_id,help_keyword_id) values (569,100);
insert into help_relation (help_topic_id,help_keyword_id) values (570,554);
insert into help_relation (help_topic_id,help_keyword_id) values (570,578);
insert into help_relation (help_topic_id,help_keyword_id) values (571,554);
insert into help_relation (help_topic_id,help_keyword_id) values (571,580);
insert into help_relation (help_topic_id,help_keyword_id) values (572,554);
insert into help_relation (help_topic_id,help_keyword_id) values (572,581);
insert into help_relation (help_topic_id,help_keyword_id) values (573,554);
insert into help_relation (help_topic_id,help_keyword_id) values (573,566);
insert into help_relation (help_topic_id,help_keyword_id) values (574,554);
insert into help_relation (help_topic_id,help_keyword_id) values (574,526);
insert into help_relation (help_topic_id,help_keyword_id) values (575,554);
insert into help_relation (help_topic_id,help_keyword_id) values (575,185);
insert into help_relation (help_topic_id,help_keyword_id) values (575,582);
insert into help_relation (help_topic_id,help_keyword_id) values (576,554);
insert into help_relation (help_topic_id,help_keyword_id) values (576,185);
insert into help_relation (help_topic_id,help_keyword_id) values (576,100);
insert into help_relation (help_topic_id,help_keyword_id) values (577,554);
insert into help_relation (help_topic_id,help_keyword_id) values (577,583);
insert into help_relation (help_topic_id,help_keyword_id) values (578,554);
insert into help_relation (help_topic_id,help_keyword_id) values (578,584);
insert into help_relation (help_topic_id,help_keyword_id) values (579,554);
insert into help_relation (help_topic_id,help_keyword_id) values (579,536);
insert into help_relation (help_topic_id,help_keyword_id) values (580,554);
insert into help_relation (help_topic_id,help_keyword_id) values (580,579);
insert into help_relation (help_topic_id,help_keyword_id) values (580,100);
insert into help_relation (help_topic_id,help_keyword_id) values (580,585);
insert into help_relation (help_topic_id,help_keyword_id) values (581,554);
insert into help_relation (help_topic_id,help_keyword_id) values (581,60);
insert into help_relation (help_topic_id,help_keyword_id) values (582,554);
insert into help_relation (help_topic_id,help_keyword_id) values (582,586);
insert into help_relation (help_topic_id,help_keyword_id) values (582,539);
insert into help_relation (help_topic_id,help_keyword_id) values (583,554);
insert into help_relation (help_topic_id,help_keyword_id) values (583,571);
insert into help_relation (help_topic_id,help_keyword_id) values (583,572);
insert into help_relation (help_topic_id,help_keyword_id) values (583,100);
insert into help_relation (help_topic_id,help_keyword_id) values (584,554);
insert into help_relation (help_topic_id,help_keyword_id) values (584,571);
insert into help_relation (help_topic_id,help_keyword_id) values (584,100);
insert into help_relation (help_topic_id,help_keyword_id) values (585,554);
insert into help_relation (help_topic_id,help_keyword_id) values (585,587);
insert into help_relation (help_topic_id,help_keyword_id) values (585,545);
insert into help_relation (help_topic_id,help_keyword_id) values (586,554);
insert into help_relation (help_topic_id,help_keyword_id) values (586,587);
insert into help_relation (help_topic_id,help_keyword_id) values (587,554);
insert into help_relation (help_topic_id,help_keyword_id) values (587,588);
insert into help_relation (help_topic_id,help_keyword_id) values (588,554);
insert into help_relation (help_topic_id,help_keyword_id) values (588,327);
insert into help_relation (help_topic_id,help_keyword_id) values (588,582);
insert into help_relation (help_topic_id,help_keyword_id) values (589,554);
insert into help_relation (help_topic_id,help_keyword_id) values (589,327);
insert into help_relation (help_topic_id,help_keyword_id) values (589,100);
insert into help_relation (help_topic_id,help_keyword_id) values (590,554);
insert into help_relation (help_topic_id,help_keyword_id) values (590,589);
insert into help_relation (help_topic_id,help_keyword_id) values (591,554);
insert into help_relation (help_topic_id,help_keyword_id) values (591,590);
insert into help_relation (help_topic_id,help_keyword_id) values (592,554);
insert into help_relation (help_topic_id,help_keyword_id) values (592,591);
insert into help_relation (help_topic_id,help_keyword_id) values (593,554);
insert into help_relation (help_topic_id,help_keyword_id) values (593,592);
insert into help_relation (help_topic_id,help_keyword_id) values (594,554);
insert into help_relation (help_topic_id,help_keyword_id) values (594,593);
insert into help_relation (help_topic_id,help_keyword_id) values (594,566);
insert into help_relation (help_topic_id,help_keyword_id) values (595,554);
insert into help_relation (help_topic_id,help_keyword_id) values (595,558);
insert into help_relation (help_topic_id,help_keyword_id) values (595,555);
insert into help_relation (help_topic_id,help_keyword_id) values (596,554);
insert into help_relation (help_topic_id,help_keyword_id) values (596,558);
insert into help_relation (help_topic_id,help_keyword_id) values (596,100);
insert into help_relation (help_topic_id,help_keyword_id) values (597,554);
insert into help_relation (help_topic_id,help_keyword_id) values (597,100);
insert into help_relation (help_topic_id,help_keyword_id) values (598,554);
insert into help_relation (help_topic_id,help_keyword_id) values (598,594);
insert into help_relation (help_topic_id,help_keyword_id) values (599,554);
insert into help_relation (help_topic_id,help_keyword_id) values (599,574);
insert into help_relation (help_topic_id,help_keyword_id) values (599,100);
insert into help_relation (help_topic_id,help_keyword_id) values (600,554);
insert into help_relation (help_topic_id,help_keyword_id) values (600,539);
insert into help_relation (help_topic_id,help_keyword_id) values (601,554);
insert into help_relation (help_topic_id,help_keyword_id) values (601,595);
insert into help_relation (help_topic_id,help_keyword_id) values (602,554);
insert into help_relation (help_topic_id,help_keyword_id) values (602,596);
insert into help_relation (help_topic_id,help_keyword_id) values (603,554);
insert into help_relation (help_topic_id,help_keyword_id) values (603,597);
insert into help_relation (help_topic_id,help_keyword_id) values (604,554);
insert into help_relation (help_topic_id,help_keyword_id) values (604,101);
insert into help_relation (help_topic_id,help_keyword_id) values (605,554);
insert into help_relation (help_topic_id,help_keyword_id) values (605,598);
insert into help_relation (help_topic_id,help_keyword_id) values (606,554);
insert into help_relation (help_topic_id,help_keyword_id) values (606,599);
insert into help_relation (help_topic_id,help_keyword_id) values (607,554);
insert into help_relation (help_topic_id,help_keyword_id) values (607,600);
insert into help_relation (help_topic_id,help_keyword_id) values (608,601);
insert into help_relation (help_topic_id,help_keyword_id) values (609,602);
insert into help_relation (help_topic_id,help_keyword_id) values (609,603);
insert into help_relation (help_topic_id,help_keyword_id) values (610,604);
insert into help_relation (help_topic_id,help_keyword_id) values (610,605);
insert into help_relation (help_topic_id,help_keyword_id) values (611,510);
insert into help_relation (help_topic_id,help_keyword_id) values (611,321);
insert into help_relation (help_topic_id,help_keyword_id) values (612,510);
insert into help_relation (help_topic_id,help_keyword_id) values (612,185);
insert into help_relation (help_topic_id,help_keyword_id) values (613,510);
insert into help_relation (help_topic_id,help_keyword_id) values (613,606);
insert into help_relation (help_topic_id,help_keyword_id) values (613,127);
insert into help_relation (help_topic_id,help_keyword_id) values (614,510);
insert into help_relation (help_topic_id,help_keyword_id) values (614,62);
insert into help_relation (help_topic_id,help_keyword_id) values (615,510);
insert into help_relation (help_topic_id,help_keyword_id) values (615,574);
insert into help_relation (help_topic_id,help_keyword_id) values (616,607);
insert into help_relation (help_topic_id,help_keyword_id) values (616,331);
insert into help_relation (help_topic_id,help_keyword_id) values (616,549);
insert into help_relation (help_topic_id,help_keyword_id) values (617,510);
insert into help_relation (help_topic_id,help_keyword_id) values (617,608);
insert into help_relation (help_topic_id,help_keyword_id) values (618,609);
insert into help_relation (help_topic_id,help_keyword_id) values (618,610);
insert into help_relation (help_topic_id,help_keyword_id) values (619,611);
insert into help_relation (help_topic_id,help_keyword_id) values (620,511);
insert into help_relation (help_topic_id,help_keyword_id) values (621,511);
insert into help_relation (help_topic_id,help_keyword_id) values (621,321);
insert into help_relation (help_topic_id,help_keyword_id) values (622,511);
insert into help_relation (help_topic_id,help_keyword_id) values (622,570);
insert into help_relation (help_topic_id,help_keyword_id) values (623,511);
insert into help_relation (help_topic_id,help_keyword_id) values (623,185);
insert into help_relation (help_topic_id,help_keyword_id) values (624,511);
insert into help_relation (help_topic_id,help_keyword_id) values (624,536);
insert into help_relation (help_topic_id,help_keyword_id) values (625,511);
insert into help_relation (help_topic_id,help_keyword_id) values (625,606);
insert into help_relation (help_topic_id,help_keyword_id) values (625,127);
insert into help_relation (help_topic_id,help_keyword_id) values (626,511);
insert into help_relation (help_topic_id,help_keyword_id) values (626,571);
insert into help_relation (help_topic_id,help_keyword_id) values (626,572);
insert into help_relation (help_topic_id,help_keyword_id) values (627,511);
insert into help_relation (help_topic_id,help_keyword_id) values (627,571);
insert into help_relation (help_topic_id,help_keyword_id) values (628,511);
insert into help_relation (help_topic_id,help_keyword_id) values (628,62);
insert into help_relation (help_topic_id,help_keyword_id) values (629,511);
insert into help_relation (help_topic_id,help_keyword_id) values (629,574);
insert into help_relation (help_topic_id,help_keyword_id) values (630,511);
insert into help_relation (help_topic_id,help_keyword_id) values (630,608);
insert into help_relation (help_topic_id,help_keyword_id) values (631,612);
insert into help_relation (help_topic_id,help_keyword_id) values (631,568);
insert into help_relation (help_topic_id,help_keyword_id) values (632,613);
insert into help_relation (help_topic_id,help_keyword_id) values (632,568);
insert into help_relation (help_topic_id,help_keyword_id) values (633,614);
insert into help_relation (help_topic_id,help_keyword_id) values (633,615);
insert into help_relation (help_topic_id,help_keyword_id) values (633,616);
insert into help_relation (help_topic_id,help_keyword_id) values (634,513);
insert into help_relation (help_topic_id,help_keyword_id) values (634,321);
insert into help_relation (help_topic_id,help_keyword_id) values (635,513);
insert into help_relation (help_topic_id,help_keyword_id) values (635,570);
insert into help_relation (help_topic_id,help_keyword_id) values (636,513);
insert into help_relation (help_topic_id,help_keyword_id) values (636,536);
insert into help_relation (help_topic_id,help_keyword_id) values (637,513);
insert into help_relation (help_topic_id,help_keyword_id) values (637,606);
insert into help_relation (help_topic_id,help_keyword_id) values (637,127);
insert into help_relation (help_topic_id,help_keyword_id) values (638,513);
insert into help_relation (help_topic_id,help_keyword_id) values (638,571);
insert into help_relation (help_topic_id,help_keyword_id) values (638,572);
insert into help_relation (help_topic_id,help_keyword_id) values (639,513);
insert into help_relation (help_topic_id,help_keyword_id) values (639,571);
insert into help_relation (help_topic_id,help_keyword_id) values (640,513);
insert into help_relation (help_topic_id,help_keyword_id) values (640,62);
insert into help_relation (help_topic_id,help_keyword_id) values (641,513);
insert into help_relation (help_topic_id,help_keyword_id) values (641,574);
insert into help_relation (help_topic_id,help_keyword_id) values (642,513);
insert into help_relation (help_topic_id,help_keyword_id) values (642,608);
insert into help_relation (help_topic_id,help_keyword_id) values (643,513);
insert into help_relation (help_topic_id,help_keyword_id) values (643,575);
insert into help_relation (help_topic_id,help_keyword_id) values (644,515);
insert into help_relation (help_topic_id,help_keyword_id) values (644,574);
insert into help_relation (help_topic_id,help_keyword_id) values (645,617);
insert into help_relation (help_topic_id,help_keyword_id) values (645,577);
insert into help_relation (help_topic_id,help_keyword_id) values (646,618);
insert into help_relation (help_topic_id,help_keyword_id) values (647,619);
insert into help_relation (help_topic_id,help_keyword_id) values (647,49);
insert into help_relation (help_topic_id,help_keyword_id) values (647,620);
insert into help_relation (help_topic_id,help_keyword_id) values (648,480);
insert into help_relation (help_topic_id,help_keyword_id) values (649,621);
insert into help_relation (help_topic_id,help_keyword_id) values (650,529);
insert into help_relation (help_topic_id,help_keyword_id) values (651,622);
insert into help_relation (help_topic_id,help_keyword_id) values (651,623);
insert into help_relation (help_topic_id,help_keyword_id) values (652,624);
insert into help_relation (help_topic_id,help_keyword_id) values (653,448);
insert into help_relation (help_topic_id,help_keyword_id) values (653,103);
insert into help_relation (help_topic_id,help_keyword_id) values (653,323);
insert into help_relation (help_topic_id,help_keyword_id) values (653,99);
insert into help_relation (help_topic_id,help_keyword_id) values (653,625);
insert into help_relation (help_topic_id,help_keyword_id) values (653,13);
insert into help_relation (help_topic_id,help_keyword_id) values (654,448);
insert into help_relation (help_topic_id,help_keyword_id) values (654,626);
insert into help_relation (help_topic_id,help_keyword_id) values (655,448);
insert into help_relation (help_topic_id,help_keyword_id) values (655,624);
insert into help_relation (help_topic_id,help_keyword_id) values (656,448);
insert into help_relation (help_topic_id,help_keyword_id) values (656,627);
insert into help_relation (help_topic_id,help_keyword_id) values (656,625);
insert into help_relation (help_topic_id,help_keyword_id) values (656,628);
insert into help_relation (help_topic_id,help_keyword_id) values (656,529);
insert into help_relation (help_topic_id,help_keyword_id) values (657,448);
insert into help_relation (help_topic_id,help_keyword_id) values (657,629);
insert into help_relation (help_topic_id,help_keyword_id) values (658,448);
insert into help_relation (help_topic_id,help_keyword_id) values (659,630);
insert into help_relation (help_topic_id,help_keyword_id) values (660,631);
insert into help_relation (help_topic_id,help_keyword_id) values (660,2);
insert into help_relation (help_topic_id,help_keyword_id) values (660,632);
insert into help_relation (help_topic_id,help_keyword_id) values (661,631);
insert into help_relation (help_topic_id,help_keyword_id) values (661,536);
insert into help_relation (help_topic_id,help_keyword_id) values (662,631);
insert into help_relation (help_topic_id,help_keyword_id) values (662,633);
insert into help_relation (help_topic_id,help_keyword_id) values (663,634);
insert into help_relation (help_topic_id,help_keyword_id) values (663,635);
insert into help_relation (help_topic_id,help_keyword_id) values (663,574);
insert into help_relation (help_topic_id,help_keyword_id) values (663,414);
insert into help_relation (help_topic_id,help_keyword_id) values (663,39);
insert into help_relation (help_topic_id,help_keyword_id) values (664,636);
insert into help_relation (help_topic_id,help_keyword_id) values (664,635);
insert into help_relation (help_topic_id,help_keyword_id) values (664,574);
insert into help_relation (help_topic_id,help_keyword_id) values (664,414);
insert into help_relation (help_topic_id,help_keyword_id) values (664,39);
insert into help_relation (help_topic_id,help_keyword_id) values (665,116);
insert into help_relation (help_topic_id,help_keyword_id) values (666,637);
insert into help_relation (help_topic_id,help_keyword_id) values (667,67);
insert into help_relation (help_topic_id,help_keyword_id) values (667,529);
insert into help_relation (help_topic_id,help_keyword_id) values (668,127);
insert into help_relation (help_topic_id,help_keyword_id) values (668,638);
insert into help_relation (help_topic_id,help_keyword_id) values (669,639);
insert into help_relation (help_topic_id,help_keyword_id) values (669,640);
insert into help_relation (help_topic_id,help_keyword_id) values (670,641);
insert into help_relation (help_topic_id,help_keyword_id) values (671,641);
insert into help_relation (help_topic_id,help_keyword_id) values (671,49);
insert into help_relation (help_topic_id,help_keyword_id) values (671,642);
insert into help_relation (help_topic_id,help_keyword_id) values (672,641);
insert into help_relation (help_topic_id,help_keyword_id) values (672,116);
insert into help_relation (help_topic_id,help_keyword_id) values (672,643);
insert into help_relation (help_topic_id,help_keyword_id) values (672,49);
insert into help_relation (help_topic_id,help_keyword_id) values (672,644);
insert into help_relation (help_topic_id,help_keyword_id) values (673,641);
insert into help_relation (help_topic_id,help_keyword_id) values (673,49);
insert into help_relation (help_topic_id,help_keyword_id) values (673,645);
insert into help_relation (help_topic_id,help_keyword_id) values (674,641);
insert into help_relation (help_topic_id,help_keyword_id) values (674,49);
insert into help_relation (help_topic_id,help_keyword_id) values (674,640);
insert into help_relation (help_topic_id,help_keyword_id) values (675,641);
insert into help_relation (help_topic_id,help_keyword_id) values (675,222);
insert into help_relation (help_topic_id,help_keyword_id) values (675,646);
insert into help_relation (help_topic_id,help_keyword_id) values (675,647);
insert into help_relation (help_topic_id,help_keyword_id) values (675,648);
insert into help_relation (help_topic_id,help_keyword_id) values (675,649);
insert into help_relation (help_topic_id,help_keyword_id) values (675,650);
insert into help_relation (help_topic_id,help_keyword_id) values (676,44);
insert into help_relation (help_topic_id,help_keyword_id) values (676,641);
insert into help_relation (help_topic_id,help_keyword_id) values (677,651);
insert into help_relation (help_topic_id,help_keyword_id) values (677,641);
insert into help_relation (help_topic_id,help_keyword_id) values (678,652);
insert into help_relation (help_topic_id,help_keyword_id) values (678,653);
insert into help_relation (help_topic_id,help_keyword_id) values (679,640);
insert into help_relation (help_topic_id,help_keyword_id) values (680,654);
insert into help_relation (help_topic_id,help_keyword_id) values (680,655);
insert into help_relation (help_topic_id,help_keyword_id) values (680,656);
insert into help_relation (help_topic_id,help_keyword_id) values (681,656);
insert into help_relation (help_topic_id,help_keyword_id) values (681,605);
insert into help_relation (help_topic_id,help_keyword_id) values (682,657);
insert into help_relation (help_topic_id,help_keyword_id) values (683,532);
insert into help_relation (help_topic_id,help_keyword_id) values (683,222);
insert into help_relation (help_topic_id,help_keyword_id) values (683,658);
insert into help_relation (help_topic_id,help_keyword_id) values (683,659);
insert into help_relation (help_topic_id,help_keyword_id) values (684,660);
insert into help_relation (help_topic_id,help_keyword_id) values (684,638);
insert into help_relation (help_topic_id,help_keyword_id) values (685,327);
insert into help_relation (help_topic_id,help_keyword_id) values (686,629);
insert into help_relation (help_topic_id,help_keyword_id) values (686,661);
insert into help_relation (help_topic_id,help_keyword_id) values (686,662);
insert into help_relation (help_topic_id,help_keyword_id) values (687,629);
insert into help_relation (help_topic_id,help_keyword_id) values (687,661);
insert into help_relation (help_topic_id,help_keyword_id) values (687,663);
insert into help_relation (help_topic_id,help_keyword_id) values (688,629);
insert into help_relation (help_topic_id,help_keyword_id) values (688,664);
insert into help_relation (help_topic_id,help_keyword_id) values (688,665);
insert into help_relation (help_topic_id,help_keyword_id) values (688,666);
insert into help_relation (help_topic_id,help_keyword_id) values (689,629);
insert into help_relation (help_topic_id,help_keyword_id) values (689,116);
insert into help_relation (help_topic_id,help_keyword_id) values (689,667);
insert into help_relation (help_topic_id,help_keyword_id) values (690,629);
insert into help_relation (help_topic_id,help_keyword_id) values (691,668);
insert into help_relation (help_topic_id,help_keyword_id) values (692,669);
insert into help_relation (help_topic_id,help_keyword_id) values (693,670);
insert into help_relation (help_topic_id,help_keyword_id) values (694,671);
insert into help_relation (help_topic_id,help_keyword_id) values (694,672);
insert into help_relation (help_topic_id,help_keyword_id) values (694,222);
insert into help_relation (help_topic_id,help_keyword_id) values (694,574);
insert into help_relation (help_topic_id,help_keyword_id) values (694,673);
insert into help_relation (help_topic_id,help_keyword_id) values (695,674);
insert into help_relation (help_topic_id,help_keyword_id) values (696,641);
insert into help_relation (help_topic_id,help_keyword_id) values (696,116);
insert into help_relation (help_topic_id,help_keyword_id) values (696,222);
insert into help_relation (help_topic_id,help_keyword_id) values (696,49);
insert into help_relation (help_topic_id,help_keyword_id) values (696,465);
insert into help_relation (help_topic_id,help_keyword_id) values (697,528);
insert into help_relation (help_topic_id,help_keyword_id) values (698,675);
insert into help_relation (help_topic_id,help_keyword_id) values (699,676);
insert into help_relation (help_topic_id,help_keyword_id) values (700,677);
insert into help_relation (help_topic_id,help_keyword_id) values (701,678);
insert into help_relation (help_topic_id,help_keyword_id) values (702,679);
insert into help_relation (help_topic_id,help_keyword_id) values (703,680);
insert into help_relation (help_topic_id,help_keyword_id) values (704,681);
insert into help_relation (help_topic_id,help_keyword_id) values (705,682);
insert into help_relation (help_topic_id,help_keyword_id) values (706,683);
insert into help_relation (help_topic_id,help_keyword_id) values (707,684);
insert into help_relation (help_topic_id,help_keyword_id) values (708,685);
insert into help_relation (help_topic_id,help_keyword_id) values (709,686);
insert into help_relation (help_topic_id,help_keyword_id) values (710,687);
insert into help_relation (help_topic_id,help_keyword_id) values (711,688);
insert into help_relation (help_topic_id,help_keyword_id) values (712,689);
insert into help_relation (help_topic_id,help_keyword_id) values (713,690);
insert into help_relation (help_topic_id,help_keyword_id) values (714,691);
insert into help_relation (help_topic_id,help_keyword_id) values (715,692);
insert into help_relation (help_topic_id,help_keyword_id) values (716,693);
insert into help_relation (help_topic_id,help_keyword_id) values (717,694);
insert into help_relation (help_topic_id,help_keyword_id) values (718,695);
insert into help_relation (help_topic_id,help_keyword_id) values (719,696);
insert into help_relation (help_topic_id,help_keyword_id) values (720,697);
insert into help_relation (help_topic_id,help_keyword_id) values (721,698);
insert into help_relation (help_topic_id,help_keyword_id) values (722,699);
insert into help_relation (help_topic_id,help_keyword_id) values (723,700);
insert into help_relation (help_topic_id,help_keyword_id) values (724,701);
insert into help_relation (help_topic_id,help_keyword_id) values (725,702);
insert into help_relation (help_topic_id,help_keyword_id) values (726,703);
insert into help_relation (help_topic_id,help_keyword_id) values (727,704);
insert into help_relation (help_topic_id,help_keyword_id) values (728,705);
insert into help_relation (help_topic_id,help_keyword_id) values (729,706);
insert into help_relation (help_topic_id,help_keyword_id) values (730,707);
insert into help_relation (help_topic_id,help_keyword_id) values (731,708);
insert into help_relation (help_topic_id,help_keyword_id) values (732,709);
insert into help_relation (help_topic_id,help_keyword_id) values (733,710);
insert into help_relation (help_topic_id,help_keyword_id) values (734,711);
insert into help_relation (help_topic_id,help_keyword_id) values (735,712);
insert into help_relation (help_topic_id,help_keyword_id) values (736,713);
insert into help_relation (help_topic_id,help_keyword_id) values (737,714);
insert into help_relation (help_topic_id,help_keyword_id) values (738,715);
insert into help_relation (help_topic_id,help_keyword_id) values (739,716);
insert into help_relation (help_topic_id,help_keyword_id) values (740,717);
insert into help_relation (help_topic_id,help_keyword_id) values (741,718);
insert into help_relation (help_topic_id,help_keyword_id) values (742,719);
insert into help_relation (help_topic_id,help_keyword_id) values (743,720);
insert into help_relation (help_topic_id,help_keyword_id) values (744,721);
insert into help_relation (help_topic_id,help_keyword_id) values (745,722);
insert into help_relation (help_topic_id,help_keyword_id) values (746,723);
insert into help_relation (help_topic_id,help_keyword_id) values (747,724);
insert into help_relation (help_topic_id,help_keyword_id) values (748,725);
insert into help_relation (help_topic_id,help_keyword_id) values (749,726);
insert into help_relation (help_topic_id,help_keyword_id) values (750,727);
insert into help_relation (help_topic_id,help_keyword_id) values (751,728);
insert into help_relation (help_topic_id,help_keyword_id) values (752,729);
insert into help_relation (help_topic_id,help_keyword_id) values (753,730);
insert into help_relation (help_topic_id,help_keyword_id) values (754,731);
insert into help_relation (help_topic_id,help_keyword_id) values (755,732);
insert into help_relation (help_topic_id,help_keyword_id) values (756,733);
insert into help_relation (help_topic_id,help_keyword_id) values (757,734);
insert into help_relation (help_topic_id,help_keyword_id) values (758,735);
insert into help_relation (help_topic_id,help_keyword_id) values (759,736);
insert into help_relation (help_topic_id,help_keyword_id) values (760,737);
insert into help_relation (help_topic_id,help_keyword_id) values (761,738);
insert into help_relation (help_topic_id,help_keyword_id) values (762,739);
insert into help_relation (help_topic_id,help_keyword_id) values (763,740);
insert into help_relation (help_topic_id,help_keyword_id) values (764,741);
insert into help_relation (help_topic_id,help_keyword_id) values (765,742);
insert into help_relation (help_topic_id,help_keyword_id) values (766,743);
insert into help_relation (help_topic_id,help_keyword_id) values (767,744);
insert into help_relation (help_topic_id,help_keyword_id) values (767,745);
insert into help_relation (help_topic_id,help_keyword_id) values (768,746);
insert into help_relation (help_topic_id,help_keyword_id) values (769,747);
insert into help_relation (help_topic_id,help_keyword_id) values (770,748);
insert into help_relation (help_topic_id,help_keyword_id) values (771,749);
insert into help_relation (help_topic_id,help_keyword_id) values (772,750);
insert into help_relation (help_topic_id,help_keyword_id) values (773,751);
insert into help_relation (help_topic_id,help_keyword_id) values (774,752);
insert into help_relation (help_topic_id,help_keyword_id) values (775,753);
insert into help_relation (help_topic_id,help_keyword_id) values (776,754);
insert into help_relation (help_topic_id,help_keyword_id) values (777,755);
insert into help_relation (help_topic_id,help_keyword_id) values (778,756);
insert into help_relation (help_topic_id,help_keyword_id) values (779,757);
insert into help_relation (help_topic_id,help_keyword_id) values (780,758);
insert into help_relation (help_topic_id,help_keyword_id) values (781,759);
insert into help_relation (help_topic_id,help_keyword_id) values (782,760);
insert into help_relation (help_topic_id,help_keyword_id) values (783,761);
insert into help_relation (help_topic_id,help_keyword_id) values (784,762);
insert into help_relation (help_topic_id,help_keyword_id) values (785,763);
insert into help_relation (help_topic_id,help_keyword_id) values (786,764);
insert into help_relation (help_topic_id,help_keyword_id) values (787,765);
insert into help_relation (help_topic_id,help_keyword_id) values (788,766);
insert into help_relation (help_topic_id,help_keyword_id) values (789,767);
insert into help_relation (help_topic_id,help_keyword_id) values (790,768);
insert into help_relation (help_topic_id,help_keyword_id) values (791,769);
insert into help_relation (help_topic_id,help_keyword_id) values (792,770);
insert into help_relation (help_topic_id,help_keyword_id) values (793,771);
insert into help_relation (help_topic_id,help_keyword_id) values (794,772);
insert into help_relation (help_topic_id,help_keyword_id) values (795,773);
insert into help_relation (help_topic_id,help_keyword_id) values (796,774);
insert into help_relation (help_topic_id,help_keyword_id) values (797,775);
insert into help_relation (help_topic_id,help_keyword_id) values (798,776);
insert into help_relation (help_topic_id,help_keyword_id) values (799,777);
insert into help_relation (help_topic_id,help_keyword_id) values (800,778);
insert into help_relation (help_topic_id,help_keyword_id) values (801,779);
insert into help_relation (help_topic_id,help_keyword_id) values (802,780);
insert into help_relation (help_topic_id,help_keyword_id) values (803,781);
insert into help_relation (help_topic_id,help_keyword_id) values (804,782);
insert into help_relation (help_topic_id,help_keyword_id) values (805,783);
insert into help_relation (help_topic_id,help_keyword_id) values (806,784);
insert into help_relation (help_topic_id,help_keyword_id) values (807,785);
insert into help_relation (help_topic_id,help_keyword_id) values (808,786);
insert into help_relation (help_topic_id,help_keyword_id) values (809,787);
insert into help_relation (help_topic_id,help_keyword_id) values (810,788);
insert into help_relation (help_topic_id,help_keyword_id) values (811,789);
insert into help_relation (help_topic_id,help_keyword_id) values (812,790);
insert into help_relation (help_topic_id,help_keyword_id) values (813,791);
insert into help_relation (help_topic_id,help_keyword_id) values (814,792);
insert into help_relation (help_topic_id,help_keyword_id) values (815,793);
insert into help_relation (help_topic_id,help_keyword_id) values (816,794);
insert into help_relation (help_topic_id,help_keyword_id) values (817,795);
insert into help_relation (help_topic_id,help_keyword_id) values (818,796);
insert into help_relation (help_topic_id,help_keyword_id) values (819,797);
insert into help_relation (help_topic_id,help_keyword_id) values (820,798);
insert into help_relation (help_topic_id,help_keyword_id) values (821,799);
insert into help_relation (help_topic_id,help_keyword_id) values (822,800);
insert into help_relation (help_topic_id,help_keyword_id) values (823,801);
insert into help_relation (help_topic_id,help_keyword_id) values (824,802);
insert into help_relation (help_topic_id,help_keyword_id) values (824,47);
insert into help_relation (help_topic_id,help_keyword_id) values (824,803);
insert into help_relation (help_topic_id,help_keyword_id) values (824,137);
insert into help_relation (help_topic_id,help_keyword_id) values (825,804);
insert into help_relation (help_topic_id,help_keyword_id) values (826,805);
insert into help_relation (help_topic_id,help_keyword_id) values (827,806);
insert into help_relation (help_topic_id,help_keyword_id) values (828,807);
insert into help_relation (help_topic_id,help_keyword_id) values (829,808);
insert into help_relation (help_topic_id,help_keyword_id) values (830,809);
insert into help_relation (help_topic_id,help_keyword_id) values (831,810);
insert into help_relation (help_topic_id,help_keyword_id) values (832,811);
insert into help_relation (help_topic_id,help_keyword_id) values (833,812);
insert into help_relation (help_topic_id,help_keyword_id) values (834,813);
insert into help_relation (help_topic_id,help_keyword_id) values (835,814);
insert into help_relation (help_topic_id,help_keyword_id) values (836,815);
insert into help_relation (help_topic_id,help_keyword_id) values (837,816);
insert into help_relation (help_topic_id,help_keyword_id) values (838,817);
insert into help_relation (help_topic_id,help_keyword_id) values (839,818);
insert into help_relation (help_topic_id,help_keyword_id) values (840,819);
insert into help_relation (help_topic_id,help_keyword_id) values (841,820);
insert into help_relation (help_topic_id,help_keyword_id) values (842,821);
insert into help_relation (help_topic_id,help_keyword_id) values (843,822);
insert into help_relation (help_topic_id,help_keyword_id) values (844,823);
insert into help_relation (help_topic_id,help_keyword_id) values (845,824);
insert into help_relation (help_topic_id,help_keyword_id) values (846,825);
insert into help_relation (help_topic_id,help_keyword_id) values (847,826);
insert into help_relation (help_topic_id,help_keyword_id) values (848,827);
insert into help_relation (help_topic_id,help_keyword_id) values (849,828);
insert into help_relation (help_topic_id,help_keyword_id) values (850,829);
insert into help_relation (help_topic_id,help_keyword_id) values (851,830);
insert into help_relation (help_topic_id,help_keyword_id) values (852,831);
insert into help_relation (help_topic_id,help_keyword_id) values (853,832);
insert into help_relation (help_topic_id,help_keyword_id) values (854,833);
insert into help_relation (help_topic_id,help_keyword_id) values (855,834);
insert into help_relation (help_topic_id,help_keyword_id) values (856,835);
insert into help_relation (help_topic_id,help_keyword_id) values (857,836);
insert into help_relation (help_topic_id,help_keyword_id) values (858,837);
insert into help_relation (help_topic_id,help_keyword_id) values (859,838);
insert into help_relation (help_topic_id,help_keyword_id) values (859,745);
insert into help_relation (help_topic_id,help_keyword_id) values (860,839);
insert into help_relation (help_topic_id,help_keyword_id) values (861,840);
insert into help_relation (help_topic_id,help_keyword_id) values (862,841);
insert into help_relation (help_topic_id,help_keyword_id) values (863,842);
insert into help_relation (help_topic_id,help_keyword_id) values (864,843);
insert into help_relation (help_topic_id,help_keyword_id) values (865,844);
insert into help_relation (help_topic_id,help_keyword_id) values (866,845);
insert into help_relation (help_topic_id,help_keyword_id) values (866,513);
insert into help_relation (help_topic_id,help_keyword_id) values (866,846);
insert into help_relation (help_topic_id,help_keyword_id) values (867,847);
insert into help_relation (help_topic_id,help_keyword_id) values (867,848);
insert into help_relation (help_topic_id,help_keyword_id) values (868,847);
insert into help_relation (help_topic_id,help_keyword_id) values (868,525);
insert into help_relation (help_topic_id,help_keyword_id) values (869,846);
insert into help_relation (help_topic_id,help_keyword_id) values (869,525);
insert into help_relation (help_topic_id,help_keyword_id) values (870,849);
insert into help_relation (help_topic_id,help_keyword_id) values (870,850);
insert into help_relation (help_topic_id,help_keyword_id) values (871,181);
insert into help_relation (help_topic_id,help_keyword_id) values (871,525);
insert into help_relation (help_topic_id,help_keyword_id) values (872,851);
insert into help_relation (help_topic_id,help_keyword_id) values (872,852);
insert into help_relation (help_topic_id,help_keyword_id) values (873,851);
insert into help_relation (help_topic_id,help_keyword_id) values (873,853);
insert into help_relation (help_topic_id,help_keyword_id) values (874,851);
insert into help_relation (help_topic_id,help_keyword_id) values (874,3);
insert into help_relation (help_topic_id,help_keyword_id) values (875,851);
insert into help_relation (help_topic_id,help_keyword_id) values (875,160);
insert into help_relation (help_topic_id,help_keyword_id) values (876,67);
insert into help_relation (help_topic_id,help_keyword_id) values (877,854);
insert into help_relation (help_topic_id,help_keyword_id) values (878,184);
insert into help_relation (help_topic_id,help_keyword_id) values (879,855);
insert into help_relation (help_topic_id,help_keyword_id) values (880,856);
insert into help_relation (help_topic_id,help_keyword_id) values (881,857);
insert into help_relation (help_topic_id,help_keyword_id) values (882,858);
insert into help_relation (help_topic_id,help_keyword_id) values (883,859);
insert into help_relation (help_topic_id,help_keyword_id) values (884,860);
insert into help_relation (help_topic_id,help_keyword_id) values (884,39);
insert into help_relation (help_topic_id,help_keyword_id) values (885,851);
insert into help_relation (help_topic_id,help_keyword_id) values (885,860);
insert into help_relation (help_topic_id,help_keyword_id) values (886,666);
insert into help_relation (help_topic_id,help_keyword_id) values (887,586);
insert into help_relation (help_topic_id,help_keyword_id) values (888,861);
insert into help_relation (help_topic_id,help_keyword_id) values (888,767);
insert into help_relation (help_topic_id,help_keyword_id) values (889,862);
insert into help_relation (help_topic_id,help_keyword_id) values (889,861);
insert into help_relation (help_topic_id,help_keyword_id) values (890,863);
insert into help_relation (help_topic_id,help_keyword_id) values (891,479);
insert into help_relation (help_topic_id,help_keyword_id) values (891,858);
insert into help_relation (help_topic_id,help_keyword_id) values (892,864);
insert into help_relation (help_topic_id,help_keyword_id) values (893,865);
insert into help_relation (help_topic_id,help_keyword_id) values (894,629);
insert into help_relation (help_topic_id,help_keyword_id) values (894,661);
insert into help_relation (help_topic_id,help_keyword_id) values (895,56);
insert into help_relation (help_topic_id,help_keyword_id) values (895,160);
insert into help_relation (help_topic_id,help_keyword_id) values (896,866);
insert into help_relation (help_topic_id,help_keyword_id) values (897,527);
insert into help_relation (help_topic_id,help_keyword_id) values (897,867);
insert into help_relation (help_topic_id,help_keyword_id) values (897,509);
insert into help_relation (help_topic_id,help_keyword_id) values (897,868);
insert into help_relation (help_topic_id,help_keyword_id) values (897,45);
insert into help_relation (help_topic_id,help_keyword_id) values (897,869);
insert into help_relation (help_topic_id,help_keyword_id) values (897,870);
insert into help_relation (help_topic_id,help_keyword_id) values (898,871);
insert into help_relation (help_topic_id,help_keyword_id) values (899,869);
insert into help_relation (help_topic_id,help_keyword_id) values (899,872);
insert into help_relation (help_topic_id,help_keyword_id) values (899,509);
insert into help_relation (help_topic_id,help_keyword_id) values (900,873);
insert into help_relation (help_topic_id,help_keyword_id) values (901,874);
insert into help_relation (help_topic_id,help_keyword_id) values (902,574);
insert into help_relation (help_topic_id,help_keyword_id) values (902,509);
insert into help_relation (help_topic_id,help_keyword_id) values (903,517);
insert into help_relation (help_topic_id,help_keyword_id) values (903,574);
insert into help_relation (help_topic_id,help_keyword_id) values (904,156);
insert into help_relation (help_topic_id,help_keyword_id) values (904,574);
insert into help_relation (help_topic_id,help_keyword_id) values (905,156);
insert into help_relation (help_topic_id,help_keyword_id) values (905,576);
insert into help_relation (help_topic_id,help_keyword_id) values (906,875);
insert into help_relation (help_topic_id,help_keyword_id) values (906,574);
insert into help_relation (help_topic_id,help_keyword_id) values (907,531);
insert into help_relation (help_topic_id,help_keyword_id) values (907,574);
insert into help_relation (help_topic_id,help_keyword_id) values (907,585);
insert into help_relation (help_topic_id,help_keyword_id) values (908,876);
insert into help_relation (help_topic_id,help_keyword_id) values (908,574);
insert into help_relation (help_topic_id,help_keyword_id) values (908,585);
insert into help_relation (help_topic_id,help_keyword_id) values (909,877);
insert into help_relation (help_topic_id,help_keyword_id) values (909,574);
insert into help_relation (help_topic_id,help_keyword_id) values (910,877);
insert into help_relation (help_topic_id,help_keyword_id) values (910,576);
insert into help_relation (help_topic_id,help_keyword_id) values (911,287);
insert into help_relation (help_topic_id,help_keyword_id) values (911,574);
insert into help_relation (help_topic_id,help_keyword_id) values (912,878);
insert into help_relation (help_topic_id,help_keyword_id) values (913,532);
insert into help_relation (help_topic_id,help_keyword_id) values (913,539);
insert into help_relation (help_topic_id,help_keyword_id) values (914,879);
insert into help_relation (help_topic_id,help_keyword_id) values (914,880);
insert into help_relation (help_topic_id,help_keyword_id) values (915,881);
insert into help_relation (help_topic_id,help_keyword_id) values (916,882);
insert into help_relation (help_topic_id,help_keyword_id) values (917,56);
insert into help_relation (help_topic_id,help_keyword_id) values (917,883);
insert into help_relation (help_topic_id,help_keyword_id) values (918,508);
insert into help_relation (help_topic_id,help_keyword_id) values (918,509);
insert into help_relation (help_topic_id,help_keyword_id) values (918,884);
insert into help_relation (help_topic_id,help_keyword_id) values (918,885);
insert into help_relation (help_topic_id,help_keyword_id) values (918,886);
insert into help_relation (help_topic_id,help_keyword_id) values (918,878);
insert into help_relation (help_topic_id,help_keyword_id) values (919,556);
insert into help_relation (help_topic_id,help_keyword_id) values (919,883);
insert into help_relation (help_topic_id,help_keyword_id) values (920,883);
insert into help_relation (help_topic_id,help_keyword_id) values (920,887);
insert into help_relation (help_topic_id,help_keyword_id) values (921,888);
insert into help_relation (help_topic_id,help_keyword_id) values (921,889);
insert into help_relation (help_topic_id,help_keyword_id) values (922,888);
insert into help_relation (help_topic_id,help_keyword_id) values (922,890);
insert into help_relation (help_topic_id,help_keyword_id) values (923,891);
insert into help_relation (help_topic_id,help_keyword_id) values (923,888);
insert into help_relation (help_topic_id,help_keyword_id) values (924,892);
insert into help_relation (help_topic_id,help_keyword_id) values (925,893);
insert into help_relation (help_topic_id,help_keyword_id) values (925,539);
insert into help_relation (help_topic_id,help_keyword_id) values (926,894);
insert into help_relation (help_topic_id,help_keyword_id) values (926,49);
insert into help_relation (help_topic_id,help_keyword_id) values (926,895);
insert into help_relation (help_topic_id,help_keyword_id) values (927,896);
insert into help_relation (help_topic_id,help_keyword_id) values (927,897);
insert into help_relation (help_topic_id,help_keyword_id) values (928,898);
insert into help_relation (help_topic_id,help_keyword_id) values (928,899);
insert into help_relation (help_topic_id,help_keyword_id) values (929,898);
insert into help_relation (help_topic_id,help_keyword_id) values (929,51);
insert into help_relation (help_topic_id,help_keyword_id) values (930,900);
insert into help_relation (help_topic_id,help_keyword_id) values (930,901);
insert into help_relation (help_topic_id,help_keyword_id) values (931,900);
insert into help_relation (help_topic_id,help_keyword_id) values (931,902);
insert into help_relation (help_topic_id,help_keyword_id) values (932,903);
insert into help_relation (help_topic_id,help_keyword_id) values (932,536);
insert into help_relation (help_topic_id,help_keyword_id) values (933,640);
insert into help_relation (help_topic_id,help_keyword_id) values (933,641);
insert into help_relation (help_topic_id,help_keyword_id) values (933,49);
insert into help_relation (help_topic_id,help_keyword_id) values (933,56);
insert into help_relation (help_topic_id,help_keyword_id) values (934,904);
insert into help_relation (help_topic_id,help_keyword_id) values (935,905);
insert into help_relation (help_topic_id,help_keyword_id) values (935,615);
insert into help_relation (help_topic_id,help_keyword_id) values (935,906);
insert into help_relation (help_topic_id,help_keyword_id) values (936,905);
insert into help_relation (help_topic_id,help_keyword_id) values (936,568);
insert into help_relation (help_topic_id,help_keyword_id) values (937,853);
insert into help_relation (help_topic_id,help_keyword_id) values (938,853);
insert into help_relation (help_topic_id,help_keyword_id) values (938,67);
insert into help_relation (help_topic_id,help_keyword_id) values (938,907);
insert into help_relation (help_topic_id,help_keyword_id) values (938,539);
insert into help_relation (help_topic_id,help_keyword_id) values (939,908);
insert into help_relation (help_topic_id,help_keyword_id) values (939,909);
insert into help_relation (help_topic_id,help_keyword_id) values (939,910);
insert into help_relation (help_topic_id,help_keyword_id) values (940,908);
insert into help_relation (help_topic_id,help_keyword_id) values (940,131);
insert into help_relation (help_topic_id,help_keyword_id) values (940,97);
insert into help_relation (help_topic_id,help_keyword_id) values (941,908);
insert into help_relation (help_topic_id,help_keyword_id) values (941,911);
insert into help_relation (help_topic_id,help_keyword_id) values (941,902);
insert into help_relation (help_topic_id,help_keyword_id) values (942,908);
insert into help_relation (help_topic_id,help_keyword_id) values (942,132);
insert into help_relation (help_topic_id,help_keyword_id) values (943,912);
insert into help_relation (help_topic_id,help_keyword_id) values (943,182);
insert into help_relation (help_topic_id,help_keyword_id) values (943,913);
insert into help_relation (help_topic_id,help_keyword_id) values (944,914);
insert into help_relation (help_topic_id,help_keyword_id) values (944,182);
insert into help_relation (help_topic_id,help_keyword_id) values (944,915);
insert into help_relation (help_topic_id,help_keyword_id) values (944,916);
insert into help_relation (help_topic_id,help_keyword_id) values (945,917);
insert into help_relation (help_topic_id,help_keyword_id) values (945,182);
insert into help_relation (help_topic_id,help_keyword_id) values (945,918);
insert into help_relation (help_topic_id,help_keyword_id) values (946,919);
insert into help_relation (help_topic_id,help_keyword_id) values (946,182);
insert into help_relation (help_topic_id,help_keyword_id) values (946,920);
insert into help_relation (help_topic_id,help_keyword_id) values (947,921);
insert into help_relation (help_topic_id,help_keyword_id) values (947,182);
insert into help_relation (help_topic_id,help_keyword_id) values (947,922);
insert into help_relation (help_topic_id,help_keyword_id) values (948,923);
insert into help_relation (help_topic_id,help_keyword_id) values (948,182);
insert into help_relation (help_topic_id,help_keyword_id) values (948,924);
insert into help_relation (help_topic_id,help_keyword_id) values (949,923);
insert into help_relation (help_topic_id,help_keyword_id) values (949,182);
insert into help_relation (help_topic_id,help_keyword_id) values (949,925);
insert into help_relation (help_topic_id,help_keyword_id) values (950,372);
insert into help_relation (help_topic_id,help_keyword_id) values (950,49);
insert into help_relation (help_topic_id,help_keyword_id) values (951,926);
insert into help_relation (help_topic_id,help_keyword_id) values (952,927);
insert into help_relation (help_topic_id,help_keyword_id) values (953,928);
insert into help_relation (help_topic_id,help_keyword_id) values (954,929);
insert into help_relation (help_topic_id,help_keyword_id) values (955,930);
insert into help_relation (help_topic_id,help_keyword_id) values (956,222);
insert into help_relation (help_topic_id,help_keyword_id) values (957,931);
insert into help_relation (help_topic_id,help_keyword_id) values (958,932);
insert into help_relation (help_topic_id,help_keyword_id) values (958,80);
insert into help_relation (help_topic_id,help_keyword_id) values (959,932);
insert into help_relation (help_topic_id,help_keyword_id) values (959,465);
insert into help_relation (help_topic_id,help_keyword_id) values (959,12);
insert into help_relation (help_topic_id,help_keyword_id) values (960,932);
insert into help_relation (help_topic_id,help_keyword_id) values (960,465);
insert into help_relation (help_topic_id,help_keyword_id) values (961,932);
insert into help_relation (help_topic_id,help_keyword_id) values (961,12);
insert into help_relation (help_topic_id,help_keyword_id) values (962,932);
insert into help_relation (help_topic_id,help_keyword_id) values (963,933);
insert into help_relation (help_topic_id,help_keyword_id) values (964,934);
insert into help_relation (help_topic_id,help_keyword_id) values (965,935);
insert into help_relation (help_topic_id,help_keyword_id) values (966,936);
insert into help_relation (help_topic_id,help_keyword_id) values (967,465);
insert into help_relation (help_topic_id,help_keyword_id) values (967,372);
insert into help_relation (help_topic_id,help_keyword_id) values (968,937);
insert into help_relation (help_topic_id,help_keyword_id) values (969,465);
insert into help_relation (help_topic_id,help_keyword_id) values (969,222);
insert into help_relation (help_topic_id,help_keyword_id) values (970,938);
insert into help_relation (help_topic_id,help_keyword_id) values (971,939);
insert into help_relation (help_topic_id,help_keyword_id) values (972,940);
insert into help_relation (help_topic_id,help_keyword_id) values (973,941);
insert into help_relation (help_topic_id,help_keyword_id) values (974,942);
insert into help_relation (help_topic_id,help_keyword_id) values (975,182);
insert into help_relation (help_topic_id,help_keyword_id) values (975,671);
insert into help_relation (help_topic_id,help_keyword_id) values (976,943);
insert into help_relation (help_topic_id,help_keyword_id) values (977,510);
insert into help_relation (help_topic_id,help_keyword_id) values (977,573);
insert into help_relation (help_topic_id,help_keyword_id) values (978,511);
insert into help_relation (help_topic_id,help_keyword_id) values (978,573);
insert into help_relation (help_topic_id,help_keyword_id) values (979,513);
insert into help_relation (help_topic_id,help_keyword_id) values (979,573);
insert into help_relation (help_topic_id,help_keyword_id) values (980,944);
insert into help_relation (help_topic_id,help_keyword_id) values (981,945);
insert into help_relation (help_topic_id,help_keyword_id) values (981,358);
insert into help_relation (help_topic_id,help_keyword_id) values (981,67);
insert into help_relation (help_topic_id,help_keyword_id) values (982,946);
insert into help_relation (help_topic_id,help_keyword_id) values (983,947);
insert into help_relation (help_topic_id,help_keyword_id) values (983,358);
insert into help_relation (help_topic_id,help_keyword_id) values (983,67);
insert into help_relation (help_topic_id,help_keyword_id) values (984,948);
insert into help_relation (help_topic_id,help_keyword_id) values (985,573);
insert into help_relation (help_topic_id,help_keyword_id) values (985,39);
insert into help_relation (help_topic_id,help_keyword_id) values (986,47);
insert into help_relation (help_topic_id,help_keyword_id) values (986,949);
insert into help_relation (help_topic_id,help_keyword_id) values (987,6);
insert into help_relation (help_topic_id,help_keyword_id) values (987,49);
insert into help_relation (help_topic_id,help_keyword_id) values (987,9);
insert into help_relation (help_topic_id,help_keyword_id) values (987,949);
insert into help_relation (help_topic_id,help_keyword_id) values (988,950);
insert into help_relation (help_topic_id,help_keyword_id) values (988,949);
insert into help_relation (help_topic_id,help_keyword_id) values (989,951);
insert into help_relation (help_topic_id,help_keyword_id) values (989,181);
insert into help_relation (help_topic_id,help_keyword_id) values (989,952);
insert into help_relation (help_topic_id,help_keyword_id) values (990,951);
insert into help_relation (help_topic_id,help_keyword_id) values (990,71);
insert into help_relation (help_topic_id,help_keyword_id) values (991,951);
insert into help_relation (help_topic_id,help_keyword_id) values (991,953);
insert into help_relation (help_topic_id,help_keyword_id) values (992,951);
insert into help_relation (help_topic_id,help_keyword_id) values (992,551);
insert into help_relation (help_topic_id,help_keyword_id) values (992,954);
insert into help_relation (help_topic_id,help_keyword_id) values (992,955);
insert into help_relation (help_topic_id,help_keyword_id) values (992,124);
insert into help_relation (help_topic_id,help_keyword_id) values (993,19);
insert into help_relation (help_topic_id,help_keyword_id) values (993,949);
insert into help_relation (help_topic_id,help_keyword_id) values (994,956);
insert into help_relation (help_topic_id,help_keyword_id) values (994,957);
insert into help_relation (help_topic_id,help_keyword_id) values (995,331);
insert into help_relation (help_topic_id,help_keyword_id) values (995,953);
insert into help_relation (help_topic_id,help_keyword_id) values (996,17);
insert into help_relation (help_topic_id,help_keyword_id) values (996,949);
insert into help_relation (help_topic_id,help_keyword_id) values (997,958);
insert into help_relation (help_topic_id,help_keyword_id) values (997,949);
insert into help_relation (help_topic_id,help_keyword_id) values (998,574);
insert into help_relation (help_topic_id,help_keyword_id) values (998,358);
insert into help_relation (help_topic_id,help_keyword_id) values (998,959);
insert into help_relation (help_topic_id,help_keyword_id) values (999,960);
insert into help_relation (help_topic_id,help_keyword_id) values (999,101);
insert into help_relation (help_topic_id,help_keyword_id) values (1000,961);
insert into help_relation (help_topic_id,help_keyword_id) values (1000,539);
insert into help_relation (help_topic_id,help_keyword_id) values (1001,962);
insert into help_relation (help_topic_id,help_keyword_id) values (1001,963);
insert into help_relation (help_topic_id,help_keyword_id) values (1002,964);
insert into help_relation (help_topic_id,help_keyword_id) values (1002,539);
insert into help_relation (help_topic_id,help_keyword_id) values (1003,965);
insert into help_relation (help_topic_id,help_keyword_id) values (1003,539);
insert into help_relation (help_topic_id,help_keyword_id) values (1004,966);
insert into help_relation (help_topic_id,help_keyword_id) values (1005,511);
insert into help_relation (help_topic_id,help_keyword_id) values (1005,574);
insert into help_relation (help_topic_id,help_keyword_id) values (1005,116);
insert into help_relation (help_topic_id,help_keyword_id) values (1005,966);
insert into help_relation (help_topic_id,help_keyword_id) values (1006,967);
insert into help_relation (help_topic_id,help_keyword_id) values (1006,968);
insert into help_relation (help_topic_id,help_keyword_id) values (1006,969);
insert into help_relation (help_topic_id,help_keyword_id) values (1006,150);
insert into help_relation (help_topic_id,help_keyword_id) values (1006,116);
insert into help_relation (help_topic_id,help_keyword_id) values (1006,970);
insert into help_relation (help_topic_id,help_keyword_id) values (1006,426);
insert into help_relation (help_topic_id,help_keyword_id) values (1006,971);
insert into help_relation (help_topic_id,help_keyword_id) values (1006,972);
insert into help_relation (help_topic_id,help_keyword_id) values (1007,43);
insert into help_relation (help_topic_id,help_keyword_id) values (1007,973);
insert into help_relation (help_topic_id,help_keyword_id) values (1007,974);
insert into help_relation (help_topic_id,help_keyword_id) values (1008,43);
insert into help_relation (help_topic_id,help_keyword_id) values (1008,39);
insert into help_relation (help_topic_id,help_keyword_id) values (1009,43);
insert into help_relation (help_topic_id,help_keyword_id) values (1009,98);
insert into help_relation (help_topic_id,help_keyword_id) values (1009,101);
