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
INSERT INTO command : Values can be inserted for all columns or for the selected columns Values can be given by sub query. In place of values parameter substitution

Question: Using the data model express the following queries in SQL. (a) Create the Table named "Cinema" and make the cinema_code to be the primary key of the relation and

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

Define the Boyce-Codd Normal Form with instance and also Compare BCNF and 3NF.  Ans: BCNF: For each functional dependency X->Y in a set F of functional dependencies over relati

What is meant by Physical blocks? The input and output operations are completed in block units. The blocks residing on the disk are referred to as physical blocks.

Describe integrity and security? a)      Domain constraint b)      Referential integrity A value that appears in one relation for a given set of attributes also appear fo

It defines that no primary key value can be null. This is as the primary key is used to recognize individual tuple in the relation. So we will not be able to recognize the records

Which is a valid SQL type? A valid SQL Should be in CHARACTER it is should be NUMERIC and FLOAT.

give some example real-life situations where DBMS are most suiitabe