Skip to content
Python and Data Primer / Professional Workflow

SQL

A financial dataset may be too large to load in full. SQL lets you select the records needed for a calculation and summarise them in the database. This lesson uses a small SQLite price table to teach filtering, ordering and aggregation. You will use pandas to analyse a selected result and timestamps to define its time meaning.
Learning objectives. By the end of this note you should be able to describe a table, run a parameterised SELECT, aggregate rows and explain why string-built queries are unsafe.

In this lesson

  1. Query a relation
  2. Aggregate in the database
  3. Filtering happens before the result is fetched

Before you start

The full lesson, with worked examples and exercise solutions, is for members.

Read the full lesson

New to SelfMadeQuant.com? See membership options or browse the Python and Data Primer syllabus.