У нас вы можете посмотреть бесплатно SQL Aggregate Functions: SUM, AVG, COUNT and Handling NULLs | T-SQL Course Part 7 или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
In this lesson, we learn how to perform calculations on multiple rows of data using SQL Aggregate Functions. I will show you how to find totals, averages, and counts, as well as the professional way to handle missing data (NULLs) in your calculations. Practical SQL Topics Covered: Core Functions: Using SUM(), AVG(), MIN(), and MAX() to analyze employee salaries. The Power of COUNT: Understanding the difference between COUNT(*) (total rows) and COUNT(salary) (non-null values). Distinct Counting: How to use COUNT(DISTINCT city) to find the number of unique locations. Handling NULL Values: Why AVG(salary) might give different results than manual calculations and how to use ISNULL(salary, 0) to fix it. Column Aliasing: Using the AS keyword to give your calculation results professional names (e.g., AverageSalary). Custom Calculations: How to combine functions, like SUM(salary) / COUNT(*), to understand the underlying logic of SQL math. This video is essential for anyone aiming to work in Data Analysis or Reporting (SSRS/Power BI). -- [ T-SQL SCRIPT FROM THIS VIDEO ] -- -- Inbuilt functions to calculate maximum, minimum, average, sum etc. -- "as salary", "as TotalSalary" etc. are called aliases -- Find the highest salary select MAX(salary) as Salary from EmployeeDetails; -- Find the average salary select AVG(salary) as Average from EmployeeDetails; -- Find the sum of all salaries select sum(salary) as TotalSalary from EmployeeDetails; -- Find the lowest salary select min(salary) as Minimumsalary from EmployeeDetails; -- Count total number of records select COUNT(*) as TotalEmployees from EmployeeDetails; -- Count values in the city column select COUNT(city) from EmployeeDetails; -- Count only unique cities select COUNT(distinct city) from EmployeeDetails; --------------------------------------------------- The Teaching Moment: I explained to the viewers that AVG(salary) automatically ignores NULL values, but SUM(salary)/COUNT(*) treats NULL values as if they are part of the total count. The "Pro" Fix: I Showed them that your line AVG(ISNULL(salary, 0)) is the most accurate way to ensure that employees with "no salary recorded" are still counted in the average as a zero, preventing the average from being artificially inflated. #SQLServer #TSQL #DataAnalysis #SQLAggregateFunctions #LearnSQL #DatabaseDevelopment #SQLTutorial #DataReporting