CS50 Lesson 7 (SQL)
SQL is one of those things I never got into. I didn't have a reason to - all the hobbying I did around web development was brochure-like, not dealing with any significant amounts of data. I can likely count on one hand how many times in my career I've had to write a SQL statement, especially when products like WordPress and MovableType handled any database connectivity under the hood, or any database manipulation needs I had could be done via SequelPro UI.
So in a way it was kind of fun to approach this academically, and building upon previous methods. We learn that databases have a way of storing data that can be advantageous over spreadsheets or csv's. Data can be relational, and normalized, and can be flattened, making the ability to create, read, update, and delete data to be done in an optimized manner. We also learn about how indexing tables in the database can further make SQL much more performant.
It's fun to watch how grabbing data from IMDB gave us a good foundation of data to play around with. I do feel like there was room for improvement in demonstrating how the data is represented in the database. Having two tables that just say show_id
and id
with lines connecting them, while likely is a diagram I need to get used to, I'd much prefer an even dumbed-down-even-moreso walkthrough of how to visualize some of that data. Or maybe I just need to watch that segment again. :)
I love the idea of having the class submit a google form of 'what is your favorite tv show' to demonstrate how data needs to be massaged a bit before inserting those values from the database, such as trimming white space and normalizing the casing.
It's also interesting to see how you can use a SQL statement as a parameter for another SQL statement to c.r.u.d the things you need.
Finally, the instructor touches on some gotchas, such as SQL injection attacks and race conditions.