Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are you trying to make?
Adding new SQL queries to handle NULL values in the product table using COALESCE, creating customer visit numbering using ROW_NUMBER(), and calculating the total number of purchases per product using a window function. Additionally, string manipulations for product descriptions and a UNION query for highest and lowest market sales are implemented.
What did you learn from the changes you have made?
I learned how to manage NULL data efficiently using COALESCE, how to use window functions like ROW_NUMBER() and DENSE_RANK() to rank or number records, and how to use INSTR() for string manipulation to extract specific parts of a string.
Was there another approach you were thinking about making?
Yes, I considered using a CASE statement for the product description extraction but opted for INSTR() and SUBSTR() to make the query more dynamic and adaptable for various product names.
Were there any challenges?
The main challenge was ensuring that NULL values were handled correctly across different columns without affecting non-NULL data. Another challenge was managing string manipulation with varying product name formats. These were resolved by applying COALESCE and testing string functions like INSTR() to dynamically split values.
How were these changes tested?
The changes were tested using a set of sample data with both valid and NULL values. The output was verified to ensure correct formatting of product names, proper ranking of customer visits, and accurate handling of highest and lowest market sales using a UNION query.