MySQL Archaeology

When I was first playing with databases I was putting lots of stray stuff into mine. It was pretty fun, actually.

mysql> select want_id, artist, title from music_wanted;
+---------+-----------------------+--------------------------------+
| want_id | artist                | title                          |
+---------+-----------------------+--------------------------------+
| 0001    | Anderson, Laurie      | Mr. Heartbreak                 |
| 0002    | Cocker, Joe           | Greatest Hits                  |
| 0003    | Costello, Elvis       | Armed Forces                   |
| 0004    | Cure                  | Mixed Up                       |
| 0005    | De La Soul            | 3 Feet High and Rising         |
| 1005    | Fishbone              | In Your Face                   |
| 0006    | Hendrix, Jimi         | Experiences                    |
| 0007    | Holliday, Billie      | The Billie Holiday Collection  |
| 0008    | Hooker, John Lee      | Best of John Lee Hooker        |
| 0009    | Jackson, Joe          | Body & Soul                    |
| 0010    | Jackson, Joe          | Beat Crazy                     |
| 0011    | Marley, Bob           | Exodus                         |
| 0012    | Nine Inch Nails       | Broken                         |
| 0013    | Oingo Boingo          | 4 Song EP                      |
| 0014    | Pet Shop Boys         | Discography                    |
| 0015    | Red Hot Chili Peppers | One Hot Minute                 |
| 0016    | REM                   | Murmur                         |
| 0017    | REM                   | Chronic Town                   |
| 0018    | Soul Coughing         | Ruby Vroom                     |
| 0019    | Soundtrack            | Adventures of Baron Munchausen |
| 0020    | Soundtrack            | Stormy Weather                 |
| 0021    | Talking Heads         | Little Creatures               |
| 0022    | Talking Heads         | True Stories                   |
| 0023    | Waits, Tom            | Nighthawks at the Diner        |
| 0024    | Waters, Muddy         | I'm Ready                      |
+---------+-----------------------+--------------------------------+
25 rows in set (0.00 sec)

Of course, I was a little naive about usable data structures, here’s the design of that music_wanted table:

mysql> describe music_wanted;
+---------+--------------+------+-----+---------+-------+
| Field   | Type         | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| want_id | varchar(4)   |      | PRI |         |       |
| artist  | varchar(60)  | YES  |     | NULL    |       |
| title   | varchar(60)  |      |     |         |       |
| comment | varchar(200) | YES  |     | NULL    |       |
+---------+--------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

Now, why I would use a VARCHAR of length 4, formatted like a number as a primary key? It just seems sort of silly now.

And the comment field is a 200 character string, rather than TEXT?

Very silly.

Also, I think I have a few more of those now, bought used. Some of those I still want to replace with CDs, but I’m in no hurry, really. I mean, it’s been years.

Now, for little reminders to myself (like books to read or music to check out) I have this blog to keep records, so it’s time to…

 mysql> drop table music_wanted; Query OK, 0 rows affected (0.00 sec) 

And poof! my little database table evaporates in a puff of logic.*

*Bonus points to you if you recognize that phrase

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.