SQL to MediaWiki Converter

Transform SQL database dumps into MediaWiki table markup for Wikipedia, Wikimedia projects, and MediaWiki-powered wikis

SQL Input

MediaWiki Output

About SQL to MediaWiki Converter

Convert SQL database dumps (CREATE TABLE and INSERT statements) to MediaWiki table markup format. Perfect for creating tables in Wikipedia, Wikimedia projects, and any MediaWiki-powered wiki with support for sortable, collapsible, and styled tables.

Key Features

  • Multiple Table Classes: wikitable, sortable, collapsible, and mw-collapsible
  • Cell Alignment: Left, center, or right alignment for all cells
  • Header Row: Optional header row with proper MediaWiki syntax
  • Special Character Escaping: Handles MediaWiki special characters (|, [, ], })
  • Smart Parsing: Extracts column names and data from SQL dumps
  • File Download: Save as .wiki file for direct use in MediaWiki

How to Use

  1. Input SQL Data: Paste your SQL CREATE TABLE and INSERT statements or upload a .sql file
  2. Choose Table Class: Select wikitable, sortable, collapsible, or mw-collapsible
  3. Set Alignment: Choose left, center, or right alignment for cells
  4. Configure Options: Toggle header row inclusion
  5. Copy or Download: Use the Copy or Download button to save your MediaWiki markup

Table Classes

wikitable:

  • Standard Wikipedia table style
  • Includes borders and alternating row colors
  • Most commonly used table class
  • Works on all MediaWiki installations

wikitable sortable:

  • Adds sorting functionality to columns
  • Users can click column headers to sort
  • Requires JavaScript enabled
  • Perfect for data-heavy tables

wikitable collapsible:

  • Table can be collapsed/expanded
  • Saves space on long pages
  • Shows/hides with a toggle button
  • Useful for optional information

wikitable mw-collapsible:

  • MediaWiki's built-in collapsible class
  • More reliable across different skins
  • Recommended for modern MediaWiki
  • Better accessibility support

Example Conversion

SQL Input:

CREATE TABLE products (
  id INT,
  name VARCHAR(100),
  price DECIMAL(10,2)
);

INSERT INTO products VALUES (1, 'Laptop', 999.99);
INSERT INTO products VALUES (2, 'Mouse', 24.99);

MediaWiki Output:

{| class="wikitable"
|+ products
|-
! id
! name
! price
|-
| 1
| Laptop
| 999.99
|-
| 2
| Mouse
| 24.99
|}

MediaWiki Syntax

Understanding the generated markup:

  • {| - Table opening tag
  • |+ - Table caption
  • |- - New row
  • ! - Header cell
  • | - Data cell
  • |} - Table closing tag

Cell Styling

Alignment is applied using inline styles:

  • Left: Default alignment, no style needed
  • Center: style="text-align:center;"
  • Right: style="text-align:right;"

Common Use Cases

  • Wikipedia Articles: Add data tables to Wikipedia pages
  • Documentation Wikis: Document database schemas and sample data
  • Internal Wikis: Share database information in company wikis
  • Educational Content: Create learning materials with data tables
  • Project Wikis: Document project data in MediaWiki

Sortable Tables

When using "wikitable sortable", users can:

  • Click column headers to sort ascending
  • Click again to sort descending
  • Click a third time to restore original order
  • Sort works automatically for numbers, dates, and text

Special Character Handling

The converter automatically escapes MediaWiki special characters:

  • | → | (pipe character)
  • [ → [ (left bracket)
  • ] → ] (right bracket)
  • { → { (left brace)
  • } → } (right brace)

Best Practices

  • Use wikitable: Always include the wikitable class for consistent styling
  • Add Captions: Table captions help readers understand the data
  • Keep Tables Simple: Avoid overly complex tables for better readability
  • Use Sortable: Enable sorting for data-heavy tables
  • Test Rendering: Preview tables in MediaWiki before publishing

Privacy & Security

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