Wednesday, 25 July 2018

MySQL: How to import XML File Data into a Table?

In this post, I am going to import XML file data into a table of MySQL Database.
MySQL provides LOAD XML INFILE to import XML file data into a table. We can use ROWS IDENTIFIED BY clause to read row by providing a XML node.
It supports three different type of XML formats.
Note: Table column name and XML column or tag name should be same otherwise it will not insert into a table.
Below is a small demonstration of this:
First, Create a sample XML file:
Name of this file is Employee.xml and I have saved in my local drive.
Create a sample table:
Import XML Data into a table:
Check the table:


MySQL XML Import Data

0 comments:

Post a Comment