MediaWiki to SQL Converter

Transform MediaWiki tables into SQL statements with support for MySQL, PostgreSQL, SQLite, and SQL Server

MediaWiki Input

SQL Output

About MediaWiki to SQL Converter

Convert MediaWiki table markup to SQL CREATE TABLE and INSERT statements with support for multiple database dialects including MySQL, PostgreSQL, SQLite, and SQL Server. Perfect for importing Wikipedia data into databases.

Key Features

  • Multi-Dialect Support: MySQL, PostgreSQL, SQLite, and SQL Server
  • CREATE TABLE: Generate table schema with proper column definitions
  • INSERT Statements: Generate data insertion statements
  • Type Detection: Automatically detect INTEGER, DECIMAL, DATE, VARCHAR, TEXT
  • Identifier Quoting: Proper quoting with `, ", or [] based on dialect
  • String Escaping: Proper escaping of single quotes and special characters
  • NULL Handling: Empty cells converted to NULL values
  • Custom Table Name: Specify your own table name
  • MediaWiki Parser: Accurately parses MediaWiki table syntax
  • File Upload: Upload .wiki files directly
  • Instant Preview: Real-time conversion as you type
  • Copy & Download: Easy export as .sql file

How to Use

  1. Input MediaWiki Table: Paste your MediaWiki table markup or upload a .wiki file
  2. Configure Table Name: Set the desired table name
  3. Select SQL Dialect: Choose your database system
  4. Toggle Options: Enable/disable CREATE TABLE, INSERT statements, and type detection
  5. Review Output: The SQL statements update automatically
  6. Export: Copy to clipboard or download as .sql file

SQL Dialects

  • MySQL: Uses backticks (`) for identifiers, supports TINYINT, SMALLINT, INT, BIGINT
  • PostgreSQL: Uses double quotes (") for identifiers, NUMERIC type for decimals
  • SQLite: Uses double quotes ("), simplified type system
  • SQL Server: Uses brackets ([]) for identifiers, NVARCHAR(MAX) for long text

Example Conversion

MediaWiki Input:

{| class="wikitable" border="1"
! Name !! Age !! City !! Department
|-
| John Doe || 28 || New York || Engineering
|-
| Jane Smith || 34 || London || Marketing
|}

MySQL Output:

-- Create table
CREATE TABLE `data_table` (
  `name` VARCHAR(50),
  `age` INTEGER,
  `city` VARCHAR(50),
  `department` VARCHAR(50)
);

-- Insert data
INSERT INTO `data_table` (`name`, `age`, `city`, `department`) VALUES ('John Doe', 28, 'New York', 'Engineering');
INSERT INTO `data_table` (`name`, `age`, `city`, `department`) VALUES ('Jane Smith', 34, 'London', 'Marketing');

Common Use Cases

  • Wikipedia Data Import: Import Wikipedia tables into databases
  • Database Migration: Convert wiki data for database systems
  • Test Data: Generate SQL test data from Wikipedia
  • Data Seeding: Create seed data scripts for applications
  • Documentation: Convert documented data into executable SQL
  • Prototyping: Quickly create database schemas from wiki tables
  • Data Transfer: Move data between wikis and databases
  • Learning SQL: Practice SQL with real-world Wikipedia data

MediaWiki Table Syntax

Supports standard MediaWiki table markup:

  • {|: Table opening with optional attributes
  • ! Header: Exclamation mark for header cells (separated by !!)
  • |-: Row separator
  • | Data: Pipe for data cells (separated by ||)
  • |}: Table closing

Type Detection

When auto-detect is enabled, the converter analyzes column data:

  • TINYINT: Integers 0-127
  • SMALLINT: Integers 128-32,767
  • INTEGER/INT: Integers 32,768-2,147,483,647
  • BIGINT: Integers larger than 2,147,483,647
  • DECIMAL/NUMERIC: Decimal numbers (10,2 precision)
  • DATE/DATETIME: Values matching YYYY-MM-DD format
  • VARCHAR(50): Text up to 50 characters
  • VARCHAR(255): Text up to 255 characters
  • TEXT/NVARCHAR(MAX): Text longer than 255 characters

Tips for Best Results

  • Choose the correct SQL dialect for your database
  • Enable type detection for accurate column types
  • Use descriptive column names from Wikipedia headers
  • Test generated SQL in a development environment first
  • Consider adding indexes and constraints after import
  • Use transactions for data integrity
  • Validate Wikipedia data before importing

Privacy & Security

All conversions happen locally in your browser. Your MediaWiki data is never uploaded to any server, ensuring complete privacy and security.