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
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 minimal set of functional dependencies for the following data. This table is part of the OHSU database of extracurricular activities and tracks the DMICE band's co

What is Secondary Index While making the index, generally the index table is kept in the primary memory (RAM) and the main table, because of its size is keeps in the secondary

Explain the Concept of Two-phase Locking It concerns the positions of locking and unlocking operations in each transaction.  In this protocol every transaction issue lock and u

WHAT IS DSS? WRITE ITS REQUIREMENTS.

List two restrictions that are applied on the modification (updation, insertion or deletion) of base tables through view.  Ans: The two restrictions are: 1. If a view

Define check point and its impact on data base recovery.                  Ans:  There could be hundreds of transactions handled per minute, in a large on-line database system.

What is difference among mysql_connect and mysql_pconnect? Mysql_connect() opens a new connection to the database while mysql_pconnect() opens persistent connection to the data

Define Signal. It allows methods to respond to events triggered by themselves or by other processes. Each signal corresponds to an exacting event. A signal is represented in Sy

Problem: A DBMS built for Online Transaction Processing (OLTP) is usually regarded as unsuitable for data warehousing. Each system is designed with a different set of requireme