SQL EXISTS clause Statements

In this chapter you will learn:
What is EXISTS clause?
Syntax of EXISTS clause
Example of EXISTS clause

What is EXISTS clause?

The EXISTS clause helps to check the existence of a subquery according to the condition specified and passes the status of existence to the outer query. It always returns a Boolean value (True or False).

Syntax of EXISTS clause

SELECT column_name from table_name where EXISTS (SELECT column_name from table_name where conditional_expression)

Example of EXISTS clause

select employeeid, title from humanresources.employee where
exists (select * from humanresources.employeedepartmenthistory
where employeeid=humanresources.employee.employeeid and departmentid=4)
  exists clause example screen shot
SUMMARY

In this chapter, you have learned about EXISTS clause with an example. In the next chapter you will learn about BETWEEN clause.

More Articles

 

Share your thought



PLEASE DISABLE ADBLOCKER AND SUPPORT US!

Please support us by enabling ads on this page. Refresh

YOU DON'T LIKE ADS, WE ALSO DON'T LIKE ADS!
 
But we have to show ads on our site to keep it free and updated. We have to pay huge server costs, domain costs, CDN Costs, Developer Costs, Electricity and Internet Bill. Your little contribution will encourage us to regularly update this site.