Be a Pro: A Sequel Pro
Tags: sequelpro, mysql
Published: 2019-09-23 05:32:43

I'm not ashamed to admit it: I love MySQL. I love the demanding, uptight raw MySQL queries and all their asinine, diva-esque demands. I love the coy error messages, which somehow deliver almost zero information whatsoever about the error while simultaneously making you feel like a straight-up dipshit for not already knowing what your error is. 

I love all of this about MySQL because MySQL is just like me: a foul-tempered, arrogant, know-it-all, jerk. What's more, MySQL treats me the same way I treat my partner.

I, too, do things like tell my partner he's screwing up but refuse to tell him explicitly how he's doing so and leave it up to him to figure out (he should've already figured it out). I, too, make obnoxious, pedantic comments to him (he should parse their meaning himself). And I, too, make egregious demands about exactly how the towels must be folded and which of my clothes CANNOT go in the dryer (and no I do not care that the tag says it can go in the dryer, those pants are never to go in the dryer, thank you very much, sir).

I'm not sure why he stays with me.
I'm not sure why I stay with MySQL.
Which is why I decided to try Sequel Pro.

As the folks at Sequel Pro put it, the program is "a fast, easy-to-use Mac database management application for working with MySQL databases." Note here that this is just for Mac users. If you prefer a PC (as do I, actually) you should check out MySQL Workbench. But back to Mac-centric Sequel Pro. It's a really simple, intuitive program that's free and easy to download right [here](https://www.sequelpro.com/).

You can think of Sequel Pro as an oven mitt. Do you have to have it? No. But (and here, let's pretend for a second like I know how to cook things and have done something like "make a casserole" before in my life, which, ha, yeah right, I definitely have not done) when you're pulling a casserole out of the oven, it'll sure be a lot easier and more pleasant if you put that oven mitt on first to protect yourself from all the burns your oven/MySQL will expose you to if you handle it raw.
 
Sequel Pro steps in between you and MySQL and gives you a far more intuitive and simple way to do things like write queries, create and manage the relationships between data, and so on. 
In fact, it's intuitive from the start. Once you download and open it, you'll see this screen
![Sequel Pro opening screen]
(http://research.bowdoin.edu/digital-computational-studies/files/2016/04/Screen-Shot-2016-04-24-at-8.33.09-PM.png)

That's one of the least-intimidating coding-related pages I've ever seen. Which is great.
From there, if you click "connect," without entering any information in those blanks at all, Sequel Pro alerts you with this
```Insufficient details provided to establish a connection. Please enter at least the hostname.```

If you're a person like me (ignorant, unclear on what's going on here/there/anywhere, and just trying to fake it til I make it) then you'll probably be like, "huh, well, I don't know what my hostname is but I know every time I make a MySQL database, I just put 'localhost' as the host and 'root' as the user, so I'll try 'localhost' for the 'host' blank and 'root' for the 'username' blank." And you'll type that in, and then Sequel Pro will very kindly nudge you along with this crystal-clear message:

![Sequel Pro error message]
(https://i.stack.imgur.com/lF6TP.jpg)

At this point, even if you don't recognize 127.0.0.1 for what it is, you'll probably be like, "127 sounds less weird than a socket, so shoot, gimme that one," and you will have chosen wisely young Padawan. Sequel Pro will open up to you like a daisy after a rain shower.

From there, you'll see that, like magic, Sequel Pro will already have access to all the MySQL databases you have on your machine. They'll be in the "Choose Database" dropdown in the top left-hand corner, as seen in the picture above.

Once you pick a database, you can open up any of the tables, and get a view sorta like this
![Sequel Pro table](https://blog.calevans.com/wp-content/uploads/2015/10/Screen-Shot-2015-10-07-at-8.47.32-AM.png)

Looka how clean that organization and structure is! No more struggling through viewing your tables in the terminal and/or writing half-mile-long queries to prettify the view of the contents of your table, just to make them legible. Now you can just double-click on a table and get that sweet symmetrical view. Notice how quickly you can identify the primary key. Notice that you have dropdown options for things like "type" of data, which helps avoid syntax errors that occur when you've typed VARCHAR 50 times already today. 

Finally, one of my favorite parts is the "Indexes" section on the bottom which shows you the relationships between a table's primary key and foreign key(s) in a way that's so easy to understand from just a quick glance. Even better, if you navigate to the "Relations" screen, it gives a sweet layout of what the foreign keys are, what table they came from, and what their name and column are in this table. All of this makes dissecting MySQL tables and their relationships way easier.

Last thing I have to mention is that Sequel Pro will actually *tell you what your errors are* if you have any. If you haven't tinkered in MySQL too much, that might not sound like a huge deal, but once you've seen this error about 7 dozen times,
```You have an error in your SQL syntax: check the manual that corresponds to your MySQL version for the right syntax to use near 'id int AUTO_INCREMENT PRIMARY KEY, setup varchar(250) NOT NULL,' at line 2```
and you *still* have yet to see any "manual" for anything you've ever done with coding, you'll be ready for somebody to just tell you what your damn error is already.

I came to appreciate this feature about Sequel Pro recently when I had to import, into my MySQL database, a CSV file of 690 rows with about 15 columns. There was an error in the file, and I spent hours bogged down in MySQL, trying to guess about what it could be. As soon as I switched to using Sequel Pro, though (there's also really intuitive functionality for importing and exporting data), I imported the CSV file, wrote a query, and instantly got squiggle lines under a part of my query. Hovered over that part, and Sequel Pro just outright told me that I couldn't use "Dec" in a column name because it's a reserved keyword that's short for "decimal" in MySQL. Now, you'd think MySQL would be decent enough to alert me to that fact, but nooooo. It was all like, "I don't like you or the query you rode in on and I refuse to help either of you." Two minutes in Sequel Pro, and the problem was solved.

In short, despite the fact that I do still think MySQL is pretty much the best, Sequel Pro makes the data simpler to see/understand and it's boss at handling errors. I'm a huge proponent of knowing how to do things at their most basic level, before getting a safety net that will make everything easier, so I do still suggest learning raw MySQL first. But after that, download Sequel Pro and save yourself hours. 
Also, please know that I don't actually treat my partner like shit. That was all just a joke to get my point across. But MySQL is legit that much of an asshole.