SQL and Python terms

Every term you need for data and analytics exams and take-home tasks, explained from scratch. The theory first, then a glossary of 165 terms, then a quiz to test yourself. Short on time? Go straight to the quiz.

1 The theory in brief

How data is stored

Data lives in tables. Keys link one table to another.

customers · one row per customer

customer_idPKnamecity
1AoifeDublin
2CianCork
3NiamhNULL

orders · one row per order

order_idPKcustomer_idFKamount
101130.00
102112.50
103245.00
  • Primary key: unique on every row
  • Foreign key: points at another table's primary key
  • Row: one thing
  • Column: one kind of fact

The schema is the plan: table names, columns, types and keys. The grain is what one row stands for. Customer 1 has two orders, so joining these tables gives one row per order, not per customer. Niamh's city is NULL: unknown.

How SQL runs

You write SELECT first. The database works on it fifth. This order explains most SQL errors, and exams love it.

YOU WRITE IT RUNS SELECT FROM WHERE GROUP BY HAVING ORDER BY LIMIT 1FROM 2WHERE 3GROUP BY 4HAVING 5SELECT 6ORDER BY 7LIMIT
  • WHERE runs before GROUP BY, so it can't test COUNT(*). Filter groups with HAVING.
  • SELECT runs fifth, so strict SQL won't let WHERE use its aliases. ORDER BY runs later, so it can.
  • Window functions are worked out at the SELECT step. Filter on them in an outer query, or with QUALIFY in DuckDB and Hex.

DISTINCT happens just after SELECT. Joins happen inside the FROM step.

How Python runs

The interpreter reads your code from the top, one line at a time, and stops at the first error.

Names point to values

a b [1, 2, 3]
a = [1, 2] b = a b.append(3) print(a) # [1, 2, 3]

Both names point at one list. For a separate list, use a.copy().

Types, and which can change

Mutable: change in place

list [ ]dict { }set

Immutable: fixed once made

int 42float 3.5str "Cork"bool Truetuple ( )

type(x) tells you what you have. '5' + 5 fails: text and a number don't add.

Indentation makes the blocks

for p in prices: if p > 50: print("dear") # inside both total += p # inside the loop print(total) # once, after

Errors: read the last line first

Traceback (most recent call last): File "clean.py", line 3 print(totl) NameError: name 'totl' is not defined

The last line names the error. The line above shows where. Here: a typo.

How pandas thinks

A DataFrame is a table of columns. Each column is a Series. The index labels the rows.

city
price
qty
0
Cork
20.0
2
1
Dublin
35.5
1
2
Galway
NaN
4

Grey: the index. Blue: df["price"], a Series. NaN: missing.

axis=0 ↓ down the rows. df.sum() gives one total per column.

axis=1 → across. df.sum(axis=1) gives one total per row.

# vectorised: whole column at once df["with_vat"] = df["price"] * 1.23 # NaN stays NaN. Missing in, missing out.

Write column maths like this, not a for loop over rows. It is shorter and much faster.

JSON shapes

Three building blocks. APIs send them nested, and you flatten them into a table.

Object: keys and values

{"id": 1, "name": "Aoife"}

Array: values in order

["Cork", "Galway"]

Nested: one inside another

[ {"id": 1, "address": {"city": "Cork"}}, {"id": 2, "address": {"city": null}} ]

pd.json_normalize(data) turns the nested list into:

idaddress.city
1Cork
2None

JSON has strings, numbers, true/false and null. It has no date type: dates travel as text.

Data types across the four

The same idea goes by a different name in each place.

SQLPythonpandasJSON
Whole numberINTEGERintint64number
DecimalREAL, DECIMALfloatfloat64number
TextTEXT, VARCHARstrobjectstring
True / falseBOOLEANboolbooltrue / false
DateDATE, TIMESTAMPdatetimedatetime64text
MissingNULLNoneNaN, NaTnull
ListARRAY*listobjectarray
Keys and valuesSTRUCT, JSON*dictobjectobject

* Postgres and DuckDB have these. SQLite stores dates as text and true/false as 1 and 0. pandas also has a newer string type for text.

2 The glossary

165 terms in seven groups. Each has a plain definition, an example, and the trap that catches people.

Data basics17 terms

