HOW TO USE COUNT() AVG() SUM() FUNTIONS IN SQL?

333 viewsSQLSQL
0
COUNT AVG SUM in SQL
COUNT AVG SUM in SQL

COUNT()ย function returns the number of rows that matches a specified condition.

Syntax โ€“

SELECTย  COUNT(ColumnName)

FROMย <TableName>

WHERE<condition> ;

Example-

SELECTย  Count(ProductID)

FROMย Products;

AVG()ย function returns the average value of a numeric column.

Syntax โ€“

SELECTย  AVG(ColumnName)

FROMย <TableName>

WHERE<condition> ;

Example-

SELECTย  AVG(Price)

FROMย Products;

SUM()ย function returns the sum value of a numeric column.

Syntax โ€“

SELECTย  SUM(ColumnName)

FROMย <TableName>

WHERE<condition> ;

Example-

SELECTย  SUM(Quantity)

FROMย OrderDetails;

Note-

Northwind sample database is used for examples.

Saraswat World Changed status to publish June 14, 2023
You are viewing 1 out of 1 answers, click here to view all answers.
Write your answer.

Posted

in

Tags:

Comments

Leave a Reply

A Tribute to Dilip Kumar