Functions in Dbms
Functions in Dbms
SQL Functions are built-in programs that are used to perform different
operations on the database.
There are two types of functions in SQL:
● Aggregate Functions
● Scalar Functions
SQL Aggregate Functions
SQL Aggregate Functions operate on a data group and return a singular output.
They are mostly used with the GROUP BY clause to summarize data.
Some common Aggregate functions with Syntax and description are shown in
the table below.
Aggregate
Function Description Syntax
Scalar
function Description Syntax
Rounds a number to a
SELECT ROUND(column_name,
specified number of
decimals) FROM table_name;
ROUND() decimals
AvgMarks
80
NumStudents
MarksFirst
90
MarksLas
t
85
MaxMark
s
95
MinMark
s
50
TotalMark
s
400
NAME
HARSH
SURESH
PRATIK
DHANRA
J
NAME
RAM
NAME
harsh
suresh
pratik
dhanraj
ram
HARS
SURE
PRAT
DHAN
RAM
NAME
7
NAME
MARKS
90
50
80
95
85
DHANRA
1/13/2017 1:30:11 PM
J
NAME Date
2017-01-1
HARSH
3
2017-01-1
SURESH
3
2017-01-1
PRATIK
3
NAME Date
DHANRA 2017-01-1
J 3
2017-01-1
RAM
3