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
Objectives After Reading this part, you should be able to: Explain the term CONCURRENCY; Describe the term transaction and concurrent transactions; Talk about co

What is known as sequential file organization? In the sequential file organization, the records are kept in sequential order, according to the value of a "search key" of every

CAR SALE (Car_id, Option_type, Option_listprice, Sale_date, Option_discountedprice) This relation refers to options installed in cars (e.g., cruise control) that were sold at a de

Determine the Disadvantages of file based systems Some of the disadvantages of file based systems are like this: Data redundancy and inconsistency: the dissimilar applic

Explain sorted File with advantages?  Sorted file The sort utility shall perform one of the subsequent functions: 1.Sort lines of all the named files together and write the

Describe the advantage of State chart Diagram A state chart represents a state machine, emphasizing flow of control from one state to other. A state machine is a behaviour whi

Implementing software control To implement software control designer must redesign strategy of state event model which is present in dynamic model. There are three basic ap

Q. State the Technique for converting a state diagram to code. i) Identify the major control path. Starting with first state, find the path from diagram that corresponds

Suppose an instruction takes 1 nanosecond to execute (on average), a page fault takes 20 microseconds of processor time, and it takes 300 microseconds of disk time to read or write

Discuss The difference between drop table R and delete from R.  DROP TABLE command deletes all the records with the table definition. This command will automatically committed