SQL Sub Query in SQL 2008 Server - IN clause

15.10.2010
http://sqlserver2008tutorial.com In this video tutorial on SQL 2008 Server, we cover basic sub query with the IN Clause. SQL IN statement will result matching results from two tables, the NOT IN sql clause will return non-matching data between sqlserver tables. Left Outer Join with foreign key = Null is used which is similar to subquery with IN sql statement. We compare performance of SQL sub queries to SQL joins as they behave similarly when returning data. Using the Execution plan in SQL 2008 Server, we calculate estimated cost of query of using NOT IN clause with a LEFT OUTER join. Finally we find missing orders for customers using the NOT IN sql command. Query uses Table Scan here which is not good, we rewrite the query using an RIGHT OUTER join and NULL condition. The Join query is definitely more efficient here in comparison to MS sql subquery.

Похожие видео

Показать еще