Skip to content

UofT-DSI | SQL - Assignment 1#1

Open
MGE-17 wants to merge 2 commits intomainfrom
assignment-one
Open

UofT-DSI | SQL - Assignment 1#1
MGE-17 wants to merge 2 commits intomainfrom
assignment-one

Conversation

@MGE-17
Copy link
Copy Markdown
Owner

@MGE-17 MGE-17 commented Aug 10, 2025

What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)

I have completed all required queries in assignment1.sql for the farmersmarket.db dataset and added a logical model diagram showing the customer and customer_purchases tables with their relationships. This includes solutions for WHERE, JOIN, AGGREGATE, and DATE section prompts.

What did you learn from the changes you have made?

I learned how to use SQLite functions such as strftime for date extraction, CASE statements for conditional columns, and HAVING with aggregate functions. I also reinforced my understanding of one-to-many relationships in a database and how to represent them in a logical model.

Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?

There are many ways to write the same query, but this seemed the easiest way to do it.

Were there any challenges? If so, what issue(s) did you face? How did you overcome it?

I had to adjust my logic in some of the queries, also since the date section was not requeried but I wanted to do it, I had to brush up the strftime concept.

How were these changes tested?

Each query was run directly against farmersmarket.db in the SQLite CLI to verify that the output matched the assignment requirements. I also ran the full assignment1.sql file to confirm there were no syntax errors and that all queries executed correctly.

A reference to a related issue in your repository (if applicable)

None

Checklist

I can confirm that my changes are working as intended YES

I have verified that all queries return the correct results YES

I have included the logical model diagram in this branch YES

Copy link
Copy Markdown

@DwardEE DwardEE left a comment

Choose a reason for hiding this comment

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

Good Job!

Your logic model looks good.

There are some issues with your code. WHERE Q1 is not correct because you split product 4 and product 9 into two separate queries instead of a single query with both values. AGGREGATE Q2 is logically correct, but you’re grouping by names instead of customer_id. This usually works, but grouping by customer_id is safer in case names repeat. DATE Q2 is correct.

These fixes are quite minor, so I'll consider the assignment as complete

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