How data is laid out before you query it.

Table

A grid of data with named columns, like one sheet of a spreadsheet.

Example A customers table with customer_id, name and city.

Row

One line across a table. Each one is a single thing: one order, one customer.

Example Order 1042: Aoife, €30, 3 May.

Often confused with Column. Rows go across, columns go down. Also called a record.

Column

One kind of fact, running down the table. Every value in it has the same type.

Example city in the customers table.

Often confused with Row. Also called a field.

Database

A set of tables kept together and linked by keys.

Example A shop's customers, products and orders tables.

Often confused with Table: one grid. The database holds many.

Schema

The plan of a database: its tables, their columns, each column's type and the keys that link them.

Example orders(order_id INTEGER, customer_id INTEGER, amount REAL)

Watch out In Postgres the word also means a named folder of tables, such as public.

Primary key

A column whose value is unique on every row and never missing, so it identifies the row.

Example order_id in orders.

Often confused with Foreign key. A primary key can be two columns together (a composite key).

Foreign key

A column that holds another table's primary key, so rows can be linked.

Example customer_id in orders points at customers.

Often confused with Primary key. Foreign key values can repeat: one customer, many orders.

Grain

What one row of a table or result stands for.

Example One row per order. Or one row per customer per month.

Often confused with Primary key. Check the grain of both tables before you join or sum.

Data type

The kind of value a column holds: whole number, decimal, text, date, true/false.

Example '42' is text. 42 is a number.

Missing value

A gap where a value should be. SQL calls it NULL, pandas shows NaN, JSON writes null.

Example A customer with no email address.

Often confused with Zero or empty text. Those are real values.

Duplicate row

A row that repeats another, either fully or on the key that should be unique.

Example The same order loaded twice, so revenue is double-counted.

Structured data

Data that fits rows and columns with a fixed schema.

Example A sales table.

Often confused with Unstructured data: free text, images, audio.

Categorical variable

A column of labels that sort rows into groups.

Example city, plan, device.

Often confused with Numeric variable. An ID looks like a number but is a label: never average it.

Numeric variable

A column of numbers you can do maths on.

Example price, minutes_played.

Often confused with Categorical variable.

Long format

One row per measurement, with a column saying what was measured.

Example country, year, value

Often confused with Wide format. Charts and groupby usually want long.

Wide format

One row per thing, with a separate column for each measurement.

Example country, 2023, 2024, 2025

Often confused with Long format. Reports and spreadsheets usually show wide.

Normalisation

Splitting data into linked tables so each fact is stored once.

Example A customer's city lives in customers, not on every order.

Often confused with Scaling numbers to 0 to 1, which shares the name.

SQL38 terms

Words for writing and reading queries.

Query

One question written in SQL. It returns a result table.

Example SELECT COUNT(*) FROM orders;

SELECT

Picks the columns, or worked-out values, the result should have.

Example SELECT name, price * 1.23 AS with_vat

FROM

Names the table the rows come from. Runs first.

Example FROM orders

WHERE

Keeps only the rows that pass a test, before any grouping.

Example WHERE city = 'Cork'

Often confused with HAVING, which filters groups after grouping.

ORDER BY

Sorts the result. Smallest first unless you add DESC.

Example ORDER BY revenue DESC

Watch out Without it, row order is not guaranteed.

LIMIT

Caps how many rows come back.

Example LIMIT 10

Watch out SQL Server writes TOP 10. Standard SQL has FETCH FIRST 10 ROWS ONLY.

DISTINCT

Removes repeated rows from the result.

Example SELECT DISTINCT city FROM customers

Watch out COUNT(DISTINCT city) counts unique values.

Alias

A temporary name for a column or table, given with AS.

Example price * 1.23 AS with_vat

Watch out Strict SQL will not let WHERE use a SELECT alias. Postgres refuses; SQLite and DuckDB allow it.

NULL

A missing or unknown value. Not zero, not empty text.

Example WHERE email IS NULL

Watch out = NULL never matches anything. Use IS NULL.

COALESCE

Returns the first value in its list that is not NULL.

Example COALESCE(city, 'Unknown')

Watch out IFNULL (SQLite) and NVL (Oracle, Snowflake) do the same for two values.

CASE WHEN

