Convert XML to SQL

Form for XML converting to SQL

This form allows you convert XML to SQL queries, paste or upload your XML file below:


SQL configuration:

Your result can be seen below.

Result of XML conversion to SQL


Move to "Paste Code" for Save it

About XML conversion to SQL

About XML data conversion to SQL queries

The XML to SQL Converter was created for online transform XML(Extensible Markup Language) data into SQL(Structured Query Language) queries to insert in the database. This awesome tool supports custom table name and several MySQL commands to insert. It's very simple and easy way to transform and share XML to SQL queries.

As a result, you will receive several queries:

  • SQL query to create a table. But this is just an example of "create table"; in fact, it is not recommended to execute this query, because it does not contain indexes, keys, valid types, etc.
  • Insert or Replace queries.

How it Works?

Just select the options you need and paste your XML data to the textarea above and click to the button "Convert" and you will instantly get SQL queries.

Example of XML conversion to SQL

Before:
<artists>
    <artist>
        <id>1</id>
        <firstName>Dwayne</firstName>
        <lastName>Johnson</lastName>
        <age>47</age>
    </artist>
    <artist>
        <id>2</id>
        <firstName>Jessica</firstName>
        <lastName>Alba</lastName>
        <age>38</age>
    </artist>
    <artist>
        <id>3</id>
        <firstName>Peter</firstName>
        <lastName>Pan</lastName>
        <age>120</age>
    </artist>
</artists>
After:
/* CREATE TABLE */
CREATE TABLE test(
`id` DOUBLE,
`firstName` VARCHAR(100),
`lastName` VARCHAR(100),
`age` DOUBLE
);

/* INSERT QUERY NO: 1 */
INSERT INTO test(`id`, `firstName`, `lastName`, `age`)
VALUES (1, 'Dwayne', 'Johnson', 47);

/* INSERT QUERY NO: 2 */
INSERT INTO test(`id`, `firstName`, `lastName`, `age`)
VALUES (2, 'Jessica', 'Alba', 38);

/* INSERT QUERY NO: 3 */
INSERT INTO test(`id`, `firstName`, `lastName`, `age`)
VALUES (3, 'Peter', 'Pan', 120);
After conversion, you can execute these commands in your SQL server and add all data to your database.