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
When are they useful? Justify with an example. The temporary tables are commonly used to support specialized rollups or exact application processing needs. Unlike a permanent t

Advantages of Database management system Let us summarize the advantages. Reduction of Redundancy: This is perhaps the most important advantage of using DBMS. Redundancy i

A TDMS project plan is not a typical Information Technology project plan; therefore, a traffic data project has several unique characteristics: Traffic data management system

Explain the Cartesian product:  The Cartesian product operation does not need relations to union-compatible.  The meaning of this is that the involved relations may have dissim

Fifth Normal Form (5NF) These relations still have a difficulty. While defining the 4NF we mentioned that all the attributes depend upon each other. Whereas creating the two ta

File Organisation And Its Types  Just as arrays, trees, lists and other data structures are used to execute data Organisation in main memory, a number of planning's are used to

What are the advantages of having an index structure?      Ans: The index structures commonly provide secondary access paths, which offer alternative ways of accessing the reco

How to create a biological database based on viruses. How to decide which attribute should be there in the table and schema? How to identify the primary keys, foreign keys, domain,

A database is to be constructed to remain track of the teams and games of a sport league. A team has a number of players, not all of whom participate in every game. It is desired

1. Explain different addressing modes of 8086 Explanation of all addressing modes 2. Write a sequence of instructions to exchange two register contents using stack