Skip to content
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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

Alexa86
Copy link

@Alexa86 Alexa86 commented May 31, 2024

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

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

add bit-functions markdown file
@dakshdeepHERE dakshdeepHERE self-assigned this May 31, 2024
@dakshdeepHERE dakshdeepHERE added sql SQL entries new entry New entry or entries status: under review Issue or PR is currently being reviewed labels May 31, 2024
@dakshdeepHERE dakshdeepHERE linked an issue Jun 1, 2024 that may be closed by this pull request
3 tasks
ishg-153 and others added 2 commits June 1, 2024 11:55
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 "```"
Copy link
Collaborator

@dakshdeepHERE dakshdeepHERE left a 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.

content/mysql/concepts/bit-functions/bit-functions.md Outdated Show resolved Hide resolved
content/mysql/concepts/bit-functions/bit-functions.md Outdated Show resolved Hide resolved
content/mysql/concepts/bit-functions/bit-functions.md Outdated Show resolved Hide resolved
content/mysql/concepts/bit-functions/bit-functions.md Outdated Show resolved Hide resolved
content/mysql/concepts/bit-functions/bit-functions.md Outdated Show resolved Hide resolved
content/mysql/concepts/bit-functions/bit-functions.md Outdated Show resolved Hide resolved
content/mysql/concepts/bit-functions/bit-functions.md Outdated Show resolved Hide resolved
content/mysql/concepts/bit-functions/bit-functions.md Outdated Show resolved Hide resolved
Co-authored-by: Daksha Deep <dakshadeep1234@gmail.com>
@Alexa86
Copy link
Author

Alexa86 commented Jun 1, 2024 via email

@dakshdeepHERE
Copy link
Collaborator

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
Copy link
Author

@Alexa86 Alexa86 left a 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

@Alexa86
Copy link
Author

Alexa86 commented Jun 3, 2024

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

@dakshdeepHERE
Copy link
Collaborator

Thank you @Alexa86, I will go through it again.

dakshdeepHERE and others added 6 commits June 5, 2024 20:46
- 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
Copy link
Author

@Alexa86 Alexa86 left a 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

Copy link
Collaborator

@dakshdeepHERE dakshdeepHERE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Alexa86
Copy link
Author

Alexa86 commented Jun 15, 2024

Merge branch 'main' into create-add-bit-functions

Thank you
waiting for next step that will allow the checks to run

@Alexa86
Copy link
Author

Alexa86 commented Jun 19, 2024

hello, I'm sorry, I saw all checks in green and clicked to merge branch. Is it ok? thank you

@ishg-153 ishg-153 self-assigned this Jun 23, 2024
@ishg-153 ishg-153 added status: under review Issue or PR is currently being reviewed and removed status: ready for next review labels Jun 23, 2024
Copy link
Collaborator

@ishg-153 ishg-153 left a 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.

Comment on lines +15 to +16
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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```mysql
```pseudo

Comment on lines +35 to +36
`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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`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.

Comment on lines +50 to +51
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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Comment on lines +85 to +95
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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)

Copy link
Author

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)..

Comment on lines +139 to +141
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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Author

@Alexa86 Alexa86 Jul 4, 2024

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

Comment on lines +65 to +66
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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 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:

Copy link
Author

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):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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):

Copy link
Author

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

Copy link
Collaborator

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.

@Alexa86
Copy link
Author

Alexa86 commented Jul 4, 2024

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
6 successful checks), I'm still required to make format changes at certain rows? I'm asking because some of above suggestions might trigger new format errors, in my opinion. Because of spent time a few days in past to avoid and correct my .md format errors, now I want to be sure I will not get them again, and as everything is green I would prefer not to break it... Some I remember I fixed just to avoid the format error but for some I have them in my notes written (sorry if there is other more efficient way to keep track, for now I do as I can). . So, double checking here before making any adjustments again to the .md file. Example: suggested lines 85-95: is suggested change (by rows 85-92) not going to result in a format error (MD032) triggered by the list lines not being surrounded by blank spaces? If current format checks status green is not important and suggested changes are necessary and will not result in new errors, please let me know - so I schedule next week work on them. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Concept Entry] MySQL bit-functions
4 participants