#sql How to handle NULL while aggregation | SUM() | AVG() | Data Analyst | Data Engineer |Math calc

preview_player
Показать описание
Hi All,
My name is Ankit Shrivastava and I am a Data Engineer.
Today this #vlog is regarding #sql How to handle NULL while aggregation or performing any mathematical calculation.

Please find the below DDL for practice:-

create table product_sales (prd_id int,sale_amt int)
insert into product_sales values (1,100);
insert into product_sales values (2,200);
insert into product_sales values (3,null);
insert into product_sales values (4,300);

#sqlinterviewquestions #dataanalyst #dataengineering #dataanalysis

Please find the link of my all previous videos:-
#sql Calculate start & end time and average time spent in successful transaction | startup interview

#sql to achieve last NOT NULL value from the record | Analytical Function | Data Engg | Data Analyst

#sql to identify Top Performing Product every Quarter of each year | Highest sale every quarter

#sql Interview Question - Calculate Running Total | Cumulative sum | UNBOUNDED PRECEDING FOLLOWING

#sql Interview question - Schedule cricket match between teams and generate points table using SQL

#sql Interview Questions - All JOINS (INNER, LEFT, RIGHT, FULL OUTER) | JOIN only NULL values

#sql Interview Question - What is the difference between COUNT(*), COUNT(1) and COUNT(-1)

#SQL Interview Question - How to delete duplicate record from table

#SQL Interview Question -Second highest salary using dense rank analytical function

#SQL to pull unique record after combination of column

#SELFJOIN
Рекомендации по теме
Комментарии
Автор

we can use NVL function like

select avg(nvl(sale_amt, 0)) as avg_sal from product_sales

g.hemanthkumar