SQL Aggregate Functions

SQL Aggregate Functions perform calculations on a set of values and return a single result. They are used to summarize […]

SQL Aggregate Functions perform calculations on a set of values and return a single result. They are used to summarize data and provide insights.

SQL Aggregate Functions Syntax

SQL




Tutorials dojo strip

SQL Aggregate Functions Example

SQL Aggregate Functions COUNT Example

This query counts the total number of rows in the Patients table, giving the total number of patients.

SQL




SQL Aggregate Functions SUM Example

This query calculates the total dosage of ‘Aspirin’ from the Prescriptions table. It adds up all values in the dosage column where the medication name is ‘Aspirin’.

SQL




SQL Aggregate Functions AVG Example

This query computes the average dosage of ‘Ibuprofen’ from the Prescriptions table. It finds the average value of the dosage column for rows where the medication name is ‘Ibuprofen’.

SQL




SQL Aggregate Functions MIN Example

This query retrieves the earliest birthdate from the Patients table. The MIN function finds the smallest value in the dob column.

SQL




SQL Aggregate Functions MAX Example

This query finds the latest birthdate from the Patients table. The MAX function returns the largest value in the dob (date of birth) column.

SQL




SQL Aggregate Functions Visual Diagram




SQL Aggregate Functions Labs

Tutorials dojo strip