Skip to content

UofT-DSI | SQL - Assignment 1#1

Open
akorade wants to merge 1 commit into
mainfrom
assignment-one
Open

UofT-DSI | SQL - Assignment 1#1
akorade wants to merge 1 commit into
mainfrom
assignment-one

Conversation

@akorade
Copy link
Copy Markdown
Owner

@akorade akorade commented Nov 12, 2025

Added FarmersMarket-DB-ER-Diagram in Mermaid and PNG formats. Updated assignment1.sql with complete example queries for SELECT, WHERE, CASE, JOIN, GROUP BY, temp table creation, and date-based aggregations to provide clearer solutions and additional context for each exercise.

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

I wrote a series of SQL queries to retrieve and manipulate data from the Farmers Market database.
The queries include:

  • Selecting and sorting customer data.
  • Filtering purchases by product and customer IDs.
  • Creating calculated columns (e.g., total price).
  • Joining related tables such as vendor and vendor_booth_assignments.
  • Using aggregation functions (SUM, COUNT) and conditional logic (CASE, HAVING).
  • Extracting date parts using STRFTIME.
  • Creating and inserting into temporary tables.

What did you learn from the changes you have made?

Overall, I gained a better understanding of how relational databases structure and link data logically.

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

  • Creating views to simplify repetitive logic such as calculating total spending.
  • Using a surrogate key (like an auto-increment inventory_id) in vendor_inventory instead of a composite primary key for easier joins.

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

All the queries were quite straightforward.

How were these changes tested?

Validated in SQLite

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

NA

Checklist

  • I can confirm that my changes are working as intended

Added FarmersMarket-DB-ER-Diagram in Mermaid and PNG formats. Updated assignment1.sql with complete example queries for SELECT, WHERE, CASE, JOIN, GROUP BY, temp table creation, and date-based aggregations to provide clearer solutions and additional context for each exercise.
Copy link
Copy Markdown

@monzchan monzchan left a comment

Choose a reason for hiding this comment

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

Excellent!

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