Column Aliasing & Expressions: Overview
Module: SQL Fundamentals
Column aliases rename output columns without touching the table — AS keyword syntax and when it is optional
Aliases are available in ORDER BY only — WHERE and HAVING cannot see SELECT aliases (execution order rule)
Arithmetic expressions: +, -, *, /, % with correct operator precedence and parentheses
String concatenation cross-database: || (PostgreSQL/Oracle), CONCAT() (MySQL), + (SQL Server — not NULL-safe)
NULL propagation: any NULL operand silently nullifies the entire expression — use COALESCE as a shield
Non-SARGable expressions: functions on indexed columns in WHERE cause full scans — a top production bug
Table aliases shorten JOIN queries and prevent ambiguous column references across multiple tables
Production ETL patterns: ROUND, discount formulas, commission calculations with proper precedence
Column aliases rename output columns without touching the table — AS keyword syntax and when it is optional
Aliases are available in ORDER BY only — WHERE and HAVING cannot see SELECT aliases (execution order rule)
Arithmetic expressions: +, -, *, /, % with correct operator precedence and parentheses
String concatenation cross-database: || (PostgreSQL/Oracle), CONCAT() (MySQL), + (SQL Server — not NULL-safe)
NULL propagation: any NULL operand silently nullifies the entire expression — use COALESCE as a shield
Non-SARGable expressions: functions on indexed columns in WHERE cause full scans — a top production bug
Table aliases shorten JOIN queries and prevent ambiguous column references across multiple tables
Production ETL patterns: ROUND, discount formulas, commission calculations with proper precedence