Created
March 3, 2012 07:47
-
-
Save drakmail/1964920 to your computer and use it in GitHub Desktop.
Generate random data table with string and int PK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo " CREATE TABLE myTable (" | |
echo ' `address` varchar(255) default NULL,' | |
echo ' `city` varchar(50) default NULL,' | |
echo ' PRIMARY KEY (`address`)' | |
echo ' ) ENGINE=MyISAM;' | |
echo ''; | |
rm sql_string.sql | |
for i in {1..5000} | |
do | |
a="`pwgen 10` `pwgen 5` `pwgen 10`" | |
b="`pwgen 8`" | |
echo "step $i" | |
echo "INSERT INTO \`myTable\` (\`address\`,\`city\`) VALUES ('$a','$b');" >> sql_string.sql | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo ' CREATE TABLE myTableInt (' | |
echo ' `id` mediumint(8) unsigned NOT NULL auto_increment, ' | |
echo ' `address` varchar(255) default NULL, ' | |
echo ' `city` varchar(50) default NULL, ' | |
echo ' PRIMARY KEY (`id`) ' | |
echo ' ) ENGINE=MyISAM AUTO_INCREMENT=1; ' | |
rm sql_int.sql | |
for i in {1..5000} | |
do | |
a="`pwgen 10` `pwgen 5` `pwgen 10`" | |
b="`pwgen 8`" | |
echo "step $i"; | |
echo "INSERT INTO \`myTableInt\` (\`address\`,\`city\`) VALUES ('$a','$b');" >> sql_int.sql | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment