Member-only story
5 Snowflake Hidden Features You Should Know
Dear Readers,
Snowflake offers many powerful features for data management. While some are well-known, others remain hidden gems that can simplify your queries and boost productivity. Let’s dive into five lesser-known Snowflake features.
- Extra Comma After Last Column:
Unlike many other databases, Snowflake allows you to include an extra comma after the last column in a SELECT statement without throwing an error. This can be helpful when developers accidentally leave an extra comma or plan to add more columns later but forget the comma.
Eg: Customer_id has an additional comma, and the query runs fine.
SELECT order_id,
customer_id,
FROM sales_data2. Using Aliases Within the Same SELECT:
Snowflake lets you reuse column aliases within the same SELECT clause. This reduces unnecessary lines and helps keep your queries clean and concise
Eg: The alias SALE_AMT is reused in a window function.
SELECT REGION,
ORDER_DATE,
QUANTITY*UNIT_PRICE AS SALE_AMT,
SUM(SALE_AMT) OVER (PARTITION BY REGION ORDER BY ORDER_DATE) AS RUNNING_TOTAL
FROM SALES_DATA
ORDER BY REGION,
ORDER_DATE