Skip to content

Assignment 1#1

Open
greg-antono wants to merge 5 commits intomainfrom
assignment-1
Open

Assignment 1#1
greg-antono wants to merge 5 commits intomainfrom
assignment-1

Conversation

@greg-antono
Copy link
Copy Markdown
Owner

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

I added code to the assignment 1 sql file, uploaded an image for section 1, as well as my written response for section 4.

What did you learn from the changes you have made?

I learnt how to tinker with SQL code!! it was a challenge since i'm new to this, but I learnt new commands.

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

I wonder whether there are more efficient/shorter ways of coding for some of the questions.

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

I struggled with the syntax a little bit, and more of the time I was either missing or added a ;/, somewhere.
Challenge this week was also mostly time-related (sorry for the late submission!)

How were these changes tested?

I coded in DB SQlite and ran each code each time to make sure that they worked.

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

Checklist

  • [X ] I can confirm that my changes are working as intended

Added response to section 4
added diagram for Section 1 of Assignment 1
Updated with answers to assignment 1 sections 2-3
/* 1. Write a query that INNER JOINs the vendor table to the vendor_booth_assignments table on the
vendor_id field they both have in common, and sorts the result by vendor_name, then market_date. */

SELECT vendor.vendor_id, vendor.vendor_name, vendor_booth_assignments.booth_number, vendor_booth_assignments.market_date
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider using table alias to shorten the queries and improve readability.

INNER JOIN customer_purchases
ON customer.customer_id = customer_purchases.customer_id
GROUP BY customer.customer_id, customer.customer_first_name, customer.customer_last_name
HAVING SUM(customer_purchases.quantity * customer_purchases.cost_to_customer_per_qty) > 2000
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing the sorting part of the requirement.

Copy link
Copy Markdown

@kelichiu kelichiu left a comment

Choose a reason for hiding this comment

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

Point: 27/30

Section 1: ☑️ Partial

The relationship between market_date_info and customer_purchases is indeed one-to-many but from the opposite direction. At a specific day, there can be many customer purchases. On the other hand, a customer purchase (a transaction for a specific item) can only happen in one specific day. A same item can't be purchased more than once.

Todo:

  • Revisit the relationship direction between customer_purchases and market_date_info

Section 2: ✅ Complete

Section 3: ☑️ Partial

Aggregate Question 2

Todo:

  • Sort the result by the requirement stated in the question

Section 4: ✅ Complete

Thank you for the thoughtful reflection, I enjoyed reading it.

Added code to sort for AGGREGATE q2
New logical model reflects correct relationship between market_date_info and customer_purchases (one to many, in that direction).
@greg-antono greg-antono requested a review from kelichiu January 28, 2025 00:54
Copy link
Copy Markdown

@kelichiu kelichiu left a comment

Choose a reason for hiding this comment

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

2nd Assessment Point: 30/30

Section 1: ✅ Complete

Section 2: ✅ Complete

Section 3: ✅ Complete

Section 4: ✅ 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