0% found this document useful (0 votes)
47 views3 pages

Abhi Aggrigate

The document demonstrates the use of aggregate functions such as SUM, AVG, COUNT, MAX, MIN, VARIANCE and STDDEV in SQL. An employee table is created and sample data is inserted. The aggregate functions are then applied to the salary column of the employee table to calculate the total salary, average salary, number of salaries, maximum salary, minimum salary, variance and standard deviation.

Uploaded by

Hai Frnds
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views3 pages

Abhi Aggrigate

The document demonstrates the use of aggregate functions such as SUM, AVG, COUNT, MAX, MIN, VARIANCE and STDDEV in SQL. An employee table is created and sample data is inserted. The aggregate functions are then applied to the salary column of the employee table to calculate the total salary, average salary, number of salaries, maximum salary, minimum salary, variance and standard deviation.

Uploaded by

Hai Frnds
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

AGGREGATE FUNCTIONS: SQL> create table employee(sno number(3),name varchar2(20),salary number(10)); Table created.

SQL> insert into employee values(&sno,'&name',&salary); Enter value for sno: 1 Enter value for name: abhi Enter value for salary: 150000 old 1: insert into employee values(&sno,'&name',&salary) new 1: insert into employee values(1,'abhi',150000) 1 row created. SQL> / Enter value for sno: 2 Enter value for name: nandhu Enter value for salary: 125000 old 1: insert into employee values(&sno,'&name',&salary) new 1: insert into employee values(2,'nandhu',125000) 1 row created. SQL> / Enter value for sno: 3 Enter value for name: saranya Enter value for salary: 100000 old 1: insert into employee values(&sno,'&name',&salary) new 1: insert into employee values(3,'saranya',100000) 1 row created. SQL> / Enter value for sno: 4 Enter value for name: valar Enter value for salary: 80000 old 1: insert into employee values(&sno,'&name',&salary) new 1: insert into employee values(4,'valar',80000) 1 row created. SQL> / Enter value for sno: 5 Enter value for name: kiran Enter value for salary: 90000 old 1: insert into employee values(&sno,'&name',&salary) new 1: insert into employee values(5,'kiran',90000) 1 row created.

SUM() SQL> select sum(salary) from employee; SUM(SALARY) ----------545000 AVG() SQL> select avg(salary) from employee; AVG(SALARY) ----------109000 COUNT() SQL> select count(salary) from employee; COUNT(SALARY) ------------5 MAX() SQL> select max(salary) from employee; MAX(SALARY) ----------150000 MIN() SQL> select min(salary) from employee; MIN(SALARY) ----------80000 VARIANCE() SQL> select variance(salary) from employee; VARIANCE(SALARY) ---------------805000000 STDDEV() SQL> select stddev(salary) from employee; STDDEV(SALARY) -------------28372.522

Displaying the table: SQL> select * from employee; SNO NAME SALARY --------- -------------------- --------1 abhi 150000 2 nandhu 125000 3 saranya 100000 4 valar 80000 5 kiran 90000

You might also like