Firstly, we create a table with
name employee
SQL
AVG() Function -
This function returns the average
value of numeric column in table
Example –
select avg(salary) as AverageSal from employee
output -
SQL count function –
The COUNT() returns number of rows
from the table
Example –
select COUNT(*) as ROWS from employee
Output – ROWS - 3
SQL Max()
Function –
This function returns the largest
value of the selected column
Example –
select MAX(salary) as HigherSal from employee
Output – HigherSal – 24000
SQL
Min() Function –
This function returns the smallest
value from the column
Example –
select MIN(salary) as MinSal from employee
Output – MinSal -15000
SQL
SUM() Function –
SUM() function returns the total of
any column
Example –
select SUM(salary) as TotalSal from employee
Output – 59000
SQL
LEN() function –
This function returns the number of
character of any column
Example –
select LEN(name) as Name from employee
Output –
SQL ROUND()
function -
This is used to round a numeric field
to the number of decimals specified.
Syntax-
Select round(column_name,decimals)
from table-name
No comments:
Post a Comment