This week I’ve consolidated a lot of SQL concepts, I really like knowing that I can’t only handle null records, but also do casts to uppercase or remove spaces at the same time.

I’d to learn in a not so pleasant way that my logic is good and that I shouldn’t distrust what I do, I say the above because when making a join between two tables it gave me a result of zero records, I was thinking several ways to fix this. My first attempt was to review my query for several minutes, seeing that it didn’t work, I decided to do another query with a different approach, it didn’t work either; The query still returned me a table with zero records.
After much thought I decided to wait for a call that I would have with my SQL mentor and my partner, to my surprise they had the same problem, we analyzed the logic of our queries and it wasn’t until after almost half an hour that our mentor put in doubt the records that we were using as keys to join the tables, were they really the same?
Turns out no, one of the columns had about 100 whitespace characters after the strings we wanted to compare, clearly SQL understands that `example` is not equal to `example ` so that was the reason for the failure.
As I said before, this made me think about trusting that the work I do is of quality and also questioning more factors than just my skills.

As I once read somewhere, “if you work with poor quality data you are going to get poor quality results”, so the first thing I will do from now on is to review my raw material, the data, before working on it.

Photo by Agence Olloweb on Unsplash

Another thing I want to talk about is how the simplest tools are the ones that help us understand our problems and get to a solution faster, as I’ve learned in the book “Make time” by Jake Knapp and John Zeratsky, choosing a sophisticated tool will only waste your time and focus on things that will only distract you from solving the problem. The above was clear to me when joining more than one table in PostgeSQL, since it is super easy to get lost and make mistakes when indicating the columns with which SQL should do the join, but when writing the necessary columns and joining them with colored markers it’s much easier and faster to pass this to code. So, working with pencil and paper has made me more efficient than any other tool I’ve used before.

Photo by Umberto on Unsplash

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store