/SQLBasics

An iPython notebook for illustrating the basics of SQL

Primary LanguageJupyter Notebook

Overview

This notebook is intended to provide a non-comprehensive introduction to SQL and relational database concepts.

Specifically, it was created to show a person with some technical background but no familiarity with SQL everything needed to construct queries to address use cases like:

  • Given a table of event logs associated with users, I need to see events triggered by a specific set of users
  • Given a table of event logs associated with users, I need the set of users assocaited with a specific event recorded during a given period of time

To address these use cases, the document will cover:

  • Basic relational database structure
  • SELECTing columns from a table
  • ORDERing and LIMITing column data
  • GROUPing and aggregating column data
  • Filtering results to show only columns WHERE the value matches one or more criteria, including being IN a given list
  • JOINing tables together

Setup

  1. Install JupyterLab if you haven't already
  2. Clone this repo
  3. Install other dependencies: pip install -r requirements.txt
  4. Start the notebook: jupyter-lab SQLBasics.ipynb

Viewing the notebook

Best viewed in Binder (be patient, it will take a while for this link to fully load!)