Find the employee name,salary,department number and average, Database Management System

Assignment Help:

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


Related Discussions:- Find the employee name,salary,department number and average

Compare the nested-loop join and block-nested loop join, Compare the Nested...

Compare the Nested-loop join and block-nested loop join Ans: Nested  loop join - It is costly as worst case cost, no. of block accesses needed is n r * b s + b r   where b

Describe integrity and security, Describe integrity and security? a)   ...

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

In case of entity integrity the primary key may be declared, In case of ent...

In case of entity integrity, the primary key may be declared? In a case of entity integrity primary key may be not Null.

File handling and classes, Write the C++ program having class name studenti...

Write the C++ program having class name studentinfo, that is used to store the VU student information: This class should store your VUID, campus id, name and father name in the fol

Define the terms - physical schema and logical schema, Define the terms  1)...

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

Queries, Find the names of all Albums that have more than 30 tracks. Result...

Find the names of all Albums that have more than 30 tracks. Result: (name: varchar(255))

Selective replication-data replication, Selective replication: This is a c...

Selective replication: This is a combination of generating small fragments of relation and replicating them rather than a entire relation. The data should be fragmented on require

The users who use easy-to-use menu are called, The users who use easy-to-us...

The users who use easy-to-use menu are called ? The users who use easy to use menu are called as Naïve users.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd