Learn Spatial SQL

Spatial SQL for GIS and Geospatial: Basic SQL

Welcome to the first in a series of videos and posts on learning spatial SQL. This will focus on learning the core elements of SQL, and in the name of not reinventing the wheel, there are already such great resources to learn SQL.

The Spatial SQL Book – Available now!

Check out my new book on Spatial SQL with 500+ pages to help you go from SQL novice to spatial SQL pro.

What you need to know

Here are some of the top things you should focus on when learning SQL. Of course, there are more but this is a good base list to choose from.

  • Handing NULL data
  • Using SQL functions
  • Aggregations – MIN/MAX/AVG/SUM/COUNT and GROUP BY
  • Joins
  • CTEs or Common Table Expressions
  • Subqueries

I also like these posts from Nick Singh and Eric Weber and the comments that have other items as well.

Courses for SQL

Mode SQL Course

The Mode SQL course is a great tool that breaks down every aspect of SQL from end to end for a beginner with absolutely no experience up to those looking for more advanced tutorials. It also allows you to practice with sample data in their platform and has some programming challenges at the end.

Mode SQL Course
Mode SQL Course

Learn SQL

I really like Learn SQL which has a few different options. You can select a course on a very specific topic like window functions or joins, run through monthly practice sessions, or complete courses. You don’t need to set anything up and you can run all your queries and sessions right from your browser.


Practice SQL Online

Here are some of the best resources to practice your SQL skills online.


Practice real SQL use cases and questions from interview questions from a variety of companies all from your browser. Stratascratch is just like Leetcode, but built for and by data scientists and analysts. You can also practice Python and other languages too.

Practice SQL with Stratascratch
Practice SQL with Stratascratch

SQL Bolt

This is a practical and contained SQL tutorial that allows you to practice a range of basic concepts all in your browser. Simple and easy to get started.

Learn Spatial SQL
Learn Spatial SQL

Reference guides for SQL

You always need to look things up, and outside of the code docs (which I definitely recommend becoming familiar with), these are great tools for great quick look-ups as you are working with SQL.

PostgreSQL Tutorial

This is a very comprehensive toolkit for referencing SQL functions and checking and referencing quick guides and proper usage.

PostgreSQL Tutorial
PostgreSQL Tutorial

W3 Schools

W3 Schools has so many resources for a lot of languages, and SQL is no different. You can quickly find any reference on the site and then see the structure, usage, and actually run the code in the browser too.

W3 Schools for SQL

Other Resources

Advanced SQL from Taylor Brownlow

This series of 5 posts is one of the best set of really comprehensive posts on advanced SQL topics such as common table expressions, dates, joins, window functions, and user-defined functions. These are incredibly well written so I recommend them for beginners and as refreshers for advanced users.

Advanced SQL Tutorials
Advanced SQL Tutorials

Spatial SQL Cookbook

This is a quick reference guide I put together for some spatial SQL code snippets.

Learn SQL Cheatsheets

Everyone loves a cheat sheet! These are an amazing visual reference for more simple and advanced topics.

SQL Cheat Sheet
SQL Cheat Sheet

Data by Danny SQL Challenge

Data by Danny is one of the best resources for SQL online! Follow him on LinkedIn and make sure to check out his resources page. There are free resources, code challenges, and a link to his super comprehensive course called the 8 Week SQL Challenge.