Skip to content

Conversation

@monzchan
Copy link
Owner

@monzchan monzchan commented May 26, 2024

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

Using SQL query to fulfil task requirement
reflect about any ethics & inequity issues encountered in daily life

What did you learn from the changes you have made?

SQL query such as JOIN, COALESCES, INSERT, UPDATE, DELETE etc

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

Still trying to simplifying the codes.

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

Yes. A lot of errors coming up during writing the codes. Search on google and keep trying

How were these changes tested?

Using SQLite to test, and desired result shown.

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

Checklist

  • I can confirm that my changes are working as intended

Copy link

@ananyajha2000 ananyajha2000 left a comment

Choose a reason for hiding this comment

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

HW4 6/10:
2.1 is incorrect:
SELECT cp.*,
DENSE_RANK() OVER (PARTITION BY customer_id ORDER BY market_date) AS visit_number

FROM customer_purchases AS cp

ORDER BY customer_id, market_date

UNION question is also incorrect:

;WITH sales_per_market AS (
SELECT
market_date,
ROUND(SUM(quantity * cost_to_customer_per_qty),2) AS sales

FROM customer_purchases
GROUP BY market_date
)

,market_dates_ranked_by_sales AS (
SELECT
market_date,
sales,
RANK() OVER (ORDER BY sales) AS sales_rank_asc,
RANK() OVER (ORDER BY sales DESC) AS sales_rank_desc

FROM sales_per_market
)

SELECT market_date, sales, sales_rank_desc AS sales_rank
FROM market_dates_ranked_by_sales
WHERE sales_rank_asc = 1

UNION

SELECT market_date, sales, sales_rank_desc AS sales_rank
FROM market_dates_ranked_by_sales
WHERE sales_rank_desc = 1

@monzchan monzchan changed the title Complete homework 4, 5 Complete homework 4, 5, 6 May 27, 2024
Copy link

@ananyajha2000 ananyajha2000 left a comment

Choose a reason for hiding this comment

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

HW 5: 8/8!

HW 6: 8/8!

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.

3 participants