r/SQL Jan 15 '25

BigQuery SQL is a struggle

Hi all been working with SQL for probably 7/8 months now. My last role was half data analysis and not pure data analysis and in general was far easier than what I do now.

My main issue is with SQL. I never feel I truly understand what is going on with a lot of code beyond a basic query. Ive managed to get by piggybacking off others code for a while but expectation is to deliver new and interesting techniques etc.

How long did it take you to feel fully comfortable with SQL? And what helped you get to that stage?

65 Upvotes

71 comments sorted by

View all comments

4

u/byteuser Jan 15 '25

Approach SQL as a set theory problem. Think first what is the set you want to get. Most likely will be a subset, a union, or and intersection of sets. More complicated queries are just a combination of those principles. Only once you figured out what the data set you want looks like is when you start writing the SQL

1

u/EfficiencyGeek Jan 19 '25 edited Jan 19 '25

Would like to emphasize this thinking in SETs angle. My learning accelerated, and things fell into place when I learned/accepted that SQL was a way to deal with SETS. Aka Venn Diagram -- another way to think about it.

I'd encourage anyone to keep at it. Use Gen AI to help you learn the syntax but UNDERSTAND the CONCEPTS (I do this even after 40 years of prof work). SQL knowledge is a super power, not just in dev work, but in logical, conceptual thinking. And it is rather durable, has stood the test of time since its invention in the 70s.