Picks a value by testing conditions in order, like if/else inside a query.

Example CASE WHEN price > 50 THEN 'high' ELSE 'low' END

LIKE

Matches text to a pattern. % stands for any run of characters, _ for exactly one.

Example name LIKE 'A%'

Watch out SQLite's version ignores case for plain letters; Postgres and DuckDB do not (use ILIKE).

IN

Tests whether a value matches any item in a list.

Example city IN ('Cork', 'Galway')

Watch out NOT IN with a NULL in the list returns no rows at all.

Aggregate function

A function that turns many rows into one value.

Example COUNT, SUM, AVG, MIN, MAX.

Watch out Aggregates skip NULLs. Only COUNT(*) counts every row.

COUNT(*)

Counts rows, whether or not they hold NULLs.

Example SELECT COUNT(*) FROM orders

Often confused with COUNT(column), which skips NULLs.

COUNT(column)

Counts the values in one column that are not NULL.

Example COUNT(email) gives customers who have an email.

Often confused with COUNT(*), which counts every row.

GROUP BY

Splits rows into groups that share a value and returns one row per group.

Example GROUP BY city

Watch out Every column in SELECT that is not aggregated must be in GROUP BY. SQLite lets this slide; most databases raise an error.

HAVING

Filters groups after grouping, using aggregate results.

Example HAVING COUNT(*) >= 5

Often confused with WHERE, which filters rows before grouping.

Logical query order

The order a database works through a query: FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, LIMIT.

Example You write SELECT first, but it runs fifth.

Often confused with Written order. See the diagram in Theory.

INNER JOIN

Keeps only rows that have a match in both tables.

Example orders JOIN customers ON orders.customer_id = customers.customer_id

Watch out Plain JOIN means INNER JOIN.

LEFT JOIN

Keeps every row from the first table, with NULLs where the second table has no match.

Example Every customer, with their orders if any.

Watch out A WHERE on a right-hand column after it can quietly turn it into an inner join. RIGHT JOIN is the mirror image.

FULL OUTER JOIN

Keeps every row from both tables, matched where possible, NULLs elsewhere.

Example Budget lines and spend lines, including ones on only one side.

Watch out Older SQLite versions lack it.

Anti join

Finds rows in one table with no match in another.

Example Customers who never ordered: LEFT JOIN then WHERE o.order_id IS NULL, or NOT EXISTS.

Fan-out

When a join matches one row to many, so rows multiply and totals come out too big.

Example Joining orders to order lines, then summing the order totals.

Watch out Duplicate rows in the source. Here the join made them.

UNION

Stacks two results with the same columns and removes repeated rows.

Example This year's and last year's customer lists, each name once.

Often confused with UNION ALL.

UNION ALL

Stacks two results with the same columns and keeps every row.

Example Two months of orders into one list.

Often confused with UNION, which also removes repeats and is slower.

Subquery

A query in brackets placed inside a clause of another query.

Example WHERE price > (SELECT AVG(price) FROM products)

Often confused with CTE: the same idea, named and written first.

CTE

A named step written with WITH name AS ( ... ), used like a table by the query below it.

Example WITH totals AS (SELECT ...) SELECT * FROM totals

Often confused with Subquery. CTEs read top to bottom, so exams like them.

Window function

Calculates across a set of related rows but keeps every row, using OVER ( ).

Example AVG(price) OVER (PARTITION BY category)

Often confused with GROUP BY, which collapses rows.

PARTITION BY

Splits rows into groups for a window function, without collapsing them.

Example OVER (PARTITION BY customer_id ORDER BY order_date)

Often confused with GROUP BY.

ROW_NUMBER

Numbers rows 1, 2, 3 within each partition, with no ties.

Example Latest order per customer: keep row number 1, ordered by date descending.

Often confused with RANK and DENSE_RANK, which allow ties.

RANK

Numbers rows in order; ties share a number and the next number is skipped (1, 1, 3).

Example Leaderboard with gaps after ties.

Often confused with DENSE_RANK.

DENSE_RANK

Numbers rows in order; ties share a number and no number is skipped (1, 1, 2).

Example Top 3 distinct salaries.

Often confused with RANK.

LAG

Reads a value from an earlier row in the window.

Example LAG(sales) OVER (ORDER BY month) gives last month's sales.

