How to find (max, AVG, COUNT, SUM, and MIN) in the row/ columnFor calculating the operations on the column we will have to find max, AVG, COUNT, SUM, and MIN of salary then below will be operation:
For calculating the operations on the column we will have to find max, AVG, COUNT, SUM, and MIN of salary then below will be operation:
Dataset:
CREATE TABLE [dbo].[Employ]
(
[EmployID] [int] NULL,
[EmployName] [varchar](30) NULL,
[EmploySalary] [int] NULL
)
insert into Employ values(8,'emp1',2020)
insert into Employ values(9,'emp2',2070)
insert into Employ values(10,'emp3',2120)
insert into Employ values(11,'emp4',2170)
insert into Employ values(12,'emp5',2220)
insert into Employ values(13,'emp6',2270)
insert into Employ values(14,'emp7',2320)
insert into Employ values(15,'emp8',2370)
insert into Employ values(1,'emp9',2090)
insert into Employ values(2,'emp10',2140)
insert into Employ values(3,'emp11',2190)
insert into Employ values(4,'emp12',2240)
insert into Employ values(5,'emp13',2090)
insert into Employ values(6,'emp14',2140)
insert into Employ values(7,'emp15',2190)
SELECT MAX(EMPLOYSALARY) MAX_EMPLOYSALARY, AVG(EMPLOYSALARY) AVG_EMPLOYSALARY
, COUNT(EMPLOYSALARY) COUNT_EMPLOYSALARY, SUM(EMPLOYSALARY) SUM_EMPLOYSALARY, MIN(EMPLOYSALARY) MIN_EMPLOYSALARY FROM
EMPLOY