You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This query uses an equi-join and a theta-join and functions similar to a `CROSS JOIN`, but with one big difference, NULL markers are not returned. NULL markers are neither equal to nor not equal to each other. They are unknown.
141
+
This query uses an equi-join and a non-equi-join and functions similar to a `CROSS JOIN`, but with one big difference, NULL markers are not returned. NULL markers are neither equal to nor not equal to each other. They are unknown.
This query uses an equi-join and a theta-join negated with a `NOT` operator. Determining if the `ID` is between the `Quantity` columns may be a somewhat absurd SQL statement to write, but this shows the possibilities in creating join logic. We often forget we can use comparison operators such as `LIKE` or `BETWEEN` in an SQL statement's `ON` clause and then negate it with `NOT`.
184
+
This query uses an equi-join and a non-equi-join negated with a `NOT` operator. Determining if the `ID` is between the `Quantity` columns may be an absurd SQL statement to write, but this shows the possibilities in creating join logic. We often forget we can use comparison operators such as `LIKE` or `BETWEEN` in an SQL statement's `ON` clause and then negate it with `NOT`.
185
185
186
186
```sql
187
187
SELECTa.ID,
@@ -199,7 +199,7 @@ FROM ##TableA a INNER JOIN
199
199
| 4 |\<NULL> | 5 | 4 |\<NULL> |\<NULL> |
200
200
201
201
---
202
-
Functions can be used in the join condition as well. Assigning the empty string to a NULL value via the `ISNULL` function causes the NULLs to now equate to each other.
202
+
Functions can also be used in the join condition. Assigning the empty string to a NULL value via the `ISNULL` function causes the NULLs to equate to each other.
203
203
204
204
```sql
205
205
SELECTa.ID,
@@ -253,7 +253,7 @@ WHERE (CASE WHEN a.Fruit = 'Apple' THEN a.Fruit ELSE 'Peach' END) = b.Fruit;
When joining three or more statements, this SQL statement works in `SQL Server`. The table referenced in the `ON` clause must be in reverse order for this to work.
256
+
This SQL statement works in `SQL Server` when joining three or more statements. The table referenced in the `ON` clause must be in reverse order for this to work.
257
257
258
258
For this SQL statement, I am self-joining to `TableA` three times.
0 commit comments