Often confused with LEAD, which reads a later row.

Running total

A sum that adds each row to everything before it.

Example SUM(amount) OVER (ORDER BY day)

Watch out Also called a cumulative sum.

QUALIFY

Filters rows on a window function's result, the way HAVING filters groups.

Example QUALIFY ROW_NUMBER() OVER (...) = 1

Watch out DuckDB (so Hex), Snowflake and BigQuery have it. SQLite and Postgres do not: use a CTE.

Integer division

Dividing whole numbers and getting a whole number back, remainder dropped.

Example SQLite and Postgres: 5 / 2 gives 2. DuckDB: 2.5.

Watch out Fix it with 5 * 1.0 / 2 or a CAST.

Dialect

One database's version of SQL. The basics match; functions and dates differ.

Example SQLite, Postgres, DuckDB, Snowflake, BigQuery.

Python27 terms

How Python code is built and run.

Interpreter

The program that reads your Python and runs it, line by line from the top.

Example python clean.py

Often confused with Kernel: the interpreter running behind a notebook.

Variable

A name that points to a value.

Example total = 42

Watch out b = a gives one list two names. It does not copy it.

int

A whole number, positive or negative.

Example 42, -3

float

A number with a decimal point.

Example 3.5

Watch out 0.1 + 0.2 gives 0.30000000000000004. Round for display.

str

Text, written inside quote marks.

Example "Cork"

Watch out '5' is text and 5 is a number. '5' + 5 is an error.

None

Python's value for nothing here.

Example A function with no return gives back None.

Often confused with NaN in pandas, NULL in SQL.

list

Values in order, inside square brackets. Can be changed.

Example [3, 1, 2]

Often confused with tuple.

tuple

Values in order, inside round brackets. Fixed once made.

Example (53.3, -6.2)

Often confused with list.

dict

Values stored under keys, inside curly brackets.

Example {"name": "Aoife", "age": 21}

Watch out A JSON object looks the same.

set

Unique values with no order, inside curly brackets.

Example {"Cork", "Galway"}

Watch out {} on its own is an empty dict. Use set().

Mutable

Can be changed after it is made: list, dict, set.

Example nums.append(4) changes nums in place.

Often confused with Immutable.

Immutable

Cannot be changed once made: int, float, str, tuple, bool.

Example s.upper() returns a new string; s stays the same.

Often confused with Mutable.

Indentation

The spaces at the start of a line. Python uses them to group lines into blocks.

Example Four spaces under if x > 3:

Watch out One line off by a space gives an IndentationError.

if / elif / else

Runs code only when a condition is true, checking each test in order.

Example if score >= 40: print("pass")

for loop

Repeats lines once for each item in a sequence.

Example for city in cities:

Often confused with while loop.

Function

A named set of steps. Made with def, run with brackets.

Example def vat(p): return p * 1.23

Argument

A value you pass into a function, inside its brackets.

Example vat(100): 100 is the argument.

Often confused with Parameter: the name in the def line (p) that receives it.

Return value

What a function hands back with return.

Example vat(100) returns 123.0.

Watch out print shows a value on screen but hands nothing back.

Method

A function attached to a value, called with a dot.

Example "cork".upper()

lambda

A small function with no name, written on one line.

Example df["price"].apply(lambda p: p * 2)

Exception

An error raised while code runs. If nothing catches it, the program stops.

Example ZeroDivisionError, KeyError

Often confused with Syntax error: broken grammar, found before the code runs at all.

Traceback

Python's error report. Read it from the bottom up: the last line names the error.

Example KeyError: 'price' on the last line.

List comprehension

Builds a new list in one line from a loop.

Example [p * 1.23 for p in prices]

Slicing

Taking a run of items with [start:stop]. The stop position is left out.

Example nums[1:3] gives items 1 and 2.

Watch out pandas .loc slices, which include the end label.

==

Checks whether two values are equal.

Example 3 == 3.0 is True.

Watch out = assigns a value. is checks for the same object.

is

Checks whether two names point to the very same object.

Example x is None

Watch out ==, which checks equal value.

Floor division

Divides and rounds down to a whole number, written //.

Example 7 // 2 is 3. -7 // 2 is -4.

