Aggregate Functions in SQL | Learn with Mr. Kiran Jadhav

Опубликовано: 04 Апрель 2025
на канале: Full Stack Java Developer
136
19

Aggregate Functions in SQL-
Aggregate functions in SQL perform calculations on a set of values and return a single value. They are commonly used with the GROUP BY clause to perform operations on grouped data.

There are 5 Aggregate Functions in SQL- MIN, MAX, AVG, SUM & COUNT
MIN- Returns the lowest value in a column

MAX- Returns the highest value in a column

AVG- Returns the average value of a numeric column

SUM- Returns the total sum of a numeric column

COUNT- Returns the number of rows that match a specified condition

- Aggregate Functions MIN, MAX, AVG, SUM, COUNT
-- MIN
SELECT MIN(empsalary) FROM employee
-- select empname, empsalary from employee where empsalary = (SELECT MIN(empsalary) FROM employee)

-- MAX
SELECT MAX(empsalary) FROM employee

-- select empname, empsalary from employee where empsalary = (select max(empsalary) from employee)

-- AVG

SELECT AVG(empsalary) FROM employee

-- SUM

SELECT SUM(empsalary) FROM employee

-- COUNT

SELECT COUNT(empid) FROM employee

-- 2nd largest salary from employee

SELECT MAX(empsalary) FROM employee WHERE empsalary NOT IN (SELECT MAX(empsalary) FROM employee)

SELECT empname, empsalary FROM employee WHERE empsalary=(SELECT MAX(empsalary) FROM employee WHERE empsalary NOT IN (SELECT MAX(empsalary) FROM employee)
)


-- Department wise Sum of salary

SELECT empdept, SUM(empsalary) FROM employee GROUP BY empdept

-- Department wise Avg salary

SELECT empdept, AVG(empsalary) FROM employee GROUP BY empdept

💻 Stay ahead in 2025 and beyond!
📢 Don't forget to like, share, and subscribe for more insightful content.

Visit fullstackjavadeveloper.in for more details and enrollment opportunities.

#CoreJava #JDK8Features #Java #Fullstack #FullStackJavaDeveloper #SpringBoot #SoftwareDevelopment

Connect with us:
Call or WhatsApp: +91 7887575991 / 020 47212644 [24/7 Support]
Visit: fullstackjavadeveloper.in
Facebook -   / fullstackjavadeveloper  
LinkedIn -   / full-stack-java-developer-pune  
Instagram -   / fullstackjavadeveloper  

Meet Mr. Kiran Jadhav :
Software Architect | Full Stack Book Author | Technical Keynote Speaker
LinkedIn -   / kiran-jadhav-22649b99  

guys if you like this video please do subscribe now and press the bell icon to not miss any update from Full Stack Java Developer, Pune
#CodeDeployment #JavaApp #Programming #DevLife #TechTips #FileManagement #Coding #OpenSource #Java #TechTutorial #DeveloperCommunity #JavaProjects #LearnToCode #AppDevelopment #WebDevelopment #TechEducation #like #share #comment

Disclaimer/Policy:
--------------------------------
Note: All uploaded content in this channel is mine and it’s not copied from any community, you are free to use source code from above mentioned GitHub account