Introduction to Databases with SQL: Free Harvard Course

Want to learn SQL the Harvard way? Start learning today with CS50 SQL, a free course on databases with SQL from Harvard.



Introduction to Databases with SQL: Free Harvard Course
Image by Editor

 

For years, Harvard’s CS50 class—everyone's introduction to Computer Science—taught by Prof. David J Malan has helped learners from around the world break into computer science and start their dev journey. While CS 50 is an introduction to computer science, there are specialized tracks on Python, AI, and more.

As you might have guessed, the team has released an Introduction to Databases with SQL course—or CS50 SQL—to help you learn to query databases, design your own, and much more.

If you are an aspiring data professional, you should build a solid foundation in databases and SQL. And this course will help you get there.

 

About the CS50 SQL Course

 

Taught by Carter Zenke, the Introduction to Databases with SQL course is organized into seven modules spanning seven weeks. The modules contain lectures and associated problem sets based on real-world datasets.

For each module, you can follow this approach:

  • Watch the lectures
  • Review the notes
  • Try out the examples presented in the lecture
  • Work through the problem set for the module

You can solve the problem sets on VS Code for CS50. Like codespaces, it gives you VS Codde on the cloud—adapted for CS50. So there’s a ton of learning and practice as you’re progressing through the course.

Now that we know what the course is about, let's go over its contents.

Note: Modules 1 through 7 below map to weeks 0 through 6 in the course.

 

1. Querying Databases

 

The first module Querying Databases starts out by discussing the need to move beyond spreadsheets and how data is stored in a relational database. It then proceeds to the basics of querying databases with SQL. The topics the topics covered include:

  • SELECT statement
  • LIMIT and WHERE clause
  • Understanding NULLs
  • LIKE keyword
  • Ranges
  • ORDER BY
  • aggregate functions

Check out the module on querying.

 

2. Relating Database Tables

 

The Relating Database Tables module builds on the previous module and moves beyond a single database table. You’ll learn to work with multiple tables and understand the relationships between them. The topics covered include:

  • Entity relationship diagrams (ER diagrams)
  • Relationship types: one-to-one, one-to-many, and many-to-many relationships
  • Keys: primary and foreign keys
  • Subqueries
  • IN keyword
  • JOINs
  • Set operations: INTERSECT, UNION, and EXCEPT
  • GROUPBY

Check out the module on relating.

 

3. Designing Database Schemas

 

So far you’ve learned  to work with databases, query single and multiple tables to answer questions. But how do you create such a database yourself? This module Designing Database Schemas covers exactly that. You’ll learn to design databases from scratch including concepts like:

  • Creating database schemas
  • Concepts of normalization and relating database tables
  • Creating tables
  • Data types and storage classes
  • Constraints on tables and columns
  • Altering tables

Check out the module on designing.

 

4. Writing to Databases

 

By now you know to retrieve data from databases using queries and design your own databases from scratch. This module Writing to Databases teaches you:

  • Inserting records into databases
  • Importing data from CSV files into a database
  • Deleting and updating records

Check out the module on writing.

 

5. Viewing Database Tables

 

The next module on Viewing Database Tables is a deep dive into creating database views and their advantages covering:

  • What views are
  • Creating views
  • Advantages of creating views
  • Common Table Expressions (CTEs)
  • Partitioning
  • Securing databases
  • Soft deletions

Check out the module on viewing.

 

6. Optimizing Database Queries

 

The Optimizing Database Queries module focuses on using indexes to speed up database queries and the trade-offs associated with indexes. The topic covered include:

  • Creating a database table index
  • Creating indexes across multiple tables
  • Space and time trade-off
  • Partial indexes on a subset of rows
  • Transactions and race conditions

Check out the module on optimizing.

 

7. Scaling Databases

 

In this course thus far, you’ve used SQLite. This final module on Scaling Databases introduces you to MySQL and PostgreSQL. It lays a foundation for these widely used RDMSs that you can build upon. This module covers:

  • Creating and altering tables
  • MySQL stored procedures
  • Stored procedures with parameters
  • Working with PostgreSQL
  • Access control statements
  • SQL injection attacks

Check out the module on scaling.

All the topics covered in this course are important if you’re considering a career in data. Introduction to Databases in Data Science provides an overview of the relevance of databases and essential database skills.

 

Wrapping Up

 

Overall, this is a great course to build a solid foundation in databases and SQL. As a data professional, you’ll use SQL all the time. But you’ll also realize that mastering SQL is a continuous journey. And to that end practice is your best friend!

If you’re ready to hone and flex your SQL muscles, check out this compilation of the 7 Best Platforms to Practice SQL.
 
 

Bala Priya C is a developer and technical writer from India. She likes working at the intersection of math, programming, data science, and content creation. Her areas of interest and expertise include DevOps, data science, and natural language processing. She enjoys reading, writing, coding, and coffee! Currently, she's working on learning and sharing her knowledge with the developer community by authoring tutorials, how-to guides, opinion pieces, and more. Bala also creates engaging resource overviews and coding tutorials.