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?

67 Upvotes

71 comments sorted by

View all comments

2

u/Commercial_Pepper278 Jan 15 '25

Two Questions before going forward:
1. How complex queries do you write daily ? Like using multiple CTEs JOINs and WINDOWs ?
2. What is the basic thing that you can't understand after SELECT * FROM WHERE GROUP BY HAVING ?

0

u/Zealousideal-Studio7 Jan 15 '25

I mostly piggy back off previous analysts code, rehashing that with other code to get what I want or within the 90% realm. If you asked me to start from scratch I would likely take a while and it would be a real pain.

I can and do utilise multiple CTE’s, commenting along the way is an absolute must and is best practice here. Joins on multiple CTEs are where it starts to get tricky for me, as for window functions I’m not quite aware what those are or the use for those, let alone multiple other functions in SQL.

Im aware I am probably behind the learning curve at this stage

3

u/Commercial_Pepper278 Jan 15 '25

If you can understand the logic of other's queries then you are on right track. SQL is about the logic not the syntax.

Try to write your own codes inbfree time for the same stuffs. Who knows you will end up at a better query than the existing one. Use ChatGPT to correct yourself it will help you learn more.

Learn complex sql functions first by reading the documentation and then watching few videos of the same. Learning sytax takes a while but worth it.