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
Define the terms  1) physical schema 2) logical schema.  Physical schema:  The physical schema explains the database design at the physical level, which  is  the  lowest  lev


Given the following relations TRAIN (NAME, START, DEST) TICKET (PNRNO., START, DEST, FARE) PASSENGER (NAME, ADDRESS, PNRNO.) Write SQL expressions for the following queries: No

let us consider a table having 2200 records and the fixed size of the table to be considered as 25.then how many numbers of table is requredto perform horizontal fragmentation

Related fields in a database are grouped in which form? Related data fields in a database are grouped to form a data record. (A record is a collection of related fields)

Question: (a) List four disadvantages of the File Processing System as compared to the Database Systems. (b) The integrity of a database is enforced by integrity rules. One

Strict 2PL :Though, this basic 2PL suffers from the trouble that it can result into loss of isolation / atomic property of transaction as theoretically speaking once a lock is rele

What is Oracle Process? Explain any four processes started by Oracle. Oracle Process is as follows: SMON: The System Monitor carries out a crash recovery while a crashed in

When is a transaction rolled back? Any changes that the aborted transaction made to the database must be uncompleted. While the changes caused by an aborted transaction have be

What is DML compiler? DML Compiler: Translates DML statements in a query language within low level instructions understandable through the query evaluation engine. Attempts to