Skip to content

UofT-DSI | SQL - Assignment 1#1

Open
hayun120 wants to merge 4 commits into
mainfrom
assignment-one
Open

UofT-DSI | SQL - Assignment 1#1
hayun120 wants to merge 4 commits into
mainfrom
assignment-one

Conversation

@hayun120

Copy link
Copy Markdown
Owner

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

  • I can confirm that my changes are working as intended

@Dmytro-Bonislavskyi Dmytro-Bonislavskyi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Well done

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants