Find the employee name,salary,department number and average, Database Management System

Example-Find the employee name, salary, department number and average salary of his/her department, for those employees whose salary is more than the average salary of that department.

EMPNO

ENAME

JOB

SAL

DEPTNO

7566

Nirmal

MANAGER

2975

10

7788

Kailash

ANALYST

3000

10

7839

Karuna

PRESIDENT

5000

20

7902

Ashwin

ANALYST

3000

20

7905

Ashwini

MANAGER

4000

20

 

SELECT A.ENAME, A.SAL, A.DEPTNO, B.AVGSAL

FROM EMP A, (   SELECT DEPTNO, AVG (SAL) AVGSAL

                              FROM EMP

                               GROUP BY DEPTNO) B

WHERE A.DEPTNO=B.DEPTNO AND A.SAL> B. AVGSAL;

Output:

ENAME

SAL

DEPTNO

AVGSAL

Kailash

3000

10

2987.5

Karuna

5000

20

4000

Posted Date: 3/11/2013 3:59:56 AM | Location : United States







Related Discussions:- Find the employee name,salary,department number and average, Assignment Help, Ask Question on Find the employee name,salary,department number and average, Get Answer, Expert's Help, Find the employee name,salary,department number and average Discussions

Write discussion on Find the employee name,salary,department number and average
Your posts are moderated
Related Questions
Improved availability: The data in a distributed system may be replicated so that it is at more than one site. Thus, the failure of a node or a communication link does not necessar

Data Independence This brings us to our next topic: data independence. It is the property of the database which tries to make sure that if we make any change in any level of sc

Define an abstraction by which relationships are treated as higher level entities Ans: Aggregation.  It is an abstraction by which relationships are treated as higher level

Explain pipelining.        Ans: In order to describe pipelining in simple terms, think of it as breaking down processor functions into smaller and smaller parts. For instance,

what is cascading? what is rollback cascading? please explain in detail

What are the basic objects of the data dictionary? Tables Domains Data elements Structures Foreign Keys

Give the levels of data abstraction? There are three levels of Data Abstraction a) Physical level b) logical level c) view level

Construct an ER diagram for a hospital along with a set of patients and a set of medical doctors Associate with every patient a log of the several tests and examinations conducted.

What is Relational calculus? Relational calculus is a Non- Procedural language.

Illustrate different types of Locks in SQL Server. There are three kinds of locks in SQL Server i.) Shared locks - These are used for operations which don't allow any update