filmov
tv
Use Snowflake’s Pivot Function with a Dynamic List of Columns
Показать описание
Code used in the video is pasted below.
SELECT *
FROM "EXAMPLE_DB"."EXAMPLE_SCHEMA"."EXAMPLE_TABLE"
PIVOT(sum("VALUE") for
CATEGORY in ('AB', 'BA', 'AC', 'CA'))
;
SET column_list = (
SELECT LISTAGG(DISTINCT "CATEGORY", '\',\'')
FROM "EXAMPLE_DB"."EXAMPLE_SCHEMA"."EXAMPLE_TABLE"
WHERE CONTAINS("CATEGORY", 'A')
);
SELECT $column_list;
SET column_list2 = concat('(\'', $column_list, '\'))');
SELECT $column_list2;
set sql_query = concat('SELECT * FROM "EXAMPLE_DB"."EXAMPLE_SCHEMA"."EXAMPLE_TABLE" PIVOT(sum("VALUE") for CATEGORY in', $column_list2);
SELECT $sql_query;
EXECUTE IMMEDIATE $sql_query
SELECT *
FROM "EXAMPLE_DB"."EXAMPLE_SCHEMA"."EXAMPLE_TABLE"
PIVOT(sum("VALUE") for
CATEGORY in ('AB', 'BA', 'AC', 'CA'))
;
SET column_list = (
SELECT LISTAGG(DISTINCT "CATEGORY", '\',\'')
FROM "EXAMPLE_DB"."EXAMPLE_SCHEMA"."EXAMPLE_TABLE"
WHERE CONTAINS("CATEGORY", 'A')
);
SELECT $column_list;
SET column_list2 = concat('(\'', $column_list, '\'))');
SELECT $column_list2;
set sql_query = concat('SELECT * FROM "EXAMPLE_DB"."EXAMPLE_SCHEMA"."EXAMPLE_TABLE" PIVOT(sum("VALUE") for CATEGORY in', $column_list2);
SELECT $sql_query;
EXECUTE IMMEDIATE $sql_query
Use Snowflake’s Pivot Function with a Dynamic List of Columns
Create a Dynamic Pivot Stored Procedure in Snowflake
How to transform data in Snowflake | Use Snowflake Dynamic Tables like a pro
Kyligence Pivot to Snowflake Webinar
SQL Query - Convert data from Rows to Columns | Pivot
I don't use PIVOT tables anymore... I use this other thing instead!
Snowflake Stream & Change Data Capture | Chapter-17 | Snowflake Hands-on Tutorial
SQL Convert Rows to Columns and Columns to Rows without using Pivot Functions
Dynamic Table in Snowflake
What is STAR schema | Star vs Snowflake Schema | Fact vs Dimension Table
Follow this SQL RoadMap to kick start your SQL journey | #learncoding
Snowflake SQL Improvements | Summit 2023
Connect to Snowflake through Microsoft Excel // ODBC
Dynamic Pivot Columns | How to generate dynamic Pivot Columns in BigQuery
SQL PIVOT & UNPIVOT simple explanation
The Basics: An introductions to Snowflake and why we use it
SQL Stored Procedures | Snowflake Scripting
Transient Vs Temporary Tables in Snwoflake | #snowflake #datacloud #clouddata #datawarehouse
Working with JSON in Snowflake
An introduction to Data Science using Snowflake
Snowflake Vs Databricks - 🏃♂️ A Race To Build THE Cloud Data Platform 🏃♂️
LECTURE 11 | STRING FUNCTIONS | PART 1 | SQL | SNOWFLAKE | LIVE STREAM | 11 PM | DATA ANALYTICS |
Intermediate SQL Tutorial | Partition By
What is a Snowflake cloud data warehouse- |PowerBI|FAQs #PowerApps #snowflakes #BiAroof
Комментарии