r/learnSQL • • Dec 28 '22

SQL Cheat Sheet

Post image
132 Upvotes

8 comments sorted by

5

u/Tempest0042 Dec 28 '22

I love you and thank you!

2

u/trbotwuk Dec 29 '22

missing sub-queries, derived table, ordered analytics, row_number definitely a start for newbies. probably easier to just ask chatgpt do write the code.

1

u/_okbloomer_ Dec 29 '22

My beloved row_number

2

u/kiwibutterket Dec 28 '22

Every time I see joins visualized as set intersections I want to bang my head on a wall.

8

u/1o0t Dec 29 '22

Never understood this take. Like, sure, there are better ways to visualize joins. But Venn diagrams do the job pretty well and are familiar to most people.

1

u/kiwibutterket Dec 29 '22 edited Dec 29 '22

It's the false sense of familiarity that makes people mess up. In my previous job some juniors messed up some tasks because they thought of joins as set intersections. I also remember when first learning I was puzzled. Sure, maybe a cheat sheet is not for first learning, but I don't understand why we should keep going with something that is almost the concept but not really, and make people learn things twice. When the real concept is simple enough.

5

u/Von_Lincoln Dec 29 '22

What’s your preferred way of thinking about it?

I learned SQL through GIS/ Mapping so the join visual can be literal.

1

u/Apollorx Jan 09 '23

Can you point me in the best direction?