Watch out / always gives a float in Python 3: 4 / 2 is 2.0.

pandas27 terms

Tables in Python.

DataFrame

A table in pandas: rows, named columns and an index.

Example df = pd.read_csv("orders.csv")

Often confused with Series.

Series

One column of data with an index. A DataFrame is made of these.

Example df["price"]

Watch out df[["price"]], with double brackets, gives a one-column DataFrame.

Index

The row labels of a DataFrame or Series.

Example 0, 1, 2 ... by default, or dates, or IDs.

Often confused with Database index, which speeds up lookups.

dtype

The type of data in a column: int64, float64, object, bool, datetime64.

Example df.dtypes

Watch out A price column shown as object usually holds text like '€30'.

NaN

Not a Number: pandas' usual mark for a missing value.

Example An empty cell in a CSV becomes NaN.

Watch out NaN never equals NaN. Use isna(), not == np.nan.

read_csv

Loads a CSV file into a DataFrame.

Example pd.read_csv("sales.csv", parse_dates=["date"])

describe

Summary stats for numeric columns: count, mean, std, min, quartiles, max.

Example df.describe()

Often confused with info.

loc

Selects rows and columns by label. Slices include the end label.

Example df.loc[df["city"] == "Cork", "price"]

Often confused with iloc.

iloc

Selects rows and columns by position number. Slices leave out the end.

Example df.iloc[0:5, 0:2] gives 5 rows, 2 columns.

Often confused with loc.

Boolean mask

A True/False Series used to keep only the rows marked True.

Example df[df["price"] > 20]

Watch out Combine with & and |, each test in brackets. and and or raise an error.

Vectorised operation

One step applied to a whole column at once, with no Python loop.

Example df["price"] * 1.23

Often confused with apply, which runs Python once per row and is slower.

axis

Which way an operation runs. 0 works down the rows (one answer per column); 1 works across (one answer per row).

Example df.drop("city", axis=1) drops a column.

groupby

Splits rows into groups, summarises each, and combines the results.

Example df.groupby("city")["price"].mean()

Watch out Rows with a missing group key are dropped unless you pass dropna=False.

agg

Applies one or more summary functions, often after grouping.

Example .agg(total=("price", "sum"), n=("price", "size"))

merge

Joins two DataFrames on shared columns, like a SQL join. Inner by default.

Example orders.merge(customers, on="customer_id", how="left")

Often confused with concat. Check row counts after: a merge can fan out too.

concat

Stacks DataFrames on top of each other, or side by side.

Example pd.concat([jan, feb])

Often confused with merge. Stacking is like UNION ALL.

pivot_table

Reshapes long data to wide, summarising values into a grid.

Example df.pivot_table(index="city", columns="month", values="sales", aggfunc="sum")

Often confused with melt, which goes the other way.

melt

Reshapes wide data to long: many columns become a name column and a value column.

Example df.melt(id_vars="country", var_name="year")

Often confused with pivot_table.

value_counts

Counts how often each value appears in a Series, largest first.

Example df["city"].value_counts()

Watch out Missing values are left out unless you pass dropna=False.

apply

Runs a function on each row, column or value. Flexible but slow.

Example df["name"].apply(len)

Often confused with Vectorised operation.

isna

Marks each missing value as True.

Example df["email"].isna().sum() counts missing emails.

fillna

Replaces missing values with one you choose.

Example df["discount"].fillna(0)

Watch out Filling with 0 changes the mean. Choose with care.

dropna

Removes rows, or columns, that have missing values.

Example df.dropna(subset=["price"])

to_datetime

Turns text into real dates you can sort, filter and do maths on.

Example pd.to_datetime(df["date"])

count()

Counts the values in each column that are not missing.

Example df.count()

Often confused with size, which counts every row.

size

Counts every row, missing values included.

Example df.groupby("city").size()

Often confused with count().

SettingWithCopyWarning

A warning that you may be changing a copy of the data rather than the original DataFrame.

Example df[df.x > 0]["y"] = 1

Watch out Fix with one .loc[rows, col] = value. Newer pandas with copy-on-write drops this warning.

JSON and files15 terms

How data arrives.

JSON

A text format for data built from objects, arrays and plain values. Short for JavaScript Object Notation.

Example {"name": "Aoife", "tags": ["new"]}

