mariadbHow to work with XML in Mariadb?
Mariadb supports the use of XML data type and functions to work with XML documents.
The following example shows how to create a table with an XML column and insert a document into it:
CREATE TABLE xml_table (
id INT NOT NULL AUTO_INCREMENT,
xml_doc XML,
PRIMARY KEY (id)
);
INSERT INTO xml_table (xml_doc) VALUES
('<root><name>John Doe</name><age>30</age></root>');
The output of the above code will be:
Query OK, 1 row affected (0.01 sec)
To extract data from the XML document, the following functions can be used:
EXTRACTVALUE()
: Extracts a value from an XML document.UPDATEXML()
: Updates an XML document.DELETEXML()
: Deletes an XML document.
Helpful links
More of Mariadb
- What type to use for a year in Mariadb?
- How to use xtrabackup in Mariadb?
- How to change wait_timeout in Mariadb?
- How to use window functions in Mariadb?
- How to use the WITH clause in Mariadb?
- How to use variables in Mariadb?
- Mariadb partitioning example
- How to use UUID in Mariadb?
- How to check version of Mariadb?
See more codes...