Learn SQL on Khan Academy

I was browsing around on the Khan Academy website looking for some coding courses to do in the holidays. It was recently the “hour of code” challenge and Khan Academy has a number of free online courses. For those unfamiliar with the concept, the “Hour of code” is designed to introduce computer science to students during Computer Science Education week in the U.S. It is organised by the Code.org organisation in Seattle, and it is a movement that has spread around the world. My friends Michael & Chris will also be the first to tell you that SQL is not coding. Nevertheless, the Khan Academy course was a fun introduction for me to learn SQL.

Why did I want to learn SQL?

I am proficient in using analytics tools for web and mobile. I did notice that using SQL did come up for the purpose of product management & for customer support queries. Its something I’ve wanted to learn.

If you want to query the database directly you need to use SQL – provided you are using SQL database. It can help you find relational information between tables. There was also a tool I wanted to use called Periscope Data for visualising SQL data. However you need to be able to type SQL first!

I wanted to have a basic understanding of SQL for the purpose of product management. This post on Khan Academy explains it why you need to learn SQL. Its in the context of a health related app with thousands of users logging data. It provides the “why” for 3 different roles.

1. Software engineers:

They are the ones building the backend (the server-side logic) and the frontend (the HTML/CSS/JS that renders data and forms). The software engineers would use SQL to communicate on the server-side with the database that’s storing all of the user’s data. They would need to know how to do any queries needed by the frontend. For example, if users saw a dashboard when they logged on of how much exercise they did that day, the engineer would need to figure out how to do a SELECT filtered by date and user. They would need to figure out how to insert data and update it (which we’ll discuss much later)

2. Data scientists

They are the ones analyzing the data, trying to learn more about users, maybe coming up with suggestions about how to help them exercise more. They need a deep understanding of SELECT statements, because they need to do very complex queries to do the analysis they’re interested in. For example, they might use a SELECT to analyze what percentage of users were more likely to do more exercise if they started off exercising in the morning, maybe using CASE and GROUP BY.

3. Product Mangers
They are the decision makers at a company, the people that look at the data, talk to users, look at the market, and try to understand how to improve a product to get more users, make users happier, or make more money. They often need an understanding of SQL queries so they can look at usage statistics and try to understand what parts of a product are being used the most, which parts are being used in surprising ways, and what isn’t being used at all. They might use a SELECT to look at how many users even use the “heart_rate” field at all, if they’re debating getting rid of it.

Khan Academy Course

I like the way Khan Academy does computer programming courses. For the “Introduction to SQL” course they have a video you watch first explaining some examples. Then there are interactive exercises that you do. On the left hand side of the screen is the editor where you can write queries. On the right hand side it runs the code. If there is a problem, it will tell you with a funny character pointing out the error in the specific line.


Welcome to SQL:

 

It has fun interactive examples from grocery lists, music play lists, movie data and more. What I don’t like about is that the “help” section, which is the Q&A from other students & instructors is found on the video screen. Its not on the screen where you do the exercises. I’m sure this is deliberate so you can’t “cheat”. However, I had two browser windows open and switched between them when I got stuck for clues.

I’ve completed the following modules for “Intro to SQL”:
1. SQL basics
2. More Advanced SQL Queries

That’s approximately 50% of the course. I’d say its taken me about 1/2 day, but I took my time in between doing other things.

Additional resources

Here are some additional resources I came across that I found useful.

1. Datatypes in SQL

2. Learn SQL in day ebook
I highly recommend this ebook. Its $3 on the kindle and is an easy to read book. I found it to be a good crash course to SQL concepts.

Learn SQL In A Day book

Learn SQL In A Day book

A note about NoSQL

I’m aware that NoSQL is used these days as well. NoSQL is a database that does not have tabular relationships. I was at a presentation in San Francisco by Aerospike, which is a NoSQL database.

There’s some more info about NoSQL here. I’m not going to discuss NoSQL in this post. Once I’ve got my head around SQL, I’ll take on NoSQL in a separate post 🙂

Final note

If you have an hour or a few hours spare, I’d recommend doing the “Hour of databases” course on Khan Academy. They also have an “Hour of webpages” and “Hour of drawing with code”.

When I’ve finished my SQL course on Khan Academy, I will get back into learning Python again. A goal for 2016!

I’m out like Christmas,
Matt Ho

One thought on “Learn SQL on Khan Academy

  1. Pingback: Programming Update - learning javascript - inspiredworldsinspiredworlds

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA * Time limit is exhausted. Please reload CAPTCHA.