Skip to content
In academic affiliation with Carnegie Mellon University
Institute of Algorithmic Tradingand Applied Computational Finance

Foundation course in programming

SQL for Finance

SQL for finance, taught on market data: selecting, joining and aggregating prices, trades and positions, window functions for returns and rolling statistics, and the design of a research database that does not lie about the past.

SQL for finance is the skill that turns a pile of price files into data you can trust. Prices, trades, positions and reference data all live in tables, and a researcher who can join and window them correctly avoids the quiet errors, such as missing delisted stocks, that make a backtest look better than it was.

Why is a point-in-time database so important?

Because a database built from today’s view of the world leaks the future. Index members are the ones that survived, company names are today’s names, and fundamentals are revised after they were first reported. The course shows how to store data as it was known on each date and how to query it with as-of joins.

How is the course taught?

Audio lessons explain the ideas, short explainer films show the queries running, and the workbooks hold every exercise with its data, model answers and a cheat sheet of the patterns used in research. The database project is marked by the faculty with written feedback.

Who is this course for?

Anyone who will handle market data for research, trading or risk. It is part of the Foundation Certificate in Computational Finance, which opens the Professional Diploma in Algorithmic Trading and the Fellowship in Computational Finance.

What you will be able to do

  • Write SELECT, JOIN, GROUP BY and window-function queries on price, trade and position tables.
  • Compute returns, rolling statistics and corporate-action adjustments in SQL.
  • Design a point-in-time research database that avoids survivorship and look-ahead bias.
  • Move data between SQL and Python for analysis.

Syllabus, module by module

  1. Tables of market data

    Prices, trades, quotes, positions and reference data, and how they relate.

  2. Querying

    SELECT, WHERE, ORDER BY and aggregates on daily and intraday prices.

  3. Joins

    Matching trades to instruments, prices to corporate actions, and positions to prices.

  4. Window functions

    Returns, rolling means and volatilities, ranks and lags without leaving the database.

  5. Point-in-time design

    As-of joins, delisted names and why a database can quietly leak the future.

  6. SQL and Python together

    Querying from Python, DuckDB and Parquet files, and when to compute where.

How the certificate is earned

Quizzes at the end of each unit and a graded project in which you build and query a small point-in-time equity database. On a pass you receive the Course certificate in SQL for Finance, issued by the Institute with a verification code. Read how certification works.

Before you start

Basic Python, as taught in Python for Finance or equivalent.

This course counts toward

Questions applicants ask

Do quants use SQL?

Yes. Most market, reference and position data lives in databases, and many quant, risk and data roles list SQL alongside Python. Researchers who can query their own data move faster and make fewer silent errors.

Which database does the course use?

The exercises run on DuckDB and SQLite, which need no server. The SQL taught is standard and carries over to PostgreSQL, kdb’s q-SQL ideas and the cloud warehouses used at banks and funds.

$190 48 hours