# What are cross apply and outer apply in SQL Server?

**SQL Server APPLY**operator has two variants;

**CROSS APPLY and OUTER APPLY**. The

**CROSS APPLY**operator returns only those rows from the left table expression (in its final output) if it matches with the right table expression. In other words, the right table expression returns rows for the left table expression match only.

Likewise, people ask, what is cross apply and outer apply in SQL Server?

**SQL Server APPLY** operator has two variants; **CROSS APPLY and OUTER APPLY**. The **CROSS APPLY** operator returns only those rows from the left table expression (in its final output) if it matches with the right table expression. In other words, the right table expression returns rows for the left table expression match only.

**CROSS APPLY**returns only rows from the

**outer**table that produce a result set from the table-valued function.

**It**other words, result of

**CROSS APPLY**doesn't contain any row of left side table expression for which no result is obtained from right side table expression.

**CROSS APPLY**work as a row by row INNER JOIN.

Furthermore, when to use Cross Apply and Outer Apply?

It retrieves those records from the table valued function and the table being joined, where it finds matching rows between the two. On the other hand, **OUTER APPLY** retrieves all the records from both the table valued function and the table, irrespective of the match.

A **cross join** is used when you wish to create combination of every row from two tables. All row combinations are included in the result; this is commonly called **cross** product **join**. A common **use** for a **cross join** is to create obtain all combinations of items, such as colors and sizes.