Search the salary of employees who are not ‘analyst’ , Database Management System

Example-Search the salary of employees who are not 'ANALYST' but get a salary below than or equal to any people employed as 'ANALYST'.

SELECT EMPNO, ENAME, JOB, SAL

FROMEMP

WHERE SAL <= ANY (SELECT SAL

                                     FROM EMP WHERE JOB = 'ANALYST')

            AND JOB<>'ANALYST' ;

 

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

OUTPUT:

EMPNO

ENAME

JOB

SAL

7566

Nirmal

MANAGER

2975

 

Search the average salary in every department

SELECT DEPTNO, AVG(SAL) FROM EMP GROUP BY DEPTNO;

Result:

 

DEPTNO

SAL

10

2987.5

20

4000

 

Posted Date: 3/11/2013 3:57:11 AM | Location : United States







Related Discussions:- Search the salary of employees who are not ‘analyst’ , Assignment Help, Ask Question on Search the salary of employees who are not ‘analyst’ , Get Answer, Expert's Help, Search the salary of employees who are not ‘analyst’ Discussions

Write discussion on Search the salary of employees who are not ‘analyst’
Your posts are moderated
Related Questions
Consider the relations EMP(ENO,ENAME,AGE,BASIC_SALARY) WORK_IN(ENO,DNO) DEPT(DNO,DNAME,CITY) Express the following queries in SQL (i) Find names of employees who work in a dep

Define weak and strong entity sets?  Weak entity  set:  entity  set  that  do not  have  key  attribute  of  their  own are  known as weak entity sets.  Strong entity set

What are stored and derived attributes? Stored attributes: The attributes keeps in a data base are known as stored attributes. Derived attributes: The attributes that are de

Explain the Exec statement in SQL Ans: Exec statement has the structure    EXEC SQL END-EXEC   Embeded SQl statements are of a form identical to non embedded SQL statem

In the ER diagram, one example of subclassing is depicted following the Services entity. The subclasses Item Based and Time Based are created. The entity Services gains the attribu

What is 2NF? A relation schema R is in 2NF if it is in 1NF and every non-prime attribute A in R is fully functionally dependent on primary key.



Show a centralised schema to support the operation of the system you have chosen, including in particular: the product catalogue; the outlets and respective stocks; customer record

DROP TABLE Command: When an existing object is not needed for further use, it is always better to eliminate it from the database. To remove the existing object from the databas