Object

Key-value pairs inside curly brackets { }.

Example {"name": "Aoife", "age": 21}

Often confused with Python dict, which looks the same.

Array

An ordered list of values inside square brackets [ ].

Example [1, 2, 3]

Often confused with Python list.

Key

The name in a key-value pair. In JSON it must be text in double quotes.

Example "name" in {"name": "Aoife"}

Nesting

Putting objects or arrays inside other objects or arrays.

Example {"user": {"city": "Cork"}}

null

JSON's value for nothing. Python reads it as None.

Example {"email": null}

Often confused with The text "null" in quotes, which is a string.

Flattening

Turning nested data into a flat table with one column per field.

Example user.city becomes its own column.

json_normalize

A pandas function that turns a list of nested records into a flat DataFrame.

Example pd.json_normalize(data) gives a user.city column.

json.loads

Turns a JSON string into Python objects.

Example json.loads('{"a": 1}') gives {'a': 1}.

Often confused with json.load, which reads from a file. The s stands for string.

json.load

Reads JSON from an open file into Python objects.

Example with open("data.json") as f: data = json.load(f)

Often confused with json.loads.

CSV

Comma-separated values: a table saved as plain text, one row per line.

Example id,name,city

Watch out No types are stored. Every value is text until it is read.

Delimiter

The character that separates values on a line of a file.

Example Comma, tab or semicolon.

Watch out European CSVs often use ; because , is the decimal mark.

Header row

The first line of a file, holding the column names.

Example order_id,date,amount

Watch out If a file has none, use read_csv(..., header=None).

Encoding

How characters are stored as bytes. UTF-8 is the safe default.

Example é where é should be is an encoding mix-up.

Parquet

A compressed, column-based file format for tables that keeps data types.

Example pd.read_parquet("sales.parquet")

Often confused with CSV: plain text, no types, bigger.

Stats for exams27 terms

The numbers behind the charts. Careful wording matters here.

Mean

The sum of the values divided by how many there are. The everyday average.

Example 2, 3 and 10: mean 5.

Often confused with Median. Extreme values pull the mean; they barely move the median.

Median

The middle value once sorted. With an even count, the average of the middle two.

Example 2, 3 and 10: median 3.

Often confused with Mean.

Weighted average

An average where some values count more than others.

Example Average price per item across orders of different sizes.

Often confused with Averaging averages, which goes wrong when groups differ in size.

Percentile

The value that a given percentage of the data is at or below.

Example 90th percentile load time: 9 in 10 loads are this fast or faster.

Often confused with Percentage, which is a share and not a position.

Quartile

The three cut points that split sorted data into four equal parts.

Example Q1 is the 25th percentile, Q2 the median, Q3 the 75th.

Interquartile range

The third quartile minus the first: the spread of the middle half.

Example Q1 = 30, Q3 = 50, so the IQR is 20.

Watch out A common outlier rule flags values more than 1.5 × IQR beyond Q1 or Q3.

Variance

The average squared distance from the mean. A sample divides by n - 1.

Example Its units are squared, such as euro².

Often confused with Standard deviation, its square root.

Standard deviation

How far values typically sit from the mean, in the data's own units.

Example Heights with mean 170 cm and SD 8 cm.

Often confused with Standard error, which measures an estimate, not the data.

Outlier

A value far from the rest.

Example One €9,000 order among €30 ones.

Watch out Check it is real before you remove it.

Normal distribution

A symmetric bell shape: about 68% of values within one standard deviation of the mean, 95% within two.

Example Adult heights, roughly.

Correlation

A number from -1 to 1 for how closely two things move together in a straight-line pattern.

Example Study hours and exam marks: 0.6.

Often confused with Causation. A strong correlation alone does not show cause.

Confounder

A third factor that drives both things you are comparing, so they look linked.

Example Hot weather drives both ice cream sales and drownings.

Sample

The part of the population you actually measure.

Example 1,000 users picked at random.

Watch out A sample that is not random can be biased.

Sample size

How many observations you have, written n.

Example n = 400 users in each group.

Watch out More observations give narrower confidence intervals and more power.

Standard error

How much an estimate, such as a sample mean, would vary from sample to sample.

Example For a mean: standard deviation divided by the square root of n.

