Conversation
monzchan
left a comment
There was a problem hiding this comment.
Employee's shift table is missing.
And, please complete prompt 3 and also assignment2.sql
|
Hey @monzchan, |
monzchan
left a comment
There was a problem hiding this comment.
Please complete the remaining parts of the assignment :)
|
|
||
| -- second query | ||
| SELECT | ||
| MAX(market_date), |
There was a problem hiding this comment.
For “most recent visit,” you may consider filtering WHERE visit_number = 1, instead of using MAX(market_date) + GROUP BY. The result may not be exactly correct if a customer has multiple visits on the same date since MAX(market_date) won't capture ties correctly
There was a problem hiding this comment.
Great suggestion! that makes sense. Thanks!
Yes working on it. |
monzchan
left a comment
There was a problem hiding this comment.
Excellent work! Just some minor comments for improvement:)
|
|
||
| SELECT * | ||
| , CASE | ||
| WHEN INSTR(product_name, '-') THEN TRIM(SUBSTR(product_name, INSTR(product_name, '-') + 1)) |
There was a problem hiding this comment.
INSTR returns an integer, so here may throw an error
consider WHEN INSTR(product_name, '-') >0
| ADD COLUMN current_quantity INTEGER; | ||
|
|
||
| WITH Latest_Qty AS ( | ||
| SELECT product_id, max(market_date), quantity |
There was a problem hiding this comment.
the quantity may not matches the max(market_date) row. Consider ROW_NUMBER() here
Great points. Will work on them. Thanks for the valuable comments! |
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