This is CS50’s introduction to databases using a language called SQL. Learn how to create, read, update, and delete data with relational databases, which store data in rows and columns. Learn how to model real-world entities and relationships among them using tables with appropriate types, triggers, and constraints. Learn how to normalize data to eliminate redundancies and reduce potential for errors. Learn how to join tables together using primary and foreign keys. Learn how to automate searches with views and expedite searches with indexes. Learn how to connect SQL with other languages like Python and Java. Course begins with SQLite for portability’s sake and ends with introductions to PostgreSQL and MySQL for scalability’s sake as well. Assignments inspired by real-world datasets.

Whereas CS50x itself focuses on computer science more generally as well as programming with C, Python, SQL, and JavaScript, this course, aka CS50 SQL, is entirely focused on SQL. You can take CS50 SQL before CS50x, during CS50x, or after CS50x. But for an introduction to computer science itself, you should still take CS50x!

Watch an introduction

How to Take this Course

Even if you are not a student at Harvard, you are welcome to “take” this course for free via this OpenCourseWare by working your way through the course’s seven weeks of material. If you’d like to submit the course’s problem sets and final project for feedback, be sure to create an edX account, if you haven’t already. Ask questions along the way via any of the course’s communities!

How to Teach this Course

If you are a teacher, you are welcome to adopt or adapt these materials for your own course, per the license.