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
Discuss deferred update technique of recovery.  What are the advantages?  Ans:  The deferred update methods do not physically update the database on disk till after a transact

What is Hierarchical DBMS In HDBMS, data is structured in a tree like manner. There is a parent-child relationship between data items and the data model is very suitable for re

Why Like predicate used for? LIKE predicate: The LIKE predicate searches for strings in which have a certain pattern.

#floating point representation is used to store

Submit the SQL Statements necessary to create your database according to the following guidelines: Your SQL statements should exactly mirror your ERD. All primary keys,

Consider the join of a relation R with relation S. If R has m tuples and S has n tuples, then the maximum size of join is: If R has m tuples and S has n tuples then maximum siz

Define the Traditional System Analysis and Design Traditional System Analysis and Design (SAD) have three basic life cycle models. A typical software lifecycle consists of the

Domain Constraint It shows that each attribute in a relation has to contain an atomic value only from the corresponding domains. The data types associated with commercial RDBMS

What is SQL Server Agent? SQL Server agent plays a significant role in the day-to-day tasks of a database administrator (DBA). It is often overlooked as one of the major tools

What are called multilevel indices? Indices with two or more levels are known as multilevel indices.