MySQL to SQL Converter
Transform MySQL database dumps to other SQL dialects with automatic type conversion and proper identifier quoting
MySQL Input
SQL Output
About MySQL to SQL Converter
Convert MySQL database dumps (CREATE TABLE and INSERT statements) to other SQL dialects including PostgreSQL, SQLite, and SQL Server. Perfect for database migrations, cross-platform development, and SQL dialect compatibility.
Key Features
- Multi-Dialect Support: Convert to MySQL, PostgreSQL, SQLite, or SQL Server
- Automatic Type Detection: Detects INTEGER, DECIMAL, DATE, VARCHAR, TEXT, and BOOLEAN types
- Proper Identifier Quoting: Uses correct quote characters (`, ", []) for each dialect
- String Escaping: Properly escapes single quotes and special characters
- NULL Handling: Converts empty cells to NULL values
- Custom Table Names: Override source table name if needed
- Flexible Output: Choose to include CREATE TABLE, INSERT statements, or both
How to Use
- Input MySQL Data: Paste your MySQL CREATE TABLE and INSERT statements or upload a .sql file
- Choose Target Dialect: Select MySQL, PostgreSQL, SQLite, or SQL Server
- Configure Options: Set table name, toggle CREATE TABLE and INSERT statements
- Enable Type Detection: Automatically detect and convert data types
- Copy or Download: Use the Copy or Download button to save your SQL
Supported SQL Dialects
- MySQL: Uses backticks (`) for identifiers, BOOLEAN type
- PostgreSQL: Uses double quotes (") for identifiers, BOOLEAN type, NUMERIC for decimals
- SQLite: Uses double quotes ("), INTEGER for booleans, simplified types
- SQL Server: Uses square brackets ([]), BIT for booleans, NVARCHAR for strings
Example Conversion
MySQL Input:
CREATE TABLE employees ( id INT, name VARCHAR(100), age INT, active BOOLEAN ); INSERT INTO employees VALUES (1, 'John Doe', 28, true); INSERT INTO employees VALUES (2, 'Jane Smith', 34, false);
PostgreSQL Output:
-- Converted to POSTGRESQL dialect
-- Create table
CREATE TABLE "employees" (
"id" INTEGER,
"name" VARCHAR(50),
"age" INTEGER,
"active" BOOLEAN
);
-- Insert data
INSERT INTO "employees" ("id", "name", "age", "active") VALUES (1, 'John Doe', 28, TRUE);
INSERT INTO "employees" ("id", "name", "age", "active") VALUES (2, 'Jane Smith', 34, FALSE); SQL Server Output:
-- Converted to SQLSERVER dialect -- Create table CREATE TABLE [employees] ( [id] INTEGER, [name] NVARCHAR(50), [age] INTEGER, [active] BIT ); -- Insert data INSERT INTO [employees] ([id], [name], [age], [active]) VALUES (1, 'John Doe', 28, 1); INSERT INTO [employees] ([id], [name], [age], [active]) VALUES (2, 'Jane Smith', 34, 0);
Common Use Cases
- Database Migration: Migrate data from MySQL to PostgreSQL, SQLite, or SQL Server
- Cross-Platform Development: Test SQL queries across different database systems
- Data Portability: Move data between different database platforms
- SQL Dialect Learning: Compare SQL syntax across different databases
- Schema Conversion: Convert database schemas between platforms
- Backup & Restore: Create compatible backups for different database systems
Type Conversion
The converter automatically detects and converts data types:
- INTEGER: TINYINT, SMALLINT, INTEGER, BIGINT based on value range
- DECIMAL: DECIMAL(10,2) or NUMERIC(10,2) for PostgreSQL
- DATE: DATE or DATETIME for SQL Server
- VARCHAR: VARCHAR(50/255) or NVARCHAR for SQL Server
- TEXT: TEXT or NVARCHAR(MAX) for SQL Server
- BOOLEAN: BOOLEAN, BIT (SQL Server), or INTEGER (SQLite)
Identifier Quoting
Each SQL dialect uses different quote characters for identifiers:
- MySQL: Backticks `table_name`, `column_name`
- PostgreSQL: Double quotes "table_name", "column_name"
- SQLite: Double quotes "table_name", "column_name"
- SQL Server: Square brackets [table_name], [column_name]
Dialect-Specific Features
PostgreSQL:
- Uses NUMERIC instead of DECIMAL for better precision
- Native BOOLEAN type support
- TEXT type for large strings
SQL Server:
- Uses NVARCHAR for Unicode string support
- BIT type for boolean values (1/0)
- NVARCHAR(MAX) for large text
SQLite:
- Simplified type system
- INTEGER for boolean values (1/0)
- Dynamic typing support
Supported MySQL Syntax
- CREATE TABLE: Extracts column names and structure
- INSERT INTO: Parses data values from INSERT statements
- Data Types: Handles all MySQL data types (VARCHAR, INT, DECIMAL, BOOLEAN, etc.)
- Quoted Strings: Handles single and double quotes with proper escaping
Privacy & Security
All conversions happen locally in your browser. Your MySQL data is never uploaded to any server, ensuring complete privacy and security.
