SQL basics

SQL

SQL stands for “Structured Query Language”, and it is used to communicate with a database. In this section, we will talk about SQL and play with it! There are plenty of resources out there to learn SQL. My favorites are:

w3 school: https://www.w3schools.com/sql/
SQLBolt: https://sqlbolt.com
Leetcode: https://leetcode.com/problemset/database/
Greg Wilson: https://gvwilson.github.io/sql-tutorial/

There are a few other things one may try to learn as well in this SQL zone…

  1. How to test your SQL query? Unit testing with pyspark:
  • https://davidlindelof.com/unit-testing-sql-with-pyspark/
  • https://andrewpwheeler.com/2023/02/02/setting-up-pyspark-to-run-sql-tests/

  1. How to connect to a database, and run your SQL query? Learn about ODBC (and JDBC), and pyodbc, and SQLAlchemy.


(3) How to create a database yourself, and just play with it? Learn the built-in module sqlite3, and use it to create a db and table.