Snowflake continues to enhance its SQL capabilities, introducing features that simplify queries and improve readability. Here are five standout additions that data engineers and analysts should take advantage of right now.
GROUP BY ALL
The GROUP BY ALL
clause automatically includes all non-aggregated columns from the SELECT
statement in the GROUP BY
clause. This eliminates the need to manually list every column, making your queries cleaner and easier to maintain.
SELECT region, product_category, SUM(sales_amount) AS total_sales
FROM sales
GROUP BY ALL;
BOOLAND_AGG
BOOLAND_AGG
returns TRUE
if all non-NULL Boolean expressions in a group evaluate to TRUE
. If any expression is FALSE
, the result is FALSE
. Itβs especially useful for checking completeness or validity across grouped data.
SELECT department, BOOLAND_AGG(is_active) AS all_active
FROM employees
GROUP BY department;
SELECT
Lists Snowflake now allows trailing commas in SELECT
statements, improving readability and reducing the chance of syntax errors when adding or rearranging columns.
SELECT
employee_id,
name,
department,
FROM employees;
SELECT * EXCLUDE
This feature lets you select all columns except the ones you explicitly want to exclude. Itβs a game changer for working with wide tables where you only need to omit a few sensitive or irrelevant columns.
SELECT * EXCLUDE (salary, ssn)
FROM employees;
QUALIFY
ClauseQUALIFY
allows you to filter on the result of window functions without needing to wrap your query in a subquery or CTE. Itβs a clean, intuitive way to write analytics-style queries.
SELECT employee_id, department
FROM employees
QUALIFY ROW_NUMBER() OVER (PARTITION BY department ORDER BY hire_date) = 1;
These modern features make Snowflake SQL easier to write, safer to maintain, and more expressive for analytics and engineering alike. Try incorporating them into your workflows today!