It has been a while since I did anything with sql, which is a shame because I used to really enjoyed writing out sql queries. There is a chance I may need to use it again in the future. This talk seemed like a good way to remind me of how sql worked, and highlight some common mistakes that I should avoid making. It turns out there are a lot of bad habits that have been developed over the years.
Does it matter how sql works?
In this talk, Michał Poręba talks us through several bad practices that has become quite common. So many examples were given, I barely had time to scribble then down. I certainly don’t have enough space to include them on a single A4 sheet of paper.
Some are only minor, but still affect the readability of the sql query. Examples given included using all capitals or selecting all.
Others, while they still work, can lead to inconvenient performance issues.
With so many possible solutions, does it matter?
The ‘solutions’ sometimes led to readability or performance issues. In one example, Michał used google to find a possible solution. The first results was too complex and long and another was slow to run. Its difficult to know which is the best solution, and some might be out of date. Keeping up to date with ever changing technology is essential.
Michał recommended a blog run by Aaron Bertrand which includes a large number of posts about various bad practices. It is worth checking out.