-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Create bit-functions.md #4740
base: main
Are you sure you want to change the base?
Create bit-functions.md #4740
Conversation
add bit-functions markdown file
Removed redundant rows 61-64 Added the missing line at the end of md file (row 118) Removed extra line and extra spaces Removed line 78 Corrected trailing spaces Added blank line at fenced code block "```"
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.
Please work on these changes for now then we will do the review again.
Co-authored-by: Daksha Deep <dakshadeep1234@gmail.com>
Hello Daksha,
This morning I edited the bit-functions.md (based on received errors)
and submitted while you wrote me messages and read only now.
Can I edit the md file again to make these needed corrections?
Thank you so much for your help
alex
…On Sat, Jun 1, 2024 at 10:06 AM Daksha Deep ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Please work on these changes for now then we will do the review again.
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> @@ -0,0 +1,119 @@
+---
+Title: 'MySQL bit-functions'
⬇️ Suggested change
-Title: 'MySQL bit-functions'
+Title: 'Bit Functions'
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> @@ -0,0 +1,119 @@
+---
+Title: 'MySQL bit-functions'
+Description: 'Commonly used MySql bit-functions'
This should be a small desc of what exactly bit functions are. Make sure u
keep it precise and short.
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +Title: 'MySQL bit-functions'
+Description: 'Commonly used MySql bit-functions'
+Subjects:
+ - 'Data Science'
+ - 'Computer Science'
+Tags:
+ - 'MySQL'
+ - 'bit functions'
+CatalogContent:
+ - 'getting-started-off-platform-for-data-science'
+ - 'paths/design-databases-with-mysql'
+---
+
+MySQL bit-functions are used to perform operations on binary data at the bit level. These functions are used for tasks that require binary data organization or manipulation based on bitwise logic.
+
+## Syntax
⬇️ Suggested change
-## Syntax
+## Syntax
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +Tags:
+ - 'MySQL'
+ - 'bit functions'
+CatalogContent:
+ - 'getting-started-off-platform-for-data-science'
+ - 'paths/design-databases-with-mysql'
+---
+
+MySQL bit-functions are used to perform operations on binary data at the bit level. These functions are used for tasks that require binary data organization or manipulation based on bitwise logic.
+
+## Syntax
+These are some commonly used bit-functions in MySQL:
+
+`Bitwise AND &()` takes two integer operands and compares them bit by bit. The result is 1 if the bits of both operands are 1, otherwise the result is 0.
+
+```mysql
⬇️ Suggested change
-```mysql
+```psuedo
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> + - 'Data Science'
+ - 'Computer Science'
+Tags:
+ - 'MySQL'
+ - 'bit functions'
+CatalogContent:
+ - 'getting-started-off-platform-for-data-science'
+ - 'paths/design-databases-with-mysql'
+---
+
+MySQL bit-functions are used to perform operations on binary data at the bit level. These functions are used for tasks that require binary data organization or manipulation based on bitwise logic.
+
+## Syntax
+These are some commonly used bit-functions in MySQL:
+
+`Bitwise AND &()` takes two integer operands and compares them bit by bit. The result is 1 if the bits of both operands are 1, otherwise the result is 0.
⬇️ Suggested change
-`Bitwise AND &()` takes two integer operands and compares them bit by bit. The result is 1 if the bits of both operands are 1, otherwise the result is 0.
+- `Bitwise AND &()`: It takes two integer operands and compares them bit by bit. The result is 1 if the bits of both operands are 1, otherwise, the result is 0.
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> + - 'getting-started-off-platform-for-data-science'
+ - 'paths/design-databases-with-mysql'
+---
+
+MySQL bit-functions are used to perform operations on binary data at the bit level. These functions are used for tasks that require binary data organization or manipulation based on bitwise logic.
+
+## Syntax
+These are some commonly used bit-functions in MySQL:
+
+`Bitwise AND &()` takes two integer operands and compares them bit by bit. The result is 1 if the bits of both operands are 1, otherwise the result is 0.
+
+```mysql
+SELECT (expression1 & expression2);
+```
+
+`Bitwise XOR ^()` takes two integer values and executes a bitwise exclusive OR operation on them.
⬇️ Suggested change
-`Bitwise XOR ^()` takes two integer values and executes a bitwise exclusive OR operation on them.
+- `Bitwise XOR ^()`: It takes two integer values and executes a bitwise exclusive OR operation on them.
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +---
+
+MySQL bit-functions are used to perform operations on binary data at the bit level. These functions are used for tasks that require binary data organization or manipulation based on bitwise logic.
+
+## Syntax
+These are some commonly used bit-functions in MySQL:
+
+`Bitwise AND &()` takes two integer operands and compares them bit by bit. The result is 1 if the bits of both operands are 1, otherwise the result is 0.
+
+```mysql
+SELECT (expression1 & expression2);
+```
+
+`Bitwise XOR ^()` takes two integer values and executes a bitwise exclusive OR operation on them.
+
+```mysql
⬇️ Suggested change
-```mysql
+```psuedo
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +## Syntax
+These are some commonly used bit-functions in MySQL:
+
+`Bitwise AND &()` takes two integer operands and compares them bit by bit. The result is 1 if the bits of both operands are 1, otherwise the result is 0.
+
+```mysql
+SELECT (expression1 & expression2);
+```
+
+`Bitwise XOR ^()` takes two integer values and executes a bitwise exclusive OR operation on them.
+
+```mysql
+SELECT (expression1 ^ expression2);
+```
+
+`Bitwise OR |` takes tow operands and compares them by the bit. If at least one of the corresponding bits is 1, result is 1. If both bits are 0, result is 0.
⬇️ Suggested change
-`Bitwise OR |` takes tow operands and compares them by the bit. If at least one of the corresponding bits is 1, result is 1. If both bits are 0, result is 0.
+- `Bitwise OR |`: It takes tow operands and compares them by the bit. If at least one of the corresponding bits is 1, result is 1. If both bits are 0, the result is 0.
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +SELECT (expression1 & expression2);
+```
+
+`Bitwise XOR ^()` takes two integer values and executes a bitwise exclusive OR operation on them.
+
+```mysql
+SELECT (expression1 ^ expression2);
+```
+
+`Bitwise OR |` takes tow operands and compares them by the bit. If at least one of the corresponding bits is 1, result is 1. If both bits are 0, result is 0.
+
+```mysql
+SELECT (expression1 | expression2);
+```
+
+`BIT_COUNT` function is used to return the number of bits that are set to 1 in the operand's binary representation.
⬇️ Suggested change
-`BIT_COUNT` function is used to return the number of bits that are set to 1 in the operand's binary representation.
+- `BIT_COUNT`: This function is used to return the number of bits that are set to 1 in the operand's binary representation.
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +
+`Bitwise AND &()` takes two integer operands and compares them bit by bit. The result is 1 if the bits of both operands are 1, otherwise the result is 0.
+
+```mysql
+SELECT (expression1 & expression2);
+```
+
+`Bitwise XOR ^()` takes two integer values and executes a bitwise exclusive OR operation on them.
+
+```mysql
+SELECT (expression1 ^ expression2);
+```
+
+`Bitwise OR |` takes tow operands and compares them by the bit. If at least one of the corresponding bits is 1, result is 1. If both bits are 0, result is 0.
+
+```mysql
⬇️ Suggested change
-```mysql
+```psuedo
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +
+`Bitwise XOR ^()` takes two integer values and executes a bitwise exclusive OR operation on them.
+
+```mysql
+SELECT (expression1 ^ expression2);
+```
+
+`Bitwise OR |` takes tow operands and compares them by the bit. If at least one of the corresponding bits is 1, result is 1. If both bits are 0, result is 0.
+
+```mysql
+SELECT (expression1 | expression2);
+```
+
+`BIT_COUNT` function is used to return the number of bits that are set to 1 in the operand's binary representation.
+
+```mysql
⬇️ Suggested change
-```mysql
+```psuedo
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +Next are few examples for some of the mysql concepts described.
+
+In this basic example mySQL performs the bitwise AND operation on the two literal integer values 45 and 25:
⬇️ Suggested change
-Next are few examples for some of the mysql concepts described.
-
-In this basic example mySQL performs the bitwise AND operation on the two literal integer values 45 and 25:
+Next are a few examples of some of the MySQL concepts described. In this basic example, mySQL performs the bitwise AND operation on the two literal integer values 45 and 25:
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +45 in binary is represented as 101101.
+25 in binary is represented as 011001.
+The bitwise AND operation between 45 and 25 is in binary 001001.
+001001 in decimal is represented as 9.
⬇️ Suggested change
-45 in binary is represented as 101101.
-25 in binary is represented as 011001.
-The bitwise AND operation between 45 and 25 is in binary 001001.
-001001 in decimal is represented as 9.
+In the above example:
+- 45 in binary is represented as 101101.
+- 25 in binary is represented as 011001.
+- The bitwise AND operation between 45 and 25 is in binary 001001.
+- 001001 in decimal is represented as 9.
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +In this example the function XOR is used to compare and manipulate the label values within a database.
+The query uses this function to select rows based on the results of the operation.
⬇️ Suggested change
-In this example the function XOR is used to compare and manipulate the label values within a database.
-The query uses this function to select rows based on the results of the operation.
+In this example, the function `XOR` is used to compare and manipulate the label values within a database. The query uses this function to select rows based on the results of the operation:
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +id|name |labels
+--|------|-----
+1 post1 5
+--|------|-----
+2 post2 3
+--|------|-----
+3 post3 12
Can u move this table above this example?
------------------------------
In content/mysql/concepts/bit-functions/bit-functions.md
<#4740 (comment)>:
> +---|-------|-------
+ 1 | post1 | 5
+ 3 | post3 | 12
+
+This basic XOR operation example illustrates a bit level comparison of two integer literals (5 and 0):
+
+```mysql
+> SELECT 5 ^ 0;
+-> 5;
+```
+
+Comparison of each bit position:
+If he bits are different, the resulting bit is 1
+If the bits are the same, the resulting bit is 0
+
+5 in binary is represented as 101 and 0 in binary is represented as 000:
⬇️ Suggested change
-5 in binary is represented as 101 and 0 in binary is represented as 000:
+5 in binary is represented as 101 and 0 in binary is represented as 000:
—
Reply to this email directly, view it on GitHub
<#4740 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AINBX2NP5KQOM6OTFA3DX4TZFF6JNAVCNFSM6AAAAABITAIRNCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDAOJSGAZDKNZUG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Yes you can do it 👍🏻 @Alexa86 |
added corrections suggested removed typos, extra spaces and trailings added two missing examples (pseudo) for BITCOUNT and BIT OR functions
moved some rows, deleted spaces corrected typos corrected tables layout so they look right trailings Added explanation for bit position pseudo Horizontal line styles adjusted Rearranged pseudo lines for clarity Rephrased to be more concise (row 72) Added bullet points where needed Adjusted description
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.
corrected errors from the checked yarn
adjusted content, spaces and some rows
Hello, I reworked the .md file from the edit mode and all suggestions were corrected + added new corrections. I wonder if I must use 'resolve conversation' , commit changes for each suggested correction or is the yesterday edit sufficient? thank you |
Thank you @Alexa86, I will go through it again. |
- Replaced the horizontal as expected in .md rule - Removed whtspces at rows 140,141,142, 135, 64, 61 - Inserted rows: - 108 above "- If the bits are different, t..." - 91 above "- 1100 ^ 0011 = 1111 (15 in de..." - 88 above "- 0011 ^ 0011 = 0000 (0 in dec..." - 85 above "- 0101 ^ 0011 = 0110 (6 in dec..." - Removed line 81 - Inserted line 72 bellow ‘```’ - Added 1 line 59 above "- 45 in binary is represented ..." (i corrected all manually using VSC editor, is possible I might have again errors...looking forward to next yarn) thank you
used prettier --write to correct format errors in bit-functions.md
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.
Fixed formatting issues in bit_functions.md
using npx prettier --write command
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.
LGTM
Thank you |
hello, I'm sorry, I saw all checks in green and clicked to merge branch. Is it ok? thank you |
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.
@Alexa86 I have suggested changes please make those. Let me know once you are done.
MySQL bit-functions are used to perform operations on binary data at the bit level. | ||
These functions are used for tasks that require binary data organization or manipulation based on bitwise logic. |
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 bit-functions are used to perform operations on binary data at the bit level. | |
These functions are used for tasks that require binary data organization or manipulation based on bitwise logic. | |
MySQL **bit-functions** are used to perform operations on binary data at the bit level. These functions are used for tasks that require binary data organization or manipulation based on bitwise logic. |
`Bitwise AND &()`: It takes two integer operands and compares them bit by bit. | ||
The result is 1 if the bits of both operands are 1, otherwise, the result is 0. | ||
|
||
```mysql |
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 | |
```pseudo |
`Bitwise OR |`: It takes two operands and compares them by the bit. If at least one | ||
of the corresponding bits is 1, result is 1. If both bits are 0, the result is 0. |
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.
`Bitwise OR |`: It takes two operands and compares them by the bit. If at least one | |
of the corresponding bits is 1, result is 1. If both bits are 0, the result is 0. | |
`Bitwise OR |`: It takes two operands and compares them by the bit. If at least one of the corresponding bits is 1, the result is 1. If both bits are 0, the result is 0. |
Next are a few examples of some of the MySQL concepts described. In this basic example, | ||
mySQL performs the bitwise AND operation on the two literal integer values 45 and 25: |
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.
Next are a few examples of some of the MySQL concepts described. In this basic example, | |
mySQL performs the bitwise AND operation on the two literal integer values 45 and 25: | |
Next are a few examples of some of the MySQL concepts described. In this basic example, mySQL performs the bitwise AND operation on the two literal integer values 45 and 25: |
Labels value 5 is represented by 0101 and XOR comparison is: | ||
|
||
- 0101 ^ 0011 = 0110 (6 in decimal, which is greater than 5) | ||
|
||
Labels value 3 is represented by 0011 and XOR comparison is: | ||
|
||
- 0011 ^ 0011 = 0000 (0 in decimal, which is not greater than 5) | ||
|
||
Labels value 12 is represented by 1100 and XOR comparison is: | ||
|
||
- 1100 ^ 0011 = 1111 (15 in decimal, which is greater than 5) |
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.
Labels value 5 is represented by 0101 and XOR comparison is: | |
- 0101 ^ 0011 = 0110 (6 in decimal, which is greater than 5) | |
Labels value 3 is represented by 0011 and XOR comparison is: | |
- 0011 ^ 0011 = 0000 (0 in decimal, which is not greater than 5) | |
Labels value 12 is represented by 1100 and XOR comparison is: | |
- 1100 ^ 0011 = 1111 (15 in decimal, which is greater than 5) | |
Labels value 5 is represented by 0101 and XOR comparison is: | |
- 0101 ^ 0011 = 0110 (6 in decimal, which is greater than 5) | |
Labels value 3 is represented by 0011 and XOR comparison is: | |
- 0011 ^ 0011 = 0000 (0 in decimal, which is not greater than 5) | |
Labels value 12 is represented by 1100 and XOR comparison is: | |
- 1100 ^ 0011 = 1111 (15 in decimal, which is greater than 5) |
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.
I'm afraid this will trigger MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- 0011 ^ 0011 = 0000 (0 in dec..."] (& more)..
In this example we have a table called customers which contains a list of customers IDs as integers. | ||
Each customer ID is associated with a number of orders. | ||
We need to find out how many bits are set to '1' in the binary representation of each customer's ordering activity. |
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.
In this example we have a table called customers which contains a list of customers IDs as integers. | |
Each customer ID is associated with a number of orders. | |
We need to find out how many bits are set to '1' in the binary representation of each customer's ordering activity. | |
In this example, we have a table called customers which contains a list of customers IDs as integers. Each customer ID is associated with a number of orders. We need to find out how many bits are set to '1' in the binary representation of each customer's ordering activity. |
|
||
--- | ||
|
||
BIT_COUNT(number_of_orders) function returns the number of '1' bits in the binary representation of the number_of_orders column. |
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.
BIT_COUNT(number_of_orders) function returns the number of '1' bits in the binary representation of the number_of_orders column. | |
The `BIT_COUNT(number_of_orders)` function returns the number of '1' bits in the binary representation of the number_of_orders column. |
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.
I agree with 'The' in front is much better, thanks
In this example, the function `XOR` is used to compare and manipulate the label values within a database. | ||
The query uses this function to select rows based on the results of the operation: |
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.
In this example, the function `XOR` is used to compare and manipulate the label values within a database. | |
The query uses this function to select rows based on the results of the operation: | |
In the example below, the function `XOR` is used to compare and manipulate the label values within a database. The query uses this function to select rows based on the results of the operation: |
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.
it looks better indeed, but according to my notes I modified it by two lines to avoid format error in past. I will find a way to double check to be sure before committing
| 1 | post1 | 5 | | ||
| 3 | post3 | 12 | | ||
|
||
This basic XOR operation example illustrates a bit level comparison of two integer literals (5 and 0): |
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.
This basic XOR operation example illustrates a bit level comparison of two integer literals (5 and 0): | |
This basic `XOR` operation example illustrates a bit-level comparison of two integer literals (5 and 0): |
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.
Hello, @ishg-153 thank you for your help. May I ask, please when is deadline to make corrections to the .md file? I use all this week for studying at an exam. I can maybe next week on Monday the earliest
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 @Alexa86! No worries. Do this at your earliest convenience. I will check-in with you in a weeks time about the changes.
Hello, this morning I briefly checked previous work notes on the.md file meanwhile just to be sure may I ask please: even if all format checks were in green at ci checks (for 'Create bit-functions.md #4740': All checks have passed |
add bit-functions markdown file
Description
Commonly used Mysql bit functions
Issue Solved
Type of Change
Added bit-functions md file under the bit-functions directory of Mysql concepts entry
Thank you
Checklist
main
branch.Issues Solved
section.