Skip to content

Assignment two#2

Open
haichenz wants to merge 5 commits intomainfrom
assignment-two
Open

Assignment two#2
haichenz wants to merge 5 commits intomainfrom
assignment-two

Conversation

@haichenz
Copy link
Copy Markdown
Owner

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

Competed required questions for assignment 2.

What did you learn from the changes you have made?

Various SQL techniques.

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

N/A

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

N/A

How were these changes tested?

Yes.

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

N/A

Checklist

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

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.

Great work!



SELECT *,
count() over (partition by customer_id, product_id) as pur_times
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In SQL, COUNT() requires a column or *

),
ranked as (
select *,
row_number() over (order by total_sales ASC) as worst_rank,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ROW_NUMBER() will return only one row per rank and does not handle ties. Assignment hint suggested RANK() for handling ties.

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