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
Sur cette page du site, vous pouvez voir la vidéo en ligne 39.SQL SERVER - CROSS APPLY | OUTER APPLY durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Tech2BI 10 mai 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 62 fois et il a aimé 0 téléspectateurs. Bon visionnage!