Skip to content

Assignment two#2

Open
CarlaKulcsar wants to merge 2 commits into
mainfrom
assignment-two
Open

Assignment two#2
CarlaKulcsar wants to merge 2 commits into
mainfrom
assignment-two

Conversation

@CarlaKulcsar

Copy link
Copy Markdown
Owner

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

What did you learn from the changes you have made?

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

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

How were these changes tested?

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

Checklist

  • I can confirm that my changes are working as intended

@anjali-deshpande-hub anjali-deshpande-hub left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Well done! 68/70

ORDER BY market_date ASC) AS VisitNumber
FROM customer_purchases
WHERE market_date < '2022-04-29';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

GROUP BY customer_id, market_date required here.

ORDER BY product_id ASC) AS CustomerHasBoughtProductNTimes
FROM customer_purchases
WHERE market_date < '2022-04-29';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

DISTINCT not required here.

GROUP BY product_id) AS temptable
JOIN vendor ON temptable.vendor_id = vendor .vendor_id
JOIN product ON temptable.product_id = product.product_id;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The requirement here is to use CROSS JOIN.


DELETE FROM product_units
WHERE snapshot_timestamp = (SELECT MAX(snapshot_timestamp) FROM product_units );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You also want to add condition to check product_id to identify the product.

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