22 Comments

Can you EXPLAIN which part of the post took the longest to write? Just kidding

You put explain and indexing in the Pro section. I reckon that the target group is managers - for engineers, that is something we required really early on to make sure that they think about the performance.

Great article - Thanks for writing it!

Expand full comment
author

😂

Honestly, I didn't meet a lot of engineers who new how to properly use EXPLAIN.

Expand full comment

So it sounds like it's worth EXPLAINing 🙂

Switching gears a little bit: SQL is a declarative language. I don't know why, but I think about it every time I see it in action. The concept of declaring what we want to get without needing to write procedures to get it is great. TBH It is close to what we are getting recently with LLMs 🤔

Expand full comment
author

I agree! It's much more straightforward than anything else. In contrast to LLMs, you do need to 'work' a bit to get what you want from it, but it's like a logical puzzle with very clear (and limited!) set of rules.

Expand full comment
Feb 17Liked by Anton Zaides

What a great post!

Expand full comment
author

Thank you Denis!

Expand full comment

I think SQL is important for everyone who deals with data, its a universal data language.

With so much data, one should know sql, although with chatgpt lot of things will be simplified.

Expand full comment
author

I think it’s ok to use LLMs to simplify it, but you shouldn’t depend on it. You must understand what you are doing when you work with data.

Expand full comment
Feb 28Liked by Anton Zaides

Great article summarizing all of the SQL concepts!

Expand full comment
Feb 26Liked by Anton Zaides

The first query can be done without subquery:

select deal_id,region, customer_name, MAX(deal_amount)

From deals d1

GROUP BY region;

Expand full comment
author

But then you can’t select the deal data, just the amounts

Expand full comment

Technical depth aside, this was written amazingly well from a readability point of view. Loved the hook! You are a great writer 😀

I only did #6 when I worked on a windows app and we cared about sql performance (sqllite). Now sql is just a tool to do analysis these days.

Expand full comment
author

Thanks Raviraj! The hook was rewritten like 10 times :) In the end this one didn't do so well in the open rate, but very well on reddit, once I tried 'Why most developers stop learning SQL at subqueries - a 5-minute guide for PARTITION BY and CTEs' 🤷‍♂️

Even as a just-analysis tool, it can be SUPER useful for answering complex questions

Expand full comment

Thanks so much for the mention Anton! :)

Expand full comment
Feb 14Liked by Anton Zaides

I really appreciated the article! I've used partitions in the past but it has been a while and this was a great refresher. Plus I pushed to learn about CUME_DIST() that you teased us with and I have an immediate use for it!

Expand full comment
author

Glad you’ve caught the teasing :)

I’m curious to know about the use though 🙃

Expand full comment
Feb 13Liked by Anton Zaides

Great article Anton!

Expand full comment
author

Thanks Leo! ❤️

Expand full comment
Feb 13Liked by Anton Zaides

It's good to see more technical articles on Substack! Looks like I don't have to limit myself to the advice category and post the technical things exclusively on my blog.

It's great to be hands-on with SQL! I never tried ChatGPT for queries because at the complexity where my tables and apps are, I can get by as a lvl 4 SQL player, although I remember touching on Partitions for something. 😃

Expand full comment
author

I actually hesitated a lot about the topic, as it’s out of the regular kind that I posted here. I finally decided to go for it as I really enjoyed writing this piece, and I think it’s useful for managers too (which are my main audience).

Expand full comment
Feb 13Liked by Anton Zaides

Thanks for the great article!

Expand full comment