Week 7: My Journey with SQL
Week 7: A Fabulous Journey
Hello folks! Welcome back to Soul’s yap session about what he learned in the gut-wrenching Harvard course known as CS50. Once again, I will be talking about my experiences and the challenges I faced, mainly about my journey of this week of CS50.
For those of you who are unfamiliar with what I am talking about, Harvard offers a course called CS50
which any noob like me can take and learn about computer sciences from scratch. I have been taking this course for some time and so far I have reached week 7 in which we are introduced to the world of databases.
Alright, I must say, this week of CS50 as compared to every week up until now was very different and since this whole week was all about databases, so…yeah it did teach me tons of things about databases that I didn’t know.
And since I am the type of guy who likes to program in more lower level languages that have less abstractions…. this was a very different kind of experience for me. But I must say, i spent quite some time on this week, like a lot.
Lastly, before I move on and talk more about my experiences, I would like to remind you that I did face some challenges when I was trying to push through this week, and whatever challenged me, every little detail about it, and most importantly, how I tackled it. I will go through it all, so this blog can be helpful for anyone who reads this.
Experience With Lecture Series
Let me share a bit of my story which will allow you to understand my point of view even better, so… the thing is: In the previous semester of my university, I did get introduced to databases and boy did I not hate that shit.
The teacher was explaining all the concepts that needed to be practically performed on a database using a whiteboard, almost no body understood her, she was making things dull and boring and complex.
In short, I hated every moment of that class and it made me hate databases too, but when I saw that week 7 of CS50 is all about databases, I did get kind of excited, because I knew that David would extract all that hate out of me that I had for databases, why?
Because he is a great teacher : D
What I Experienced In The Starting of the Week
When I started the week, we got introduced to different theoretical concepts such as what flat file databases are, and tons of other stuff, but most importantly: we weren’t just reading all that from a black and white page that had no soul in it. David was holding our hand and helping us understand every little thing; other than that, we were also practicing everything that we were reading and understanding using Python. Things were simple at the start, but as time passed, we were forced to do the following:
- Write the code to solve a problem.
- Make that code more efficient.
- Make the code tighter.
Basically, the goal of David was to tell us that every programming language is unique and has its own purpose.
- When we wanted more control, we used C.
- When we just wanted to solve the problem, we used Python.
But now, we are facing a different situation and python isn’t best suited for it, David was making us realize that, and guess what he did after that? He introduced us to SQLite which isn’t a toy, its just a lightweight version of SQL and in order to interact with this database management system, we got introduced to a command line tool called sqlite3 (I love using this), and throughout the lecture series, we use this tool to get more and more familiar with how to write queries and databases in general.
How I completed the lecture series
It’s a fact that CS50 doesn’t go easy on you, especially not in Week 7. By getting familiar with SQL, I didn’t just learn some new syntax, I learned a whole new way of thinking. And trust me, this lecture was packed. It took me days to get through it, not because I wasn’t trying, but because I chose to go slow. I broke it down: a bit of lecture every day. No binge-watching. Just focused on understanding whatever I learned from the lecture, and two of the most important things that I did were:
- Practicing everything.
- Noting everything down.
And these habits? I apply them everywhere, when I am learning something new, and trust me, if you are one of those guys saying “oh we don’t need to note everything, we got edx notes” then mate, you honestly need to get the f### out of here : D
And yeah, a lot of things didn’t click instantly. Concepts like primary keys and foreign keys looked simple, but somehow still confused me at first. So I did what every smart learner does - external research. Web3Schools turned out to be a solid fallback. And of course, my best study buddy, Chatgpt also helped me tons.
But here’s the biggest takeaway SQL gave me: When a problem looks too big, break it.
SQL queries can get complex, nested, and even scary. But what do you do? You don’t panic. You simplify. Turn it into smaller queries. Understand each step. Then chain them together. And guess what? That’s not just SQL. That’s problem solving.
And this concept? Knowing it in theory and practically applying and experiencing it are two different things.
Whether you’re programming in C, scripting in Python, or building anything really, this is the formula:
- Understand the problem.
- Break it down.
- Conquer the pieces.
- Repeat.
SQL taught me that. And I’ll carry it with me everywhere from now on.
Experience with Problem-Sets
This week’s problem sets were also pretty different, just like any other week’s problem set. Different in what sense? Well, we were given tasks and we weren’t supposed to write some 100 line code for it, we were supposed to simply craft a query that performed the exact task which was assigned to us. Not more, not less.
Let’s actually head towards discussing the actual problem sets now.
Problem Set 1
So, Problem Set 1 in CS50’s SQL portion is called “Songs” and the task is pretty straightforward: you’re given a database of songs, and your job is to write SQL queries to answer questions about it.
There are 8 tasks in total. Each one asks you to fetch specific information from the database using SQL queries like listing songs with certain properties, sorting data, filtering using conditions, and so on.
Since this is the first SQL problem set, it’s intentionally kept beginner-friendly. Personally, I didn’t face many challenges here. Why? Because I had already spent a lot of time on the lecture not just watching, but actively practicing what was being taught. That extra effort really paid off when it was time to solve the problems.
One habit that helped me a lot was taking structured notes in Obsidian. After I finished the problem set, I documented everything, the queries I wrote, and the logic behind them. It helped me reinforce what I’d just done.
Oh, and one pro tip if you’re new to SQL: keep a good reference open while you work. I had W3Schools SQL reference open in a tab the whole time. Whenever I wasn’t sure about syntax or needed a reminder, I just looked it up. It saves time and makes the learning process much smoother.
And that’s how I wrapped up Problem Set 1. Pretty simple, but a solid foundation for what’s coming next.
Problem Set 2
Problem Set 2 looked innocent at first. It’s called Movies, and yeah, it starts easy. But don’t be fooled. As you go deeper, it throws curveballs fast. You’re working with the IMDb database, and you’re given 13 queries to solve. Sounds simple? It’s not.
Each query is technically one task, but to get to that one answer, you often have to solve three or four sub-problems first. This is where the real game begins. Nested queries. Sub selects. Logic within logic. That whole “break the problem down” strategy? It wasn’t optional here, it was survival.
My notes saved me. Every time I got stuck (which was often), I’d go back to them. They were my map through the chaos. Still, challenges popped up. Sometimes a query just wouldn’t return what I expected. Sometimes I didn’t even know where to start.
But I stuck to the process: break it down, use official hints provided by Harvard, Google things, check different sources, and experiment. If something didn’t click, I kept digging until it did. That mindset of attacking the small problems first was the only way I got through it.
And that’s how I cracked Problem Set 2.
Problem set 3 & Some personal Lore
Unfortunately, I skipped this problem set for now, because I felt like I had gotten enough practice for now, I had exams and needed to focus on other topics that involved building webs and networking stuff, so I just left the problem set
It doesn’t mean I abandoned it, I will surely solve it, but later, for the time being, I think I have spent enough time on databases, that’s why I just decided to wind things up by writing this blog. And yeah…Next, I wanna spend time on week 8 and get good at building websites, and explore the whole development field
Why? Because in today’s world, it’s a pretty valuable skill to know how websites are built, how they function, and also because a man has got to pay bills at the end of the day, right : D
So, yeah this is it for today, I got tons of things I want to explore in near future - I am pretty sure that SQL will help me in some way as well. With that being said, See you later fellas.