Peter Lang
Peter Lang

Reputation: 55584

Create table and fill with test data provided as text

What is your way of creating and populating test tables in MySQL when looking into SO questions where tables (but not CREATEs) and test data (but not INSERTs) are provided?

And what client do you use?

EDIT: Here's a simply example of what I mean on SO.

Upvotes: 0

Views: 855

Answers (5)

Peter Lang
Peter Lang

Reputation: 55584

The great SQL Fiddle offers exactly what I wanted: Text to DDL

Upvotes: 0

Mohsin Sheikh Khalid
Mohsin Sheikh Khalid

Reputation: 4112

You can have this done for you at http://www.generatedata.com/#generator Simply specify the column names & datatypes, and how you want the data to be output (SQL statements, HTML,Excel,XML,CSV) .

Upvotes: 1

rmeador
rmeador

Reputation: 25694

Now that I understand the question, I can answer... I'd either do a bulk import of CSV/TSV, or (more likely for smaller data sets), load the example from the question into Vim and regex it into insert statements. I'd write the table create statements by hand. This all of course assumes that I need to create the tables at all, since in general I answer from experience and don't need any actual tables to play with (as @gahooa said in his/her comment).

Upvotes: 1

Jordan Ryan Moore
Jordan Ryan Moore

Reputation: 6887

I would suggest using phpMyAdmin. It provides a fairly easy-to-use interface for inserting multiple rows at once.

Upvotes: 1

DanDan
DanDan

Reputation: 10562

Bulk Inserts should be a useful term for you to search on.

Upvotes: 0

Related Questions