Data Types
- Core types. Columns are typed: integers, numeric for money, text, dates and booleans: the type is a promise about every cell.
- Money and precision. Money uses exact decimal types: floating point rounds cents away, and audits notice.
- Dates and times. Timestamps deserve time zones: store UTC, convert at the edge, and date arithmetic stays sane.
Operators and Functions
- Expressions. Any column can join an expression: a computed value like a line total, worked out per row in the query.
- String and date functions. Engines ship functions for text and time: LOWER, TRIM, and date truncation cover most daily needs.
- CASE. The CASE expression is SQL’s if: labelling rows into buckets right inside the SELECT.
NULL and Three-Valued Logic
- What NULL means. NULL means unknown, not zero and not empty: a missing fact recorded honestly.
- NULL comparisons. Nothing equals NULL, not even NULL: the test is IS NULL, and forgetting that drops rows silently.
- COALESCE. COALESCE returns the first non-null value: the standard way to give unknowns a display default.
Before and after this level
- Before: Level 1: Query Foundations: SELECT and Columns, Filtering and Sorting, Basic Query Construction.
- Next: Level 3: Joining Data: Inner and Outer Joins, Multi-Table Relationships, Designing Correct Joins.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does SQL Level 2: Expressions & Data cover?
Data Types, Operators and Functions, NULL and Three-Valued Logic: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 1: Query Foundations, which covers SELECT and Columns, Filtering and Sorting, Basic Query Construction.