-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Term Entry] SQL NULL SAFE EQUAL Operator #5205
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @SlappyChappy ,
I had a look at your PR and suggested a few changes to you that should be made asap to get it approved as a first review.
Thanks,
Savi
@@ -0,0 +1,40 @@ | |||
--- | |||
Title: 'NULL SAFE EQUAL' | |||
Description: 'Performs an inequality comparison similar to the '=' operator, using the logic of an XNOR gate. Can accept NULL as a value and will not output NULL.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description: 'Performs an inequality comparison similar to the '=' operator, using the logic of an XNOR gate. Can accept NULL as a value and will not output NULL.' | |
Description: 'Performs an equality comparison similar to the '=' operator, using the logic of an XNOR gate. Can accept NULL as a value and ensures comparisons involving NULL do not result in NULL. |
Here I have corrected inequality comparison
to equality comparison
because that is the correct logic for null safe equal operator in SQL.
Tags: | ||
- 'Operators' | ||
- 'Database' | ||
- 'Queries' | ||
- 'Tables' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tags: | |
- 'Operators' | |
- 'Database' | |
- 'Queries' | |
- 'Tables' | |
Tags: | |
- 'Operators' | |
- 'Database' | |
- 'Queries' | |
- 'Tables' |
Include only those tags that are already present in the tags.md list and you can add one if you want to include it in your PR. Here operators
is not part of the tags list so you can add it if you want it to be used.
- 'paths/analyze-data-with-sql' | ||
--- | ||
|
||
The **'NULL SAFE EQUAL'** operator performs an equality comparison like the '=' operator. However it can also accept NULL values and never returns NULL, instead always returning TRUE or FALSE. It uses the logic of an XNOR gate to determine the value returned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The **'NULL SAFE EQUAL'** operator performs an equality comparison like the '=' operator. However it can also accept NULL values and never returns NULL, instead always returning TRUE or FALSE. It uses the logic of an XNOR gate to determine the value returned. | |
The **`NULL SAFE EQUAL`** operator performs an equality comparison like the '=' operator. However, it can also accept NULL values and never returns NULL, instead always returning TRUE or FALSE. It uses the logic of an XNOR gate to determine the value returned. |
|
||
The **'NULL SAFE EQUAL'** operator performs an equality comparison like the '=' operator. However it can also accept NULL values and never returns NULL, instead always returning TRUE or FALSE. It uses the logic of an XNOR gate to determine the value returned. | ||
|
||
The 'NULL SAFE EQUAL' function is useful for when an XNOR gate that can accept NULL values and always returns True or False is needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'NULL SAFE EQUAL' function is useful for when an XNOR gate that can accept NULL values and always returns True or False is needed. | |
The `NULL SAFE EQUAL` operator is useful when an XNOR-like logic is required for comparisons that can accept NULL values and always return True or False. |
The NULL SAFE EQUAL is an operator so it must be enclosed in .....
backticks, also removed the function word as it is not a function.
Also, NULL SAFE EQUAL operator is useful when XNOR-like logic is required not literally an XNOR gate.
|
||
> **Note:** The syntax can vary across different SQL flavors. In PostgreSQL, the operator is written as 'a IS NOT DISTINCT FROM b'. In MariaDB/MySQL, it is written as 'a <=> b'. Finally, in SQLite, it is written as 'a IS b'. | ||
|
||
## MySQL Syntax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## MySQL Syntax | |
## Syntax |
Removed MYSQL as it is not necessary here, only the word syntax is sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @SlappyChappy ,
I had a look at your PR and suggested some changes to you. Please make them asap to get it approved
Thanks,
Savi
@SaviDahegaonkar I have made a second commit following the suggestions you have made. Please let me know if you have any other comments. One thing to note was that I am not fully sure of what you mean regarding the 'Operators' tag, as when I looked in docs/documentation/tags.md, I was able to find it in there, so please let me know if I need to modify the tags section again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @SlappyChappy ,
I had a look at your PR. I have suggested a few more changes to you please make them asap.
Thanks,
Savi
|
||
The **`NULL SAFE EQUAL`** operator performs an equality comparison like the '=' operator. However, it can also accept NULL values and never returns NULL, instead always returning TRUE or FALSE. It uses the logic of an XNOR gate to determine the value returned. | ||
|
||
The 'NULL SAFE EQUAL' operator is useful for when XNOR-like logic is required for comparisons that can accept NULL values and always return True or False is needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'NULL SAFE EQUAL' operator is useful for when XNOR-like logic is required for comparisons that can accept NULL values and always return True or False is needed. | |
The `NULL SAFE EQUAL` operator is useful when XNOR-like logic is required for comparisons that can accept NULL values and always return True or False. |
NULL SAFE EQUAL is an operator therefore it must be enclosed in (.....
) backticks.
```pseudo | ||
SELECT column1 | ||
FROM table | ||
WHERE column1 <=> condition | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```pseudo | |
SELECT column1 | |
FROM table | |
WHERE column1 <=> condition | |
``` | |
```pseudo | |
SELECT column1 | |
FROM table | |
WHERE column1 <=> value; |
The NULL SAFE EQUAL operator <=> does the comparison between two values , not with the word "condition".
@SaviDahegaonkar I have incorporated your suggestions. Please let me know if there is anything else to amend. Thank you. |
Description
Adding SQL NULL SAFE EQUAL operator to SQL concepts under docs/content/sql/concepts/operators/terms/null-safe-equal/null-safe-equal.md.
I am making this contribution as part of my Git & Github course on Codecademy.
Issue Solved
Closes #5166
Type of Change
Checklist
main
branch.Issues Solved
section.