Dobrica Pavlinušić's random unstructured stuff
MySQL: Revision 2

I don't like MySQL for various resons, most important one being that I saw PostgreSQL early on and never looked back.

Here are few quick commands to ease my pain:



Create grepable dump

Put every value in it's own line

mysqldump -u user -p database --extended-insert=0 > dump.sql

Poor man's graphs

mysql> select dateenrolled,count(*),rpad('',count(*) / 10,'*') from borrowers group by dateenrolled;
+--------------+----------+----------------------------------------------+
| dateenrolled | count(*) | rpad('',count(*) / 10,'*')                   |
+--------------+----------+----------------------------------------------+
| NULL         |       18 | **                                           | 
| 2008-04-03   |        1 |                                              | 
| 2008-04-17   |        1 |                                              | 
| 2008-05-28   |        1 |                                              | 
| 2008-06-05   |        1 |                                              | 
| 2008-06-12   |        3 |                                              | 
| 2008-07-28   |        1 |                                              | 
| 2008-10-17   |        1 |                                              | 
| 2008-10-20   |        1 |                                              | 
| 2008-10-21   |        1 |                                              | 
| 2008-10-27   |       11 | *                                            | 
| 2008-10-28   |        2 |                                              | 
| 2008-10-29   |        4 |                                              | 
| 2008-10-30   |        2 |                                              | 
| 2008-11-03   |        1 |                                              | 
| 2008-11-04   |        9 | *                                            | 
| 2008-11-06   |        7 | *                                            | 
| 2008-11-10   |       16 | **                                           | 
| 2008-11-11   |        1 |                                              | 
| 2008-11-13   |        1 |                                              | 
| 2008-11-14   |        4 |                                              | 
| 2008-11-17   |        1 |                                              | 
| 2008-11-20   |        1 |                                              | 
| 2008-11-26   |        1 |                                              | 
| 2008-12-02   |        1 |                                              | 
| 2008-12-19   |        2 |                                              | 
| 2009-01-07   |        2 |                                              | 
| 2009-03-16   |      301 | ******************************               | 
| 2009-03-17   |      365 | *************************************        | 
| 2009-03-18   |      439 | ******************************************** | 
| 2009-03-19   |      324 | ********************************             | 
| 2009-03-20   |      226 | ***********************                      | 
| 2009-03-23   |      105 | ***********                                  | 
+--------------+----------+----------------------------------------------+
33 rows in set (0.00 sec)