SQL Macros
You can create SQL Macros (SQM) to factor out common SQL expressions and statements into reusable, parameterized constructs that can be used in other SQL statements. SQL macros can either be scalar expressions, typically used in SELECT
lists, WHERE
, GROUP BY
and HAVING
clauses, to encapsulate calculations and business logic or can be table expressions, typically used in a FROM
clause.
SQL macros increase developer productivity, simplify collaborative development, and improve code quality.
This page provides more detailed information explaining what SQL Macros are useful for and supplying various examples to use.
Practice: Using SQM Scalar and Table Expressions
These practices show how to use SQL Macro as scalar and table expressions.