In this session we will discuss about APPLY operators in sql:
https://drive.google.com/drive/u/2/fo...
-- APPLY OPERATOR (CROSS APPLY AND OUTER APPLY)
-- Apply we used to join between two table expressions.
-- Main diff between join and apply operators is when we have table vaued functions we can use on right side and evaluate each and every row of left side table.
-- when do we use join vs apply.
-- WHEN TO USE
--Use a CROSS APPLY when no easy join exists and when the right table is an expression or table-valued function.
--It's like an INNER JOIN since rows must exist in both tables/expressions for SQL to return results.
--Use OUTER APPLY when no easy join exists and when the right table is an expression or table-valued function.
--It's like a LEFT JOIN since rows do not need to exist on the right side to return results from the left table.
-- WHEN NOT TO USE
-- If you can get the same results with an inner join, don't use a CROSS APPLY.
-- It is not clear and leaves people scratching their heads.
-- If you can get the same results with a LEFT OUTER JOIN,
-- don't use an OUTER APPLY for the reason mentioned above.
-- SYNTAX
-- SELECT
--COL1,CLO2
--FROM TAB1
--CROSS/outer APPLY TAB2/TABLE_VALUEDFUNCTIONS (COL1,CLO2) AS ALIASNAME
Note: If i use any external content the actual credit goes to respective owners only.
#sql #sqlserver #database #dataanalytics #dbms #sql #tech2bi #crossappply #outerapply
On this page of the site you can watch the video online 39.SQL SERVER - CROSS APPLY | OUTER APPLY with a duration of hours minute second in good quality, which was uploaded by the user Tech2BI 10 May 2024, share the link with friends and acquaintances, this video has already been watched 62 times on youtube and it was liked by 0 viewers. Enjoy your viewing!