SQL - Structured Query Language

Query with Clause



A subquery declared in WHERE clause expression is called OUTER subquery. By default, subquery will returns one or many record(s). The following subqueries are used to find out Employee’s maximum, minimum and then greater than average salary information.

-- Example 51 --

 

USE EBusiness

GO

 

SELECT Emp_Code, Emp_Name, Salary FROM EMP

WHERE Salary = (SELECT MAX(Salary) FROM EMP)

 

SELECT Emp_Code, Emp_Name, Salary FROM EMP

WHERE Salary = (SELECT MIN(Salary) FROM EMP)

 

SELECT Emp_Code, Emp_Name, Salary FROM EMP

WHERE Salary > (SELECT AVG(Salary) FROM EMP)


Query Output Screen



* * * * *


Email Your Comment To AUTHOR