SQL to MediaWiki Converter
Transform SQL database dumps into MediaWiki table markup for Wikipedia, Wikimedia projects, and MediaWiki-powered wikis
SQL Input
Convert SQL to other formats
MediaWiki Output
Related Tools
SQL to Pandas DataFrame
Convert SQL CREATE TABLE and INSERT statements to Python Pandas DataFrame code for data analysis
SQL to PDF
Convert SQL CREATE TABLE and INSERT statements to PDF document with professional table formatting
SQL to PHP
Convert SQL CREATE TABLE and INSERT statements to PHP arrays, objects, and JSON for web development
SQL to PNG
Convert SQL CREATE TABLE and INSERT statements to PNG image with professional styling
SQL to Protocol Buffers
Convert SQL CREATE TABLE and INSERT statements to Protocol Buffers schema with automatic type detection
SQL to Qlik
Convert SQL CREATE TABLE and INSERT statements to Qlik Sense load script format
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
- Input SQL Data: Paste your SQL CREATE TABLE and INSERT statements or upload a .sql file
- Choose Table Class: Select wikitable, sortable, collapsible, or mw-collapsible
- Set Alignment: Choose left, center, or right alignment for cells
- Configure Options: Toggle header row inclusion
- 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.
Frequently Asked Questions (FAQ)
Which table class should I use for Wikipedia articles?
For most Wikipedia articles, wikitable is sufficient and matches the standard style guidelines. Use wikitable sortable when readers will benefit from being able to sort columns.
How do I add links or wiki markup inside cells?
You can manually edit the generated markup to add links (for example, [[Page name]]) or other wiki syntax. The converter escapes only structural characters like pipes and brackets to keep the table intact; you can re-introduce markup where needed.
Why are some characters converted to HTML entities?
Characters such as the pipe symbol and square or curly brackets have special meaning in MediaWiki table syntax. They are converted to HTML entities so that they appear as literal characters in cells without breaking the table structure.
Can I combine this output with templates?
Yes. After generating the table, you can wrap it in templates or place it inside existing wiki templates as long as you preserve the core table syntax starting with {'{|'{}} and ending with {{'|}'}}.
Does sorting work automatically for all data types?
MediaWiki's built-in sorting works well for most numeric, date, and text columns, but extremely custom formats may not sort as expected. If sorting is critical, test your table on the target wiki and adjust formatting if necessary.
Can I use this markup in non-Wikipedia MediaWiki instances?
Yes. The generated markup uses standard MediaWiki table syntax and works on any MediaWiki-based site that supports the chosen table classes.
