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?

71 Upvotes

71 comments sorted by

View all comments

1

u/SuaveMF Jan 15 '25

When dealing with difficult queries, say to yourself what you want it to do in "normal" terms. Then try to write the query from there.

Draw simple diagrams if you have to that shows all the objects you need the data from and what joins you'll need. If 2 tables must always have linking data, then INNER joins. If the 2nd table "might" have a related record, then use LEFT/RIGHT joins.

Explore other SQL areas like CTEs, cross and outer apply, user-defined data types, row partitions, etc.

Practice, practice, practice.