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.
UofT-DSI | SQL - Assignment 2
What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)
I have added 2 ERDs containing logical data models for a bookstore. I have also added SQL codes to the assignment2.sql file in response to the prompts and have updated the assignment2.md file with written responses for section 1 and section 4.
What did you learn from the changes you have made?
I have learned to work with window functions, and have practiced manipulating data by using INSERT, UPDATE, and DELETE statements. Also, I have learned to handle NULL values by using functions like IFNULL and NULLIF, as well as COALESCE. Finally, I have practiced string manipulation commands and have learned to use CROSS JOINS to combine tables.
Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
I have mostly followed the hints provided for each question, except for under the prompt on UNION, where I couldn't figure out why to do a windowed function on the second CTE... I'm still not sure I did this correctly, but the results looked like they were right. I also alternated between CTEs and temp tables in this assignment, just to get practice in both.
Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
This assignment was very difficult since we learned a lot of commands in a short period of time and some of the questions even required us to nest commands within others. I reviewed the video of our live lessons many times, esp. when it came to windowed functions to try to get a better grasp of how they worked.
Nested queries just took extra time, and I eventually learned to approach them by starting from the innermost query and building outwards from there. Since I nested an INSTR statement inside a SUBSTR statement in query 5, doing something similar in query 12 was less confusing than expected.
How were these changes tested?
I ran each of the queries to make sure it generated the results I wanted.
A reference to a related issue in your repository (if applicable)
I want to flag that I'm much less certain with this assignment than I have been with previous assignments, esp. when it comes to the questions on windowed functions. I tested my solutions and they all look like they work, but when it came to query 5, I couldn't grasp why a rank windowed function was needed. Does it add anything that my solution does not provide?
Checklist