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
- Query a relation
- Aggregate in the database
- 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 lessonNew to SelfMadeQuant.com? See membership options or browse the Python and Data Primer syllabus.