Live data from Hacker News

Ask HN: Junior SQL developers – How do you learn SQL?

news.ycombinator.com

1–10 of 46 posts

Ask HN: Junior SQL developers – How do you learn SQL?

#1
I have a question to junior software developers.....

I've been an engineer for last 12 years and during my career I've been mentoring people and helping them learn SQL. I used different approaches but did not find any better approach from learning by [doing] writing SQL queries and solving tasks. Even if it was by leveraging the AdventureWorks database, and/or a real world production database.

So my question to people who just entering into any developer role and/or learning just SQL....

How do you learn SQL now, and what is the best approach for you personally?

Re: Ask HN: Junior SQL developers – How do you learn SQL?

#2
I had a bit of experience my freshmen year of college by working on a personal project that I abandoned.

When I got hired as a SQL Developer with little experience. I got a rundown on my employers database and tables and then tried my best. Google and Stack was the best teacher and with each work assignment I learned something new or a better way to do what I did before. Often the SQL queries I wrote would require updates and I would put in better solutions.

There’s still a ton of stuff I don’t know and I made a lot of mistakes along the way , but I still feel like this was the best learning experience for me.

Re: Ask HN: Junior SQL developers – How do you learn SQL?

#3
I'm not a junior, but my best learning came from real examples in my first role. Then when I had some experience, researching advanced functions such as window functions and CTEs, AKA the result of answering "why does this query take ten minutes to run and how do I optimize it?"

Re: Ask HN: Junior SQL developers – How do you learn SQL?

#5
I didn't really learn SQL until being given small tasks at work that involved some basic scripting. Requests for populating tables with new data so admins wouldn't have to manually input it from the web UI was a common one. That in particular was helpful because:

1. Performance is not usually as important for one-time scripts like these.

2. It gets you familiar with your database and the relationships between entities in your product.

3. It shows you how powerful SQL is. With a few hours writing a single script, I saved users many more hours that would've been spent entering it all manually.

The other benefit of this approach, it's easier for senior developers to review too. You can give feedback like, "this works fine for this use-case, but here's something you can do in situations where performance is a concern" and provide some useful tips in PR comments.

Re: Ask HN: Junior SQL developers – How do you learn SQL?

#6
Not so much about how I learned but how I teach.

Whenever I want to explain how one can do things in SQL I pull up a google/excel sheet and write down some sample data that resembles the problem.

When multiple tables are involved I just write the samples in two different locations within the same sheet.

After that I can just jot down the resulting table below (without writing the actual sheet commands) and maybe some instruction.

Makes all concepts very clear, for example when explaining n:m joins or window functions. Or just the general "table programming" concepts where you add columns rather than variables when you want something done.

Particularly well suited now in covid times when I have to explain things remotely.

SQL and sheets programming are just very closely related.

Re: Ask HN: Junior SQL developers – How do you learn SQL?

#8

https://sqlbolt.com/ and then https://sqlzoo.net/ were great places for me to start.

Thanks for sharing these resources. Can I ask you what was your initial context or environment that made you learn SQL first? I mean what did encourage you to go and look for a solution?

Re: Ask HN: Junior SQL developers – How do you learn SQL?

#10

I didn't really learn SQL until being given small tasks at work that involved some basic scripting. Requests for populating tables with new data so admins wouldn't have to manually input it from the web UI was a common one. That in particular was helpful because: 1. Performance is not usually as important for one-time scripts like these. 2. It gets you familiar with your database and the relationships between entitie…

Totally agree...these are some nice ways to learn and practice. So to make sure I follow your initial need back then what was your main goal when you were solving such tasks as writing a script to automate data entry? Like what was the main and most important goal back then?
Post reply on HN