SQL to HTML: read and share INSERT data as a table
A long INSERT INTO … VALUES statement is hard to read. Values run together on one line, and you have to count commas to know which column a value belongs to. This sql to html converter parses the statements and lays the rows out as an HTML table with the column names as headings, so you can inspect a dump, review a seed file, or paste the data into documentation.
The Preview tab shows the rendered table immediately. The Code tab holds clean table markup you can place in a wiki page, an internal report, a README rendered as HTML, or an email.
Example
INSERT INTO plans (code, name, monthly, active) VALUES
('S', 'Starter', 9, 1),
('P', 'Pro <beta>', 29, 0);
With Layout Auto and Styling No CSS the output is:
<table>
<thead>
<tr>
<th>code</th>
<th>name</th>
<th>monthly</th>
<th>active</th>
</tr>
</thead>
<tbody>
<tr>
<td>S</td>
<td>Starter</td>
<td>9</td>
<td>1</td>
</tr>
<tr>
<td>P</td>
<td>Pro <beta></td>
<td>29</td>
<td>0</td>
</tr>
</tbody>
</table>
Values are HTML-escaped, so text such as Pro <beta> appears literally instead of being interpreted as a tag. That matters when you preview data from an unknown source: markup or script fragments stored in the database cannot run in your page.
Layout options
- Auto – one table for a single database table. When the SQL inserts into several tables, it builds an outer table with one row per database table: the table name as a heading cell and its rows as a nested table beside it. That gives a quick overview of a whole seed file.
- Single flat table – forces one table. Use it only with a single table; several tables would be squeezed into one very wide row.
- Nested tables – for a single table, produces compact markup with each row on one line, useful when the size of the snippet matters.
Styling options
No CSS returns the bare table so it inherits your site or wiki styles. Bordered prepends a <style> block with collapsed borders, cell padding, a blue header row and a hover highlight. Striped rows adds alternating light gray rows on top of that. Because the style rules target all table, th and td elements, use them for standalone pages or previews, and No CSS when pasting into a page that already has table styles.
How values appear
NULLis shown as an empty cell.- Numbers appear in their shortest form:
250.00is shown as250. - Booleans written as
TRUE/FALSEshow astrue/false; MySQL flags stored as1/0stay numbers. - Expressions such as
NOW()are shown as written, since nothing is executed. - Column names come from the INSERT column list, then from a matching CREATE TABLE, and otherwise are numbered
column1,column2and so on.
Where this fits
To review data from a large dump, paste only the statements for the tables you care about; everything is rendered in the browser, and very long tables are easier to read in pieces. When the goal is a spreadsheet rather than a web page, SQL to CSV is the better target. For tables you want to write or edit by hand, try the HTML table generator, and to make the SQL itself readable, run it through the SQL formatter.
Privacy
The SQL is parsed and rendered in your browser, and the preview is shown in a sandboxed frame. Nothing is uploaded unless you use Load URL or Save & Share.