โ† Academy

Finance Data Analysis: From Data to Decisions

0% complete
๐Ÿ“Œ Reading as a guest. Create a free account to take quizzes and save your progress to your dashboard.
SQL from scratch

What is SQL? SELECT and FROM

SQL stands for Structured Query Language. It is the standard language for talking to a database, used by virtually every company in the world. When you want to get data out of a database, you write a query in SQL, and the database returns the answer as a table. That is the core idea: you ask a question in SQL, you get back a table of results.

Why learn it? Because in any real company, the data you need lives in a database, and SQL is how you reach it. It is precise, repeatable, and works on millions of rows instantly, things a spreadsheet cannot do. SQL is one of the most valuable and durable skills a finance analyst can have, and the basics are genuinely easy.

Tables, columns, rows (recap)

A database holds tables. Imagine a table called sales with columns date, region, product, and amount, and one row per sale. Every SQL query you write will pull from a table like this.

Your first query: SELECT and FROM

The two most fundamental keywords are SELECT (which columns you want) and FROM (which table to take them from). Here is the simplest possible query:

SELECT region, amount\nFROM sales;

Read it in plain English: "select the region and amount columns, from the sales table." The database returns a table with just those two columns, one row per sale. The semicolon at the end marks the end of the statement. SQL keywords are traditionally written in capitals (SELECT, FROM) to stand out, though the database does not care about the case.

To get every column, use the star symbol as a shortcut:

SELECT *\nFROM sales;

This says "select all columns from the sales table." Useful for a quick look, though in real work you usually name the specific columns you need.

What you get back. If the sales table has the three rows from Module 1, then SELECT region, amount FROM sales; returns:
regionamount
US200
UK50
US200
Exactly the two columns you asked for, every row. SQL did the fetching; you just described what you wanted.

The mental model

Every SQL query you will ever write is a variation of "SELECT these columns FROM this table, with these conditions, grouped and sorted like this." Once SELECT and FROM feel natural, the rest of SQL is adding clauses to refine the answer, which is exactly what the next two lessons cover.

  • SQL = Structured Query Language, the language for databases.
  • You write a query, the database returns a table of results.
  • SELECT chooses columns; FROM chooses the table; semicolon ends the statement.
  • SELECT * returns all columns.