Often confused with Standard deviation.

Null hypothesis

The starting claim that there is no effect or no difference.

Example The new button does not change sign-ups.

p-value

The probability of a result at least as extreme as the one seen, if the null hypothesis were true.

Example p = 0.03 from an A/B test.

Watch out Common mistake: reading it as the chance the null hypothesis is true. The calculation assumes the null is true.

Statistical significance

When the p-value falls below a cut-off set in advance, often 0.05.

Example p = 0.03 with a 0.05 cut-off.

Watch out Significant does not mean large or important. A tiny effect can be significant with a big sample.

Significance level

The p-value cut-off chosen before a test, often 0.05. Also the false-positive rate you accept.

Example Alpha = 0.05.

Confidence interval

A range of plausible values, built by a method that would capture the true value in, say, 95% of repeated samples.

Example Conversion 4.1% (95% CI 3.6% to 4.6%).

Watch out Common mistake: saying there is a 95% chance the true value is in this one interval. The 95% describes the method.

A/B test

An experiment that splits users at random into groups, shows each a different version and compares a metric.

Example Old checkout page against new.

Control group

The group in an experiment that gets no change, for comparison.

Example Users who still see the old page.

Type I error

A false positive: rejecting the null hypothesis when it is true.

Example Shipping a button that does nothing.

Often confused with Type II error.

Type II error

A false negative: missing an effect that is really there.

Example Dropping a button that did help.

Often confused with Type I error.

Statistical power

The chance a test detects a real effect of a given size. Often set at 80%.

Example Bigger samples give more power.

Simpson's paradox

A trend that holds in every group but reverses when the groups are combined.

Example A treatment better for both men and women, but worse overall, because of who got it.

Linear regression

Fits a straight line that predicts one number from one or more others.

Example Price = 50,000 + 2,000 × square metres.

Often confused with Correlation, which measures the link but does not predict.

Notebooks and Hex14 terms

Where exams and take-homes are often done.

Notebook

A document of code cells with the output under each, mixed with notes.

Example Jupyter, Colab, Hex.

Cell

One block in a notebook that you run on its own.

Example A code cell, a SQL cell or a text cell.

Kernel

The running Python process behind a notebook that holds your variables.

Example Restart it and every variable is gone.

Often confused with Interpreter.

Hidden state

Leftover variables from cells run earlier, then changed or deleted, so the notebook only works on your machine.

Example A cell that uses df2, which no cell makes any more.

Watch out Restart and run all to find it.

Restart and run all

Clears memory and runs every cell from top to bottom: the honest test that a notebook works.

Example Do it before you hand in.

Jupyter

The most common open-source notebook. Files end in .ipynb.

Example JupyterLab, or Colab, which is built on it.

Hex

A browser data notebook that mixes SQL, Python, charts and text, and can be published as an app.

Example Many data exams and take-homes are set in it.

SQL cell

A Hex cell where you write SQL. The result comes out as a dataframe later cells can use.

Example Query the warehouse, then plot the result in Python.

Data connection

A saved link from a notebook tool to a database or warehouse, so SQL can query it.

Example A Snowflake or Postgres connection set up in Hex.

Dataframe SQL

SQL run on a dataframe from an earlier cell instead of on a database. Hex runs it with DuckDB.

Example SELECT city, COUNT(*) FROM orders_df GROUP BY city

Watch out DuckDB rules apply: / gives decimals, QUALIFY and ILIKE work.

Reactive execution

The notebook tracks which cells depend on which and reruns the ones downstream when something changes.

Example Edit a filter cell and the chart below updates.

Often confused with Running cells by hand, in any order, as in classic Jupyter.

Input parameter

A widget, such as a dropdown or slider, whose value becomes a variable the cells use.

Example A date picker that filters every query.

Jinja

Template syntax in Hex SQL cells: double curly brackets pull a Python variable into the query.

Example WHERE city = {{ city }}

Published app

A shareable view of a Hex project: inputs, charts and results, with the code hidden.

Example A dashboard a manager can use without seeing the SQL.

3 Test yourself

Rounds of ten. See a term and pick its meaning, or see a meaning and pick the term. The wrong answers come from the same group, so they look close.

The quiz needs JavaScript.

4 Learn it properly