Programming Pandit

c/c++/c#/Javav/Python


Latest Update

Wednesday, December 2, 2020

SQL Queries for SUM( ), AVG( ), MIN( ), MAX( ), COUNT( ) by G Krishna Chauhan

Source Code

 

a. Find the average salary of the employees in employee table.

 Solution:- 

SELECT avg(salary) FROM EMPLOYEE; 

b. Find the minimum salary of a female employee in EMPLOYEE table. 

Solution:- 

SELECT Ename, min(salary) FROM EMPLOYEE WHERE sex=’F’; 

c. Find the maximum salary of a male employee in EMPLOYEE table. 

Solution:- 

SELECT Ename, max(salary) FROM EMPLOYEE WHERE sex=’M’; 

d. Find the total salary of those employees who work in Guwahati city. 

Solution:- 

SELECT sum(salary) FROM EMPLOYEE WHERE city=’Guwahati’; 

e. Find the number of tuples in the EMPLOYEE relation. 

Solution:- 

SELECT count(*) FROM EMPLOYEE;

No comments:

Post a Comment