


The last line is just a comment suggesting you run the script a few times if you want to generate more data. The second line starts off with an Insert statement that will now target that new table called mydata and insert the Information_schema data into the table. The first line Creates a table called mydata, and it generates the layout of the columns from the information_schema, which stores the information about your MYSQL server, and in this case, it is pulling from information_lumns, which allows the table being created to have all the column information needed to create not only the table, but all the columns you will need automatically, very handy.
SQL TEST DATA GENERATOR CODE
I am terribly sorry if this is out of place, but I wanted to offer some explanation on this code as I know just enough to explain it and how the answer above is rather useful if you only understand what it does. repeating the insert 11 times will give you at least 6 mln rows in the table. Records: 647680 Duplicates: 0 Warnings: 0Ĭreate table mydata as select * from information_lumns Query OK, 647680 rows affected (2.33 sec) Records: 323840 Duplicates: 0 Warnings: 0 Query OK, 323840 rows affected (1.13 sec) Records: 161920 Duplicates: 0 Warnings: 0 Query OK, 161920 rows affected (0.57 sec) Mysql> insert into t1 (x) select x + (select count(*) from t1) from t1 Here it's solution with pure math and sql: create table t1(x int primary key auto_increment)
