Welcome
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. For each week, follow this workflow:
flowchart TD
A[Watch Lecture] --> B[Submit Problem Set]
And then submit the course’s final project.
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!
- If interested in a verified certificate from edX, enroll at cs50.edx.org/sql instead.
- If interested in a professional certificate from edX, enroll at cs50.edx.org/programs/databases instead.
- If interested in transfer credit and accreditation from Harvard Extension School, register at web.dce.harvard.edu/extension/csci/e/151 instead.
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. Additionally, we encourage teachers to participate in the CS50 Educator Workshop to learn more about CS50’s curriculum, technology, and pedagogy.