UofT-DSI | SQL - Assignment 1#1
Open
hayun120 wants to merge 4 commits into
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? (e.g. Adding or removing code, refactoring existing code, adding reports)
I completed the SQL queries to retrieve, filter, transform, and aggregate data from the farmer's market database. This includes SELECT statements, WHERE filters, CASE logic, JOINs, etc.
What did you learn from the changes you have made?
I learned how to use the SQL language to filter rows using WHERE with IN, BETWEEN, and AND conditions. I also learned how to use aggregate functions like COUNT, SUM, GROUP BY. I also looked up how to use strftime to return date/time strings. Throughout the sessions, I tried to map SQL functions/conditions/language to that of Python, which I am more familiar with, and found that to be really helpful!
Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
For Query 3, I could have used WHERE product_id=4 OR product_id=9 instead of IN.
For Query 4, I could have used WHERE customer_id>=8 AND customer_id<=10 instead.
Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
I think the most challenging concept to understand was the differences between the different JOIN functions. INNER JOIN made sense early on. It only returns rows that have a match in both tables. But LEFT JOIN was trickier for me to grasp, particularly understanding that the direction of the join matters. For example, putting the product table on the left vs. the customer_purchases table on the left returns different row counts, because LEFT JOIN preserves all rows from whichever table is on the left side, even if there's no match on the right. Looking at which rows returned NULL values in the joind table's columns also helped with my understanding.
How were these changes tested?
Queries were run in DB Broswer (SQLite) with the farmer's market database and results were visually verified against the expected output.
A reference to a related issue in your repository (if applicable)
N/A
Checklist