MySQL Bulk INSERT with Backtick Quoting

Generate MySQL-compatible bulk INSERT statements with backtick-quoted identifiers, TINYINT(1) booleans, and ON DUPLICATE KEY UPDATE support.

Dialect Differences

Detailed Explanation

MySQL-Specific Bulk INSERT

MySQL has its own dialect conventions that differ from standard SQL. The bulk INSERT tool generates fully MySQL-compatible output when you select the MySQL dialect.

MySQL Identifier Quoting

MySQL uses backticks instead of double quotes for identifiers:

INSERT INTO \`users\` (\`id\`, \`first_name\`, \`email\`)
VALUES
  (1, 'Alice', 'alice@example.com'),
  (2, 'Bob', 'bob@example.com');

Boolean Handling

MySQL does not have a native BOOLEAN type. Booleans are stored as TINYINT(1):

JSON value MySQL output
true TRUE (alias for 1)
false FALSE (alias for 0)

With CREATE TABLE enabled, the column type will be TINYINT(1) instead of BOOLEAN.

ON DUPLICATE KEY UPDATE

MySQL's upsert syntax differs from PostgreSQL:

INSERT INTO \`users\` (\`id\`, \`name\`, \`email\`)
VALUES
  (1, 'Alice Updated', 'alice.new@example.com'),
  (2, 'Bob Updated', 'bob.new@example.com')
ON DUPLICATE KEY UPDATE
  \`name\` = VALUES(\`name\`),
  \`email\` = VALUES(\`email\`);

INSERT IGNORE

For skipping duplicates without updating, MySQL uses INSERT IGNORE:

INSERT IGNORE INTO \`users\` (\`id\`, \`name\`, \`email\`)
VALUES
  (1, 'Alice', 'alice@example.com');

max_allowed_packet

MySQL limits the total size of a single SQL statement. The default is 4MB (max_allowed_packet=4194304). For large imports, either increase this setting or use a smaller batch size.

Use Case

You are building a data import pipeline for a MySQL 8.0 database and need to generate INSERT statements that use backtick quoting and ON DUPLICATE KEY UPDATE for idempotent imports.

Try It — JSON to Bulk INSERT

Open full tool