Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Exploring RANK and DENSE_RANK Functions in Snowflake SQL

  • Data World Solution
  • 2024-06-03
  • 335
Exploring RANK and DENSE_RANK Functions in Snowflake SQL
Snowflake RANK function tutorialSnowflake DENSE_RANK functionSnowflake SQL RANK vs DENSE_RANKHow to use RANK in SnowflakeHow to use DENSE_RANK in SnowflakeSnowflake database ranking functionsRANK and DENSE_RANK in Snowflake SQLSnowflake SQL tutorial for beginnersSnowflake data analysis with RANKAdvanced SQL functions in Snowflake
  • ok logo

Скачать Exploring RANK and DENSE_RANK Functions in Snowflake SQL бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Exploring RANK and DENSE_RANK Functions in Snowflake SQL или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Exploring RANK and DENSE_RANK Functions in Snowflake SQL бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Exploring RANK and DENSE_RANK Functions in Snowflake SQL

Unlock the power of Snowflake's RANK and DENSE_RANK functions in your data analysis! In this video, we'll explore how to use these powerful SQL functions to rank rows within your datasets, understand the key differences between them, and learn practical applications for sorting and analyzing data effectively. Whether you're a beginner or looking to refine your Snowflake skills, this tutorial has got you covered. Don't forget to like, subscribe, and hit the bell icon for more Snowflake tutorials!

#Snowflake #SQL #DataAnalysis #RANKFunction #DENSE_RANK #DatabaseTutorial #SQLTutorial #DataScience #DataRanking #TechTutorial #LearnSQL #SnowflakeDatabase #DataQuery #SQLFunctions #dataengineering

----SQL-----------


-- Analytical Function Rank() , Dense_Rank()

--Analytic Syntax for rank
--RANK ( ) OVER ( [query_partition_clause] order_by_clause )

-- IMPORTANT NOTE
-- FIRST PROCESS
-- all joins, WHERE, GROUP BY, and HAVING clauses are performed
-- AFTER THESE the result set is made available to the analytic functions and all their calculations take place
-- Third, if the query have an ORDER BY clause at the end.


-- Create the Table
CREATE OR REPLACE TABLE customers (
CUST_CODE STRING,
CUST_FIRST_NAME STRING,
CUST_LAST_NAME STRING,
PURCHASE_AMT INTEGER
);

-- Step 2: Insert the Data
INSERT INTO customers (CUST_CODE, CUST_FIRST_NAME, CUST_LAST_NAME, PURCHASE_AMT) VALUES
('CUST-10002', 'Herman', 'Kidwell', 2545),
('CUST-1089', 'Gwen', 'Rutherford', 213),
('CUST-1104', 'Glenn', 'Hardesty', 1432),
('CUST-11131', 'Gina', 'Ballard', 124324),
('CUST-11407', 'Haland', 'Vue', 546),
('CUST-11408', 'Guy', 'Weaver', 3243),
('CUST-11443', 'Granville', 'Welk', 54315),
('CUST-1155', 'Ginna', 'Lyon', 6547);



select CUST_CODE, CUST_FIRST_NAME, CUST_LAST_NAME, PURCHASE_AMT from DEMO_DB.PUBLIC.CUSTOMERS;


select CUST_CODE, CUST_FIRST_NAME, CUST_LAST_NAME, PURCHASE_AMT,
RANK ( ) OVER ( order by PURCHASE_AMT desc) PURCHASE_AMT_rank
from DEMO_DB.PUBLIC.CUSTOMERS;


--now let us add another record with PURCHASE_AMT 54315
insert into customers values ('CUST-1156', 'Gerhard', 'Wiser', 54315);

--using rank could lead to gaps
select CUST_CODE, CUST_FIRST_NAME, CUST_LAST_NAME, PURCHASE_AMT,RANK ( ) OVER ( order by PURCHASE_AMT desc) PURCHASE_AMT_rank
from DEMO_DB.PUBLIC.CUSTOMERS;

--we can solve this by using DENSE_RANK

select CUST_CODE, CUST_FIRST_NAME, CUST_LAST_NAME, PURCHASE_AMT,DENSE_RANK ( ) OVER ( order by PURCHASE_AMT desc) PURCHASE_AMT_rank
from DEMO_DB.PUBLIC.CUSTOMERS;

--now let us add one record to the CUSTOMERS with NULL PURCHASE_AMT
insert into customers values ('CUST-11702', 'Haland', 'Welch', NULL);

--when using order by desc , the null pulling first
select CUST_CODE, CUST_FIRST_NAME, CUST_LAST_NAME, PURCHASE_AMT,DENSE_RANK ( ) OVER ( order by PURCHASE_AMT desc) PURCHASE_AMT_rank
from DEMO_DB.PUBLIC.CUSTOMERS;

-- 2 solutions

select CUST_CODE, CUST_FIRST_NAME, CUST_LAST_NAME, PURCHASE_AMT,DENSE_RANK ( ) OVER ( order by NVL(PURCHASE_AMT,0) desc) PURCHASE_AMT_rank
from DEMO_DB.PUBLIC.CUSTOMERS;


select CUST_CODE, CUST_FIRST_NAME, CUST_LAST_NAME, PURCHASE_AMT,DENSE_RANK ( ) OVER ( order by PURCHASE_AMT desc nulls last ) PURCHASE_AMT_rank
from DEMO_DB.PUBLIC.CUSTOMERS;

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]