Comparison of Subqueries to Joins in SQL

In this article I am going to explain about subqueries and Joins in SQL.
  • 1898


In this article I am going to compare Subqueries to join in SQL. A select statement known as subquery if it is codded within another SQL statement. Subquery can return a single value or a result set. This result set may contain a single column or more than one column.

There are four way to create subquery  in a SELECT statement.

  • In WHERE Clause
  • In HAVING Clause
  • In FROM Clause
  • In SELECT Clause

Join operator provide a result set that include column from both tables. Result provided by query that include subquery can only include columns from the table names in the other query.


select *
from mcninvoices join mcnvendors

on mcninvoices.vendorid = mcnvendors.vendorid




select * from mcninvoices

where vendorid IN

(select vendorid from mcnvendors)



© 2020 DotNetHeaven. All rights reserved.